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)
|
|
|
|
|
Q_PROPERTY(qreal vibrationIntensity READ vibrationIntensity WRITE setVibrationIntensity NOTIFY vibrationIntensityChanged)
|
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
|
|
|
|
|
|
|
|
// navigation panel
|
2022-03-17 03:20:36 +00:00
|
|
|
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
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)
|
|
|
|
|
|
2023-03-29 06:49:09 +00:00
|
|
|
// convergence mode
|
|
|
|
|
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
|
|
|
|
|
|
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)
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the intensity of a standard vibration event, which is a value between
|
|
|
|
|
* zero and one.
|
|
|
|
|
*/
|
|
|
|
|
qreal vibrationIntensity() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the intensity of a standard vibration event.
|
|
|
|
|
*
|
|
|
|
|
* @param vibrationIntensity The intensity of a standard vibration event, between zero and one.
|
|
|
|
|
*/
|
|
|
|
|
void setVibrationIntensity(qreal vibrationIntensity);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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);
|
|
|
|
|
|
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);
|
|
|
|
|
|
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);
|
|
|
|
|
|
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);
|
|
|
|
|
|
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 vibrationIntensityChanged();
|
|
|
|
|
void vibrationDurationChanged();
|
2022-02-13 04:23:57 +00:00
|
|
|
void navigationPanelEnabledChanged();
|
2022-09-10 02:32:04 +00:00
|
|
|
void keyboardButtonEnabledChanged();
|
2022-04-30 00:02:33 +00:00
|
|
|
void animationsEnabledChanged();
|
2022-05-21 14:54:33 +00:00
|
|
|
void taskSwitcherPreviewsEnabledChanged();
|
2022-05-31 03:37:00 +00:00
|
|
|
void actionDrawerTopLeftModeChanged();
|
|
|
|
|
void actionDrawerTopRightModeChanged();
|
2023-03-29 06:49:09 +00:00
|
|
|
void convergenceModeEnabledChanged();
|
2022-02-13 04:23:57 +00:00
|
|
|
|
|
|
|
|
private:
|
2023-10-21 05:46:31 +00:00
|
|
|
void updateNavigationBarsInPlasma(bool navigationPanelEnabled);
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
KConfigWatcher::Ptr m_configWatcher;
|
|
|
|
|
KSharedConfig::Ptr m_config;
|
|
|
|
|
};
|