From 64172463584f30a63902edf6aa5f645e8d028839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 26 Oct 2012 13:08:00 +0200 Subject: [PATCH] Add GHNS support for Scripted KWin Effects BUG: 296773 FIXED-IN: 4.10 REVIEW: 107051 --- kcmkwin/kwincompositing/CMakeLists.txt | 3 +- kcmkwin/kwincompositing/kwineffect.knsrc | 5 +++ kcmkwin/kwincompositing/main.cpp | 14 +++++++ kcmkwin/kwincompositing/main.h | 1 + kcmkwin/kwincompositing/main.ui | 52 ++++++++++++++++++------ 5 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 kcmkwin/kwincompositing/kwineffect.knsrc diff --git a/kcmkwin/kwincompositing/CMakeLists.txt b/kcmkwin/kwincompositing/CMakeLists.txt index 17fcbb4976..c3cfa68bc3 100644 --- a/kcmkwin/kwincompositing/CMakeLists.txt +++ b/kcmkwin/kwincompositing/CMakeLists.txt @@ -11,12 +11,13 @@ set(kwin_xml ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/org.kde.KWin.xml) set_source_files_properties(${kwin_xml} PROPERTIES INCLUDE "interface_util.h") QT4_ADD_DBUS_INTERFACE(kcm_kwincompositing_PART_SRCS ${kwin_xml} kwin_interface) kde4_add_plugin(kcm_kwincompositing ${kcm_kwincompositing_PART_SRCS}) -target_link_libraries(kcm_kwincompositing ${KDE4_KCMUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES}) +target_link_libraries(kcm_kwincompositing ${KDE4_KNEWSTUFF3_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES}) install(TARGETS kcm_kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR} ) ########### install files ############### install( FILES kwincompositing.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install( FILES kwineffect.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) diff --git a/kcmkwin/kwincompositing/kwineffect.knsrc b/kcmkwin/kwincompositing/kwineffect.knsrc new file mode 100644 index 0000000000..e2d65eed5c --- /dev/null +++ b/kcmkwin/kwincompositing/kwineffect.knsrc @@ -0,0 +1,5 @@ +[KNewStuff3] +Categories=KWin Effects +StandardResource=tmp +InstallationCommand=plasmapkg -t kwineffect -i %f +UninstallCommand=plasmapkg -t kwineffect -r %f diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 7a89db49fa..fdf934b273 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -37,6 +37,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -91,6 +92,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList ui.messageBox->setVisible(false); ui.messageBox->addAction(m_showDetailedErrors); ui.messageBox->setMessageType(KMessageWidget::Warning); + ui.ghns->setIcon(KIcon("get-hot-new-stuff")); // For future use (void) I18N_NOOP("Use GLSL shaders"); @@ -129,6 +131,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glShaders, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(m_showDetailedErrors, SIGNAL(triggered(bool)), SLOT(showDetailedEffectLoadingInformation())); + connect(ui.ghns, SIGNAL(clicked(bool)), SLOT(slotGHNS())); // Open the temporary config file // Temporary conf file is used to synchronize effect checkboxes with effect @@ -759,6 +762,17 @@ QString KWinCompositingConfig::quickHelp() const return i18n("

Desktop Effects

"); } +void KWinCompositingConfig::slotGHNS() +{ + QPointer downloadDialog = new KNS3::DownloadDialog("kwineffect.knsrc", this); + if (downloadDialog->exec() == KDialog::Accepted) { + if (!downloadDialog->changedEntries().isEmpty()) { + initEffectSelector(); + } + } + delete downloadDialog; +} + } // namespace #include "main.moc" diff --git a/kcmkwin/kwincompositing/main.h b/kcmkwin/kwincompositing/main.h index 706e6e34d2..35079c39a4 100644 --- a/kcmkwin/kwincompositing/main.h +++ b/kcmkwin/kwincompositing/main.h @@ -82,6 +82,7 @@ private slots: void toggleEffectShortcutChanged(const QKeySequence &seq); void updateStatusUI(bool compositingIsPossible); void showDetailedEffectLoadingInformation(); + void slotGHNS(); private: bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const; diff --git a/kcmkwin/kwincompositing/main.ui b/kcmkwin/kwincompositing/main.ui index cff0f63b16..339efde78e 100644 --- a/kcmkwin/kwincompositing/main.ui +++ b/kcmkwin/kwincompositing/main.ui @@ -6,7 +6,7 @@ 0 0 - 557 + 583 530 @@ -451,17 +451,45 @@ - - - - 0 - 0 - - - - Qt::WheelFocus - - + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + + Get New Effect + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + +