KWinCompositing becomes a KCModule

Instead of a binary it's a library installed as a plugin. main.cpp
defines the KCModule which just loads the EffectView into a widget
container.
icc-effect-5.14.5
Martin Gräßlin 2013-12-02 09:55:21 +01:00
parent dd23f40c81
commit 7372a7f784
4 changed files with 55 additions and 23 deletions

View File

@ -68,7 +68,7 @@ set(kwincomposing_SRC
effectconfig.cpp)
add_executable(kwincompositing ${kwincomposing_SRC})
add_library(kwincompositing MODULE ${kwincomposing_SRC})
target_link_libraries(kwincompositing
Qt5::Quick
@ -107,7 +107,8 @@ target_link_libraries(effectModelTest
KF5::KDeclarative)
INSTALL(DIRECTORY qml DESTINATION ${DATA_INSTALL_DIR}/kwincompositing)
INSTALL(TARGETS kwincompositing ${INSTALL_TARGETS_DEFAULT_ARGS})
INSTALL(TARGETS kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES kwincompositing.desktop DESTINATION ${SERVICES_INSTALL_DIR})
################# list the subdirectories #################
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@ -0,0 +1,17 @@
[Desktop Entry]
Exec=kcmshell5 kwincompositing
Icon=preferences-desktop
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/kwincompositing/index.html
X-KDE-Library=kwincompositing
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=workspace-appearance-and-behavior
X-KDE-Weight=50
Name=Desktop Effects
Comment=Configure desktop effects
X-KDE-Keywords=kwin,window,manager,compositing,effect,3D effects,2D effects,OpenGL,XRender,video settings,graphical effects,desktop effects,animations,various animations,window management effects,window switching effect,desktop switching effect,animations,animation speed,desktop animations,drivers,driver settings,rendering,render,invert effect,looking glass effect,magnifier effect,snap helper effect,track mouse effect,zoom effect,blur effect,dashboard effect,explosion effect,fade effect,fade desktop effect,fall apart effect,glide effect,highlight window effect,login effect,logout effect,magic lamp effect,minimize animation effect,mouse mark effect,scale in effect,screenshot effect,sheet effect,slide effect,sliding popups effect,taskbar thumbnails effect,thumbnail aside effect,translucency,translucency effect,transparency,window geometry effect,wobbly windows effect,startup feedback effect,dialog parent effect,dim inactive effect,dim screen effect,slide back effect,eye candy,candy,show FPS effect,show paint effect,box switch effect,cover switch effect,desktop cube effect,desktop cube animation effect,desktop grid effect,flip switch effect,outline effect,present windows effect,resize window effect

View File

@ -3,6 +3,7 @@
* This file is part of the KDE project. *
* *
* Copyright (C) 2013 Antonis Tsiapaliokas <kok3rs@gmail.com> *
* Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -22,33 +23,46 @@
#include "model.h"
#include <QApplication>
#include <QLayout>
#include <kaboutdata.h>
#include <klocalizedstring.h>
#include <kcmodule.h>
#include <kservice.h>
#include <kdeclarative/kdeclarative.h>
#include <QStandardPaths>
int main(int argc, char *argv[])
class KWinCompositingKCM : public KCModule
{
KAboutData aboutData("kwincompositing", 0, i18n("KWinCompositing"),
"1.0", i18n("KWin Compositing"),
KAboutData::License_GPL,
i18n("Copyright 2013 KWin Development Team"),
"", "", "kwin@kde.org");
Q_OBJECT
public:
explicit KWinCompositingKCM(QWidget* parent = 0, const QVariantList& args = QVariantList());
virtual ~KWinCompositingKCM();
aboutData.addAuthor(i18n("Antonis Tsiapaliokas"),
i18n("Author and maintainer"),
"kok3rs@gmail.com");
QApplication app(argc, argv);
private:
QScopedPointer<KWin::Compositing::EffectView> m_view;
};
KWinCompositingKCM::KWinCompositingKCM(QWidget* parent, const QVariantList& args)
: KCModule(parent, args)
, m_view(new KWin::Compositing::EffectView)
{
KDeclarative kdeclarative;
KWin::Compositing::EffectView *view = new KWin::Compositing::EffectView();
kdeclarative.setDeclarativeEngine(view->engine());
kdeclarative.setDeclarativeEngine(m_view->engine());
kdeclarative.setupBindings();
view->show();
QVBoxLayout *vl = new QVBoxLayout(this);
return app.exec();
QWidget *w = QWidget::createWindowContainer(m_view.data(), this);
w->setMinimumSize(m_view->initialSize());
vl->addWidget(w);
setLayout(vl);
m_view->setWidth(width());
m_view->setHeight(height());
}
KWinCompositingKCM::~KWinCompositingKCM()
{
}
K_PLUGIN_FACTORY(KWinCompositingConfigFactory,
registerPlugin<KWinCompositingKCM>();
)
#include "main.moc"

View File

@ -367,7 +367,7 @@ EffectView::EffectView(QWindow *parent)
void EffectView::init()
{
QString mainFile = QStandardPaths::locate(QStandardPaths::DataLocation, "qml/main.qml", QStandardPaths::LocateFile);
QString mainFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kwincompositing/qml/main.qml", QStandardPaths::LocateFile);
setResizeMode(QQuickView::SizeRootObjectToView);
rootContext()->setContextProperty("engine", this);
setSource(QUrl(mainFile));