2009-02-27 15:40:53 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2008 Martin Gräßlin <kde@martin-graesslin.com>
|
|
|
|
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "kdebug.h"
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#include <kservicetypetrader.h>
|
|
|
|
|
|
|
|
#include <KPluginFactory>
|
|
|
|
#include <KPluginLoader>
|
|
|
|
#include <QtDBus/QtDBus>
|
|
|
|
|
|
|
|
K_PLUGIN_FACTORY( KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>(); )
|
|
|
|
K_EXPORT_PLUGIN( KWinScreenEdgesConfigFactory( "kcmkwinscreenedges" ))
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
KWinScreenEdgesConfigForm::KWinScreenEdgesConfigForm( QWidget* parent )
|
|
|
|
: QWidget( parent )
|
|
|
|
{
|
|
|
|
setupUi( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
KWinScreenEdgesConfig::KWinScreenEdgesConfig( QWidget* parent, const QVariantList& args )
|
|
|
|
: KCModule( KWinScreenEdgesConfigFactory::componentData(), parent, args )
|
|
|
|
, m_config( KSharedConfig::openConfig( "kwinrc" ))
|
|
|
|
{
|
|
|
|
m_ui = new KWinScreenEdgesConfigForm( this );
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout( this );
|
|
|
|
layout->addWidget( m_ui );
|
|
|
|
|
|
|
|
monitorInit();
|
|
|
|
|
|
|
|
connect( m_ui->monitor, SIGNAL( changed() ), this, SLOT( changed() ));
|
|
|
|
|
|
|
|
connect( m_ui->desktopSwitchCombo, SIGNAL( currentIndexChanged(int) ), this, SLOT( changed() ));
|
|
|
|
connect( m_ui->activationDelaySpin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
|
|
|
|
connect( m_ui->triggerCooldownSpin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
|
2009-09-08 20:01:08 +00:00
|
|
|
connect( m_ui->quickMaximizeBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
|
|
|
|
connect( m_ui->quickTileBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Visual feedback of action group conflicts
|
|
|
|
connect( m_ui->desktopSwitchCombo, SIGNAL( currentIndexChanged(int) ), this, SLOT( groupChanged() ));
|
2009-09-17 07:48:24 +00:00
|
|
|
connect( m_ui->quickMaximizeBox, SIGNAL( stateChanged(int) ), this, SLOT( groupChanged() ));
|
|
|
|
connect( m_ui->quickTileBox, SIGNAL( stateChanged(int) ), this, SLOT( groupChanged() ));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
if( CompositingPrefs::compositingPossible() )
|
|
|
|
m_defaultPrefs.detect(); // Driver-specific config detection
|
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::groupChanged()
|
|
|
|
{
|
|
|
|
// Monitor conflicts
|
|
|
|
bool hide = false;
|
|
|
|
if( m_ui->desktopSwitchCombo->currentIndex() == 2 )
|
|
|
|
hide = true;
|
2009-05-03 10:01:31 +00:00
|
|
|
monitorHideEdge( ElectricTop, hide );
|
|
|
|
monitorHideEdge( ElectricRight, hide );
|
2009-02-27 15:40:53 +00:00
|
|
|
monitorHideEdge( ElectricBottom, hide );
|
2009-05-03 10:01:31 +00:00
|
|
|
monitorHideEdge( ElectricLeft, hide );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop switch conflicts
|
2009-09-17 07:48:24 +00:00
|
|
|
if( m_ui->quickTileBox->isChecked() || m_ui->quickMaximizeBox->isChecked() )
|
|
|
|
{
|
|
|
|
m_ui->desktopSwitchLabel->setEnabled( false );
|
|
|
|
m_ui->desktopSwitchCombo->setEnabled( false );
|
|
|
|
m_ui->desktopSwitchCombo->setCurrentIndex( 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_ui->desktopSwitchLabel->setEnabled( true );
|
|
|
|
m_ui->desktopSwitchCombo->setEnabled( true );
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
|
|
|
|
monitorLoad();
|
|
|
|
|
|
|
|
KConfigGroup config( m_config, "Windows" );
|
|
|
|
|
|
|
|
m_ui->desktopSwitchCombo->setCurrentIndex( config.readEntry( "ElectricBorders", 0 ));
|
|
|
|
m_ui->activationDelaySpin->setValue( config.readEntry( "ElectricBorderDelay", 150 ));
|
|
|
|
m_ui->triggerCooldownSpin->setValue( config.readEntry( "ElectricBorderCooldown", 350 ));
|
2009-10-27 13:11:58 +00:00
|
|
|
m_ui->quickMaximizeBox->setChecked( config.readEntry( "ElectricBorderMaximize", true ));
|
|
|
|
m_ui->quickTileBox->setChecked( config.readEntry( "ElectricBorderTiling", true ));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
emit changed( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::save()
|
|
|
|
{
|
|
|
|
KCModule::save();
|
|
|
|
|
|
|
|
monitorSave();
|
|
|
|
|
|
|
|
KConfigGroup config( m_config, "Windows" );
|
|
|
|
|
|
|
|
config.writeEntry( "ElectricBorders", m_ui->desktopSwitchCombo->currentIndex() );
|
|
|
|
config.writeEntry( "ElectricBorderDelay", m_ui->activationDelaySpin->value() );
|
|
|
|
config.writeEntry( "ElectricBorderCooldown", m_ui->triggerCooldownSpin->value() );
|
2009-09-08 20:01:08 +00:00
|
|
|
config.writeEntry( "ElectricBorderMaximize", m_ui->quickMaximizeBox->isChecked() );
|
|
|
|
config.writeEntry( "ElectricBorderTiling", m_ui->quickTileBox->isChecked() );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
config.sync();
|
|
|
|
|
|
|
|
// Reload KWin.
|
|
|
|
QDBusMessage message = QDBusMessage::createSignal( "/KWin", "org.kde.KWin", "reloadConfig" );
|
|
|
|
QDBusConnection::sessionBus().send( message );
|
|
|
|
|
|
|
|
emit changed( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::defaults()
|
|
|
|
{
|
|
|
|
monitorDefaults();
|
|
|
|
|
|
|
|
m_ui->desktopSwitchCombo->setCurrentIndex( 0 );
|
|
|
|
m_ui->activationDelaySpin->setValue( 150 );
|
|
|
|
m_ui->triggerCooldownSpin->setValue( 350 );
|
2009-10-27 13:11:58 +00:00
|
|
|
m_ui->quickMaximizeBox->setChecked( true );
|
|
|
|
m_ui->quickTileBox->setChecked( true );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
emit changed( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::showEvent( QShowEvent* e )
|
|
|
|
{
|
|
|
|
KCModule::showEvent( e );
|
|
|
|
|
|
|
|
monitorShowEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Copied from kcmkwin/kwincompositing/main.cpp
|
|
|
|
bool KWinScreenEdgesConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
|
|
|
|
{
|
|
|
|
KService::List services = KServiceTypeTrader::self()->query(
|
2009-10-30 06:51:59 +00:00
|
|
|
"KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + '\'');
|
2009-02-27 15:40:53 +00:00
|
|
|
if( services.isEmpty())
|
|
|
|
return false;
|
|
|
|
QVariant v = services.first()->property("X-KDE-PluginInfo-EnabledByDefault");
|
|
|
|
return cfg.readEntry("kwin4_effect_" + effect + "Enabled", v.toBool());
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Monitor
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorAddItem( const QString& item )
|
|
|
|
{
|
|
|
|
for( int i = 0; i < 8; i++ )
|
|
|
|
m_ui->monitor->addEdgeItem( i, item );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorItemSetEnabled( int index, bool enabled )
|
|
|
|
{
|
|
|
|
for( int i = 0; i < 8; i++ )
|
|
|
|
m_ui->monitor->setEdgeItemEnabled( i, index, enabled );
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorInit()
|
|
|
|
{
|
|
|
|
monitorAddItem( i18n( "No Action" ));
|
2009-02-28 08:33:16 +00:00
|
|
|
monitorAddItem( i18n( "Show Dashboard" ));
|
2009-06-28 20:32:50 +00:00
|
|
|
monitorAddItem( i18n( "Show Desktop" ));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Search the effect names
|
|
|
|
KServiceTypeTrader* trader = KServiceTypeTrader::self();
|
|
|
|
KService::List services;
|
|
|
|
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_presentwindows'" );
|
2009-02-28 08:33:16 +00:00
|
|
|
if( services.isEmpty() )
|
2009-05-17 09:56:35 +00:00
|
|
|
{
|
|
|
|
// adding empty strings in case the effect is not found
|
|
|
|
// TODO: after string freeze add a info that the effect is missing
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "All Desktops" ));
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "Current Desktop" ));
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_desktopgrid'" );
|
2009-02-28 08:33:16 +00:00
|
|
|
if( services.isEmpty() )
|
2009-05-17 09:56:35 +00:00
|
|
|
{
|
|
|
|
// adding empty strings in case the effect is not found
|
|
|
|
// TODO: after string freeze add a info that the effect is missing
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
monitorAddItem( services.first()->name());
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'" );
|
2009-02-28 08:33:16 +00:00
|
|
|
if( services.isEmpty() )
|
2009-05-17 09:56:35 +00:00
|
|
|
{
|
|
|
|
// adding empty strings in case the effect is not found
|
|
|
|
// TODO: after string freeze add a info that the effect is missing
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "Cube" ));
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "Cylinder" ));
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "Sphere" ));
|
|
|
|
}
|
2009-07-21 10:18:48 +00:00
|
|
|
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_flipswitch'" );
|
|
|
|
if( services.isEmpty() )
|
|
|
|
{
|
|
|
|
// adding empty strings in case the effect is not found
|
|
|
|
// TODO: after string freeze add a info that the effect is missing
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
monitorAddItem( QString() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "All Desktops" ));
|
|
|
|
monitorAddItem( services.first()->name() + " - " + i18n( "Current Desktop" ));
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
monitorShowEvent();
|
|
|
|
}
|
|
|
|
|
2009-02-28 08:33:16 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorLoadAction( ElectricBorder edge, const QString& configName )
|
|
|
|
{
|
|
|
|
KConfigGroup config( m_config, "ElectricBorders" );
|
|
|
|
QString lowerName = config.readEntry( configName, "None" ).toLower();
|
|
|
|
if( lowerName == "dashboard" ) monitorChangeEdge( edge, int( ElectricActionDashboard ));
|
|
|
|
}
|
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorLoad()
|
|
|
|
{
|
2009-02-28 08:33:16 +00:00
|
|
|
// Load ElectricBorderActions
|
|
|
|
monitorLoadAction( ElectricTop, "Top" );
|
|
|
|
monitorLoadAction( ElectricTopRight, "TopRight" );
|
|
|
|
monitorLoadAction( ElectricRight, "Right" );
|
|
|
|
monitorLoadAction( ElectricBottomRight, "BottomRight" );
|
|
|
|
monitorLoadAction( ElectricBottom, "Bottom" );
|
|
|
|
monitorLoadAction( ElectricBottomLeft, "BottomLeft" );
|
|
|
|
monitorLoadAction( ElectricLeft, "Left" );
|
|
|
|
monitorLoadAction( ElectricTopLeft, "TopLeft" );
|
|
|
|
|
|
|
|
// Load effect-specific actions:
|
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
// Present Windows
|
|
|
|
KConfigGroup presentWindowsConfig( m_config, "Effect-PresentWindows" );
|
2009-03-29 12:57:20 +00:00
|
|
|
QList<int> list = QList<int>();
|
|
|
|
// PresentWindows BorderActivateAll
|
|
|
|
list.append( int( ElectricTopLeft ) );
|
|
|
|
list = presentWindowsConfig.readEntry( "BorderActivateAll", list );
|
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( PresentWindowsAll ) );
|
|
|
|
}
|
|
|
|
// PresentWindows BorderActivate
|
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
|
|
|
list = presentWindowsConfig.readEntry( "BorderActivate", list );
|
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( PresentWindowsCurrent ) );
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Grid
|
|
|
|
KConfigGroup gridConfig( m_config, "Effect-DesktopGrid" );
|
2009-03-29 12:57:20 +00:00
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
|
|
|
list = gridConfig.readEntry( "BorderActivate", list );
|
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( DesktopGrid ) );
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Cube
|
|
|
|
KConfigGroup cubeConfig( m_config, "Effect-Cube" );
|
2009-03-29 12:57:20 +00:00
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
2009-07-24 21:10:34 +00:00
|
|
|
list = cubeConfig.readEntry( "BorderActivate", list );
|
2009-03-29 12:57:20 +00:00
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( Cube ) );
|
|
|
|
}
|
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
2009-07-24 21:10:34 +00:00
|
|
|
list = cubeConfig.readEntry( "BorderActivateCylinder", list );
|
2009-03-29 12:57:20 +00:00
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( Cylinder ) );
|
|
|
|
}
|
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
2009-07-24 21:10:34 +00:00
|
|
|
list = cubeConfig.readEntry( "BorderActivateSphere", list );
|
2009-03-29 12:57:20 +00:00
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( Sphere ) );
|
|
|
|
}
|
2009-07-21 10:18:48 +00:00
|
|
|
|
|
|
|
// Flip Switch
|
|
|
|
KConfigGroup flipSwitchConfig( m_config, "Effect-FlipSwitch" );
|
|
|
|
list.clear();
|
|
|
|
// FlipSwitch BorderActivateAll
|
|
|
|
list.append( int( ElectricNone ) );
|
|
|
|
list = flipSwitchConfig.readEntry( "BorderActivateAll", list );
|
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( FlipSwitchAll ) );
|
|
|
|
}
|
|
|
|
// FlipSwitch BorderActivate
|
|
|
|
list.clear();
|
|
|
|
list.append( int( ElectricNone ) );
|
|
|
|
list = flipSwitchConfig.readEntry( "BorderActivate", list );
|
|
|
|
foreach( int i, list )
|
|
|
|
{
|
|
|
|
monitorChangeEdge( ElectricBorder( i ), int( FlipSwitchCurrent ) );
|
|
|
|
}
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
|
2009-02-28 08:33:16 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorSaveAction( int edge, const QString& configName )
|
|
|
|
{
|
|
|
|
KConfigGroup config( m_config, "ElectricBorders" );
|
|
|
|
int item = m_ui->monitor->selectedEdgeItem( edge );
|
|
|
|
if( item == 1 ) // Plasma dashboard
|
|
|
|
config.writeEntry( configName, "Dashboard" );
|
2009-06-28 20:32:50 +00:00
|
|
|
else if( item == 2 )
|
|
|
|
config.writeEntry( configName, "ShowDesktop" );
|
2009-02-28 08:33:16 +00:00
|
|
|
else // Anything else
|
|
|
|
config.writeEntry( configName, "None" );
|
|
|
|
}
|
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorSave()
|
|
|
|
{
|
2009-02-28 08:33:16 +00:00
|
|
|
// Save ElectricBorderActions
|
|
|
|
monitorSaveAction( int( Monitor::Top ), "Top" );
|
|
|
|
monitorSaveAction( int( Monitor::TopRight ), "TopRight" );
|
|
|
|
monitorSaveAction( int( Monitor::Right ), "Right" );
|
|
|
|
monitorSaveAction( int( Monitor::BottomRight ), "BottomRight" );
|
|
|
|
monitorSaveAction( int( Monitor::Bottom ), "Bottom" );
|
|
|
|
monitorSaveAction( int( Monitor::BottomLeft ), "BottomLeft" );
|
|
|
|
monitorSaveAction( int( Monitor::Left ), "Left" );
|
|
|
|
monitorSaveAction( int( Monitor::TopLeft ), "TopLeft" );
|
|
|
|
|
|
|
|
// Save effect-specific actions:
|
|
|
|
|
2009-02-27 15:40:53 +00:00
|
|
|
// Present Windows
|
|
|
|
KConfigGroup presentWindowsConfig( m_config, "Effect-PresentWindows" );
|
|
|
|
presentWindowsConfig.writeEntry( "BorderActivateAll",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( PresentWindowsAll )));
|
2009-02-27 15:40:53 +00:00
|
|
|
presentWindowsConfig.writeEntry( "BorderActivate",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( PresentWindowsCurrent )));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Grid
|
|
|
|
KConfigGroup gridConfig( m_config, "Effect-DesktopGrid" );
|
|
|
|
gridConfig.writeEntry( "BorderActivate",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( DesktopGrid )));
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Cube
|
|
|
|
KConfigGroup cubeConfig( m_config, "Effect-Cube" );
|
|
|
|
cubeConfig.writeEntry( "BorderActivate",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( Cube )));
|
2009-02-27 15:40:53 +00:00
|
|
|
cubeConfig.writeEntry( "BorderActivateCylinder",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( Cylinder )));
|
2009-02-27 15:40:53 +00:00
|
|
|
cubeConfig.writeEntry( "BorderActivateSphere",
|
2009-03-29 12:57:20 +00:00
|
|
|
monitorCheckEffectHasEdge( int( Sphere )));
|
2009-07-21 10:18:48 +00:00
|
|
|
|
|
|
|
// Flip Switch
|
|
|
|
KConfigGroup flipSwitchConfig( m_config, "Effect-FlipSwitch" );
|
|
|
|
flipSwitchConfig.writeEntry( "BorderActivateAll",
|
|
|
|
monitorCheckEffectHasEdge( int( FlipSwitchAll )));
|
|
|
|
flipSwitchConfig.writeEntry( "BorderActivate",
|
|
|
|
monitorCheckEffectHasEdge( int( FlipSwitchCurrent )));
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorDefaults()
|
|
|
|
{
|
|
|
|
// Clear all edges
|
|
|
|
for( int i = 0; i < 8; i++ )
|
|
|
|
m_ui->monitor->selectEdgeItem( i, 0 );
|
|
|
|
|
|
|
|
// Present windows = Top-left
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::TopLeft ), int( PresentWindowsAll ));
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorShowEvent()
|
|
|
|
{
|
|
|
|
// Check if they are enabled
|
|
|
|
KConfigGroup config( m_config, "Compositing" );
|
|
|
|
if( config.readEntry( "Enabled", m_defaultPrefs.enableCompositing() ))
|
|
|
|
{ // Compositing enabled
|
|
|
|
config = KConfigGroup( m_config, "Plugins" );
|
|
|
|
|
|
|
|
// Present Windows
|
|
|
|
bool enabled = effectEnabled( "presentwindows", config );
|
2009-03-30 14:35:17 +00:00
|
|
|
monitorItemSetEnabled( int( PresentWindowsCurrent ), enabled );
|
|
|
|
monitorItemSetEnabled( int( PresentWindowsAll ), enabled );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Grid
|
|
|
|
enabled = effectEnabled( "desktopgrid", config );
|
2009-03-30 14:35:17 +00:00
|
|
|
monitorItemSetEnabled( int( DesktopGrid ), enabled );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
|
|
|
// Desktop Cube
|
|
|
|
enabled = effectEnabled( "cube", config );
|
2009-03-30 14:35:17 +00:00
|
|
|
monitorItemSetEnabled( int( Cube ), enabled );
|
|
|
|
monitorItemSetEnabled( int( Cylinder ), enabled );
|
|
|
|
monitorItemSetEnabled( int( Sphere ), enabled );
|
2009-07-21 10:18:48 +00:00
|
|
|
|
|
|
|
// Flip Switch
|
|
|
|
enabled = effectEnabled( "flipswitch", config );
|
|
|
|
monitorItemSetEnabled( int( FlipSwitchAll ), enabled );
|
|
|
|
monitorItemSetEnabled( int( FlipSwitchCurrent ), enabled );
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
else // Compositing disabled
|
|
|
|
{
|
2009-03-30 14:35:17 +00:00
|
|
|
monitorItemSetEnabled( int( PresentWindowsCurrent ), false );
|
|
|
|
monitorItemSetEnabled( int( PresentWindowsAll ), false );
|
|
|
|
monitorItemSetEnabled( int( DesktopGrid ), false );
|
|
|
|
monitorItemSetEnabled( int( Cube ), false );
|
|
|
|
monitorItemSetEnabled( int( Cylinder ), false );
|
|
|
|
monitorItemSetEnabled( int( Sphere ), false );
|
2009-07-21 10:18:48 +00:00
|
|
|
monitorItemSetEnabled( int( FlipSwitchAll ), false );
|
|
|
|
monitorItemSetEnabled( int( FlipSwitchCurrent ), false );
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorChangeEdge( ElectricBorder border, int index )
|
|
|
|
{
|
|
|
|
switch( border )
|
|
|
|
{
|
|
|
|
case ElectricTop:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::Top ), index );
|
|
|
|
break;
|
|
|
|
case ElectricTopRight:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::TopRight ), index );
|
|
|
|
break;
|
|
|
|
case ElectricRight:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::Right ), index );
|
|
|
|
break;
|
|
|
|
case ElectricBottomRight:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::BottomRight ), index );
|
|
|
|
break;
|
|
|
|
case ElectricBottom:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::Bottom ), index );
|
|
|
|
break;
|
|
|
|
case ElectricBottomLeft:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::BottomLeft ), index );
|
|
|
|
break;
|
|
|
|
case ElectricLeft:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::Left ), index );
|
|
|
|
break;
|
|
|
|
case ElectricTopLeft:
|
|
|
|
m_ui->monitor->selectEdgeItem( int( Monitor::TopLeft ), index );
|
|
|
|
break;
|
|
|
|
default: // Nothing
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorHideEdge( ElectricBorder border, bool hidden )
|
|
|
|
{
|
|
|
|
switch( border )
|
|
|
|
{
|
|
|
|
case ElectricTop:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::Top ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricTopRight:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::TopRight ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricRight:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::Right ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricBottomRight:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::BottomRight ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricBottom:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::Bottom ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricBottomLeft:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::BottomLeft ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricLeft:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::Left ), hidden );
|
|
|
|
break;
|
|
|
|
case ElectricTopLeft:
|
|
|
|
m_ui->monitor->setEdgeHidden( int( Monitor::TopLeft ), hidden );
|
|
|
|
break;
|
|
|
|
default: // Nothing
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-29 12:57:20 +00:00
|
|
|
QList<int> KWinScreenEdgesConfig::monitorCheckEffectHasEdge( int index ) const
|
2009-02-27 15:40:53 +00:00
|
|
|
{
|
2009-03-29 12:57:20 +00:00
|
|
|
QList<int> list = QList<int>();
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Top )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricTop ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::TopRight )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricTopRight ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Right )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricRight ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::BottomRight )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricBottomRight ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Bottom )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricBottom ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::BottomLeft )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricBottomLeft ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Left )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricLeft ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
if( m_ui->monitor->selectedEdgeItem( int( Monitor::TopLeft )) == index )
|
2009-03-29 12:57:20 +00:00
|
|
|
list.append( int( ElectricTopLeft ) );
|
2009-02-27 15:40:53 +00:00
|
|
|
|
2009-03-29 12:57:20 +00:00
|
|
|
if( list.isEmpty() )
|
|
|
|
list.append( int( ElectricNone ) );
|
|
|
|
return list;
|
2009-02-27 15:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "main.moc"
|