Cube & co becomes zoomable (usage: + and -). Adding also a config option to define the default zoom.
svn path=/trunk/KDE/kdebase/workspace/; revision=852059
This commit is contained in:
parent
4e9d2d3a25
commit
a59111148c
11 changed files with 229 additions and 20 deletions
|
@ -74,6 +74,8 @@ CubeEffect::CubeEffect()
|
|||
, bigCube( false )
|
||||
, bottomCap( false )
|
||||
, closeOnMouseRelease( false )
|
||||
, zoom( 0.0 )
|
||||
, zPosition( 0.0 )
|
||||
, capListCreated( false )
|
||||
, capList( 0 )
|
||||
{
|
||||
|
@ -102,6 +104,7 @@ void CubeEffect::loadConfig( QString config )
|
|||
capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
|
||||
paintCaps = conf.readEntry( "Caps", true );
|
||||
closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
|
||||
zPosition = conf.readEntry( "ZPosition", 100.0 );
|
||||
QString file = conf.readEntry( "Wallpaper", QString("") );
|
||||
if( !file.isEmpty() )
|
||||
{
|
||||
|
@ -425,7 +428,7 @@ void CubeEffect::paintScene( int mask, QRegion region, ScreenPaintData& data )
|
|||
float internalCubeAngle = 360.0f / effects->numberOfDesktops();
|
||||
cube_painting = true;
|
||||
int desktopIndex = 0;
|
||||
float zTranslate = 100.0;
|
||||
float zTranslate = zPosition + zoom;
|
||||
if( start )
|
||||
zTranslate *= timeLine.value();
|
||||
if( stop )
|
||||
|
@ -739,7 +742,7 @@ void CubeEffect::paintCap( float z, float zTexture )
|
|||
glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), opacity );
|
||||
float angle = 360.0f/effects->numberOfDesktops();
|
||||
glPushMatrix();
|
||||
float zTranslate = 100.0;
|
||||
float zTranslate = zPosition + zoom;
|
||||
if( start )
|
||||
zTranslate *= timeLine.value();
|
||||
if( stop )
|
||||
|
@ -1424,6 +1427,13 @@ void CubeEffect::grabbedKeyboardEvent( QKeyEvent* e )
|
|||
case Qt::Key_Space:
|
||||
setActive( false );
|
||||
return;
|
||||
case Qt::Key_Plus:
|
||||
zoom -= 10.0;
|
||||
zoom = qMax( -zPosition, zoom );
|
||||
break;
|
||||
case Qt::Key_Minus:
|
||||
zoom += 10.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1504,6 +1514,7 @@ void CubeEffect::setActive( bool active )
|
|||
input = effects->createInputWindow( this, 0, 0, displayWidth(), displayHeight(),
|
||||
Qt::OpenHandCursor );
|
||||
frontDesktop = effects->currentDesktop();
|
||||
zoom = 0.0;
|
||||
start = true;
|
||||
}
|
||||
effects->setActiveFullScreenEffect( this );
|
||||
|
|
|
@ -110,6 +110,8 @@ class CubeEffect
|
|||
bool bigCube;
|
||||
bool bottomCap;
|
||||
bool closeOnMouseRelease;
|
||||
float zoom;
|
||||
float zPosition;
|
||||
|
||||
// GL lists
|
||||
bool capListCreated;
|
||||
|
|
|
@ -89,6 +89,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
|
|||
connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
|
||||
connect(m_ui->wallpaperLineEdit, SIGNAL(textChanged(QString)), this, SLOT(changed()));
|
||||
connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -111,6 +112,7 @@ void CubeEffectConfig::load()
|
|||
bool animateChange = conf.readEntry( "AnimateDesktopChange", false );
|
||||
bool bigCube = conf.readEntry( "BigCube", false );
|
||||
bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
|
||||
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) );
|
||||
m_ui->wallpaperLineEdit->setText( conf.readEntry( "Wallpaper", "" ) );
|
||||
if( activateBorder == (int)ElectricNone )
|
||||
activateBorder--;
|
||||
|
@ -198,6 +200,7 @@ void CubeEffectConfig::save()
|
|||
conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "Wallpaper", m_ui->wallpaperLineEdit->text() );
|
||||
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
|
||||
|
||||
int activateBorder = m_ui->screenEdgeCombo->currentIndex();
|
||||
if( activateBorder == (int)ELECTRIC_COUNT )
|
||||
|
@ -228,6 +231,7 @@ void CubeEffectConfig::defaults()
|
|||
m_ui->bigCubeBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->wallpaperLineEdit->setText( "" );
|
||||
m_ui->zPositionSlider->setValue( 100 );
|
||||
m_ui->editor->allDefault();
|
||||
emit changed(true);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>408</width>
|
||||
<height>598</height>
|
||||
<height>747</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
|
@ -234,6 +234,71 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Zoom</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QSlider" name="zPositionSlider" >
|
||||
<property name="toolTip" >
|
||||
<string>Define how far away the object should appear</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Near</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Far</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KWin::GlobalShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
|
|
|
@ -172,7 +172,7 @@ void CylinderEffect::paintCap( float z, float zTexture )
|
|||
|
||||
// paint round part of the cap
|
||||
glPushMatrix();
|
||||
float zTranslate = 100.0;
|
||||
float zTranslate = zPosition + zoom;
|
||||
if( start )
|
||||
zTranslate *= timeLine.value();
|
||||
if( stop )
|
||||
|
|
|
@ -88,6 +88,7 @@ CylinderEffectConfig::CylinderEffectConfig(QWidget* parent, const QVariantList&
|
|||
connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
|
||||
connect(m_ui->wallpaperLineEdit, SIGNAL(textChanged(QString)), this, SLOT(changed()));
|
||||
connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ void CylinderEffectConfig::load()
|
|||
bool caps = conf.readEntry( "Caps", true );
|
||||
bool bigCube = conf.readEntry( "BigCube", false );
|
||||
bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
|
||||
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) );
|
||||
m_ui->wallpaperLineEdit->setText( conf.readEntry( "Wallpaper", "" ) );
|
||||
if( activateBorder == (int)ElectricNone )
|
||||
activateBorder--;
|
||||
|
@ -187,6 +189,7 @@ void CylinderEffectConfig::save()
|
|||
conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "Wallpaper", m_ui->wallpaperLineEdit->text() );
|
||||
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
|
||||
|
||||
int activateBorder = m_ui->screenEdgeCombo->currentIndex();
|
||||
if( activateBorder == (int)ELECTRIC_COUNT )
|
||||
|
@ -216,6 +219,7 @@ void CylinderEffectConfig::defaults()
|
|||
m_ui->bigCubeBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->wallpaperLineEdit->setText( "" );
|
||||
m_ui->zPositionSlider->setValue( 100 );
|
||||
m_ui->editor->allDefault();
|
||||
emit changed(true);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>585</height>
|
||||
<height>694</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
|
@ -227,6 +227,71 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Zoom</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QSlider" name="zPositionSlider" >
|
||||
<property name="toolTip" >
|
||||
<string>Define how far away the object should appear</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Near</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Far</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KWin::GlobalShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
|
|
|
@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <kdebug.h>
|
||||
#include <KStandardDirs>
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
@ -44,6 +45,8 @@ SphereEffect::SphereEffect()
|
|||
loadConfig( "Sphere" );
|
||||
reflection = false;
|
||||
animateDesktopChange = false;
|
||||
KConfigGroup conf = effects->effectConfig( "Sphere" );
|
||||
zPosition = conf.readEntry( "ZPosition", 450.0 );
|
||||
}
|
||||
|
||||
SphereEffect::~SphereEffect()
|
||||
|
@ -88,19 +91,6 @@ bool SphereEffect::loadData()
|
|||
return true;
|
||||
}
|
||||
|
||||
void SphereEffect::paintScene( int mask, QRegion region, ScreenPaintData& data )
|
||||
{
|
||||
glPushMatrix();
|
||||
float zTranslate = -350.0;
|
||||
if( start )
|
||||
zTranslate *= timeLine.value();
|
||||
if( stop )
|
||||
zTranslate *= ( 1.0 - timeLine.value() );
|
||||
glTranslatef( 0.0, 0.0, zTranslate );
|
||||
CubeEffect::paintScene( mask, region, data );
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void SphereEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||
{
|
||||
if( activated )
|
||||
|
|
|
@ -38,7 +38,6 @@ class SphereEffect
|
|||
|
||||
static bool supported();
|
||||
protected:
|
||||
virtual void paintScene( int mask, QRegion region, ScreenPaintData& data );
|
||||
virtual void paintCap( float z, float zTexture );
|
||||
virtual void paintCapStep( float z, float zTexture, bool texture );
|
||||
private:
|
||||
|
|
|
@ -87,6 +87,7 @@ SphereEffectConfig::SphereEffectConfig(QWidget* parent, const QVariantList& args
|
|||
connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
|
||||
connect(m_ui->wallpaperLineEdit, SIGNAL(textChanged(QString)), this, SLOT(changed()));
|
||||
connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
|
||||
load();
|
||||
}
|
||||
|
@ -107,6 +108,7 @@ void SphereEffectConfig::load()
|
|||
bool caps = conf.readEntry( "Caps", true );
|
||||
bool bigCube = conf.readEntry( "BigCube", false );
|
||||
bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
|
||||
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 450 ) );
|
||||
m_ui->wallpaperLineEdit->setText( conf.readEntry( "Wallpaper", "" ) );
|
||||
if( activateBorder == (int)ElectricNone )
|
||||
activateBorder--;
|
||||
|
@ -176,6 +178,7 @@ void SphereEffectConfig::save()
|
|||
conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false );
|
||||
conf.writeEntry( "Wallpaper", m_ui->wallpaperLineEdit->text() );
|
||||
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
|
||||
|
||||
int activateBorder = m_ui->screenEdgeCombo->currentIndex();
|
||||
if( activateBorder == (int)ELECTRIC_COUNT )
|
||||
|
@ -204,6 +207,7 @@ void SphereEffectConfig::defaults()
|
|||
m_ui->bigCubeBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
|
||||
m_ui->wallpaperLineEdit->setText( "" );
|
||||
m_ui->zPositionSlider->setValue( 450 );
|
||||
m_ui->editor->allDefault();
|
||||
emit changed(true);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>490</height>
|
||||
<height>662</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
|
@ -220,6 +220,71 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Zoom</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QSlider" name="zPositionSlider" >
|
||||
<property name="toolTip" >
|
||||
<string>Define how far away the object should appear</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition" >
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Near</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Far</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KWin::GlobalShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue