mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
quicksettings: Extract out from mobileshell into separate plugin
This commit is contained in:
parent
158af43fd4
commit
462d99b83f
51 changed files with 284 additions and 152 deletions
|
|
@ -5,4 +5,5 @@
|
|||
add_subdirectory(mmplugin)
|
||||
add_subdirectory(mobileshell)
|
||||
add_subdirectory(mobileshellstate)
|
||||
add_subdirectory(quicksettingsplugin)
|
||||
add_subdirectory(windowplugin)
|
||||
|
|
|
|||
|
|
@ -9,11 +9,6 @@ set(mobileshellplugin_SRCS
|
|||
mobileshellsettings.cpp
|
||||
shellutil.cpp
|
||||
components/direction.cpp
|
||||
quicksettings/quicksetting.cpp
|
||||
quicksettings/paginatemodel.cpp
|
||||
quicksettings/quicksettingsmodel.cpp
|
||||
quicksettings/savedquicksettings.cpp
|
||||
quicksettings/savedquicksettingsmodel.cpp
|
||||
notifications/notificationthumbnailer.cpp
|
||||
notifications/notificationfilemenu.cpp
|
||||
taskswitcher/displaysmodel.cpp
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
|
||||
#include "taskswitcher/displaysmodel.h"
|
||||
|
||||
#include "quicksettings/paginatemodel.h"
|
||||
#include "quicksettings/quicksetting.h"
|
||||
#include "quicksettings/quicksettingsmodel.h"
|
||||
|
||||
#include "mobileshellsettings.h"
|
||||
#include "shellutil.h"
|
||||
|
||||
|
|
@ -40,12 +36,6 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
|||
return MobileShellSettings::self();
|
||||
});
|
||||
|
||||
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");
|
||||
|
||||
// components
|
||||
qmlRegisterType<Direction>(uri, 1, 0, "Direction");
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
|
||||
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
|
||||
const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings");
|
||||
|
||||
MobileShellSettings *MobileShellSettings::self()
|
||||
{
|
||||
|
|
@ -35,9 +34,6 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
|||
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
||||
Q_EMIT actionDrawerTopLeftModeChanged();
|
||||
Q_EMIT actionDrawerTopRightModeChanged();
|
||||
} else if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||
Q_EMIT enabledQuickSettingsChanged();
|
||||
Q_EMIT disabledQuickSettingsChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -145,47 +141,3 @@ void MobileShellSettings::setActionDrawerTopRightMode(ActionDrawerMode actionDra
|
|||
group.writeEntry("actionDrawerTopRightMode", (int)actionDrawerMode, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
QList<QString> MobileShellSettings::enabledQuickSettings() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
// TODO move defaults to file
|
||||
// we aren't worried about quicksettings not showing up though, any that are not specified will be automatically added to the end
|
||||
return group.readEntry("enabledQuickSettings",
|
||||
QList<QString>{QStringLiteral("org.kde.plasma.quicksetting.wifi"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.mobiledata"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.bluetooth"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.flashlight"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.screenrotation"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.settingsapp"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.airplanemode"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.audio"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.battery"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.record"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.nightcolor"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.screenshot"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.powermenu"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.donotdisturb"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.caffeine"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.keyboardtoggle")});
|
||||
}
|
||||
|
||||
void MobileShellSettings::setEnabledQuickSettings(QList<QString> &list)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
group.writeEntry("enabledQuickSettings", list, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
QList<QString> MobileShellSettings::disabledQuickSettings() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
return group.readEntry("disabledQuickSettings", QList<QString>{});
|
||||
}
|
||||
|
||||
void MobileShellSettings::setDisabledQuickSettings(QList<QString> &list)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
group.writeEntry("disabledQuickSettings", list, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,30 +151,6 @@ public:
|
|||
*/
|
||||
void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode);
|
||||
|
||||
/**
|
||||
* Get the list of IDs of quick settings that are enabled.
|
||||
*/
|
||||
QList<QString> enabledQuickSettings() const;
|
||||
|
||||
/**
|
||||
* Set the list of quick settings that are enabled.
|
||||
*
|
||||
* @param list A list of quick setting IDs.
|
||||
*/
|
||||
void setEnabledQuickSettings(QList<QString> &list);
|
||||
|
||||
/**
|
||||
* Get the list of IDs of quick settings that are disabled.
|
||||
*/
|
||||
QList<QString> disabledQuickSettings() const;
|
||||
|
||||
/**
|
||||
* Set the list of quick settings that are disabled.
|
||||
*
|
||||
* @param list A list of quick setting IDs.
|
||||
*/
|
||||
void setDisabledQuickSettings(QList<QString> &list);
|
||||
|
||||
Q_SIGNALS:
|
||||
void vibrationsEnabledChanged();
|
||||
void vibrationIntensityChanged();
|
||||
|
|
@ -185,8 +161,6 @@ Q_SIGNALS:
|
|||
void taskSwitcherPreviewsEnabledChanged();
|
||||
void actionDrawerTopLeftModeChanged();
|
||||
void actionDrawerTopRightModeChanged();
|
||||
void enabledQuickSettingsChanged();
|
||||
void disabledQuickSettingsChanged();
|
||||
|
||||
private:
|
||||
KConfigWatcher::Ptr m_configWatcher;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ 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"
|
||||
|
||||
/**
|
||||
|
|
@ -80,7 +82,7 @@ PlasmaCore.ColorScope {
|
|||
}
|
||||
anchors.margins: minWidthHeight * 0.06
|
||||
|
||||
MobileShell.NotificationsWidget {
|
||||
Notifications.NotificationsWidget {
|
||||
id: notificationWidget
|
||||
historyModel: root.actionDrawer.notificationModel
|
||||
historyModelType: root.actionDrawer.notificationModelType
|
||||
|
|
@ -143,7 +145,7 @@ PlasmaCore.ColorScope {
|
|||
font.weight: Font.Light
|
||||
}
|
||||
|
||||
MobileShell.MediaControlsWidget {
|
||||
MediaControls.MediaControlsWidget {
|
||||
id: mediaWidget
|
||||
property real fullHeight: visible ? height + PlasmaCore.Units.smallSpacing * 6 : 0
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ 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/notifications" as Notifications
|
||||
import "quicksettings"
|
||||
|
||||
/**
|
||||
|
|
@ -94,7 +95,7 @@ PlasmaCore.ColorScope {
|
|||
}
|
||||
}
|
||||
|
||||
MobileShell.NotificationsWidget {
|
||||
Notifications.NotificationsWidget {
|
||||
id: notificationWidget
|
||||
historyModel: root.actionDrawer.notificationModel
|
||||
historyModelType: root.actionDrawer.notificationModelType
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import QtQuick.Window 2.2
|
|||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
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.quicksettingsplugin as QS
|
||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||
|
||||
import "../../components" as Components
|
||||
import "../../components/util.js" as Util
|
||||
|
|
@ -48,7 +48,7 @@ Item {
|
|||
property real minimizedViewProgress: 0
|
||||
property real fullViewProgress: 1
|
||||
|
||||
readonly property MobileShell.QuickSettingsModel quickSettingsModel: MobileShell.QuickSettingsModel {}
|
||||
readonly property QS.QuickSettingsModel quickSettingsModel: QS.QuickSettingsModel {}
|
||||
|
||||
readonly property int columnCount: Math.floor(width/columnWidth)
|
||||
readonly property int rowCount: {
|
||||
|
|
@ -131,7 +131,7 @@ Item {
|
|||
anchors.right: parent.right
|
||||
|
||||
Repeater {
|
||||
model: MobileShell.PaginateModel {
|
||||
model: QS.PaginateModel {
|
||||
sourceModel: quickSettingsModel
|
||||
pageSize: minimizedColumns
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ Item {
|
|||
required property int index
|
||||
|
||||
Repeater {
|
||||
model: MobileShell.PaginateModel {
|
||||
model: QS.PaginateModel {
|
||||
sourceModel: quickSettingsModel
|
||||
pageSize: root.pageSize
|
||||
firstItem: pageSize * flow.index
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ import Qt5Compat.GraphicalEffects
|
|||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
||||
|
||||
import "../../statusbar" as StatusBar
|
||||
import "../../components" as Components
|
||||
import "../../widgets/mediacontrols" as MediaControls
|
||||
import "../"
|
||||
|
||||
/**
|
||||
|
|
@ -105,7 +105,7 @@ Components.BaseItem {
|
|||
width: parent.width
|
||||
}
|
||||
|
||||
MobileShell.MediaControlsWidget {
|
||||
MediaControls.MediaControlsWidget {
|
||||
id: mediaWidget
|
||||
property real fullHeight: height + Layout.topMargin
|
||||
Layout.fillWidth: true
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import QtQuick.Layouts 1.1
|
|||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ QuickSettingsDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
MobileShell.HapticsEffectLoader {
|
||||
Components.HapticsEffectLoader {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import Qt5Compat.GraphicalEffects
|
|||
import org.kde.kirigami 2.12 as Kirigami
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
import "../../statusbar" as StatusBar
|
||||
import "../../components" as Components
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import QtQuick.Layouts
|
|||
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.plasma.private.nanoshell as NanoShell
|
||||
import org.kde.plasma.private.mobileshell as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import org.kde.plasma.private.mobileshell as MobileShell
|
|||
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.
|
||||
|
|
@ -162,7 +164,7 @@ Item {
|
|||
}
|
||||
|
||||
// homescreen visual component
|
||||
MobileShell.BaseItem {
|
||||
Components.BaseItem {
|
||||
id: itemContainer
|
||||
anchors.fill: parent
|
||||
|
||||
|
|
@ -233,7 +235,7 @@ Item {
|
|||
}
|
||||
|
||||
// start app animation component
|
||||
MobileShell.StartupFeedback {
|
||||
Components.StartupFeedback {
|
||||
id: startupFeedback
|
||||
z: 999999
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ import org.kde.taskmanager 0.1 as TaskManager
|
|||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
|
||||
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import org.kde.taskmanager 0.1 as TaskManager
|
|||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
|
||||
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 "../components" as Components
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ Item {
|
|||
|
||||
property NavigationPanelButton activeButton
|
||||
|
||||
MobileShell.HapticsEffectLoader {
|
||||
Components.HapticsEffectLoader {
|
||||
id: haptics
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ 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 "../../dataproviders" as DataProviders
|
||||
|
||||
RowLayout {
|
||||
readonly property var provider: MobileShell.BatteryInfo {}
|
||||
readonly property var provider: DataProviders.BatteryInfo {}
|
||||
property real textPixelSize: PlasmaCore.Units.gridUnit * 0.6
|
||||
|
||||
visible: provider.isVisible
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
#include "shellutil.h"
|
||||
#include "mobileshellsettings.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KFileUtils>
|
||||
|
|
|
|||
32
components/quicksettingsplugin/CMakeLists.txt
Normal file
32
components/quicksettingsplugin/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
add_library(quicksettingsplugin)
|
||||
target_sources(quicksettingsplugin PRIVATE
|
||||
paginatemodel.cpp
|
||||
quicksetting.cpp
|
||||
quicksettingsmodel.cpp
|
||||
quicksettingsplugin.cpp
|
||||
quicksettingsconfig.cpp
|
||||
savedquicksettings.cpp
|
||||
savedquicksettingsmodel.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(quicksettingsplugin
|
||||
Qt::Qml
|
||||
Qt::DBus
|
||||
Qt::Gui
|
||||
Qt::Quick
|
||||
KF6::WaylandClient
|
||||
KF6::Service
|
||||
KF6::ConfigWidgets
|
||||
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)
|
||||
|
||||
|
||||
8
components/quicksettingsplugin/qmldir
Normal file
8
components/quicksettingsplugin/qmldir
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# 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
|
||||
|
||||
|
||||
76
components/quicksettingsplugin/quicksettingsconfig.cpp
Normal file
76
components/quicksettingsplugin/quicksettingsconfig.cpp
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "quicksettingsconfig.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
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)}
|
||||
{
|
||||
m_configWatcher = KConfigWatcher::create(m_config);
|
||||
|
||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
||||
if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||
Q_EMIT enabledQuickSettingsChanged();
|
||||
Q_EMIT disabledQuickSettingsChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QList<QString> QuickSettingsConfig::enabledQuickSettings() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
// TODO move defaults to file
|
||||
// we aren't worried about quicksettings not showing up though, any that are not specified will be automatically added to the end
|
||||
return group.readEntry("enabledQuickSettings",
|
||||
QList<QString>{QStringLiteral("org.kde.plasma.quicksetting.wifi"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.mobiledata"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.bluetooth"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.flashlight"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.screenrotation"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.settingsapp"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.airplanemode"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.audio"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.battery"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.record"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.nightcolor"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.screenshot"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.powermenu"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.donotdisturb"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.caffeine"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.keyboardtoggle")});
|
||||
}
|
||||
|
||||
void QuickSettingsConfig::setEnabledQuickSettings(QList<QString> &list)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
group.writeEntry("enabledQuickSettings", list, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
QList<QString> QuickSettingsConfig::disabledQuickSettings() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
return group.readEntry("disabledQuickSettings", QList<QString>{});
|
||||
}
|
||||
|
||||
void QuickSettingsConfig::setDisabledQuickSettings(QList<QString> &list)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP};
|
||||
group.writeEntry("disabledQuickSettings", list, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
60
components/quicksettingsplugin/quicksettingsconfig.h
Normal file
60
components/quicksettingsplugin/quicksettingsconfig.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KConfigWatcher>
|
||||
#include <KSharedConfig>
|
||||
#include <QObject>
|
||||
|
||||
/**
|
||||
* @short Wrapper class to access and control mobile shell specific settings.
|
||||
*
|
||||
* @author Devin Lin <devin@kde.org>
|
||||
*/
|
||||
class QuickSettingsConfig : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QuickSettingsConfig *self();
|
||||
|
||||
QuickSettingsConfig(QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Get the list of IDs of quick settings that are enabled.
|
||||
*/
|
||||
QList<QString> enabledQuickSettings() const;
|
||||
|
||||
/**
|
||||
* Set the list of quick settings that are enabled.
|
||||
*
|
||||
* @param list A list of quick setting IDs.
|
||||
*/
|
||||
void setEnabledQuickSettings(QList<QString> &list);
|
||||
|
||||
/**
|
||||
* Get the list of IDs of quick settings that are disabled.
|
||||
*/
|
||||
QList<QString> disabledQuickSettings() const;
|
||||
|
||||
/**
|
||||
* Set the list of quick settings that are disabled.
|
||||
*
|
||||
* @param list A list of quick setting IDs.
|
||||
*/
|
||||
void setDisabledQuickSettings(QList<QString> &list);
|
||||
|
||||
Q_SIGNALS:
|
||||
void enabledQuickSettingsChanged();
|
||||
void disabledQuickSettingsChanged();
|
||||
|
||||
private:
|
||||
KConfigWatcher::Ptr m_configWatcher;
|
||||
KSharedConfig::Ptr m_config;
|
||||
};
|
||||
23
components/quicksettingsplugin/quicksettingsplugin.cpp
Normal file
23
components/quicksettingsplugin/quicksettingsplugin.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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");
|
||||
}
|
||||
18
components/quicksettingsplugin/quicksettingsplugin.h
Normal file
18
components/quicksettingsplugin/quicksettingsplugin.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// 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;
|
||||
};
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
SavedQuickSettings::SavedQuickSettings(QObject *parent)
|
||||
: QObject{parent}
|
||||
, m_settings{new MobileShellSettings{this}}
|
||||
, m_settings{new QuickSettingsConfig{this}}
|
||||
, m_validPackages{}
|
||||
, m_enabledPackages{}
|
||||
, m_disabledPackages{}
|
||||
|
|
@ -45,10 +45,10 @@ SavedQuickSettings::SavedQuickSettings(QObject *parent)
|
|||
}
|
||||
|
||||
// subscribe to config changes
|
||||
connect(m_settings, &MobileShellSettings::enabledQuickSettingsChanged, this, [this]() {
|
||||
connect(m_settings, &QuickSettingsConfig::enabledQuickSettingsChanged, this, [this]() {
|
||||
m_updateTimer->start();
|
||||
});
|
||||
connect(m_settings, &MobileShellSettings::disabledQuickSettingsChanged, this, [this]() {
|
||||
connect(m_settings, &QuickSettingsConfig::disabledQuickSettingsChanged, this, [this]() {
|
||||
m_updateTimer->start();
|
||||
});
|
||||
|
||||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mobileshellsettings.h"
|
||||
#include "qqml.h"
|
||||
#include "quicksetting.h"
|
||||
#include "quicksettingsconfig.h"
|
||||
#include "savedquicksettingsmodel.h"
|
||||
|
||||
#include <KPackage/Package>
|
||||
|
|
@ -41,7 +41,7 @@ private:
|
|||
void refreshModel();
|
||||
void saveModel();
|
||||
|
||||
MobileShellSettings *m_settings;
|
||||
QuickSettingsConfig *m_settings;
|
||||
QList<KPluginMetaData *> m_validPackages;
|
||||
QList<KPluginMetaData *> m_enabledPackages;
|
||||
QList<KPluginMetaData *> m_disabledPackages;
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "mobileshellsettings.h"
|
||||
#include "qqml.h"
|
||||
#include "quicksetting.h"
|
||||
|
||||
|
|
@ -9,8 +9,8 @@ import QtQuick.Controls 2.15 as QQC2
|
|||
|
||||
import org.kde.kirigami 2.19 as Kirigami
|
||||
import org.kde.kcm 1.3 as KCM
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
id: root
|
||||
|
|
@ -96,7 +96,7 @@ Kirigami.ScrollablePage {
|
|||
}
|
||||
}
|
||||
|
||||
MobileShell.SavedQuickSettings {
|
||||
QS.SavedQuickSettings {
|
||||
id: savedQuickSettings
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Airplane Mode")
|
||||
icon: "network-flightmode-on"
|
||||
status: ""
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ import QtQuick
|
|||
|
||||
import org.kde.plasma.private.mobileshell as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Sound")
|
||||
icon: "audio-speakers-symbolic"
|
||||
status: i18n("%1%", MobileShellState.AudioProvider.volumeValue)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
property var batteryInfo: MobileShell.BatteryInfo {}
|
||||
|
||||
text: i18n("Battery")
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import org.kde.bluezqt 1.0 as BluezQt
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
property QtObject btManager: BluezQt.Manager
|
||||
property var connectedDevices: []
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Caffeine")
|
||||
icon: "system-suspend-hibernate"
|
||||
status: enabled ? i18n("Tap to disable sleep suspension") : i18n("Tap to suspend sleep")
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
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.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Do Not Disturb")
|
||||
icon: enabled ? "notifications-disabled" : "notifications"
|
||||
status: ""
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.quicksetting.flashlight 1.0
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Flashlight")
|
||||
icon: "flashlight-on"
|
||||
enabled: FlashlightUtil.torchEnabled
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
id: root
|
||||
|
||||
PlasmaNM.Handler {
|
||||
|
|
@ -17,7 +17,6 @@ MobileShell.QuickSetting {
|
|||
id: wirelessStatus
|
||||
}
|
||||
|
||||
|
||||
text: i18n("Hotspot")
|
||||
icon: "network-wireless-hotspot"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@
|
|||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.workspace.keyboardlayout 1.0 as Keyboards
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Virtual Keyboard")
|
||||
icon: "input-keyboard-virtual"
|
||||
status: enabled ? i18n("On") :
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ import QtQuick 2.15
|
|||
|
||||
import org.kde.plasma.mm 1.0 as PlasmaMM
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Mobile Data")
|
||||
icon: "network-modem"
|
||||
status: {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
*/
|
||||
|
||||
import org.kde.colorcorrect 0.1 as CC
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.quicksetting.nightcolor 1.0 as NightColor
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Night Color")
|
||||
icon: "redshift-status-on"
|
||||
enabled: NightColor.NightColorUtil.enabled
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.quicksetting.powermenu 1.0 as PowerMenu
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Shut Down")
|
||||
icon: "system-shutdown-symbolic"
|
||||
status: i18n("Open power menu")
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
||||
import org.kde.pipewire.record 0.1 as PWRec
|
||||
import org.kde.taskmanager 0.1 as TaskManager
|
||||
import org.kde.plasma.quicksetting.record 1.0
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
id: root
|
||||
text: switch (record.state) {
|
||||
case PWRec.PipeWireRecord.Idle:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.quicksetting.screenrotation 1.0
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Auto-rotate")
|
||||
icon: "rotation-allowed"
|
||||
settingsCommand: "plasma-open-settings kcm_kscreen"
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
||||
import org.kde.plasma.quicksetting.screenshot 1.0
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Screenshot")
|
||||
status: i18n("Tap to screenshot")
|
||||
icon: "spectacle"
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
text: i18n("Settings")
|
||||
status: i18n("Tap to open")
|
||||
icon: "configure"
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
QS.QuickSetting {
|
||||
PlasmaNM.Handler {
|
||||
id: nmHandler
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue