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-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
mmqmlplugin.cpp
signalindicator.cpp
profilesettings.cpp
)
target_link_libraries(ppc-mmqmlplugin
target_link_libraries(ppc-mmqmlplugin PRIVATE
Qt::Qml
KF6::ModemManagerQt
KF6::NetworkManagerQt
@ -16,8 +16,5 @@ target_link_libraries(ppc-mmqmlplugin
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)
install(FILES qmldir ${qml_SRC} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/mm)
ecm_finalize_qml_module(ppc-mmqmlplugin)

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

View file

@ -1,19 +1,36 @@
# SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
ecm_add_qml_module(mobileshellplugin URI org.kde.plasma.private.mobileshell GENERATE_PLUGIN_SOURCE)
set(mobileshellplugin_SRCS
mobileshellplugin.cpp
shellutil.cpp
components/direction.cpp
components/direction.h
components/swipearea.cpp
notifications/notificationthumbnailer.cpp
notifications/notificationfilemenu.cpp
)
qt_add_resources(RESOURCES resources.qrc)
add_library(mobileshellplugin SHARED ${mobileshellplugin_SRCS} ${RESOURCES})
target_include_directories(mobileshellplugin PRIVATE components)
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
PUBLIC
@ -36,8 +53,4 @@ target_link_libraries(mobileshellplugin
KF6::Package
)
# we compiled the qml files, just install qmldir
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)
ecm_finalize_qml_module(mobileshellplugin)

View file

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

View file

@ -22,13 +22,12 @@
class SwipeArea : public QQuickItem
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(SwipeArea::Mode mode READ mode WRITE setMode NOTIFY modeChanged)
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool moving READ moving NOTIFY movingChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
QML_NAMED_ELEMENT(SwipeArea)
public:
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
#include <QAction>
#include <QObject>
#include <QPointer>
#include <QQuickItem>
#include <QUrl>
class QAction;
#include <qqmlregistration.h>
class NotificationFileMenu : public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QQuickItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged)
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)

View file

@ -12,10 +12,12 @@
#include <QPixmap>
#include <QSize>
#include <QUrl>
#include <qqmlregistration.h>
class NotificationThumbnailer : public QObject, public QQmlParserStatus
{
Q_OBJECT
QML_ELEMENT
Q_INTERFACES(QQmlParserStatus)
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.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 "../components" as Components
Item {
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.private.nanoshell 2.0 as NanoShell
import "../components" as Components
/**
* 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.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import "../components" as Components
import "../widgets/mediacontrols" as MediaControls
import "../widgets/notifications" as Notifications
import "quicksettings"
import org.kde.plasma.private.mobileshell as MobileShell
/**
* 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
Notifications.NotificationsWidget {
MobileShell.NotificationsWidget {
id: notificationWidget
historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType
@ -146,7 +141,7 @@ Item {
font.weight: Font.Light
}
MediaControls.MediaControlsWidget {
MobileShell.MediaControlsWidget {
id: mediaWidget
property real fullHeight: visible ? height + Kirigami.Units.smallSpacing * 6 : 0
@ -163,7 +158,7 @@ Item {
}
// right sidebar
QuickSettingsPanel {
MobileShell.QuickSettingsPanel {
id: quickSettings
height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding
width: intendedWidth

View file

@ -9,13 +9,10 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1
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.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.
*/
@ -51,7 +48,7 @@ Item {
opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
}
QuickSettingsDrawer {
MobileShell.QuickSettingsDrawer {
id: quickSettings
z: 1 // ensure it's above notifications
anchors.top: parent.top
@ -95,7 +92,7 @@ Item {
}
}
Notifications.NotificationsWidget {
MobileShell.NotificationsWidget {
id: notificationWidget
historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType

View file

@ -10,13 +10,11 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1
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.private.mobileshell.quicksettingsplugin as QS
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.
*/
@ -32,9 +30,9 @@ Item {
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 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 rowHeight: columnWidth * 0.7
@ -134,7 +132,7 @@ Item {
sourceModel: quickSettingsModel
pageSize: minimizedColumns
}
delegate: Components.BaseItem {
delegate: MobileShell.BaseItem {
required property var modelData
implicitHeight: root.minimizedRowHeight
@ -293,7 +291,7 @@ Item {
Component {
id: quickSettingComponent
Components.BaseItem {
MobileShell.BaseItem {
height: root.rowHeight
width: root.columnWidth
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.components 3.0 as PlasmaComponents
import "../../components" as Components
Components.BaseItem {
MobileShell.BaseItem {
id: root
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.plasma.core as PlasmaCore
import "../../statusbar" as StatusBar
import "../../components" as Components
import "../../widgets/mediacontrols" as MediaControls
import "../"
import org.kde.plasma.private.mobileshell as MobileShell
/**
* Quick settings drawer pulled down from the top (for portrait mode).
* For the landscape view quicksettings container, see QuickSettingsPanel.
*/
Components.BaseItem {
MobileShell.BaseItem {
id: root
required property var actionDrawer
@ -75,10 +71,10 @@ Components.BaseItem {
anchors.top: parent.top
spacing: 0
StatusBar.StatusBar {
MobileShell.StatusBar {
id: statusBar
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.inherit: false
@ -91,7 +87,7 @@ Components.BaseItem {
disableSystemTray: actionDrawer.restrictedPermissions
}
QuickSettings {
MobileShell.QuickSettings {
id: quickSettings
Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight
Layout.topMargin: Kirigami.Units.smallSpacing
@ -105,7 +101,7 @@ Components.BaseItem {
width: parent.width
}
MediaControls.MediaControlsWidget {
MobileShell.MediaControlsWidget {
id: mediaWidget
property real fullHeight: height + Layout.topMargin
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.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.components 3.0 as PlasmaComponents
import "../../components" as Components
QuickSettingsDelegate {
id: root
@ -54,7 +53,7 @@ QuickSettingsDelegate {
}
}
Components.HapticsEffectLoader {
MobileShell.HapticsEffectLoader {
id: haptics
}
@ -94,7 +93,7 @@ QuickSettingsDelegate {
font.weight: Font.Bold
}
Components.MarqueeLabel {
MobileShell.MarqueeLabel {
// if no status is given, just use On/Off
inputText: root.status ? root.status : (root.enabled ? i18n("On") : i18n("Off"))
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.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.components 3.0 as PlasmaComponents
import "../../components" as Components
QuickSettingsDelegate {
id: root
@ -52,7 +51,7 @@ QuickSettingsDelegate {
}
}
Components.HapticsEffectLoader {
MobileShell.HapticsEffectLoader {
id: haptics
}

View file

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

View file

@ -7,6 +7,7 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
Loader {
// 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
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
import QtQuick 2.1
import org.kde.plasma.mm 1.0
import org.kde.plasma.mm
QtObject {
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.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.state as MobileShellState
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
import "../components" as Components
/**
* The base homescreen component, implementing features that simplify
* homescreen implementation.
@ -138,7 +137,7 @@ Item {
}
// homescreen visual component
Components.BaseItem {
MobileShell.BaseItem {
id: itemContainer
anchors.fill: parent
@ -209,7 +208,7 @@ Item {
}
// start app animation component
Components.StartupFeedback {
MobileShell.StartupFeedback {
id: startupFeedback
z: 999999
anchors.fill: parent

View file

@ -13,10 +13,7 @@ import QtQuick.Effects
import org.kde.kirigami 2.20 as Kirigami
import org.kde.taskmanager 0.1 as TaskManager
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import "../components" as Components
import org.kde.plasma.private.mobileshell.state as MobileShellState
Item {
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.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 "indicators" as Indicators
PlasmaComponents.Label {
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.components 3.0 as PlasmaComponents
import org.kde.kitemmodels as KItemModels
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import "indicators" as Indicators
import "../components" as Components
import org.kde.plasma.private.mobileshell as MobileShell
Item {
id: root
@ -114,7 +111,7 @@ Item {
RowLayout {
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.preferredHeight: rowHeight
@ -129,7 +126,7 @@ Item {
source: timeSource
}
Indicators.SignalStrengthIndicator {
MobileShell.SignalStrengthIndicator {
Layout.fillHeight: true
showLabel: true
visible: !root.showTime
@ -166,27 +163,27 @@ Item {
spacing: root.elementSpacing
Indicators.SignalStrengthIndicator {
MobileShell.SignalStrengthIndicator {
showLabel: false
visible: root.showTime
internetIndicator: internetIndicatorItem
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.BluetoothIndicator {
MobileShell.BluetoothIndicator {
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.InternetIndicator {
MobileShell.InternetIndicator {
id: internetIndicatorItem
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.VolumeIndicator {
MobileShell.VolumeIndicator {
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.BatteryIndicator {
MobileShell.BatteryIndicator {
spacing: root.elementSpacing
textPixelSize: root.textPixelSize
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.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 {
property real textPixelSize: Kirigami.Units.gridUnit * 0.6

View file

@ -10,7 +10,7 @@ import QtQuick
import QtQuick.Layouts
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 {
id: connectionIcon

View file

@ -11,7 +11,7 @@ import QtQuick.Layouts
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
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 {
property InternetIndicator internetIndicator

View file

@ -12,7 +12,7 @@ import QtQuick.Layouts
import org.kde.plasma.private.volume 0.1
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 {
id: paIcon

View file

@ -13,7 +13,7 @@ import QtQuick.Controls as Controls
import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents
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

View file

@ -14,10 +14,8 @@ import QtQuick.Window
import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents
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.state 1.0 as MobileShellState
import "../dataproviders" as DataProviders
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
NanoShell.FullScreenOverlay {
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.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.

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
import QtQuick
import org.kde.plasma.private.mobileshell as MobileShell
pragma Singleton
@ -11,7 +12,9 @@ pragma Singleton
*/
Loader {
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
// 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.kirigami 2.19 as Kirigami
import "../../components" as Components
Item {
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.kirigami 2.19 as Kirigami
import "../../components" as Components
/**
* Search widget that is embedded into the homescreen. The dimensions of
* 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.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.private.mpris as Mpris
import "../../components" as Components
/**
* Embeddable component that provides MPRIS control.
*/
@ -90,11 +89,11 @@ Item {
implicitWidth: playerItem.implicitWidth
onClicked: {
Components.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop");
MobileShell.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop");
MobileShellState.ShellDBusClient.closeActionDrawer();
}
Components.BaseItem {
MobileShell.BaseItem {
id: playerItem
anchors.fill: parent
@ -137,7 +136,7 @@ Item {
spacing: Kirigami.Units.smallSpacing
// media track name text
Components.MarqueeLabel {
MobileShell.MarqueeLabel {
id: trackLabel
Layout.fillWidth: true
@ -148,7 +147,7 @@ Item {
}
// media artist name text
Components.MarqueeLabel {
MobileShell.MarqueeLabel {
id: artistLabel
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.plasma5support 2.0 as P5Support
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.notificationmanager as NotificationManager
import org.kde.coreaddons 1.0 as KCoreAddons
import "util.js" as Util
RowLayout {
id: notificationHeading
property int notificationType

View file

@ -9,6 +9,7 @@ import QtQuick 2.15
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.core as PlasmaCore
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 "util.js" as Util
// notification properties are in BaseNotificationItem
BaseNotificationItem {
id: notificationItem
@ -80,7 +79,7 @@ BaseNotificationItem {
maximumLineCount: 3
wrapMode: Text.WordWrap
elide: Text.ElideRight
text: Util.determineNotificationHeadingText(notificationItem)
text: MobileShell.NotificationsUtils.determineNotificationHeadingText(notificationItem)
visible: text !== ""
font.weight: Font.DemiBold
}

View file

@ -9,6 +9,7 @@ import QtQuick 2.8
import QtQuick.Layouts 1.1
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.components 3.0 as PlasmaComponents
@ -17,8 +18,6 @@ import org.kde.notificationmanager as NotificationManager
import org.kde.coreaddons 1.0 as KCoreAddons
import "util.js" as Util
PlasmaComponents.Label {
id: ageLabel
@ -43,7 +42,7 @@ PlasmaComponents.Label {
Component.onCompleted: updateAgoText()
function updateAgoText() {
ageLabel.agoText = Util.generateNotificationHeaderAgoText(time, jobState);
ageLabel.agoText = MobileShell.NotificationsUtils.generateNotificationHeaderAgoText(time, jobState);
}
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 0.8
@ -53,5 +52,5 @@ PlasmaComponents.Label {
property string agoText: ""
visible: text !== ""
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.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.extras 2.0 as PlasmaExtras
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.plasma.core as PlasmaCore
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

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)
{
if (!item1 || !item2 || item1 == item2 || item1->parentItem() != item2->parentItem()) {

View file

@ -9,6 +9,7 @@
#include <QObject>
#include <QQuickItem>
#include <qqmlregistration.h>
#include <KConfigWatcher>
#include <KIO/ApplicationLauncherJob>
@ -22,11 +23,12 @@
class ShellUtil : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged)
public:
ShellUtil(QObject *parent = nullptr);
static ShellUtil *instance();
/**
* 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-License-Identifier: GPL-2.0-or-later
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(mobileshellstateplugin_SRCS
mobileshellstateplugin.cpp
shelldbusobject.cpp
shelldbusclient.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})
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
PUBLIC
@ -40,9 +39,4 @@ target_link_libraries(mobileshellstateplugin
KF6::PlasmaQuick
)
# we compiled the qml files, just install qmldir
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)
ecm_finalize_qml_module(mobileshellstateplugin)

View file

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

View file

@ -7,15 +7,17 @@
#include <QDBusServiceWatcher>
#include <QObject>
#include <QString>
#include <qqmlregistration.h>
class LockscreenDBusClient : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool lockscreenActive READ lockscreenActive NOTIFY lockscreenActiveChanged);
public:
explicit LockscreenDBusClient(QObject *parent = nullptr);
static LockscreenDBusClient *self();
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()
{
connect(m_interface, &OrgKdePlasmashellInterface::isActionDrawerOpenChanged, this, &ShellDBusClient::updateIsActionDrawerOpen);

View file

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

View file

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

View file

@ -1,18 +1,17 @@
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
# 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
paginatemodel.cpp
quicksetting.cpp
quicksettingsmodel.cpp
quicksettingsplugin.cpp
quicksettingsconfig.cpp
savedquicksettings.cpp
savedquicksettingsmodel.cpp
)
target_link_libraries(quicksettingsplugin
target_link_libraries(quicksettingsplugin PRIVATE
Qt::Qml
Qt::DBus
Qt::Gui
@ -23,10 +22,6 @@ target_link_libraries(quicksettingsplugin
KF6::Package
)
set_property(TARGET quicksettingsplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/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)
ecm_finalize_qml_module(quicksettingsplugin)

View file

@ -7,6 +7,7 @@
#pragma once
#include <QAbstractListModel>
#include <qqmlregistration.h>
/**
* @class PaginateModel
@ -19,6 +20,8 @@
class PaginateModel : public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
/** Holds the number of elements that will fit in a page */
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
{
Q_OBJECT
QML_ELEMENT
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 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(QQmlListProperty<QObject> children READ children CONSTANT)
Q_CLASSINFO("DefaultProperty", "children")
QML_NAMED_ELEMENT("QuickSetting")
public:
QuickSetting(QObject *parent = nullptr);

View file

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

View file

@ -22,8 +22,6 @@ class QuickSettingsConfig : public QObject
Q_OBJECT
public:
static QuickSettingsConfig *self();
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
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(SavedQuickSettingsModel *enabledModel READ enabledQuickSettingsModel CONSTANT)
Q_PROPERTY(SavedQuickSettingsModel *disabledModel READ disabledQuickSettingsModel CONSTANT)

View file

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

View file

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

View file

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

View file

@ -11,6 +11,7 @@
#include <KSharedConfig>
#include <QDBusConnection>
#include <QObject>
#include <qqmlregistration.h>
/**
* @short Wrapper class to access and control mobile shell specific settings.
@ -20,6 +21,8 @@
class MobileShellSettings : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(Settings)
QML_SINGLETON
// general
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)
public:
static MobileShellSettings *self();
MobileShellSettings(QObject *parent = nullptr);
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-License-Identifier: GPL-2.0-or-later
set(windowplugin_SRCS
windowplugin.cpp
windowutil.cpp
)
qt_add_resources(RESOURCES resources.qrc)
add_library(windowplugin SHARED ${windowplugin_SRCS} ${RESOURCES})
ecm_add_qml_module(windowplugin URI org.kde.plasma.private.mobileshell.windowplugin GENERATE_PLUGIN_SOURCE)
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::DBus
Qt::Gui
@ -18,9 +18,4 @@ target_link_libraries(windowplugin
KF6::ConfigWidgets
)
set_property(TARGET windowplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/private/mobileshell/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)
ecm_finalize_qml_module(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();
}
WindowUtil *WindowUtil::instance()
{
static WindowUtil *inst = new WindowUtil();
return inst;
}
bool WindowUtil::isShowingDesktop() const
{
return m_showingDesktop;

View file

@ -12,6 +12,7 @@
#include <QQuickItem>
#include <QQuickWindow>
#include <QTimer>
#include <qqmlregistration.h>
#include <KConfigWatcher>
#include <KSharedConfig>
@ -29,13 +30,15 @@
class WindowUtil : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool isShowingDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged)
Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged)
Q_PROPERTY(bool activeWindowIsShell READ activeWindowIsShell NOTIFY activeWindowIsShellChanged)
public:
WindowUtil(QObject *parent = nullptr);
static WindowUtil *instance();
/**
* 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.kirigami 2.10 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.plasma.private.mobileshell as MobileShell
Item {
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.kirigami as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
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.private.mobile.homescreen.folio 1.0 as Folio
import "./delegate"

View file

@ -6,9 +6,9 @@ import QtQuick.Window 2.12
import QtQuick.Layouts 1.1
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.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.kirigami 2.10 as Kirigami
import "./delegate"

View file

@ -8,7 +8,7 @@ import QtQuick.Controls as QQC2
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 "./delegate"

View file

@ -8,7 +8,7 @@ import QtQuick.Controls as QQC2
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
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.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 "./delegate"

View file

@ -5,8 +5,8 @@ import QtQuick
import QtQuick.Window
import QtQuick.Layouts
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
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.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 {
id: delegate

View file

@ -9,8 +9,8 @@ import QtQuick.Effects
import org.kde.kirigami 2.20 as Kirigami
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 1.0 as MobileShell
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell as MobileShell
AbstractDelegate {
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.components 3.0 as PlasmaComponents
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
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.private.mobile.homescreen.folio 1.0 as Folio
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.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 '../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.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.state 1.0 as MobileShellState
import org.kde.plasma.private.mobileshell.state as MobileShellState
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.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
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.kirigami 2.10 as Kirigami
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
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.private.mobile.homescreen.halcyon 1.0 as Halcyon
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.plasma.mm 1.0 as PlasmaMM
import org.kde.plasma.mm as PlasmaMM
Kirigami.Dialog {
id: dialog

View file

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

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
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

View file

@ -11,7 +11,7 @@ import QtQuick.Controls 2.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.plasma5support 2.0 as P5Support
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 {
id: root

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