mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Port record to declarative type registration
This commit is contained in:
parent
f344399ae9
commit
1a89b84917
6 changed files with 8 additions and 62 deletions
|
|
@ -1,14 +1,11 @@
|
|||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(recordplugin_SRCS
|
||||
recordplugin.cpp
|
||||
recordutil.cpp
|
||||
)
|
||||
ecm_add_qml_module(recordplugin URI "org.kde.plasma.quicksetting.record" GENERATE_PLUGIN_SOURCE)
|
||||
|
||||
add_library(recordplugin ${recordplugin_SRCS})
|
||||
target_sources(recordplugin PRIVATE recordutil.cpp)
|
||||
|
||||
target_link_libraries(recordplugin
|
||||
target_link_libraries(recordplugin PRIVATE
|
||||
Qt::Core
|
||||
Qt::DBus
|
||||
Qt::Qml
|
||||
|
|
@ -20,11 +17,8 @@ target_link_libraries(recordplugin
|
|||
KF6::Notifications
|
||||
)
|
||||
|
||||
set_property(TARGET recordplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/record)
|
||||
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/record)
|
||||
ecm_finalize_qml_module(recordplugin)
|
||||
|
||||
install(TARGETS recordplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/quicksetting/record)
|
||||
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/quicksetting/record)
|
||||
install(FILES plasma_mobile_quicksetting_record.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
|
||||
|
||||
plasma_install_package(package org.kde.plasma.quicksetting.record quicksettings)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import QtQuick.Window 2.15
|
|||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||
import org.kde.pipewire.record 0.1 as PWRec
|
||||
import org.kde.taskmanager 0.1 as TaskManager
|
||||
import org.kde.plasma.quicksetting.record 1.0
|
||||
import org.kde.plasma.quicksetting.record
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
QS.QuickSetting {
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
module org.kde.plasma.quicksetting.record
|
||||
plugin recordplugin
|
||||
classname RecordPlugin
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 by Devin Lin <devin@kde.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "recordplugin.h"
|
||||
|
||||
#include <QQmlContext>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "recordutil.h"
|
||||
|
||||
void RecordPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.quicksetting.record"));
|
||||
|
||||
qmlRegisterSingletonType<RecordUtil>(uri, 1, 0, "RecordUtil", [](QQmlEngine *, QJSEngine *) {
|
||||
return new RecordUtil;
|
||||
});
|
||||
}
|
||||
|
||||
//#include "moc_screenshotplugin.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 RecordPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
|
@ -8,10 +8,13 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
#include <qqmlregistration.h>
|
||||
|
||||
class RecordUtil : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
public:
|
||||
RecordUtil(QObject *parent = nullptr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue