[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin-compositing-kcm] /: Add Get-Hot-New-Stuff support
From:       Antonis Tsiapaliokas <kok3rs () gmail ! com>
Date:       2014-03-07 11:03:58
Message-ID: E1WLsZK-000680-2E () scm ! kde ! org
[Download RAW message or body]

Git commit fb12acb1da6b1a017f73c0a03f077b1848451541 by Antonis Tsiapaliokas.
Committed on 12/01/2014 at 19:27.
Pushed by tsiapaliokas into branch 'master'.

Add Get-Hot-New-Stuff support

REVIEW: 114477

M  +4    -1    CMakeLists.txt
M  +14   -0    effectconfig.cpp
M  +4    -0    effectconfig.h
A  +6    -0    kwineffect.knsrc
M  +1    -1    model.h
M  +0    -4    qml/Effect.qml
M  +20   -3    qml/EffectView.qml

http://commits.kde.org/kwin-compositing-kcm/fb12acb1da6b1a017f73c0a03f077b1848451541

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90d27a0..d70672f 100644
--- a/CMakeLists.txt
+++ b/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/effectconfig.cpp b/effectconfig.cpp
index 1eb2dcd..3660cb8 100644
--- a/effectconfig.cpp
+++ b/effectconfig.cpp
@@ -24,9 +24,12 @@
 #include <KPluginInfo>
 #include <KServiceTypeTrader>
 
+#include <KNS3/DownloadDialog>
+
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QVBoxLayout>
+#include <QPointer>
 #include <QStandardPaths>
 #include <QString>
 
@@ -81,5 +84,16 @@ void EffectConfig::openConfig(const QString &effectName)
         }
     }
 }
+
+void EffectConfig::openGHNS()
+{
+    QPointer<KNS3::DownloadDialog> 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/effectconfig.h b/effectconfig.h
index 531cf27..8478d91 100644
--- a/effectconfig.h
+++ b/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/kwineffect.knsrc b/kwineffect.knsrc
new file mode 100644
index 0000000..be71220
--- /dev/null
+++ b/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/model.h b/model.h
index c047677..2efa2a9 100644
--- a/model.h
+++ b/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/qml/Effect.qml b/qml/Effect.qml
index 32a9e67..62ec89c 100644
--- a/qml/Effect.qml
+++ b/qml/Effect.qml
@@ -211,10 +211,6 @@ Item {
                 }
             }
 
-            EffectConfig {
-                id: effectConfig
-            }
-
         } //end Row
     } //end Rectangle
 } //end item
diff --git a/qml/EffectView.qml b/qml/EffectView.qml
index 1c9d3a6..c1a66df 100644
--- a/qml/EffectView.qml
+++ b/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)
         }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic