Add KControl config module for effects.
ATM you can toggle them on/off, but KWin part isn't done yet, so KWin doesn't care about your changes yet. You can try it with 'kcmshell kwineffects' svn path=/trunk/KDE/kdebase/workspace/; revision=668251
This commit is contained in:
parent
19520d39b5
commit
63b58f6147
6 changed files with 204 additions and 0 deletions
|
@ -2,4 +2,5 @@
|
||||||
add_subdirectory( kwinoptions )
|
add_subdirectory( kwinoptions )
|
||||||
add_subdirectory( kwindecoration )
|
add_subdirectory( kwindecoration )
|
||||||
add_subdirectory( kwinrules )
|
add_subdirectory( kwinrules )
|
||||||
|
add_subdirectory( kwineffects )
|
||||||
|
|
||||||
|
|
17
kcmkwin/kwineffects/CMakeLists.txt
Normal file
17
kcmkwin/kwineffects/CMakeLists.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
include_directories( ${CMAKE_SOURCE_DIR}/workspace/kwin/lib )
|
||||||
|
|
||||||
|
|
||||||
|
########### next target ###############
|
||||||
|
|
||||||
|
set(kcm_kwineffects_PART_SRCS main.cpp )
|
||||||
|
kde4_automoc(${kcm_kwineffects_PART_SRCS})
|
||||||
|
kde4_add_plugin(kcm_kwineffects ${kcm_kwineffects_PART_SRCS})
|
||||||
|
target_link_libraries(kcm_kwineffects ${KDE4_KDEUI_LIBS} ${KDE4_KUTILS_LIBS})
|
||||||
|
install(TARGETS kcm_kwineffects DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||||
|
|
||||||
|
|
||||||
|
########### install files ###############
|
||||||
|
|
||||||
|
install( FILES kwineffects.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
||||||
|
|
||||||
|
|
2
kcmkwin/kwineffects/Messages.sh
Normal file
2
kcmkwin/kwineffects/Messages.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
$XGETTEXT *.cpp -o $podir/kcmkwineffects.pot
|
17
kcmkwin/kwineffects/kwineffects.desktop
Normal file
17
kcmkwin/kwineffects/kwineffects.desktop
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Exec=kcmshell kwineffects
|
||||||
|
Icon=kcmeffects
|
||||||
|
Type=Service
|
||||||
|
ServiceTypes=KCModule
|
||||||
|
DocPath=kcontrol/kwineffects/index.html
|
||||||
|
|
||||||
|
X-KDE-Library=kcm_kwineffects
|
||||||
|
X-KDE-FactoryName=kcm_kwineffects
|
||||||
|
X-KDE-ParentApp=kcontrol
|
||||||
|
|
||||||
|
Name=Window Effects
|
||||||
|
|
||||||
|
Comment=Configure window effects
|
||||||
|
|
||||||
|
Keywords=kwin,window,manager,effect
|
114
kcmkwin/kwineffects/main.cpp
Normal file
114
kcmkwin/kwineffects/main.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/*****************************************************************
|
||||||
|
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 "main.h"
|
||||||
|
|
||||||
|
#include <kgenericfactory.h>
|
||||||
|
#include <kaboutdata.h>
|
||||||
|
#include <kstandarddirs.h>
|
||||||
|
#include <kconfig.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
#include <kpluginselector.h>
|
||||||
|
#include <kservicetypetrader.h>
|
||||||
|
#include <kplugininfo.h>
|
||||||
|
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
#include <QBoxLayout>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef KGenericFactory<KWin::KWinEffectsConfig> KWinEffectsConfigFactory;
|
||||||
|
K_EXPORT_COMPONENT_FACTORY( kcm_kwineffects, KWinEffectsConfigFactory("kcmkwineffects"))
|
||||||
|
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
KWinEffectsConfig::KWinEffectsConfig(QWidget *parent, const QStringList &)
|
||||||
|
: KCModule( KWinEffectsConfigFactory::componentData(), parent),
|
||||||
|
mKWinConfig(KSharedConfig::openConfig("kwinrc"))
|
||||||
|
{
|
||||||
|
mPluginSelector = new KPluginSelector(this);
|
||||||
|
QHBoxLayout* layout = new QHBoxLayout;
|
||||||
|
layout->addWidget(mPluginSelector);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
connect(mPluginSelector, SIGNAL(changed(bool)), this, SLOT(changed()));
|
||||||
|
|
||||||
|
// Find all .desktop files of the effects
|
||||||
|
QStringList desktopFiles = KGlobal::dirs()->findAllResources("data", "kwin/effects/*.desktop");
|
||||||
|
QList<KPluginInfo*> effectinfos = KPluginInfo::fromFiles(desktopFiles);
|
||||||
|
|
||||||
|
// Add them to the plugin selector
|
||||||
|
mPluginSelector->addPlugins(effectinfos, i18n("Appearance"), "Appearance", mKWinConfig);
|
||||||
|
mPluginSelector->addPlugins(effectinfos, i18n("Window Management"), "Window Management", mKWinConfig);
|
||||||
|
mPluginSelector->addPlugins(effectinfos, i18n("Demos"), "Demos", mKWinConfig);
|
||||||
|
mPluginSelector->addPlugins(effectinfos, i18n("Tests"), "Tests", mKWinConfig);
|
||||||
|
mPluginSelector->addPlugins(effectinfos, i18n("Misc"), "Misc", mKWinConfig);
|
||||||
|
|
||||||
|
// Load config
|
||||||
|
load();
|
||||||
|
|
||||||
|
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwineffects"),
|
||||||
|
I18N_NOOP("Window Effects Configuration Module"),
|
||||||
|
0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 2007 Rivo Laks"));
|
||||||
|
about->addAuthor("Rivo Laks", 0, "rivolaks@hot.ee");
|
||||||
|
setAboutData(about);
|
||||||
|
}
|
||||||
|
|
||||||
|
KWinEffectsConfig::~KWinEffectsConfig()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void KWinEffectsConfig::load()
|
||||||
|
{
|
||||||
|
kDebug() << k_funcinfo << endl;
|
||||||
|
mKWinConfig->reparseConfiguration();
|
||||||
|
|
||||||
|
mPluginSelector->load();
|
||||||
|
|
||||||
|
emit changed( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KWinEffectsConfig::save()
|
||||||
|
{
|
||||||
|
kDebug() << k_funcinfo << endl;
|
||||||
|
|
||||||
|
mPluginSelector->save();
|
||||||
|
|
||||||
|
emit changed( false );
|
||||||
|
|
||||||
|
// Send signal to kwin
|
||||||
|
mKWinConfig->sync();
|
||||||
|
// Send signal to all kwin instances
|
||||||
|
QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||||
|
QDBusConnection::sessionBus().send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KWinEffectsConfig::defaults()
|
||||||
|
{
|
||||||
|
kDebug() << k_funcinfo << endl;
|
||||||
|
mPluginSelector->defaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString KWinEffectsConfig::quickHelp() const
|
||||||
|
{
|
||||||
|
kDebug() << k_funcinfo << endl;
|
||||||
|
return i18n("<h1>Window Effects</h1> Here you can configure which effects will be used.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#include "main.moc"
|
53
kcmkwin/kwineffects/main.h
Normal file
53
kcmkwin/kwineffects/main.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*****************************************************************
|
||||||
|
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 __MAIN_H__
|
||||||
|
#define __MAIN_H__
|
||||||
|
|
||||||
|
#include <kcmodule.h>
|
||||||
|
|
||||||
|
#include <ksharedconfig.h>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QSet>
|
||||||
|
|
||||||
|
class KListWidget;
|
||||||
|
class QListWidgetItem;
|
||||||
|
class KPluginSelector;
|
||||||
|
class QLabel;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
class KWinEffectsConfig : public KCModule
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
KWinEffectsConfig(QWidget *parent, const QStringList &args);
|
||||||
|
virtual ~KWinEffectsConfig();
|
||||||
|
|
||||||
|
virtual QString quickHelp() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void load();
|
||||||
|
virtual void save();
|
||||||
|
virtual void defaults();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
KSharedConfigPtr mKWinConfig;
|
||||||
|
KPluginSelector* mPluginSelector;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue