diff --git a/effects/cube.cpp b/effects/cube.cpp index b44700d068..9b749436ae 100644 --- a/effects/cube.cpp +++ b/effects/cube.cpp @@ -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 ); diff --git a/effects/cube.h b/effects/cube.h index caa44232e0..3ad0631c99 100644 --- a/effects/cube.h +++ b/effects/cube.h @@ -110,6 +110,8 @@ class CubeEffect bool bigCube; bool bottomCap; bool closeOnMouseRelease; + float zoom; + float zPosition; // GL lists bool capListCreated; diff --git a/effects/cube_config.cpp b/effects/cube_config.cpp index ebbe23b43c..e70d3e6e65 100644 --- a/effects/cube_config.cpp +++ b/effects/cube_config.cpp @@ -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); } diff --git a/effects/cube_config.ui b/effects/cube_config.ui index dffb41b196..9b0168480c 100644 --- a/effects/cube_config.ui +++ b/effects/cube_config.ui @@ -6,7 +6,7 @@ 0 0 408 - 598 + 747 @@ -234,6 +234,71 @@ + + + + Zoom + + + + + + Define how far away the object should appear + + + 3000 + + + 10 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 100 + + + + + + + + + Near + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Far + + + + + + + + diff --git a/effects/cylinder.cpp b/effects/cylinder.cpp index 6d056048f3..e5a1ed13d8 100644 --- a/effects/cylinder.cpp +++ b/effects/cylinder.cpp @@ -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 ) diff --git a/effects/cylinder_config.cpp b/effects/cylinder_config.cpp index 0873744b4c..2e380c5c6f 100644 --- a/effects/cylinder_config.cpp +++ b/effects/cylinder_config.cpp @@ -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); } diff --git a/effects/cylinder_config.ui b/effects/cylinder_config.ui index 6f6506b9b3..1417269512 100644 --- a/effects/cylinder_config.ui +++ b/effects/cylinder_config.ui @@ -6,7 +6,7 @@ 0 0 400 - 585 + 694 @@ -227,6 +227,71 @@ + + + + Zoom + + + + + + Define how far away the object should appear + + + 3000 + + + 10 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 100 + + + + + + + + + Near + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Far + + + + + + + + diff --git a/effects/sphere.cpp b/effects/sphere.cpp index e1f9e1c64e..ea5be48d35 100644 --- a/effects/sphere.cpp +++ b/effects/sphere.cpp @@ -22,6 +22,7 @@ along with this program. If not, see . #include #include +#include #include @@ -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 ) diff --git a/effects/sphere.h b/effects/sphere.h index 00eb514533..d92cc8612c 100644 --- a/effects/sphere.h +++ b/effects/sphere.h @@ -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: diff --git a/effects/sphere_config.cpp b/effects/sphere_config.cpp index 96f180c7fe..40b8109f7f 100644 --- a/effects/sphere_config.cpp +++ b/effects/sphere_config.cpp @@ -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); } diff --git a/effects/sphere_config.ui b/effects/sphere_config.ui index 3db2166dda..3816c1c70f 100644 --- a/effects/sphere_config.ui +++ b/effects/sphere_config.ui @@ -6,7 +6,7 @@ 0 0 400 - 490 + 662 @@ -220,6 +220,71 @@ + + + + Zoom + + + + + + Define how far away the object should appear + + + 3000 + + + 10 + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 100 + + + + + + + + + Near + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Far + + + + + + + +