Port mobileshell plugins to ecm_add_qml_module

This commit is contained in:
Yari Polla 2023-11-02 11:08:17 +00:00
parent 281586b164
commit 4f45654af6
111 changed files with 195 additions and 639 deletions

View file

@ -1,14 +1,14 @@
# SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de> # SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
add_library(ppc-mmqmlplugin) ecm_add_qml_module(ppc-mmqmlplugin URI org.kde.plasma.mm GENERATE_PLUGIN_SOURCE)
target_sources(ppc-mmqmlplugin PRIVATE target_sources(ppc-mmqmlplugin PRIVATE
mmqmlplugin.cpp
signalindicator.cpp signalindicator.cpp
profilesettings.cpp profilesettings.cpp
) )
target_link_libraries(ppc-mmqmlplugin
target_link_libraries(ppc-mmqmlplugin PRIVATE
Qt::Qml Qt::Qml
KF6::ModemManagerQt KF6::ModemManagerQt
KF6::NetworkManagerQt KF6::NetworkManagerQt
@ -16,8 +16,5 @@ target_link_libraries(ppc-mmqmlplugin
KF6::I18n KF6::I18n
) )
set_property(TARGET ppc-mmqmlplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/mm)
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/mm)
install(TARGETS ppc-mmqmlplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/mm) ecm_finalize_qml_module(ppc-mmqmlplugin)
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/mm)

View file

@ -1,16 +0,0 @@
// SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "mmqmlplugin.h"
#include <QQmlContext>
#include <QQmlEngine>
#include "signalindicator.h"
void MmQmlPlugin::registerTypes(const char *)
{
qmlRegisterSingletonType<SignalIndicator>("org.kde.plasma.mm", 1, 0, "SignalIndicator", [](QQmlEngine *, QJSEngine *) -> QObject * {
return new SignalIndicator();
});
}

View file

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QQmlExtensionPlugin>
class MmQmlPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
void registerTypes(const char *uri) override;
};

View file

@ -1,6 +0,0 @@
# SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.mm
plugin ppc-mmqmlplugin
classname MmQmlPlugin

View file

@ -11,6 +11,7 @@
#include <NetworkManagerQt/ModemDevice> #include <NetworkManagerQt/ModemDevice>
#include <QObject> #include <QObject>
#include <qqmlregistration.h>
#include "profilesettings.h" #include "profilesettings.h"
@ -18,6 +19,8 @@
class SignalIndicator : public QObject class SignalIndicator : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(int strength READ strength NOTIFY strengthChanged) Q_PROPERTY(int strength READ strength NOTIFY strengthChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged)

View file

@ -1,19 +1,36 @@
# SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org> # SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..) ecm_add_qml_module(mobileshellplugin URI org.kde.plasma.private.mobileshell GENERATE_PLUGIN_SOURCE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(mobileshellplugin_SRCS set(mobileshellplugin_SRCS
mobileshellplugin.cpp
shellutil.cpp shellutil.cpp
components/direction.cpp components/direction.cpp
components/direction.h
components/swipearea.cpp components/swipearea.cpp
notifications/notificationthumbnailer.cpp notifications/notificationthumbnailer.cpp
notifications/notificationfilemenu.cpp notifications/notificationfilemenu.cpp
) )
qt_add_resources(RESOURCES resources.qrc) target_include_directories(mobileshellplugin PRIVATE components)
add_library(mobileshellplugin SHARED ${mobileshellplugin_SRCS} ${RESOURCES}) target_include_directories(mobileshellplugin PRIVATE notifications)
target_sources(mobileshellplugin PRIVATE ${mobileshellplugin_SRCS})
# Singleton declarations
set_source_files_properties(qml/components/AppLaunch.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/components/Constants.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/dataproviders/AudioInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/dataproviders/BatteryInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/dataproviders/BluetoothInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/dataproviders/SignalStrengthInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
set_source_files_properties(qml/volumeosd/VolumeOSDProviderLoader.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
# Include qml and js files within ./qml/
file(GLOB_RECURSE _qml_sources
"qml/*.qml"
"qml/*.js"
)
ecm_target_qml_sources(mobileshellplugin SOURCES ${_qml_sources})
target_link_libraries(mobileshellplugin target_link_libraries(mobileshellplugin
PUBLIC PUBLIC
@ -36,8 +53,4 @@ target_link_libraries(mobileshellplugin
KF6::Package KF6::Package
) )
# we compiled the qml files, just install qmldir ecm_finalize_qml_module(mobileshellplugin)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
ecm_generate_qmltypes(org.kde.plasma.private.mobileshell 1.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
install(TARGETS mobileshellplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)

View file

@ -7,10 +7,12 @@
#pragma once #pragma once
#include <QObject> #include <QObject>
#include <qqmlregistration.h>
class Direction : public QObject class Direction : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
public: public:
enum Type { None = 0, Up, Down, Left, Right }; enum Type { None = 0, Up, Down, Left, Right };

View file

@ -22,13 +22,12 @@
class SwipeArea : public QQuickItem class SwipeArea : public QQuickItem
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
Q_PROPERTY(SwipeArea::Mode mode READ mode WRITE setMode NOTIFY modeChanged) Q_PROPERTY(SwipeArea::Mode mode READ mode WRITE setMode NOTIFY modeChanged)
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged) Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool moving READ moving NOTIFY movingChanged) Q_PROPERTY(bool moving READ moving NOTIFY movingChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
QML_NAMED_ELEMENT(SwipeArea)
public: public:
SwipeArea(QQuickItem *parent = nullptr); SwipeArea(QQuickItem *parent = nullptr);

View file

@ -1,89 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mobileshellplugin.h"
#include <QQmlContext>
#include <QQuickItem>
#include "components/direction.h"
#include "components/swipearea.h"
#include "notifications/notificationfilemenu.h"
#include "notifications/notificationthumbnailer.h"
#include "shellutil.h"
QUrl resolvePath(std::string str)
{
return QUrl("qrc:/org/kde/plasma/private/mobileshell/qml/" + QString::fromStdString(str));
}
void MobileShellPlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell"));
qmlRegisterSingletonType<ShellUtil>(uri, 1, 0, "ShellUtil", [](QQmlEngine *, QJSEngine *) -> QObject * {
return ShellUtil::instance();
});
// components
qmlRegisterType<Direction>(uri, 1, 0, "Direction");
qmlRegisterType<SwipeArea>(uri, 1, 0, "SwipeArea");
// notifications
qmlRegisterType<NotificationThumbnailer>(uri, 1, 0, "NotificationThumbnailer");
qmlRegisterType<NotificationFileMenu>(uri, 1, 0, "NotificationFileMenu");
// qml modules
// /actiondrawer
qmlRegisterType(resolvePath("actiondrawer/ActionDrawer.qml"), uri, 1, 0, "ActionDrawer");
qmlRegisterType(resolvePath("actiondrawer/ActionDrawerOpenSurface.qml"), uri, 1, 0, "ActionDrawerOpenSurface");
qmlRegisterType(resolvePath("actiondrawer/ActionDrawerWindow.qml"), uri, 1, 0, "ActionDrawerWindow");
// /components
qmlRegisterSingletonType(resolvePath("components/AppLaunch.qml"), uri, 1, 0, "AppLaunch");
qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
qmlRegisterSingletonType(resolvePath("components/Constants.qml"), uri, 1, 0, "Constants");
qmlRegisterType(resolvePath("components/ExtendedAbstractButton.qml"), uri, 1, 0, "ExtendedAbstractButton");
qmlRegisterType(resolvePath("components/Flickable.qml"), uri, 1, 0, "Flickable");
qmlRegisterType(resolvePath("components/GridView.qml"), uri, 1, 0, "GridView");
qmlRegisterType(resolvePath("components/HapticsEffectLoader.qml"), uri, 1, 0, "HapticsEffectLoader");
qmlRegisterType(resolvePath("components/ListView.qml"), uri, 1, 0, "ListView");
qmlRegisterType(resolvePath("components/PopupMenu.qml"), uri, 1, 0, "PopupMenu");
qmlRegisterType(resolvePath("components/StartupFeedback.qml"), uri, 1, 0, "StartupFeedback");
qmlRegisterType(resolvePath("components/TextDropShadow.qml"), uri, 1, 0, "TextDropShadow");
qmlRegisterType(resolvePath("components/VelocityCalculator.qml"), uri, 1, 0, "VelocityCalculator");
// /dataproviders
qmlRegisterSingletonType(resolvePath("dataproviders/AudioInfo.qml"), uri, 1, 0, "AudioInfo");
qmlRegisterSingletonType(resolvePath("dataproviders/BatteryInfo.qml"), uri, 1, 0, "BatteryInfo");
qmlRegisterSingletonType(resolvePath("dataproviders/BluetoothInfo.qml"), uri, 1, 0, "BluetoothInfo");
qmlRegisterSingletonType(resolvePath("dataproviders/SignalStrengthInfo.qml"), uri, 1, 0, "SignalStrengthInfo");
// /homescreen
qmlRegisterType(resolvePath("homescreen/HomeScreen.qml"), uri, 1, 0, "HomeScreen");
// /navigationpanel
qmlRegisterType(resolvePath("navigationpanel/NavigationPanel.qml"), uri, 1, 0, "NavigationPanel");
qmlRegisterType(resolvePath("navigationpanel/NavigationPanelAction.qml"), uri, 1, 0, "NavigationPanelAction");
// /statusbar
qmlRegisterType(resolvePath("statusbar/StatusBar.qml"), uri, 1, 0, "StatusBar");
// /volumeosd
qmlRegisterType(resolvePath("volumeosd/VolumeOSD.qml"), uri, 1, 0, "VolumeOSD");
qmlRegisterType(resolvePath("volumeosd/VolumeOSDProvider.qml"), uri, 1, 0, "VolumeOSDProvider");
qmlRegisterSingletonType(resolvePath("volumeosd/VolumeOSDProviderLoader.qml"), uri, 1, 0, "VolumeOSDProviderLoader");
// /widgets
qmlRegisterType(resolvePath("widgets/krunner/KRunnerScreen.qml"), uri, 1, 0, "KRunnerScreen");
qmlRegisterType(resolvePath("widgets/krunner/KRunnerWidget.qml"), uri, 1, 0, "KRunnerWidget");
qmlRegisterType(resolvePath("widgets/mediacontrols/MediaControlsWidget.qml"), uri, 1, 0, "MediaControlsWidget");
qmlRegisterType(resolvePath("widgets/notifications/NotificationsWidget.qml"), uri, 1, 0, "NotificationsWidget");
qmlRegisterType(resolvePath("widgets/notifications/NotificationsModelType.qml"), uri, 1, 0, "NotificationsModelType");
}

View file

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QUrl>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class MobileShellPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View file

@ -6,16 +6,17 @@
#pragma once #pragma once
#include <QAction>
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <QQuickItem> #include <QQuickItem>
#include <QUrl> #include <QUrl>
#include <qqmlregistration.h>
class QAction;
class NotificationFileMenu : public QObject class NotificationFileMenu : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QQuickItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged) Q_PROPERTY(QQuickItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged)
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)

View file

@ -12,10 +12,12 @@
#include <QPixmap> #include <QPixmap>
#include <QSize> #include <QSize>
#include <QUrl> #include <QUrl>
#include <qqmlregistration.h>
class NotificationThumbnailer : public QObject, public QQmlParserStatus class NotificationThumbnailer : public QObject, public QQmlParserStatus
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
Q_INTERFACES(QQmlParserStatus) Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)

View file

@ -12,11 +12,9 @@ import QtQuick.Window 2.2
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import "../components" as Components
Item { Item {
id: root id: root

View file

@ -12,8 +12,6 @@ import QtQuick.Window 2.2
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import "../components" as Components
/** /**
* Window with the ActionDrawer component embedded in it. * Window with the ActionDrawer component embedded in it.
* *

View file

@ -14,12 +14,7 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import "../components" as Components
import "../widgets/mediacontrols" as MediaControls
import "../widgets/notifications" as Notifications
import "quicksettings"
/** /**
* Root element that contains all of the ActionDrawer's contents, and is anchored to the screen. * Root element that contains all of the ActionDrawer's contents, and is anchored to the screen.
@ -83,7 +78,7 @@ Item {
} }
anchors.margins: minWidthHeight * 0.06 anchors.margins: minWidthHeight * 0.06
Notifications.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType historyModelType: root.actionDrawer.notificationModelType
@ -146,7 +141,7 @@ Item {
font.weight: Font.Light font.weight: Font.Light
} }
MediaControls.MediaControlsWidget { MobileShell.MediaControlsWidget {
id: mediaWidget id: mediaWidget
property real fullHeight: visible ? height + Kirigami.Units.smallSpacing * 6 : 0 property real fullHeight: visible ? height + Kirigami.Units.smallSpacing * 6 : 0
@ -163,7 +158,7 @@ Item {
} }
// right sidebar // right sidebar
QuickSettingsPanel { MobileShell.QuickSettingsPanel {
id: quickSettings id: quickSettings
height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding
width: intendedWidth width: intendedWidth

View file

@ -9,13 +9,10 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import "../components" as Components
import "../widgets/notifications" as Notifications
import "quicksettings"
/** /**
* Root element that contains all of the ActionDrawer's contents, and is anchored to the screen. * Root element that contains all of the ActionDrawer's contents, and is anchored to the screen.
*/ */
@ -51,7 +48,7 @@ Item {
opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset)) opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
} }
QuickSettingsDrawer { MobileShell.QuickSettingsDrawer {
id: quickSettings id: quickSettings
z: 1 // ensure it's above notifications z: 1 // ensure it's above notifications
anchors.top: parent.top anchors.top: parent.top
@ -95,7 +92,7 @@ Item {
} }
} }
Notifications.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType historyModelType: root.actionDrawer.notificationModelType

View file

@ -10,13 +10,11 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import "../../components" as Components
import "../../components/util.js" as Util
/** /**
* Quick settings elements layout, change the height to clip. * Quick settings elements layout, change the height to clip.
*/ */
@ -32,9 +30,9 @@ Item {
ScrollView ScrollView
} }
readonly property real columns: Math.round(Util.applyMinMaxRange(3, 6, width / intendedColumnWidth)) readonly property real columns: Math.round(Math.min(6, Math.max(3, width / intendedColumnWidth)))
readonly property real columnWidth: Math.floor(width / columns) readonly property real columnWidth: Math.floor(width / columns)
readonly property int minimizedColumns: Math.round(Util.applyMinMaxRange(5, 8, width / intendedMinimizedColumnWidth)) readonly property int minimizedColumns: Math.round(Math.min(8, Math.max(5, width / intendedMinimizedColumnWidth)))
readonly property real minimizedColumnWidth: Math.floor(width / minimizedColumns) readonly property real minimizedColumnWidth: Math.floor(width / minimizedColumns)
readonly property real rowHeight: columnWidth * 0.7 readonly property real rowHeight: columnWidth * 0.7
@ -134,7 +132,7 @@ Item {
sourceModel: quickSettingsModel sourceModel: quickSettingsModel
pageSize: minimizedColumns pageSize: minimizedColumns
} }
delegate: Components.BaseItem { delegate: MobileShell.BaseItem {
required property var modelData required property var modelData
implicitHeight: root.minimizedRowHeight implicitHeight: root.minimizedRowHeight
@ -293,7 +291,7 @@ Item {
Component { Component {
id: quickSettingComponent id: quickSettingComponent
Components.BaseItem { MobileShell.BaseItem {
height: root.rowHeight height: root.rowHeight
width: root.columnWidth width: root.columnWidth
padding: Kirigami.Units.smallSpacing padding: Kirigami.Units.smallSpacing

View file

@ -16,9 +16,7 @@ import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import "../../components" as Components MobileShell.BaseItem {
Components.BaseItem {
id: root id: root
required property bool restrictedPermissions required property bool restrictedPermissions

View file

@ -12,17 +12,13 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.ksvg 1.0 as KSvg import org.kde.ksvg 1.0 as KSvg
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.private.mobileshell as MobileShell
import "../../statusbar" as StatusBar
import "../../components" as Components
import "../../widgets/mediacontrols" as MediaControls
import "../"
/** /**
* Quick settings drawer pulled down from the top (for portrait mode). * Quick settings drawer pulled down from the top (for portrait mode).
* For the landscape view quicksettings container, see QuickSettingsPanel. * For the landscape view quicksettings container, see QuickSettingsPanel.
*/ */
Components.BaseItem { MobileShell.BaseItem {
id: root id: root
required property var actionDrawer required property var actionDrawer
@ -75,10 +71,10 @@ Components.BaseItem {
anchors.top: parent.top anchors.top: parent.top
spacing: 0 spacing: 0
StatusBar.StatusBar { MobileShell.StatusBar {
id: statusBar id: statusBar
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Components.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8 Layout.preferredHeight: MobileShell.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8
Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
@ -91,7 +87,7 @@ Components.BaseItem {
disableSystemTray: actionDrawer.restrictedPermissions disableSystemTray: actionDrawer.restrictedPermissions
} }
QuickSettings { MobileShell.QuickSettings {
id: quickSettings id: quickSettings
Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
@ -105,7 +101,7 @@ Components.BaseItem {
width: parent.width width: parent.width
} }
MediaControls.MediaControlsWidget { MobileShell.MediaControlsWidget {
id: mediaWidget id: mediaWidget
property real fullHeight: height + Layout.topMargin property real fullHeight: height + Layout.topMargin
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -11,11 +11,10 @@ import QtQuick.Layouts 1.1
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami 2.12 as Kirigami
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import "../../components" as Components
QuickSettingsDelegate { QuickSettingsDelegate {
id: root id: root
@ -54,7 +53,7 @@ QuickSettingsDelegate {
} }
} }
Components.HapticsEffectLoader { MobileShell.HapticsEffectLoader {
id: haptics id: haptics
} }
@ -94,7 +93,7 @@ QuickSettingsDelegate {
font.weight: Font.Bold font.weight: Font.Bold
} }
Components.MarqueeLabel { MobileShell.MarqueeLabel {
// if no status is given, just use On/Off // if no status is given, just use On/Off
inputText: root.status ? root.status : (root.enabled ? i18n("On") : i18n("Off")) inputText: root.status ? root.status : (root.enabled ? i18n("On") : i18n("Off"))
opacity: 0.6 opacity: 0.6

View file

@ -9,13 +9,12 @@ import QtQuick.Layouts 1.1
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami 2.12 as Kirigami
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import "../../components" as Components
QuickSettingsDelegate { QuickSettingsDelegate {
id: root id: root
@ -52,7 +51,7 @@ QuickSettingsDelegate {
} }
} }
Components.HapticsEffectLoader { MobileShell.HapticsEffectLoader {
id: haptics id: haptics
} }

View file

@ -10,18 +10,14 @@ import QtQuick.Layouts
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami 2.12 as Kirigami
import org.kde.ksvg 1.0 as KSvg import org.kde.ksvg 1.0 as KSvg
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import "../../statusbar" as StatusBar
import "../../components" as Components
import "../"
/** /**
* Quick settings panel for landscape view (right sidebar). * Quick settings panel for landscape view (right sidebar).
* For the portrait view quicksettings container, see QuickSettingsDrawer. * For the portrait view quicksettings container, see QuickSettingsDrawer.
*/ */
Components.BaseItem { MobileShell.BaseItem {
id: root id: root
required property var actionDrawer required property var actionDrawer
@ -56,7 +52,7 @@ Components.BaseItem {
height: root.fullScreenHeight height: root.fullScreenHeight
spacing: 0 spacing: 0
StatusBar.StatusBar { MobileShell.StatusBar {
id: statusBar id: statusBar
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
@ -75,7 +71,7 @@ Components.BaseItem {
disableSystemTray: actionDrawer.restrictedPermissions disableSystemTray: actionDrawer.restrictedPermissions
} }
QuickSettings { MobileShell.QuickSettings {
id: quickSettings id: quickSettings
mode: QuickSettings.ScrollView mode: QuickSettings.ScrollView

View file

@ -7,6 +7,7 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
Loader { Loader {
// source: "qrc:/org/kde/plasma/private/mobileshell/qml/components/HapticsEffectWrapper.qml" // source: "qrc:/org/kde/plasma/private/mobileshell/qml/components/HapticsEffectWrapper.qml"
// FIXME: the source above will have to be ported to Component type, as in `VolumeOSDProviderLoader.qml`
property bool valid: item !== null property bool valid: item !== null
function buttonVibrate() { function buttonVibrate() {

View file

@ -1,9 +0,0 @@
// SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
/**
* Applies both the min and max functions to a value.
*/
function applyMinMaxRange(min, max, num) {
return Math.min(max, Math.max(min, num));
}

View file

@ -9,7 +9,7 @@
pragma Singleton pragma Singleton
import QtQuick 2.1 import QtQuick 2.1
import org.kde.plasma.mm 1.0 import org.kde.plasma.mm
QtObject { QtObject {
readonly property string icon: "network-mobile-" + Math.floor(SignalIndicator.strength / 20) * 20 readonly property string icon: "network-mobile-" + Math.floor(SignalIndicator.strength / 20) * 20

View file

@ -7,12 +7,11 @@ import QtQuick.Window
import org.kde.plasma.plasmoid import org.kde.plasma.plasmoid
import org.kde.taskmanager as TaskManager import org.kde.taskmanager as TaskManager
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.private.mobileshell.state as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
import "../components" as Components
/** /**
* The base homescreen component, implementing features that simplify * The base homescreen component, implementing features that simplify
* homescreen implementation. * homescreen implementation.
@ -138,7 +137,7 @@ Item {
} }
// homescreen visual component // homescreen visual component
Components.BaseItem { MobileShell.BaseItem {
id: itemContainer id: itemContainer
anchors.fill: parent anchors.fill: parent
@ -209,7 +208,7 @@ Item {
} }
// start app animation component // start app animation component
Components.StartupFeedback { MobileShell.StartupFeedback {
id: startupFeedback id: startupFeedback
z: 999999 z: 999999
anchors.fill: parent anchors.fill: parent

View file

@ -13,10 +13,7 @@ import QtQuick.Effects
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.taskmanager 0.1 as TaskManager import org.kde.taskmanager 0.1 as TaskManager
import org.kde.kquickcontrolsaddons 2.0 import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import "../components" as Components
Item { Item {
id: root id: root

View file

@ -10,12 +10,10 @@ import QtQuick.Layouts 1.15
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import "indicators" as Indicators
PlasmaComponents.Label { PlasmaComponents.Label {
id: clock id: clock

View file

@ -18,10 +18,7 @@ import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kitemmodels as KItemModels import org.kde.kitemmodels as KItemModels
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import "indicators" as Indicators
import "../components" as Components
Item { Item {
id: root id: root
@ -114,7 +111,7 @@ Item {
RowLayout { RowLayout {
id: mainRow id: mainRow
readonly property real rowHeight: Components.Constants.topPanelHeight - Kirigami.Units.smallSpacing * 2 readonly property real rowHeight: MobileShell.Constants.topPanelHeight - Kirigami.Units.smallSpacing * 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: rowHeight Layout.preferredHeight: rowHeight
@ -129,7 +126,7 @@ Item {
source: timeSource source: timeSource
} }
Indicators.SignalStrengthIndicator { MobileShell.SignalStrengthIndicator {
Layout.fillHeight: true Layout.fillHeight: true
showLabel: true showLabel: true
visible: !root.showTime visible: !root.showTime
@ -166,27 +163,27 @@ Item {
spacing: root.elementSpacing spacing: root.elementSpacing
Indicators.SignalStrengthIndicator { MobileShell.SignalStrengthIndicator {
showLabel: false showLabel: false
visible: root.showTime visible: root.showTime
internetIndicator: internetIndicatorItem internetIndicator: internetIndicatorItem
implicitHeight: mainRow.rowHeight implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height Layout.preferredWidth: height
} }
Indicators.BluetoothIndicator { MobileShell.BluetoothIndicator {
implicitHeight: mainRow.rowHeight implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height Layout.preferredWidth: height
} }
Indicators.InternetIndicator { MobileShell.InternetIndicator {
id: internetIndicatorItem id: internetIndicatorItem
implicitHeight: mainRow.rowHeight implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height Layout.preferredWidth: height
} }
Indicators.VolumeIndicator { MobileShell.VolumeIndicator {
implicitHeight: mainRow.rowHeight implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height Layout.preferredWidth: height
} }
Indicators.BatteryIndicator { MobileShell.BatteryIndicator {
spacing: root.elementSpacing spacing: root.elementSpacing
textPixelSize: root.textPixelSize textPixelSize: root.textPixelSize
implicitHeight: mainRow.rowHeight implicitHeight: mainRow.rowHeight

View file

@ -12,7 +12,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.workspace.components 2.0 as PW import org.kde.plasma.workspace.components 2.0 as PW
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
RowLayout { RowLayout {
property real textPixelSize: Kirigami.Units.gridUnit * 0.6 property real textPixelSize: Kirigami.Units.gridUnit * 0.6

View file

@ -10,7 +10,7 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Kirigami.Icon { Kirigami.Icon {
id: connectionIcon id: connectionIcon

View file

@ -11,7 +11,7 @@ import QtQuick.Layouts
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Item { Item {
property InternetIndicator internetIndicator property InternetIndicator internetIndicator

View file

@ -12,7 +12,7 @@ import QtQuick.Layouts
import org.kde.plasma.private.volume 0.1 import org.kde.plasma.private.volume 0.1
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Kirigami.Icon { Kirigami.Icon {
id: paIcon id: paIcon

View file

@ -13,7 +13,7 @@ import QtQuick.Controls as Controls
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons as KQCAddons import org.kde.kquickcontrolsaddons as KQCAddons
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.volume import org.kde.plasma.private.volume

View file

@ -14,10 +14,8 @@ import QtQuick.Window
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import "../dataproviders" as DataProviders
NanoShell.FullScreenOverlay { NanoShell.FullScreenOverlay {
id: window id: window

View file

@ -11,7 +11,7 @@ import QtQuick.Layouts
import org.kde.plasma.private.volume 0.1 as VolumeLib import org.kde.plasma.private.volume 0.1 as VolumeLib
import org.kde.plasma.private.mobileshell.state as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
/** /**
* This imports the volume OSD and also sets up keyboard/hardware button bindings. * This imports the volume OSD and also sets up keyboard/hardware button bindings.

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
import QtQuick import QtQuick
import org.kde.plasma.private.mobileshell as MobileShell
pragma Singleton pragma Singleton
@ -11,7 +12,9 @@ pragma Singleton
*/ */
Loader { Loader {
id: root id: root
source: "qrc:/org/kde/plasma/private/mobileshell/qml/volumeosd/VolumeOSDProvider.qml" sourceComponent: Component {
MobileShell.VolumeOSDProvider {}
}
// WARNING: only call this load from within the plasmashell process, because // WARNING: only call this load from within the plasmashell process, because
// multiple bindings of the shortcut may break it entirely (hardware volume keys) // multiple bindings of the shortcut may break it entirely (hardware volume keys)

View file

@ -18,8 +18,6 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.milou as Milou import org.kde.milou as Milou
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import "../../components" as Components
Item { Item {
id: root id: root

View file

@ -18,8 +18,6 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.milou as Milou import org.kde.milou as Milou
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import "../../components" as Components
/** /**
* Search widget that is embedded into the homescreen. The dimensions of * Search widget that is embedded into the homescreen. The dimensions of
* the root item is assumed to be the available screen area for applications. * the root item is assumed to be the available screen area for applications.

View file

@ -8,13 +8,12 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.mpris as Mpris import org.kde.plasma.private.mpris as Mpris
import "../../components" as Components
/** /**
* Embeddable component that provides MPRIS control. * Embeddable component that provides MPRIS control.
*/ */
@ -90,11 +89,11 @@ Item {
implicitWidth: playerItem.implicitWidth implicitWidth: playerItem.implicitWidth
onClicked: { onClicked: {
Components.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop"); MobileShell.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop");
MobileShellState.ShellDBusClient.closeActionDrawer(); MobileShellState.ShellDBusClient.closeActionDrawer();
} }
Components.BaseItem { MobileShell.BaseItem {
id: playerItem id: playerItem
anchors.fill: parent anchors.fill: parent
@ -137,7 +136,7 @@ Item {
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
// media track name text // media track name text
Components.MarqueeLabel { MobileShell.MarqueeLabel {
id: trackLabel id: trackLabel
Layout.fillWidth: true Layout.fillWidth: true
@ -148,7 +147,7 @@ Item {
} }
// media artist name text // media artist name text
Components.MarqueeLabel { MobileShell.MarqueeLabel {
id: artistLabel id: artistLabel
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -14,13 +14,10 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.notificationmanager as NotificationManager import org.kde.notificationmanager as NotificationManager
import org.kde.coreaddons 1.0 as KCoreAddons import org.kde.coreaddons 1.0 as KCoreAddons
import "util.js" as Util
RowLayout { RowLayout {
id: notificationHeading id: notificationHeading
property int notificationType property int notificationType

View file

@ -9,6 +9,7 @@ import QtQuick 2.15
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
@ -18,8 +19,6 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.coreaddons 1.0 as KCoreAddons import org.kde.coreaddons 1.0 as KCoreAddons
import "util.js" as Util
// notification properties are in BaseNotificationItem // notification properties are in BaseNotificationItem
BaseNotificationItem { BaseNotificationItem {
id: notificationItem id: notificationItem
@ -80,7 +79,7 @@ BaseNotificationItem {
maximumLineCount: 3 maximumLineCount: 3
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
elide: Text.ElideRight elide: Text.ElideRight
text: Util.determineNotificationHeadingText(notificationItem) text: MobileShell.NotificationsUtils.determineNotificationHeadingText(notificationItem)
visible: text !== "" visible: text !== ""
font.weight: Font.DemiBold font.weight: Font.DemiBold
} }

View file

@ -9,6 +9,7 @@ import QtQuick 2.8
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
@ -17,8 +18,6 @@ import org.kde.notificationmanager as NotificationManager
import org.kde.coreaddons 1.0 as KCoreAddons import org.kde.coreaddons 1.0 as KCoreAddons
import "util.js" as Util
PlasmaComponents.Label { PlasmaComponents.Label {
id: ageLabel id: ageLabel
@ -43,7 +42,7 @@ PlasmaComponents.Label {
Component.onCompleted: updateAgoText() Component.onCompleted: updateAgoText()
function updateAgoText() { function updateAgoText() {
ageLabel.agoText = Util.generateNotificationHeaderAgoText(time, jobState); ageLabel.agoText = MobileShell.NotificationsUtils.generateNotificationHeaderAgoText(time, jobState);
} }
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 0.8 font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 0.8
@ -53,5 +52,5 @@ PlasmaComponents.Label {
property string agoText: "" property string agoText: ""
visible: text !== "" visible: text !== ""
opacity: 0.6 opacity: 0.6
text: Util.generateNotificationHeaderRemainingText(notificationType, jobState, jobDetails) || agoText text: MobileShell.NotificationsUtils.generateNotificationHeaderRemainingText(notificationType, jobState, jobDetails) || agoText
} }

View file

@ -13,7 +13,7 @@ import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami 2.12 as Kirigami
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.components 3.0 as PlasmaComponents3

View file

@ -11,7 +11,7 @@ import QtQuick.Effects
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.core as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.kquickcontrolsaddons 2.0 as KQCAddons import org.kde.kquickcontrolsaddons 2.0 as KQCAddons

View file

@ -1,7 +0,0 @@
# SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.private.mobileshell
plugin mobileshellplugin

View file

@ -28,12 +28,6 @@ ShellUtil::ShellUtil(QObject *parent)
{ {
} }
ShellUtil *ShellUtil::instance()
{
static ShellUtil *inst = new ShellUtil(nullptr);
return inst;
}
void ShellUtil::stackItemBefore(QQuickItem *item1, QQuickItem *item2) void ShellUtil::stackItemBefore(QQuickItem *item1, QQuickItem *item2)
{ {
if (!item1 || !item2 || item1 == item2 || item1->parentItem() != item2->parentItem()) { if (!item1 || !item2 || item1 == item2 || item1->parentItem() != item2->parentItem()) {

View file

@ -9,6 +9,7 @@
#include <QObject> #include <QObject>
#include <QQuickItem> #include <QQuickItem>
#include <qqmlregistration.h>
#include <KConfigWatcher> #include <KConfigWatcher>
#include <KIO/ApplicationLauncherJob> #include <KIO/ApplicationLauncherJob>
@ -22,11 +23,12 @@
class ShellUtil : public QObject class ShellUtil : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged) Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged)
public: public:
ShellUtil(QObject *parent = nullptr); ShellUtil(QObject *parent = nullptr);
static ShellUtil *instance();
/** /**
* Change the stacking order to have the first item behind the second item. * Change the stacking order to have the first item behind the second item.

View file

@ -1,11 +1,7 @@
# 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
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(mobileshellstateplugin_SRCS set(mobileshellstateplugin_SRCS
mobileshellstateplugin.cpp
shelldbusobject.cpp shelldbusobject.cpp
shelldbusclient.cpp shelldbusclient.cpp
lockscreendbusclient.cpp lockscreendbusclient.cpp
@ -23,7 +19,10 @@ qt_add_dbus_interface(mobileshellstateplugin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/or
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasmashell.Mobile.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasmashell.Mobile.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
add_library(mobileshellstateplugin SHARED ${mobileshellstateplugin_SRCS} ${RESOURCES})
ecm_add_qml_module(mobileshellstateplugin URI org.kde.plasma.private.mobileshell.state GENERATE_PLUGIN_SOURCE)
target_sources(mobileshellstateplugin PRIVATE ${mobileshellstateplugin_SRCS} ${RESOURCES})
target_link_libraries(mobileshellstateplugin target_link_libraries(mobileshellstateplugin
PUBLIC PUBLIC
@ -40,9 +39,4 @@ target_link_libraries(mobileshellstateplugin
KF6::PlasmaQuick KF6::PlasmaQuick
) )
# we compiled the qml files, just install qmldir ecm_finalize_qml_module(mobileshellstateplugin)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/state)
ecm_generate_qmltypes(org.kde.plasma.private.mobileshell.state 1.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/state)
install(TARGETS mobileshellstateplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/state)

View file

@ -28,12 +28,6 @@ LockscreenDBusClient::LockscreenDBusClient(QObject *parent)
SLOT(slotLockscreenActiveChanged(bool))); SLOT(slotLockscreenActiveChanged(bool)));
} }
LockscreenDBusClient *LockscreenDBusClient::self()
{
static LockscreenDBusClient *instance = new LockscreenDBusClient;
return instance;
}
bool LockscreenDBusClient::lockscreenActive() const bool LockscreenDBusClient::lockscreenActive() const
{ {
return m_lockscreenActive; return m_lockscreenActive;
@ -58,4 +52,4 @@ void LockscreenDBusClient::slotLockscreenActiveChanged(bool active)
void LockscreenDBusClient::dbusError(QDBusError error) void LockscreenDBusClient::dbusError(QDBusError error)
{ {
qDebug() << "Error fetching lockscreen state using DBus:" << error.message(); qDebug() << "Error fetching lockscreen state using DBus:" << error.message();
} }

View file

@ -7,15 +7,17 @@
#include <QDBusServiceWatcher> #include <QDBusServiceWatcher>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <qqmlregistration.h>
class LockscreenDBusClient : public QObject class LockscreenDBusClient : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool lockscreenActive READ lockscreenActive NOTIFY lockscreenActiveChanged); Q_PROPERTY(bool lockscreenActive READ lockscreenActive NOTIFY lockscreenActiveChanged);
public: public:
explicit LockscreenDBusClient(QObject *parent = nullptr); explicit LockscreenDBusClient(QObject *parent = nullptr);
static LockscreenDBusClient *self();
bool lockscreenActive() const; bool lockscreenActive() const;

View file

@ -1,30 +0,0 @@
// SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "mobileshellstateplugin.h"
#include "lockscreendbusclient.h"
#include "shelldbusclient.h"
#include "shelldbusobject.h"
#include <QQmlContext>
#include <QQuickItem>
QUrl resolvePath(std::string str)
{
return QUrl("qrc:/org/kde/plasma/private/mobileshell/state/qml/" + QString::fromStdString(str));
}
void MobileShellStatePlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell.state"));
qmlRegisterSingletonType<ShellDBusClient>(uri, 1, 0, "ShellDBusClient", [](QQmlEngine *, QJSEngine *) -> QObject * {
return ShellDBusClient::self();
});
qmlRegisterSingletonType<ShellDBusObject>(uri, 1, 0, "ShellDBusObject", [](QQmlEngine *, QJSEngine *) -> QObject * {
return ShellDBusObject::self();
});
qmlRegisterSingletonType<LockscreenDBusClient>(uri, 1, 0, "LockscreenDBusClient", [](QQmlEngine *, QJSEngine *) -> QObject * {
return LockscreenDBusClient::self();
});
}

View file

@ -1,18 +0,0 @@
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QUrl>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class MobileShellStatePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View file

@ -1,6 +0,0 @@
# SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.private.mobileshell.state
plugin mobileshellstateplugin

View file

@ -27,12 +27,6 @@ ShellDBusClient::ShellDBusClient(QObject *parent)
}); });
} }
ShellDBusClient *ShellDBusClient::self()
{
static ShellDBusClient *instance = new ShellDBusClient;
return instance;
}
void ShellDBusClient::connectSignals() void ShellDBusClient::connectSignals()
{ {
connect(m_interface, &OrgKdePlasmashellInterface::isActionDrawerOpenChanged, this, &ShellDBusClient::updateIsActionDrawerOpen); connect(m_interface, &OrgKdePlasmashellInterface::isActionDrawerOpenChanged, this, &ShellDBusClient::updateIsActionDrawerOpen);

View file

@ -8,17 +8,20 @@
#include <QDBusServiceWatcher> #include <QDBusServiceWatcher>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <qqmlregistration.h>
class ShellDBusClient : public QObject class ShellDBusClient : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged) Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged)
Q_PROPERTY(bool isActionDrawerOpen READ isActionDrawerOpen WRITE setIsActionDrawerOpen NOTIFY isActionDrawerOpenChanged) Q_PROPERTY(bool isActionDrawerOpen READ isActionDrawerOpen WRITE setIsActionDrawerOpen NOTIFY isActionDrawerOpenChanged)
Q_PROPERTY(bool isTaskSwitcherVisible READ isTaskSwitcherVisible NOTIFY isTaskSwitcherVisibleChanged) Q_PROPERTY(bool isTaskSwitcherVisible READ isTaskSwitcherVisible NOTIFY isTaskSwitcherVisibleChanged)
public: public:
explicit ShellDBusClient(QObject *parent = nullptr); explicit ShellDBusClient(QObject *parent = nullptr);
static ShellDBusClient *self();
bool doNotDisturb() const; bool doNotDisturb() const;
void setDoNotDisturb(bool value); void setDoNotDisturb(bool value);

View file

@ -11,12 +11,6 @@ ShellDBusObject::ShellDBusObject(QObject *parent)
{ {
} }
ShellDBusObject *ShellDBusObject::self()
{
static ShellDBusObject *instance = new ShellDBusObject;
return instance;
}
void ShellDBusObject::registerObject() void ShellDBusObject::registerObject()
{ {
if (!m_initialized) { if (!m_initialized) {

View file

@ -5,15 +5,17 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <qqmlregistration.h>
class ShellDBusObject : public QObject class ShellDBusObject : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_CLASSINFO("D-Bus Interface", "org.kde.plasmashell") Q_CLASSINFO("D-Bus Interface", "org.kde.plasmashell")
public: public:
ShellDBusObject(QObject *parent = nullptr); ShellDBusObject(QObject *parent = nullptr);
static ShellDBusObject *self();
// called by QML // called by QML
Q_INVOKABLE void registerObject(); Q_INVOKABLE void registerObject();

View file

@ -1,18 +1,17 @@
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> # SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
add_library(quicksettingsplugin) ecm_add_qml_module(quicksettingsplugin URI org.kde.plasma.private.mobileshell.quicksettingsplugin GENERATE_PLUGIN_SOURCE)
target_sources(quicksettingsplugin PRIVATE target_sources(quicksettingsplugin PRIVATE
paginatemodel.cpp paginatemodel.cpp
quicksetting.cpp quicksetting.cpp
quicksettingsmodel.cpp quicksettingsmodel.cpp
quicksettingsplugin.cpp
quicksettingsconfig.cpp quicksettingsconfig.cpp
savedquicksettings.cpp savedquicksettings.cpp
savedquicksettingsmodel.cpp savedquicksettingsmodel.cpp
) )
target_link_libraries(quicksettingsplugin target_link_libraries(quicksettingsplugin PRIVATE
Qt::Qml Qt::Qml
Qt::DBus Qt::DBus
Qt::Gui Qt::Gui
@ -23,10 +22,6 @@ target_link_libraries(quicksettingsplugin
KF6::Package KF6::Package
) )
set_property(TARGET quicksettingsplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/quicksettingsplugin) ecm_finalize_qml_module(quicksettingsplugin)
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/quicksettingsplugin)
install(TARGETS quicksettingsplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/quicksettingsplugin)
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/quicksettingsplugin)

View file

@ -7,6 +7,7 @@
#pragma once #pragma once
#include <QAbstractListModel> #include <QAbstractListModel>
#include <qqmlregistration.h>
/** /**
* @class PaginateModel * @class PaginateModel
@ -19,6 +20,8 @@
class PaginateModel : public QAbstractListModel class PaginateModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
/** Holds the number of elements that will fit in a page */ /** Holds the number of elements that will fit in a page */
Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged) Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged)

View file

@ -1,8 +0,0 @@
# SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.private.mobileshell.quicksettingsplugin
plugin quicksettingsplugin

View file

@ -13,6 +13,8 @@
class QuickSetting : public QObject class QuickSetting : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged) Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged)
Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) // if no status is explicitly set, On/Off is used by default Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) // if no status is explicitly set, On/Off is used by default
Q_PROPERTY(QString icon READ iconName WRITE setIconName REQUIRED NOTIFY iconNameChanged) Q_PROPERTY(QString icon READ iconName WRITE setIconName REQUIRED NOTIFY iconNameChanged)
@ -21,7 +23,7 @@ class QuickSetting : public QObject
Q_PROPERTY(bool available READ isAvailable WRITE setAvailable NOTIFY availableChanged) Q_PROPERTY(bool available READ isAvailable WRITE setAvailable NOTIFY availableChanged)
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT) Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
Q_CLASSINFO("DefaultProperty", "children") Q_CLASSINFO("DefaultProperty", "children")
QML_NAMED_ELEMENT("QuickSetting")
public: public:
QuickSetting(QObject *parent = nullptr); QuickSetting(QObject *parent = nullptr);

View file

@ -11,12 +11,6 @@
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc"); const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings"); const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings");
QuickSettingsConfig *QuickSettingsConfig::self()
{
static QuickSettingsConfig *singleton = new QuickSettingsConfig();
return singleton;
}
QuickSettingsConfig::QuickSettingsConfig(QObject *parent) QuickSettingsConfig::QuickSettingsConfig(QObject *parent)
: QObject{parent} : QObject{parent}
, m_config{KSharedConfig::openConfig(CONFIG_FILE, KConfig::SimpleConfig)} , m_config{KSharedConfig::openConfig(CONFIG_FILE, KConfig::SimpleConfig)}

View file

@ -22,8 +22,6 @@ class QuickSettingsConfig : public QObject
Q_OBJECT Q_OBJECT
public: public:
static QuickSettingsConfig *self();
QuickSettingsConfig(QObject *parent = nullptr); QuickSettingsConfig(QObject *parent = nullptr);
/** /**

View file

@ -1,23 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quicksettingsplugin.h"
#include "paginatemodel.h"
#include "quicksetting.h"
#include "quicksettingsmodel.h"
#include "savedquicksettings.h"
#include "savedquicksettingsmodel.h"
#include <QQmlContext>
#include <QQuickItem>
void QuickSettingsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell.quicksettingsplugin"));
qmlRegisterType<QuickSetting>(uri, 1, 0, "QuickSetting");
qmlRegisterType<QuickSettingsModel>(uri, 1, 0, "QuickSettingsModel");
qmlRegisterType<PaginateModel>(uri, 1, 0, "PaginateModel");
qmlRegisterType<SavedQuickSettings>(uri, 1, 0, "SavedQuickSettings");
qmlRegisterType<SavedQuickSettingsModel>(uri, 1, 0, "SavedQuickSettingsModel");
}

View file

@ -1,18 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QUrl>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class QuickSettingsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View file

@ -24,6 +24,8 @@
class SavedQuickSettings : public QObject class SavedQuickSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
Q_PROPERTY(SavedQuickSettingsModel *enabledModel READ enabledQuickSettingsModel CONSTANT) Q_PROPERTY(SavedQuickSettingsModel *enabledModel READ enabledQuickSettingsModel CONSTANT)
Q_PROPERTY(SavedQuickSettingsModel *disabledModel READ disabledQuickSettingsModel CONSTANT) Q_PROPERTY(SavedQuickSettingsModel *disabledModel READ disabledQuickSettingsModel CONSTANT)

View file

@ -19,6 +19,7 @@
class SavedQuickSettingsModel : public QAbstractListModel class SavedQuickSettingsModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
public: public:
SavedQuickSettingsModel(QObject *parent = nullptr); SavedQuickSettingsModel(QObject *parent = nullptr);

View file

@ -1,13 +1,10 @@
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> # SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
add_library(shellsettingsplugin) ecm_add_qml_module(shellsettingsplugin URI org.kde.plasma.private.mobileshell.shellsettingsplugin GENERATE_PLUGIN_SOURCE)
target_sources(shellsettingsplugin PRIVATE target_sources(shellsettingsplugin PRIVATE mobileshellsettings.cpp)
mobileshellsettings.cpp
shellsettingsplugin.cpp
)
target_link_libraries(shellsettingsplugin target_link_libraries(shellsettingsplugin PRIVATE
Qt::Qml Qt::Qml
Qt::DBus Qt::DBus
Qt::Gui Qt::Gui
@ -20,11 +17,4 @@ target_link_libraries(shellsettingsplugin
KF6::JobWidgets KF6::JobWidgets
) )
set_property(TARGET shellsettingsplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/shellsettingsplugin) ecm_finalize_qml_module(shellsettingsplugin)
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/shellsettingsplugin)
install(TARGETS shellsettingsplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/shellsettingsplugin)
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/shellsettingsplugin)

View file

@ -18,12 +18,6 @@
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc"); const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General"); const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
MobileShellSettings *MobileShellSettings::self()
{
static MobileShellSettings *singleton = new MobileShellSettings();
return singleton;
}
MobileShellSettings::MobileShellSettings(QObject *parent) MobileShellSettings::MobileShellSettings(QObject *parent)
: QObject{parent} : QObject{parent}
, m_config{KSharedConfig::openConfig(CONFIG_FILE, KConfig::SimpleConfig)} , m_config{KSharedConfig::openConfig(CONFIG_FILE, KConfig::SimpleConfig)}

View file

@ -11,6 +11,7 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <QDBusConnection> #include <QDBusConnection>
#include <QObject> #include <QObject>
#include <qqmlregistration.h>
/** /**
* @short Wrapper class to access and control mobile shell specific settings. * @short Wrapper class to access and control mobile shell specific settings.
@ -20,6 +21,8 @@
class MobileShellSettings : public QObject class MobileShellSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_NAMED_ELEMENT(Settings)
QML_SINGLETON
// general // general
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged) Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
@ -38,8 +41,6 @@ class MobileShellSettings : public QObject
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged) Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
public: public:
static MobileShellSettings *self();
MobileShellSettings(QObject *parent = nullptr); MobileShellSettings(QObject *parent = nullptr);
enum ActionDrawerMode { enum ActionDrawerMode {

View file

@ -1,9 +0,0 @@
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.private.mobileshell.shellsettingsplugin
plugin shellsettingsplugin

View file

@ -1,17 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "shellsettingsplugin.h"
#include "mobileshellsettings.h"
#include <QQmlContext>
#include <QQuickItem>
void ShellSettingsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell.shellsettingsplugin"));
qmlRegisterSingletonType<MobileShellSettings>(uri, 1, 0, "Settings", [](QQmlEngine *, QJSEngine *) -> QObject * {
return MobileShellSettings::self();
});
}

View file

@ -1,18 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QUrl>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class ShellSettingsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View file

@ -1,14 +1,14 @@
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> # SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
set(windowplugin_SRCS ecm_add_qml_module(windowplugin URI org.kde.plasma.private.mobileshell.windowplugin GENERATE_PLUGIN_SOURCE)
windowplugin.cpp
windowutil.cpp
)
qt_add_resources(RESOURCES resources.qrc)
add_library(windowplugin SHARED ${windowplugin_SRCS} ${RESOURCES})
target_link_libraries(windowplugin target_sources(windowplugin PRIVATE windowutil.cpp)
set_source_files_properties(qml/WindowMaximizedTracker.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
ecm_target_qml_sources(windowplugin SOURCES qml/WindowMaximizedTracker.qml)
target_link_libraries(windowplugin PRIVATE
Qt::Qml Qt::Qml
Qt::DBus Qt::DBus
Qt::Gui Qt::Gui
@ -18,9 +18,4 @@ target_link_libraries(windowplugin
KF6::ConfigWidgets KF6::ConfigWidgets
) )
set_property(TARGET windowplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/windowplugin) ecm_finalize_qml_module(windowplugin)
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/windowplugin)
install(TARGETS windowplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/windowplugin)
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell/windowplugin)

View file

@ -1,7 +0,0 @@
# SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
module org.kde.plasma.private.mobileshell.windowplugin
plugin windowplugin

View file

@ -1,11 +0,0 @@
<!--
- Copyright 2023 Devin Lin <devin@kde.org>
- SPDX-License-Identifier: GPL-2.0-or-later
-->
<RCC>
<qresource prefix="/org/kde/plasma/private/mobileshell/windowplugin/">
<file>qml/WindowMaximizedTracker.qml</file>
</qresource>
</RCC>

View file

@ -1,24 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "windowplugin.h"
#include "windowutil.h"
#include <QQmlContext>
#include <QQuickItem>
QUrl resolvePath(std::string str)
{
return QUrl("qrc:/org/kde/plasma/private/mobileshell/windowplugin/qml/" + QString::fromStdString(str));
}
void WindowPlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell.windowplugin"));
qmlRegisterSingletonType<WindowUtil>(uri, 1, 0, "WindowUtil", [](QQmlEngine *, QJSEngine *) -> QObject * {
return WindowUtil::instance();
});
qmlRegisterSingletonType(resolvePath("WindowMaximizedTracker.qml"), uri, 1, 0, "WindowMaximizedTracker");
}

View file

@ -1,18 +0,0 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QUrl>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
class WindowPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri) override;
};

View file

@ -27,12 +27,6 @@ WindowUtil::WindowUtil(QObject *parent)
initWayland(); initWayland();
} }
WindowUtil *WindowUtil::instance()
{
static WindowUtil *inst = new WindowUtil();
return inst;
}
bool WindowUtil::isShowingDesktop() const bool WindowUtil::isShowingDesktop() const
{ {
return m_showingDesktop; return m_showingDesktop;

View file

@ -12,6 +12,7 @@
#include <QQuickItem> #include <QQuickItem>
#include <QQuickWindow> #include <QQuickWindow>
#include <QTimer> #include <QTimer>
#include <qqmlregistration.h>
#include <KConfigWatcher> #include <KConfigWatcher>
#include <KSharedConfig> #include <KSharedConfig>
@ -29,13 +30,15 @@
class WindowUtil : public QObject class WindowUtil : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool isShowingDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged) Q_PROPERTY(bool isShowingDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged)
Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged) Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged)
Q_PROPERTY(bool activeWindowIsShell READ activeWindowIsShell NOTIFY activeWindowIsShellChanged) Q_PROPERTY(bool activeWindowIsShell READ activeWindowIsShell NOTIFY activeWindowIsShellChanged)
public: public:
WindowUtil(QObject *parent = nullptr); WindowUtil(QObject *parent = nullptr);
static WindowUtil *instance();
/** /**
* Whether the shell is in "desktop showing" mode, where all windows * Whether the shell is in "desktop showing" mode, where all windows

View file

@ -10,7 +10,7 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.kirigami 2.10 as Kirigami import org.kde.kirigami 2.10 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Item { Item {
id: root id: root

View file

@ -9,8 +9,8 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import "./delegate" import "./delegate"

View file

@ -6,9 +6,9 @@ import QtQuick.Window 2.12
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.kirigami 2.10 as Kirigami import org.kde.kirigami 2.10 as Kirigami
import "./delegate" import "./delegate"

View file

@ -8,7 +8,7 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import "./delegate" import "./delegate"

View file

@ -8,7 +8,7 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
MobileShell.BaseItem { MobileShell.BaseItem {

View file

@ -11,7 +11,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import "./delegate" import "./delegate"

View file

@ -5,8 +5,8 @@ import QtQuick
import QtQuick.Window import QtQuick.Window
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import org.kde.kirigami 2.10 as Kirigami import org.kde.kirigami 2.10 as Kirigami

View file

@ -14,7 +14,7 @@ import org.kde.kquickcontrolsaddons 2.0
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Folio.DelegateTouchArea { Folio.DelegateTouchArea {
id: delegate id: delegate

View file

@ -9,8 +9,8 @@ import QtQuick.Effects
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
AbstractDelegate { AbstractDelegate {
id: root id: root

View file

@ -10,8 +10,8 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin

View file

@ -9,7 +9,7 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio import org.kde.private.mobile.homescreen.folio 1.0 as Folio
import '../delegate' import '../delegate'

View file

@ -11,9 +11,9 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0 import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami

View file

@ -10,7 +10,7 @@ import org.kde.plasma.components 3.0 as PC3
import org.kde.draganddrop 2.0 as DragDrop import org.kde.draganddrop 2.0 as DragDrop
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
Item { Item {

View file

@ -10,8 +10,8 @@ import QtQuick.Controls 2.15 as Controls
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.kirigami 2.10 as Kirigami import org.kde.kirigami 2.10 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.private.mobile.homescreen.halcyon 1.0 as Halcyon import org.kde.private.mobile.homescreen.halcyon 1.0 as Halcyon
MobileShell.GridView { MobileShell.GridView {

View file

@ -7,7 +7,7 @@ import QtQuick.Controls 2.12 as Controls
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.plasma.mm 1.0 as PlasmaMM import org.kde.plasma.mm as PlasmaMM
Kirigami.Dialog { Kirigami.Dialog {
id: dialog id: dialog

View file

@ -7,7 +7,7 @@ import QtQuick.Layouts
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard 1 as FormCard import org.kde.kirigamiaddons.formcard 1 as FormCard
import org.kde.plasma.mm 1 as PlasmaMM import org.kde.plasma.mm as PlasmaMM
Item { Item {
id: root id: root

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
import initialstart 1.0 as InitialStart import initialstart 1.0 as InitialStart

View file

@ -11,7 +11,7 @@ import QtQuick.Controls 2.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PC3 import org.kde.plasma.components 3.0 as PC3
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
Item { Item {
id: root id: root

Some files were not shown because too many files have changed in this diff Show more