Make compositing config more user friendly by renaming Compositing to Desktop Effects and
putting advanced options into separate dialog. svn path=/trunk/KDE/kdebase/workspace/; revision=690288
This commit is contained in:
parent
9c05342745
commit
887caff1c4
8 changed files with 218 additions and 44 deletions
|
@ -1,7 +1,7 @@
|
|||
########### next target ###############
|
||||
|
||||
set(kcm_kwincompositing_PART_SRCS main.cpp )
|
||||
kde4_add_ui_files(kcm_kwincompositing_PART_SRCS main.ui)
|
||||
set(kcm_kwincompositing_PART_SRCS advanced.cpp main.cpp )
|
||||
kde4_add_ui_files(kcm_kwincompositing_PART_SRCS advanced.ui main.ui)
|
||||
kde4_add_plugin(kcm_kwincompositing ${kcm_kwincompositing_PART_SRCS})
|
||||
target_link_libraries(kcm_kwincompositing ${KDE4_KUTILS_LIBS})
|
||||
install(TARGETS kcm_kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
|
75
kcmkwin/kwincompositing/advanced.cpp
Normal file
75
kcmkwin/kwincompositing/advanced.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
******************************************************************/
|
||||
|
||||
#include "advanced.h"
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
KWinAdvancedCompositingOptions::KWinAdvancedCompositingOptions(QWidget* parent, KSharedConfigPtr config) :
|
||||
KDialog(parent)
|
||||
{
|
||||
mKWinConfig = config;
|
||||
|
||||
setCaption(i18n("Advanced compositing options"));
|
||||
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
|
||||
setModal(true);
|
||||
|
||||
QWidget* mainWidget = new QWidget(this);
|
||||
ui.setupUi(mainWidget);
|
||||
setMainWidget(mainWidget);
|
||||
|
||||
ui.compositingType->insertItem(0, i18n("OpenGL"));
|
||||
ui.compositingType->insertItem(1, i18n("XRender"));
|
||||
|
||||
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
|
||||
connect(this, SIGNAL(okClicked()), this, SLOT(save()));
|
||||
connect(this, SIGNAL(applyClicked()), this, SLOT(save()));
|
||||
|
||||
load();
|
||||
|
||||
enableButtonApply(false);
|
||||
}
|
||||
|
||||
KWinAdvancedCompositingOptions::~KWinAdvancedCompositingOptions()
|
||||
{
|
||||
}
|
||||
|
||||
void KWinAdvancedCompositingOptions::changed()
|
||||
{
|
||||
enableButtonApply(true);
|
||||
}
|
||||
|
||||
void KWinAdvancedCompositingOptions::load()
|
||||
{
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
QString backend = config.readEntry("Backend", "OpenGL");
|
||||
ui.compositingType->setCurrentIndex((backend == "XRender") ? 1 : 0);
|
||||
}
|
||||
|
||||
void KWinAdvancedCompositingOptions::save()
|
||||
{
|
||||
// Is this ok?
|
||||
if (!isButtonEnabled(KDialog::Apply)) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
config.writeEntry("Backend", (ui.compositingType->currentIndex() == 0) ? "OpenGL" : "XRender");
|
||||
|
||||
enableButtonApply(false);
|
||||
emit configSaved();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
46
kcmkwin/kwincompositing/advanced.h
Normal file
46
kcmkwin/kwincompositing/advanced.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#ifndef ADVANCED_H
|
||||
#define ADVANCED_H
|
||||
|
||||
#include <kdialog.h>
|
||||
|
||||
#include "ui_advanced.h"
|
||||
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class KWinAdvancedCompositingOptions : public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KWinAdvancedCompositingOptions(QWidget* parent, KSharedConfigPtr config);
|
||||
virtual ~KWinAdvancedCompositingOptions();
|
||||
|
||||
void load();
|
||||
|
||||
public slots:
|
||||
void changed();
|
||||
void save();
|
||||
|
||||
signals:
|
||||
void configSaved();
|
||||
|
||||
private:
|
||||
KSharedConfigPtr mKWinConfig;
|
||||
Ui::KWinAdvancedCompositingOptions ui;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
47
kcmkwin/kwincompositing/advanced.ui
Normal file
47
kcmkwin/kwincompositing/advanced.ui
Normal file
|
@ -0,0 +1,47 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWinAdvancedCompositingOptions</class>
|
||||
<widget class="QWidget" name="KWinAdvancedCompositingOptions" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Compositing type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="compositingType" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -10,8 +10,8 @@ X-KDE-Library=kcm_kwincompositing
|
|||
X-KDE-FactoryName=kcm_kwincompositing
|
||||
X-KDE-ParentApp=kcontrol
|
||||
|
||||
Name=Compositing
|
||||
Name=Desktop effects
|
||||
|
||||
Comment=Configure window compositing
|
||||
Comment=Configure desktop effects
|
||||
|
||||
Keywords=kwin,window,manager,compositing,effect
|
||||
|
|
|
@ -10,6 +10,8 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
|
||||
#include "main.h"
|
||||
|
||||
#include "advanced.h"
|
||||
|
||||
#include <kgenericfactory.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kconfig.h>
|
||||
|
@ -36,19 +38,16 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QStringList
|
|||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
ui.compositingType->insertItem(0, i18n("OpenGL"));
|
||||
ui.compositingType->insertItem(1, i18n("XRender"));
|
||||
|
||||
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(changed()));
|
||||
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
|
||||
// Load config
|
||||
load();
|
||||
|
||||
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwincompositing"), 0,
|
||||
ki18n("KWin Compositing Configuration Module"),
|
||||
ki18n("KWin Desktop Effects Configuration Module"),
|
||||
0, KLocalizedString(), KAboutData::License_GPL, ki18n("(c) 2007 Rivo Laks"));
|
||||
about->addAuthor(ki18n("Rivo Laks"), KLocalizedString(), "rivolaks@hot.ee");
|
||||
setAboutData(about);
|
||||
|
@ -63,6 +62,14 @@ void KWinCompositingConfig::reparseConfiguration(const QByteArray&conf)
|
|||
KSettings::Dispatcher::reparseConfiguration(conf);
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::showAdvancedOptions()
|
||||
{
|
||||
KWinAdvancedCompositingOptions* dialog = new KWinAdvancedCompositingOptions(this, mKWinConfig);
|
||||
|
||||
dialog->show();
|
||||
connect(dialog, SIGNAL(configSaved()), this, SLOT(configChanged()));
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::load()
|
||||
{
|
||||
kDebug() << k_funcinfo << endl;
|
||||
|
@ -70,8 +77,6 @@ void KWinCompositingConfig::load()
|
|||
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
ui.useCompositing->setChecked(config.readEntry("Enabled", false));
|
||||
QString backend = config.readEntry("Backend", "OpenGL");
|
||||
ui.compositingType->setCurrentIndex((backend == "XRender") ? 1 : 0);
|
||||
|
||||
emit changed( false );
|
||||
}
|
||||
|
@ -83,12 +88,16 @@ void KWinCompositingConfig::save()
|
|||
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
config.writeEntry("Enabled", ui.useCompositing->isChecked());
|
||||
config.writeEntry("Backend", (ui.compositingType->currentIndex() == 0) ? "OpenGL" : "XRender");
|
||||
|
||||
// TODO: save effects
|
||||
|
||||
emit changed( false );
|
||||
|
||||
configChanged();
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::configChanged()
|
||||
{
|
||||
// Send signal to kwin
|
||||
mKWinConfig->sync();
|
||||
// Send signal to all kwin instances
|
||||
|
@ -101,7 +110,6 @@ void KWinCompositingConfig::defaults()
|
|||
{
|
||||
kDebug() << k_funcinfo << endl;
|
||||
ui.useCompositing->setChecked(false);
|
||||
ui.compositingType->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
QString KWinCompositingConfig::quickHelp() const
|
||||
|
|
|
@ -33,11 +33,15 @@ class KWinCompositingConfig : public KCModule
|
|||
virtual QString quickHelp() const;
|
||||
|
||||
public slots:
|
||||
virtual void showAdvancedOptions();
|
||||
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
void reparseConfiguration(const QByteArray&conf);
|
||||
|
||||
void configChanged();
|
||||
|
||||
private:
|
||||
KSharedConfigPtr mKWinConfig;
|
||||
Ui::KWinCompositingConfig ui;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="useCompositing" >
|
||||
<property name="text" >
|
||||
<string>Use compositing</string>
|
||||
<string>Enable desktop effects</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
|
@ -26,20 +26,6 @@
|
|||
<item>
|
||||
<widget class="QWidget" native="1" name="compositingOptionsContainer" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Compositing type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="compositingType" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
|
@ -96,6 +82,30 @@
|
|||
</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>
|
||||
|
@ -116,22 +126,6 @@
|
|||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>useCompositing</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>compositingType</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>110</x>
|
||||
<y>21</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>324</x>
|
||||
<y>50</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useCompositing</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
|
|
Loading…
Reference in a new issue