From f590506818100362614209e238d823c8cfdd6603 Mon Sep 17 00:00:00 2001 From: Antonis Tsiapaliokas Date: Sun, 12 Jan 2014 21:27:10 +0200 Subject: [PATCH] Add Get-Hot-New-Stuff support REVIEW: 114477 --- kcmkwin/kwincompositing/CMakeLists.txt | 5 ++++- kcmkwin/kwincompositing/effectconfig.cpp | 14 +++++++++++++ kcmkwin/kwincompositing/effectconfig.h | 4 ++++ kcmkwin/kwincompositing/kwineffect.knsrc | 6 ++++++ kcmkwin/kwincompositing/model.h | 2 +- kcmkwin/kwincompositing/qml/Effect.qml | 4 ---- kcmkwin/kwincompositing/qml/EffectView.qml | 23 +++++++++++++++++++--- 7 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 kcmkwin/kwincompositing/kwineffect.knsrc diff --git a/kcmkwin/kwincompositing/CMakeLists.txt b/kcmkwin/kwincompositing/CMakeLists.txt index 90d27a02f6..d70672f393 100644 --- a/kcmkwin/kwincompositing/CMakeLists.txt +++ b/kcmkwin/kwincompositing/CMakeLists.txt @@ -48,7 +48,7 @@ set (QT_MIN_VERSION "5.2.0") # Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs: -find_package(KF5 CONFIG REQUIRED COMPONENTS CoreAddons Config I18n Service XmlGui KCMUtils) +find_package(KF5 CONFIG REQUIRED COMPONENTS CoreAddons Config I18n Service XmlGui KCMUtils NewStuff) find_package(KF5Declarative REQUIRED NO_MODULE) @@ -87,6 +87,7 @@ target_link_libraries(kwincompositing KF5::I18n KF5::Service KF5::KCMUtils + KF5::NewStuff KF5::Declarative ) @@ -111,11 +112,13 @@ target_link_libraries(effectModelTest KF5::I18n KF5::Service KF5::KCMUtils + KF5::NewStuff KF5::Declarative) INSTALL(DIRECTORY qml DESTINATION ${DATA_INSTALL_DIR}/kwincompositing) INSTALL(TARGETS kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES kwincompositing.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES kwineffect.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) ################# list the subdirectories ################# feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/kcmkwin/kwincompositing/effectconfig.cpp b/kcmkwin/kwincompositing/effectconfig.cpp index 1eb2dcd4a3..3660cb80b3 100644 --- a/kcmkwin/kwincompositing/effectconfig.cpp +++ b/kcmkwin/kwincompositing/effectconfig.cpp @@ -24,9 +24,12 @@ #include #include +#include + #include #include #include +#include #include #include @@ -81,5 +84,16 @@ void EffectConfig::openConfig(const QString &effectName) } } } + +void EffectConfig::openGHNS() +{ + QPointer downloadDialog = new KNS3::DownloadDialog(QStringLiteral("kwineffect.knsrc")); + if (downloadDialog->exec() == QDialog::Accepted) { + emit effectListChanged(); + } + + delete downloadDialog; +} + }//end namespace Compositing }//end namespace KWin diff --git a/kcmkwin/kwincompositing/effectconfig.h b/kcmkwin/kwincompositing/effectconfig.h index 531cf27717..8478d911a6 100644 --- a/kcmkwin/kwincompositing/effectconfig.h +++ b/kcmkwin/kwincompositing/effectconfig.h @@ -38,6 +38,10 @@ public: Q_INVOKABLE bool effectUiConfigExists(const QString &effectName); Q_INVOKABLE void openConfig(const QString &effectName); + Q_INVOKABLE void openGHNS(); + +Q_SIGNALS: + void effectListChanged(); }; }//end namespace Compositing }//end namespace KWin diff --git a/kcmkwin/kwincompositing/kwineffect.knsrc b/kcmkwin/kwincompositing/kwineffect.knsrc new file mode 100644 index 0000000000..be712200ec --- /dev/null +++ b/kcmkwin/kwincompositing/kwineffect.knsrc @@ -0,0 +1,6 @@ +[KNewStuff3] +ProvidersUrl=http://download.kde.org/ocs/providers.xml +Categories=KWin Effects +StandardResource=tmp +InstallationCommand=plasmapkg -t kwineffect -i %f +UninstallCommand=plasmapkg -t kwineffect -r %f diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index c047677fed..2efa2a9df6 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -131,12 +131,12 @@ public: Q_INVOKABLE void updateEffectStatus(int rowIndex, bool effectState); Q_INVOKABLE void syncConfig(); Q_INVOKABLE void enableWidnowManagement(bool enabled); + Q_INVOKABLE void load(); QColor backgroundActiveColor() { return KColorScheme(QPalette::Active, KColorScheme::Selection, KSharedConfigPtr(0)).background(KColorScheme::LinkBackground).color(); }; QColor backgroundNormalColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); }; QColor backgroundAlternateColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::AlternateBackground).color(); }; - void load(); void defaults(); public Q_SLOTS: diff --git a/kcmkwin/kwincompositing/qml/Effect.qml b/kcmkwin/kwincompositing/qml/Effect.qml index 32a9e67815..62ec89c83b 100644 --- a/kcmkwin/kwincompositing/qml/Effect.qml +++ b/kcmkwin/kwincompositing/qml/Effect.qml @@ -211,10 +211,6 @@ Item { } } - EffectConfig { - id: effectConfig - } - } //end Row } //end Rectangle } //end item diff --git a/kcmkwin/kwincompositing/qml/EffectView.qml b/kcmkwin/kwincompositing/qml/EffectView.qml index 1c9d3a6d29..c1a66dfa41 100644 --- a/kcmkwin/kwincompositing/qml/EffectView.qml +++ b/kcmkwin/kwincompositing/qml/EffectView.qml @@ -56,19 +56,37 @@ Item { id: compositingType } + EffectConfig { + id: effectConfig + onEffectListChanged: { + searchModel.load() + } + } + RowLayout { id: row width: parent.width height: parent.height + Button { + id: ghnsButton + text: i18n("Get New Effects ...") + iconName: "get-hot-new-stuff" + anchors { + left: col.right + top: parent.top + topMargin: col.height/8 + } + onClicked: effectConfig.openGHNS() + } + CheckBox { id: useCompositing text: i18n("Enable desktop effects on startup") checked: compositing.compositingEnabled anchors { - top: parent.top + top: ghnsButton.bottom left: col.right - topMargin: col.height/8 } Connections { target: compositing @@ -84,7 +102,6 @@ Item { checked: false anchors.left: col.right anchors.top: useCompositing.bottom - //anchors.topMargin: col.height/8 onClicked: searchModel.enableWidnowManagement(windowManagement.checked) }