aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2012-10-26 11:08:00 (GMT)
committerMartin Gräßlin <mgraesslin@kde.org>2012-10-28 08:49:02 (GMT)
commitf7539c1c3082de8c1de0c8d4149fdbdb560dc182 (patch)
tree33c52379f5ba87583198a7dfa3d5b20c66f8ca44
parent09af8f0c7fd32a54199c3bd258d2e7694317f6d7 (diff)
Add GHNS support for Scripted KWin Effects
BUG: 296773 FIXED-IN: 4.10 REVIEW: 107051
-rw-r--r--kwin/kcmkwin/kwincompositing/CMakeLists.txt3
-rw-r--r--kwin/kcmkwin/kwincompositing/kwineffect.knsrc5
-rw-r--r--kwin/kcmkwin/kwincompositing/main.cpp14
-rw-r--r--kwin/kcmkwin/kwincompositing/main.h1
-rw-r--r--kwin/kcmkwin/kwincompositing/main.ui52
5 files changed, 62 insertions, 13 deletions
diff --git a/kwin/kcmkwin/kwincompositing/CMakeLists.txt b/kwin/kcmkwin/kwincompositing/CMakeLists.txt
index 17fcbb4..c3cfa68 100644
--- a/kwin/kcmkwin/kwincompositing/CMakeLists.txt
+++ b/kwin/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/kwin/kcmkwin/kwincompositing/kwineffect.knsrc b/kwin/kcmkwin/kwincompositing/kwineffect.knsrc
new file mode 100644
index 0000000..e2d65ee
--- /dev/null
+++ b/kwin/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/kwin/kcmkwin/kwincompositing/main.cpp b/kwin/kcmkwin/kwincompositing/main.cpp
index 7a89db4..fdf934b 100644
--- a/kwin/kcmkwin/kwincompositing/main.cpp
+++ b/kwin/kcmkwin/kwincompositing/main.cpp
@@ -37,6 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kservice.h>
#include <ktitlewidget.h>
#include <knotification.h>
+#include <KNS3/DownloadDialog>
#include <QtDBus/QtDBus>
#include <QPainter>
@@ -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("<h1>Desktop Effects</h1>");
}
+void KWinCompositingConfig::slotGHNS()
+{
+ QPointer<KNS3::DownloadDialog> 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/kwin/kcmkwin/kwincompositing/main.h b/kwin/kcmkwin/kwincompositing/main.h
index 706e6e3..35079c3 100644
--- a/kwin/kcmkwin/kwincompositing/main.h
+++ b/kwin/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/kwin/kcmkwin/kwincompositing/main.ui b/kwin/kcmkwin/kwincompositing/main.ui
index cff0f63..339efde 100644
--- a/kwin/kcmkwin/kwincompositing/main.ui
+++ b/kwin/kcmkwin/kwincompositing/main.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>557</width>
+ <width>583</width>
<height>530</height>
</rect>
</property>
@@ -451,17 +451,45 @@
</widget>
</item>
<item>
- <widget class="KPluginSelector" name="effectSelector" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="focusPolicy">
- <enum>Qt::WheelFocus</enum>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="KPluginSelector" name="effectSelector" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::WheelFocus</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="QPushButton" name="ghns">
+ <property name="text">
+ <string>Get New Effect</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
</layout>
</widget>