2022-02-13 04:23:57 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <KConfigGroup>
|
|
|
|
|
#include <KConfigWatcher>
|
|
|
|
|
#include <KSharedConfig>
|
2023-10-21 05:46:31 +00:00
|
|
|
#include <QDBusConnection>
|
2022-02-13 04:23:57 +00:00
|
|
|
#include <QObject>
|
2023-11-02 11:08:17 +00:00
|
|
|
#include <qqmlregistration.h>
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2022-05-06 01:02:18 +00:00
|
|
|
/**
|
|
|
|
|
* @short Wrapper class to access and control mobile shell specific settings.
|
|
|
|
|
*
|
|
|
|
|
* @author Devin Lin <devin@kde.org>
|
|
|
|
|
*/
|
2022-03-21 14:00:03 +00:00
|
|
|
class MobileShellSettings : public QObject
|
2022-02-13 04:23:57 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2023-11-02 11:08:17 +00:00
|
|
|
QML_NAMED_ELEMENT(Settings)
|
|
|
|
|
QML_SINGLETON
|
2022-05-21 14:54:33 +00:00
|
|
|
|
|
|
|
|
// general
|
2022-04-29 20:15:53 +00:00
|
|
|
Q_PROPERTY(bool vibrationsEnabled READ vibrationsEnabled WRITE setVibrationsEnabled NOTIFY vibrationsEnabledChanged)
|
2022-05-06 01:02:18 +00:00
|
|
|
Q_PROPERTY(int vibrationDuration READ vibrationDuration WRITE setVibrationDuration NOTIFY vibrationDurationChanged)
|
2022-04-30 00:02:33 +00:00
|
|
|
Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged)
|
2022-05-21 14:54:33 +00:00
|
|
|
|
2024-06-28 02:05:42 +00:00
|
|
|
// status bar
|
|
|
|
|
Q_PROPERTY(bool dateInStatusBar READ dateInStatusBar WRITE setDateInStatusBar NOTIFY dateInStatusBarChanged)
|
2024-10-17 17:20:14 +00:00
|
|
|
Q_PROPERTY(float statusBarScaleFactor READ statusBarScaleFactor WRITE setStatusBarScaleFactor NOTIFY statusBarScaleFactorChanged)
|
2025-03-19 20:09:33 +00:00
|
|
|
Q_PROPERTY(bool showBatteryPercentage READ showBatteryPercentage WRITE setShowBatteryPercentage NOTIFY showBatteryPercentageChanged)
|
2024-06-28 02:05:42 +00:00
|
|
|
|
2022-05-21 14:54:33 +00:00
|
|
|
// navigation panel
|
2022-03-17 03:20:36 +00:00
|
|
|
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
2025-03-19 20:09:33 +00:00
|
|
|
Q_PROPERTY(bool alwaysShowKeyboardToggleOnNavigationPanel READ alwaysShowKeyboardToggleOnNavigationPanel WRITE setAlwaysShowKeyboardToggleOnNavigationPanel NOTIFY alwaysShowKeyboardToggleOnNavigationPanelChanged)
|
2025-12-14 04:38:13 +00:00
|
|
|
Q_PROPERTY(bool gesturePanelEnabled READ gesturePanelEnabled WRITE setGesturePanelEnabled NOTIFY gesturePanelEnabledChanged)
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2022-05-31 03:37:00 +00:00
|
|
|
// action drawer
|
|
|
|
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged)
|
|
|
|
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged)
|
|
|
|
|
|
2025-08-19 11:35:11 +00:00
|
|
|
// quicksettings
|
|
|
|
|
Q_PROPERTY(int quickSettingsColumns READ quickSettingsColumns WRITE setQuickSettingsColumns NOTIFY quickSettingsColumnsChanged)
|
|
|
|
|
|
2023-03-29 06:49:09 +00:00
|
|
|
// convergence mode
|
|
|
|
|
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
|
|
|
|
|
|
2025-04-21 15:56:33 +00:00
|
|
|
// Auto Hide Panels
|
|
|
|
|
Q_PROPERTY(bool autoHidePanelsEnabled READ autoHidePanelsEnabled WRITE setAutoHidePanelsEnabled NOTIFY autoHidePanelsEnabledChanged)
|
|
|
|
|
|
2024-11-29 10:49:24 +00:00
|
|
|
// logout dialog
|
|
|
|
|
Q_PROPERTY(bool allowLogout READ allowLogout READ allowLogout NOTIFY allowLogoutChanged)
|
|
|
|
|
|
2025-03-13 20:11:41 +00:00
|
|
|
// locksreen shortcut icons
|
2025-03-19 20:09:33 +00:00
|
|
|
Q_PROPERTY(LockscreenButtonAction lockscreenLeftButtonAction READ lockscreenLeftButtonAction WRITE setLockscreenLeftButtonAction NOTIFY lockscreenLeftButtonActionChanged)
|
|
|
|
|
Q_PROPERTY(LockscreenButtonAction lockscreenRightButtonAction READ lockscreenRightButtonAction WRITE setLockscreenRightButtonAction NOTIFY lockscreenRightButtonActionChanged)
|
2025-03-13 20:11:41 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
public:
|
|
|
|
|
MobileShellSettings(QObject *parent = nullptr);
|
|
|
|
|
|
2022-05-31 03:37:00 +00:00
|
|
|
enum ActionDrawerMode {
|
|
|
|
|
Pinned = 0, /** The drawer when pulled down is in its pinned mode. A second swipe fully expands it.*/
|
|
|
|
|
Expanded /** The drawer is fully expanded when pulled down.*/
|
|
|
|
|
};
|
|
|
|
|
Q_ENUM(ActionDrawerMode)
|
|
|
|
|
|
2025-03-13 20:11:41 +00:00
|
|
|
enum LockscreenButtonAction {
|
|
|
|
|
None, // hide the button
|
|
|
|
|
Flashlight, // toggle flashlight/torch
|
|
|
|
|
Camera, // camera
|
|
|
|
|
OpenApp // cant be selected, no support yet
|
|
|
|
|
};
|
|
|
|
|
Q_ENUM(LockscreenButtonAction)
|
|
|
|
|
|
2022-05-06 01:02:18 +00:00
|
|
|
/**
|
|
|
|
|
* Get whether shell vibrations are enabled.
|
|
|
|
|
*/
|
2022-04-29 20:15:53 +00:00
|
|
|
bool vibrationsEnabled() const;
|
2022-05-06 01:02:18 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether shell vibrations should be enabled.
|
|
|
|
|
*
|
|
|
|
|
* @param vibrationsEnabled Whether vibrations are enabled.
|
|
|
|
|
*/
|
2022-04-29 20:15:53 +00:00
|
|
|
void setVibrationsEnabled(bool vibrationsEnabled);
|
|
|
|
|
|
2022-05-06 01:02:18 +00:00
|
|
|
/**
|
|
|
|
|
* Get the duration of a standard vibration event, in milliseconds.
|
|
|
|
|
* Different types of vibration events may be calculated off of this.
|
|
|
|
|
*/
|
|
|
|
|
int vibrationDuration() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the duration of a standard vibration event, in milliseconds.
|
|
|
|
|
*
|
|
|
|
|
* @param vibrationDuration The duration of a standard vibration event.
|
|
|
|
|
*/
|
|
|
|
|
void setVibrationDuration(int vibrationDuration);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether animations are enabled in the shell.
|
|
|
|
|
*
|
|
|
|
|
* If false, vibrations will either be disabled or minimized as much as possible.
|
|
|
|
|
* TODO: integrate with animation speed (in settings at "Workspace Behaviour->General Behaviour"),
|
|
|
|
|
* which affects applications as well.
|
|
|
|
|
*/
|
2022-04-30 00:02:33 +00:00
|
|
|
bool animationsEnabled() const;
|
2022-05-06 01:02:18 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether animations are enabled in the shell.
|
|
|
|
|
*
|
|
|
|
|
* @param animationsEnabled Whether animations should be enabled in the shell.
|
|
|
|
|
*/
|
2022-04-30 00:02:33 +00:00
|
|
|
void setAnimationsEnabled(bool animationsEnabled);
|
|
|
|
|
|
2024-06-28 02:05:42 +00:00
|
|
|
/**
|
|
|
|
|
* Whether date is shown in the status bar.
|
|
|
|
|
*
|
|
|
|
|
* If true, date will be shown in the status bar next to the clock.
|
|
|
|
|
*/
|
|
|
|
|
bool dateInStatusBar() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether date is shown in the status bar.
|
|
|
|
|
*
|
|
|
|
|
* @param dateInStatusBar Whether date is shown in the status bar.
|
|
|
|
|
*/
|
|
|
|
|
void setDateInStatusBar(bool dateInStatusBar);
|
|
|
|
|
|
2024-10-17 17:20:14 +00:00
|
|
|
/**
|
|
|
|
|
* Scale factor for status bar height.
|
|
|
|
|
*
|
|
|
|
|
* Status bar height will be multiplied by this value.
|
|
|
|
|
*/
|
|
|
|
|
float statusBarScaleFactor() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the scale factor for the status bar's height.
|
|
|
|
|
*
|
|
|
|
|
* @param statusBarScaleFactor Scale factor for status bar height.
|
|
|
|
|
*/
|
|
|
|
|
void setStatusBarScaleFactor(float statusBarScaleFactor);
|
|
|
|
|
|
2025-03-19 20:09:33 +00:00
|
|
|
/**
|
|
|
|
|
* Whether the battery percentage is shown in the status bar.
|
|
|
|
|
*
|
|
|
|
|
* If true, the percentage will be shown next to the battery in the status bar.
|
|
|
|
|
*/
|
|
|
|
|
bool showBatteryPercentage() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the battery percentage is shown in the status bar.
|
|
|
|
|
*
|
|
|
|
|
* @param showBatteryPercentage Whether the battery percentage is shown in the status bar.
|
|
|
|
|
*/
|
|
|
|
|
void setShowBatteryPercentage(bool showBatteryPercentage);
|
|
|
|
|
|
2022-05-06 01:02:18 +00:00
|
|
|
/**
|
|
|
|
|
* Whether the navigation panel is enabled.
|
|
|
|
|
*
|
|
|
|
|
* If this is false, then gesture based navigation is used.
|
|
|
|
|
*/
|
2022-02-13 04:23:57 +00:00
|
|
|
bool navigationPanelEnabled() const;
|
2022-05-06 01:02:18 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the navigation panel is enabled.
|
|
|
|
|
*
|
|
|
|
|
* @param navigationPanelEnabled Whether the navigation panel should be enabled.
|
|
|
|
|
*/
|
2022-03-17 03:20:36 +00:00
|
|
|
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
|
|
|
|
|
2025-12-14 04:38:13 +00:00
|
|
|
/**
|
|
|
|
|
* Whether the gesture panel is enabled.
|
|
|
|
|
*
|
|
|
|
|
* This is only applicable when navigationPanelEnabled() = false (gesture mode).
|
|
|
|
|
*/
|
|
|
|
|
bool gesturePanelEnabled() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the gesture panel is enabled.
|
|
|
|
|
*
|
|
|
|
|
* @param gesturePanelEnabled Whether the gesture panel should be enabled.
|
|
|
|
|
*/
|
|
|
|
|
void setGesturePanelEnabled(bool gesturePanelEnabled);
|
|
|
|
|
|
2023-11-05 20:14:37 +00:00
|
|
|
/**
|
|
|
|
|
* Set whether the keyboard toggle button should always show on the navigation panel, regardless of
|
|
|
|
|
* whether the app properly supports virtual keyboards.
|
|
|
|
|
*
|
|
|
|
|
* If this is false, then the keyboard toggle only shows on the navigation panel if the app doesn't
|
|
|
|
|
* support virtual keyboards.
|
|
|
|
|
*/
|
|
|
|
|
bool alwaysShowKeyboardToggleOnNavigationPanel() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether the keyboard toggle button should always show on the navigation panel, regardless of
|
|
|
|
|
* whether the app properly supports virtual keyboards.
|
|
|
|
|
*
|
|
|
|
|
* @param alwaysShowKeyboardToggleOnNavigationPanel
|
|
|
|
|
*/
|
|
|
|
|
void setAlwaysShowKeyboardToggleOnNavigationPanel(bool alwaysShowKeyboardToggleOnNavigationPanel);
|
|
|
|
|
|
2022-05-31 03:37:00 +00:00
|
|
|
/**
|
|
|
|
|
* The mode of the action drawer when swiped down from the top left.
|
|
|
|
|
*/
|
|
|
|
|
ActionDrawerMode actionDrawerTopLeftMode() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the mode of the action drawer when swiped down from the top left.
|
|
|
|
|
*
|
|
|
|
|
* @param actionDrawerMode The mode of the action drawer.
|
|
|
|
|
*/
|
|
|
|
|
void setActionDrawerTopLeftMode(ActionDrawerMode actionDrawerMode);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The mode of the action drawer when swiped down from the top right.
|
|
|
|
|
*/
|
|
|
|
|
ActionDrawerMode actionDrawerTopRightMode() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the mode of the action drawer when swiped down from the top right.
|
|
|
|
|
*
|
|
|
|
|
* @param actionDrawerMode The mode of the action drawer.
|
|
|
|
|
*/
|
|
|
|
|
void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode);
|
|
|
|
|
|
2025-08-19 11:35:11 +00:00
|
|
|
/**
|
|
|
|
|
* The number of columns to use for the QuickSettings drawer.
|
|
|
|
|
*/
|
|
|
|
|
int quickSettingsColumns() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the number of columns to use for the QuickSettings drawer.
|
|
|
|
|
*
|
|
|
|
|
* @param columns The number of columns to use.
|
|
|
|
|
*/
|
|
|
|
|
void setQuickSettingsColumns(int columns);
|
|
|
|
|
|
2023-03-29 06:49:09 +00:00
|
|
|
/**
|
|
|
|
|
* Whether convergence/docked mode is enabled.
|
|
|
|
|
*/
|
|
|
|
|
bool convergenceModeEnabled() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether convergence/docked mode is enabled.
|
|
|
|
|
*
|
|
|
|
|
* @param enabled
|
|
|
|
|
*/
|
|
|
|
|
void setConvergenceModeEnabled(bool enabled);
|
|
|
|
|
|
2025-04-21 15:56:33 +00:00
|
|
|
/**
|
|
|
|
|
* Whether Auto Hide Panels is enabled.
|
|
|
|
|
*/
|
|
|
|
|
bool autoHidePanelsEnabled() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set whether Auto Hide Panels is enabled.
|
|
|
|
|
*
|
|
|
|
|
* @param enabled
|
|
|
|
|
*/
|
|
|
|
|
void setAutoHidePanelsEnabled(bool enabled);
|
|
|
|
|
|
2024-11-29 10:49:24 +00:00
|
|
|
/**
|
|
|
|
|
* Whether logout button is shown in the logout/shutdown dialog.
|
|
|
|
|
*/
|
|
|
|
|
bool allowLogout() const;
|
|
|
|
|
|
2025-03-13 20:11:41 +00:00
|
|
|
/**
|
|
|
|
|
* The action of the left lock screen shortcut
|
|
|
|
|
*/
|
|
|
|
|
LockscreenButtonAction lockscreenLeftButtonAction() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the action of the left lock screen shortcut
|
|
|
|
|
*
|
|
|
|
|
* @param action
|
|
|
|
|
*/
|
|
|
|
|
void setLockscreenLeftButtonAction(LockscreenButtonAction action);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The action of the right lock screen shortcut
|
|
|
|
|
*/
|
|
|
|
|
LockscreenButtonAction lockscreenRightButtonAction() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the action of the right lock screen shortcut
|
|
|
|
|
*
|
|
|
|
|
* @param action
|
|
|
|
|
*/
|
|
|
|
|
void setLockscreenRightButtonAction(LockscreenButtonAction action);
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
Q_SIGNALS:
|
2022-04-29 20:15:53 +00:00
|
|
|
void vibrationsEnabledChanged();
|
2022-05-06 01:02:18 +00:00
|
|
|
void vibrationDurationChanged();
|
2022-02-13 04:23:57 +00:00
|
|
|
void navigationPanelEnabledChanged();
|
2025-12-14 04:38:13 +00:00
|
|
|
void gesturePanelEnabledChanged();
|
2023-11-05 20:14:37 +00:00
|
|
|
void alwaysShowKeyboardToggleOnNavigationPanelChanged();
|
2022-09-10 02:32:04 +00:00
|
|
|
void keyboardButtonEnabledChanged();
|
2022-04-30 00:02:33 +00:00
|
|
|
void animationsEnabledChanged();
|
2024-06-28 02:05:42 +00:00
|
|
|
void dateInStatusBarChanged();
|
2024-10-17 17:20:14 +00:00
|
|
|
void statusBarScaleFactorChanged();
|
2025-03-19 20:09:33 +00:00
|
|
|
void showBatteryPercentageChanged();
|
2022-05-21 14:54:33 +00:00
|
|
|
void taskSwitcherPreviewsEnabledChanged();
|
2022-05-31 03:37:00 +00:00
|
|
|
void actionDrawerTopLeftModeChanged();
|
|
|
|
|
void actionDrawerTopRightModeChanged();
|
2025-08-19 11:35:11 +00:00
|
|
|
void quickSettingsColumnsChanged();
|
2023-03-29 06:49:09 +00:00
|
|
|
void convergenceModeEnabledChanged();
|
2025-04-21 15:56:33 +00:00
|
|
|
void autoHidePanelsEnabledChanged();
|
2024-11-29 10:49:24 +00:00
|
|
|
void allowLogoutChanged();
|
2025-03-13 20:11:41 +00:00
|
|
|
void lockscreenLeftButtonActionChanged();
|
|
|
|
|
void lockscreenRightButtonActionChanged();
|
2022-02-13 04:23:57 +00:00
|
|
|
|
|
|
|
|
private:
|
2025-12-14 04:38:13 +00:00
|
|
|
void updateNavigationBarsInPlasma();
|
2023-10-21 05:46:31 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
KConfigWatcher::Ptr m_configWatcher;
|
|
|
|
|
KSharedConfig::Ptr m_config;
|
|
|
|
|
};
|