Add GHNS support for Scripted KWin Effects

BUG: 296773
FIXED-IN: 4.10
REVIEW: 107051
This commit is contained in:
Martin Gräßlin 2012-10-26 13:08:00 +02:00
parent 2cb8e724d4
commit 6417246358
5 changed files with 62 additions and 13 deletions

View file

@ -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} )

View file

@ -0,0 +1,5 @@
[KNewStuff3]
Categories=KWin Effects
StandardResource=tmp
InstallationCommand=plasmapkg -t kwineffect -i %f
UninstallCommand=plasmapkg -t kwineffect -r %f

View file

@ -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"

View file

@ -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;

View file

@ -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>