From 502fdbb751f27ef35bfed0ac173dc95b439e74a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 Feb 2009 09:51:04 +0000 Subject: [PATCH] Cylinder and Sphere effect have their own shortcut. Nevertheless it's still not possible to use cube and cylinder or sphere. That'll be fixed when the effects are merged into cube. BUG: 175788 svn path=/trunk/KDE/kdebase/workspace/; revision=922033 --- effects/cube/cube.cpp | 34 ++++++++++++++++++++++++++------ effects/cube/cylinder.cpp | 1 + effects/cube/cylinder_config.cpp | 8 ++++---- effects/cube/sphere.cpp | 1 + effects/cube/sphere_config.cpp | 8 ++++---- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index caa918b35c..589ab8615c 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -81,17 +81,12 @@ CubeEffect::CubeEffect() , zPosition( 0.0 ) , useForTabBox( false ) , tabBoxMode( false ) + , shortcutsRegistered( false ) , capListCreated( false ) , recompileList( true ) , glList( 0 ) { reconfigure( ReconfigureAll ); - - KActionCollection* actionCollection = new KActionCollection( this ); - KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cube" )); - a->setText( i18n("Desktop Cube" )); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); - connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); } bool CubeEffect::supported() @@ -204,6 +199,33 @@ void CubeEffect::loadConfig( QString config ) verticalTimeLine.setDuration( rotationDuration ); slideTimeLine.setCurveShape( TimeLine::EaseInOutCurve ); slideTimeLine.setDuration( rotationDuration ); + + // do not connect the shortcut if we use cylinder or sphere + KActionCollection* actionCollection = new KActionCollection( this ); + if( config == "Cube" && !shortcutsRegistered ) + { + KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cube" )); + a->setText( i18n("Desktop Cube" )); + a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); + shortcutsRegistered = true; + } + if( config == "Cylinder" && !shortcutsRegistered ) + { + KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cylinder" )); + a->setText( i18n("Desktop Cylinder" )); + a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); + connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); + shortcutsRegistered = true; + } + if( config == "Sphere" && !shortcutsRegistered ) + { + KAction* a = static_cast< KAction* >( actionCollection->addAction( "Sphere" )); + a->setText( i18n("Desktop Sphere" )); + a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); + connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); + shortcutsRegistered = true; + } } CubeEffect::~CubeEffect() diff --git a/effects/cube/cylinder.cpp b/effects/cube/cylinder.cpp index 5735290d3e..e5dfe8ca5b 100644 --- a/effects/cube/cylinder.cpp +++ b/effects/cube/cylinder.cpp @@ -39,6 +39,7 @@ CylinderEffect::CylinderEffect() , mValid( true ) , mShader( 0 ) { + shortcutsRegistered = false; reconfigure( ReconfigureAll ); } diff --git a/effects/cube/cylinder_config.cpp b/effects/cube/cylinder_config.cpp index 4971996953..4a3068e5bf 100644 --- a/effects/cube/cylinder_config.cpp +++ b/effects/cube/cylinder_config.cpp @@ -53,13 +53,13 @@ CylinderEffectConfig::CylinderEffectConfig(QWidget* parent, const QVariantList& m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") ); m_actionCollection = new KActionCollection( this, componentData() ); - m_actionCollection->setConfigGroup( "Cube" ); + m_actionCollection->setConfigGroup( "Cylinder" ); m_actionCollection->setConfigGlobal(true); - KAction* a = (KAction*) m_actionCollection->addAction( "Cube" ); - a->setText( i18n("Desktop Cube" )); + KAction* a = (KAction*) m_actionCollection->addAction( "Cylinder" ); + a->setText( i18n("Desktop Cylinder" )); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); m_ui->editor->addCollection(m_actionCollection); diff --git a/effects/cube/sphere.cpp b/effects/cube/sphere.cpp index 7ef348cc30..2b63ccb1d4 100644 --- a/effects/cube/sphere.cpp +++ b/effects/cube/sphere.cpp @@ -39,6 +39,7 @@ SphereEffect::SphereEffect() , mValid( true ) , mShader( 0 ) { + shortcutsRegistered = false; reconfigure( ReconfigureAll ); } diff --git a/effects/cube/sphere_config.cpp b/effects/cube/sphere_config.cpp index 9e0df2d548..eb22b7714d 100644 --- a/effects/cube/sphere_config.cpp +++ b/effects/cube/sphere_config.cpp @@ -53,13 +53,13 @@ SphereEffectConfig::SphereEffectConfig(QWidget* parent, const QVariantList& args m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") ); m_actionCollection = new KActionCollection( this, componentData() ); - m_actionCollection->setConfigGroup( "Cube" ); + m_actionCollection->setConfigGroup( "Sphere" ); m_actionCollection->setConfigGlobal(true); - KAction* a = (KAction*) m_actionCollection->addAction( "Cube" ); - a->setText( i18n("Desktop Cube" )); + KAction* a = (KAction*) m_actionCollection->addAction( "Sphere" ); + a->setText( i18n("Desktop Sphere" )); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); m_ui->editor->addCollection(m_actionCollection);