Move WidgetExplorer to be a private QML plugin
Instead of registering WidgetExplorer inside the shell, create a new qml plugin in the org.kde.plasma.private namespace. This is useful for running widgetexplorer in qmlscene. This makes testing, debugging and profiling considerably easier. REVIEW: 114914
This commit is contained in:
parent
3b7fe5f2e6
commit
3e599d30b4
@ -33,12 +33,6 @@ set(scripting_SRC
|
|||||||
scripting/widget.cpp
|
scripting/widget.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(widgetexplorer_SRC
|
|
||||||
widgetexplorer/kcategorizeditemsviewmodels.cpp
|
|
||||||
widgetexplorer/plasmaappletitemmodel.cpp
|
|
||||||
widgetexplorer/widgetexplorer.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(plasma-shell
|
add_executable(plasma-shell
|
||||||
activity.cpp
|
activity.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -54,7 +48,6 @@ add_executable(plasma-shell
|
|||||||
shellpluginloader.cpp
|
shellpluginloader.cpp
|
||||||
shellmanager.cpp
|
shellmanager.cpp
|
||||||
${scripting_SRC}
|
${scripting_SRC}
|
||||||
${widgetexplorer_SRC}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
|
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
|
||||||
@ -85,3 +78,5 @@ endif()
|
|||||||
|
|
||||||
install(TARGETS plasma-shell ${INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS plasma-shell ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
install(FILES plasma-shell.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
|
install(FILES plasma-shell.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
|
||||||
|
|
||||||
|
add_subdirectory(widgetexplorer)
|
||||||
|
@ -97,9 +97,6 @@ ShellCorona::ShellCorona(QObject *parent)
|
|||||||
{
|
{
|
||||||
d->desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
|
d->desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
|
||||||
|
|
||||||
qmlRegisterType<WidgetExplorer>("org.kde.plasma.private.shell", 2, 0, "WidgetExplorer");
|
|
||||||
qmlRegisterType<Plasma::Containment>();
|
|
||||||
|
|
||||||
connect(&d->appConfigSyncTimer, &QTimer::timeout,
|
connect(&d->appConfigSyncTimer, &QTimer::timeout,
|
||||||
this, &ShellCorona::syncAppConfig);
|
this, &ShellCorona::syncAppConfig);
|
||||||
|
|
||||||
|
27
src/shell/widgetexplorer/CMakeLists.txt
Normal file
27
src/shell/widgetexplorer/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
project(plasmawidgetexplorerplugin)
|
||||||
|
|
||||||
|
set(widgetexplorer_SRC
|
||||||
|
kcategorizeditemsviewmodels.cpp
|
||||||
|
plasmaappletitemmodel.cpp
|
||||||
|
widgetexplorer.cpp
|
||||||
|
widgetexplorerplugin.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(plasmawidgetexplorerplugin SHARED ${widgetexplorer_SRC})
|
||||||
|
target_link_libraries(plasmawidgetexplorerplugin
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Quick
|
||||||
|
Qt5::Qml
|
||||||
|
Qt5::Gui
|
||||||
|
Qt5::Widgets
|
||||||
|
Qt5::Quick
|
||||||
|
Qt5::Qml
|
||||||
|
KF5::Plasma
|
||||||
|
KF5::PlasmaQuick
|
||||||
|
KF5::I18n
|
||||||
|
KF5::Service
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS plasmawidgetexplorerplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell)
|
||||||
|
|
||||||
|
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/shell)
|
2
src/shell/widgetexplorer/qmldir
Normal file
2
src/shell/widgetexplorer/qmldir
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
module org.kde.plasma.private.shell
|
||||||
|
plugin plasmawidgetexplorerplugin
|
36
src/shell/widgetexplorer/widgetexplorerplugin.cpp
Normal file
36
src/shell/widgetexplorer/widgetexplorerplugin.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 by David Edmundson <davidedmundson@kde.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "widgetexplorerplugin.h"
|
||||||
|
|
||||||
|
#include <QtQml>
|
||||||
|
|
||||||
|
#include "widgetexplorer.h"
|
||||||
|
#include <plasma/containment.h>
|
||||||
|
|
||||||
|
void WidgetExplorerPlugin::registerTypes(const char *uri)
|
||||||
|
{
|
||||||
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.shell"));
|
||||||
|
|
||||||
|
qmlRegisterType<Plasma::Containment>();
|
||||||
|
qmlRegisterType<WidgetExplorer>(uri, 2, 0, "WidgetExplorer");
|
||||||
|
}
|
37
src/shell/widgetexplorer/widgetexplorerplugin.h
Normal file
37
src/shell/widgetexplorer/widgetexplorerplugin.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 by David Edmundson <davidedmundson@kde.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WIDGETEXPLORERPLUGIN_H
|
||||||
|
#define WIDGETEXPLORERPLUGIN_H
|
||||||
|
|
||||||
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
class WidgetExplorerPlugin : public QQmlExtensionPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||||
|
|
||||||
|
public:
|
||||||
|
void registerTypes(const char *uri);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user