mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 00:34:45 +00:00
Port powermenu to declarative type registration
This commit is contained in:
parent
c9f3d5f2ae
commit
f344399ae9
6 changed files with 10 additions and 64 deletions
|
|
@ -1,16 +1,13 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
set(powermenuplugin_SRCS
|
|
||||||
powermenuplugin.cpp
|
|
||||||
powermenuutil.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(powermenuplugin ${powermenuplugin_SRCS})
|
|
||||||
|
|
||||||
find_package(LibKWorkspace)
|
find_package(LibKWorkspace)
|
||||||
|
|
||||||
target_link_libraries(powermenuplugin
|
ecm_add_qml_module(powermenuplugin URI "org.kde.plasma.quicksetting.powermenu" GENERATE_PLUGIN_SOURCE)
|
||||||
|
|
||||||
|
target_sources(powermenuplugin PRIVATE powermenuutil.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(powermenuplugin PRIVATE
|
||||||
Qt::Core
|
Qt::Core
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
|
|
@ -18,11 +15,7 @@ target_link_libraries(powermenuplugin
|
||||||
PW::KWorkspace
|
PW::KWorkspace
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(TARGET powermenuplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu)
|
ecm_finalize_qml_module(powermenuplugin)
|
||||||
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu)
|
|
||||||
|
|
||||||
install(TARGETS powermenuplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/quicksetting/powermenu)
|
|
||||||
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/quicksetting/powermenu)
|
|
||||||
|
|
||||||
plasma_install_package(package org.kde.plasma.quicksetting.powermenu quicksettings)
|
plasma_install_package(package org.kde.plasma.quicksetting.powermenu quicksettings)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.kde.plasma.quicksetting.powermenu 1.0 as PowerMenu
|
import org.kde.plasma.quicksetting.powermenu as PowerMenu
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
QS.QuickSetting {
|
QS.QuickSetting {
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "powermenuplugin.h"
|
|
||||||
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QQuickItem>
|
|
||||||
|
|
||||||
#include "powermenuutil.h"
|
|
||||||
|
|
||||||
void PowerMenuPlugin::registerTypes(const char *uri)
|
|
||||||
{
|
|
||||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.quicksetting.powermenu"));
|
|
||||||
|
|
||||||
qmlRegisterSingletonType<PowerMenuUtil>(uri, 1, 0, "PowerMenuUtil", [](QQmlEngine *, QJSEngine *) {
|
|
||||||
return new PowerMenuUtil;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//#include "moc_powermenuplugin.cpp"
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QUrl>
|
|
||||||
|
|
||||||
#include <QQmlEngine>
|
|
||||||
#include <QQmlExtensionPlugin>
|
|
||||||
|
|
||||||
class PowerMenuPlugin : public QQmlExtensionPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
|
||||||
|
|
||||||
public:
|
|
||||||
void registerTypes(const char *uri) override;
|
|
||||||
};
|
|
||||||
|
|
@ -7,10 +7,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <qqmlregistration.h>
|
||||||
|
|
||||||
class PowerMenuUtil : public QObject
|
class PowerMenuUtil : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PowerMenuUtil(QObject *parent = nullptr);
|
PowerMenuUtil(QObject *parent = nullptr);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
module org.kde.plasma.quicksetting.powermenu
|
|
||||||
plugin powermenuplugin
|
|
||||||
classname PowerMenuPlugin
|
|
||||||
Loading…
Reference in a new issue