Add Effects tab to the compositing config module.

It contains the list of all effects which has it's separate module ATM.

svn path=/trunk/KDE/kdebase/workspace/; revision=713933
This commit is contained in:
Rivo Laks 2007-09-18 10:09:07 +00:00
parent 23f78b0b57
commit 86831ca7a8
3 changed files with 187 additions and 99 deletions

View file

@ -17,6 +17,10 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kconfiggroup.h>
#include <kdebug.h>
#include <ksettings/dispatcher.h>
#include <kpluginselector.h>
#include <kservicetypetrader.h>
#include <kplugininfo.h>
#include <kservice.h>
#include <QtDBus/QtDBus>
#include <KPluginFactory>
@ -36,15 +40,22 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
mKWinConfig(KSharedConfig::openConfig("kwinrc"))
{
ui.setupUi(this);
ui.tabWidget->setCurrentIndex(0);
connect(ui.advancedOptions, SIGNAL(clicked()), this, SLOT(showAdvancedOptions()));
connect(ui.useCompositing, SIGNAL(toggled(bool)), ui.compositingOptionsContainer, SLOT(setEnabled(bool)));
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(compositingEnabled(bool)));
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.effectWinManagement, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.effectShadows, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.effectAnimations, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.effectSelector, SIGNAL(changed(bool)), this, SLOT(changed()));
connect(ui.effectSelector, SIGNAL(configCommitted(const QByteArray&)),
this, SLOT(reparseConfiguration(const QByteArray&)));
initEffectSelector();
// Load config
load();
@ -61,7 +72,13 @@ KWinCompositingConfig::~KWinCompositingConfig()
void KWinCompositingConfig::reparseConfiguration(const QByteArray&conf)
{
KSettings::Dispatcher::reparseConfiguration(conf);
KSettings::Dispatcher::reparseConfiguration(conf);
}
void KWinCompositingConfig::compositingEnabled(bool enabled)
{
ui.compositingOptionsContainer->setEnabled(enabled);
ui.tabWidget->setTabEnabled(1, enabled);
}
void KWinCompositingConfig::showAdvancedOptions()
@ -72,6 +89,21 @@ void KWinCompositingConfig::showAdvancedOptions()
connect(dialog, SIGNAL(configSaved()), this, SLOT(configChanged()));
}
void KWinCompositingConfig::initEffectSelector()
{
// Find all .desktop files of the effects
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect");
QList<KPluginInfo> effectinfos = KPluginInfo::fromServices(offers);
// Add them to the plugin selector
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Appearance"), "Appearance", mKWinConfig);
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Accessibility"), "Accessibility", mKWinConfig);
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Window Management"), "Window Management", mKWinConfig);
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Demos"), "Demos", mKWinConfig);
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Tests"), "Tests", mKWinConfig);
ui.effectSelector->addPlugins(effectinfos, KPluginSelector::ReadConfigFile, i18n("Misc"), "Misc", mKWinConfig);
}
void KWinCompositingConfig::load()
{
kDebug() ;
@ -91,6 +123,8 @@ void KWinCompositingConfig::load()
ui.effectShadows->setChecked(LOAD_EFFECT_CONFIG("shadow"));
ui.effectAnimations->setChecked(LOAD_EFFECT_CONFIG("minimizeanimation"));
ui.effectSelector->load();
emit changed( false );
}
@ -115,6 +149,8 @@ void KWinCompositingConfig::save()
WRITE_EFFECT_CONFIG("minimizeanimation", ui.effectAnimations);
#undef WRITE_EFFECT_CONFIG
ui.effectSelector->save();
emit changed( false );
configChanged();
@ -137,6 +173,8 @@ void KWinCompositingConfig::defaults()
ui.effectWinManagement->setChecked(true);
ui.effectShadows->setChecked(true);
ui.effectAnimations->setChecked(true);
ui.effectSelector->defaults();
}
QString KWinCompositingConfig::quickHelp() const

View file

@ -33,6 +33,7 @@ class KWinCompositingConfig : public KCModule
virtual QString quickHelp() const;
public slots:
virtual void compositingEnabled(bool enabled);
virtual void showAdvancedOptions();
virtual void load();
@ -41,6 +42,9 @@ class KWinCompositingConfig : public KCModule
void reparseConfiguration(const QByteArray&conf);
void configChanged();
void initEffectSelector();
protected:
private:
KSharedConfigPtr mKWinConfig;

View file

@ -5,112 +5,158 @@
<rect>
<x>0</x>
<y>0</y>
<width>515</width>
<height>334</height>
<width>607</width>
<height>661</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="useCompositing" >
<property name="text" >
<string>Enable desktop effects</string>
</property>
<property name="checked" >
<bool>true</bool>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>1</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>General</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="useCompositing" >
<property name="text" >
<string>Enable desktop effects</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="compositingOptionsContainer" >
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Common effects</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="effectWinManagement" >
<property name="text" >
<string>Improved window management</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="effectShadows" >
<property name="text" >
<string>Shadows</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="effectAnimations" >
<property name="text" >
<string>Various animations</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>You can find more effects in the All effects tab</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="advancedOptions" >
<property name="text" >
<string>Advanced options...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>All effects</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Hint: to find out or configure how to activate an effect, look at effect's options</string>
</property>
</widget>
</item>
<item>
<widget class="KPluginSelector" native="1" name="effectSelector" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="compositingOptionsContainer" >
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Common effects</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="effectWinManagement" >
<property name="text" >
<string>Improved window management</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="effectShadows" >
<property name="text" >
<string>Shadows</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="effectAnimations" >
<property name="text" >
<string>Various animations</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>You can find more effects in the Effects config module</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="advancedOptions" >
<property name="text" >
<string>Advanced options...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPluginSelector</class>
<extends>QWidget</extends>
<header>kpluginselector.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>