mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
navigationpanel: Add force keyboard toggle, and add setting
This commit is contained in:
parent
a2170b4b3c
commit
2aaf5fca98
6 changed files with 112 additions and 2 deletions
|
|
@ -31,6 +31,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
Q_EMIT vibrationDurationChanged();
|
Q_EMIT vibrationDurationChanged();
|
||||||
Q_EMIT animationsEnabledChanged();
|
Q_EMIT animationsEnabledChanged();
|
||||||
Q_EMIT navigationPanelEnabledChanged();
|
Q_EMIT navigationPanelEnabledChanged();
|
||||||
|
Q_EMIT keyboardButtonEnabledChanged();
|
||||||
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
||||||
Q_EMIT actionDrawerTopLeftModeChanged();
|
Q_EMIT actionDrawerTopLeftModeChanged();
|
||||||
Q_EMIT actionDrawerTopRightModeChanged();
|
Q_EMIT actionDrawerTopRightModeChanged();
|
||||||
|
|
@ -106,6 +107,19 @@ void MobileShellSettings::setNavigationPanelEnabled(bool navigationPanelEnabled)
|
||||||
m_config->sync();
|
m_config->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MobileShellSettings::keyboardButtonEnabled() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
return group.readEntry("keyboardButtonEnabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MobileShellSettings::setKeyboardButtonEnabled(bool keyboardButtonEnabled)
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
group.writeEntry("keyboardButtonEnabled", keyboardButtonEnabled, KConfigGroup::Notify);
|
||||||
|
m_config->sync();
|
||||||
|
}
|
||||||
|
|
||||||
bool MobileShellSettings::taskSwitcherPreviewsEnabled() const
|
bool MobileShellSettings::taskSwitcherPreviewsEnabled() const
|
||||||
{
|
{
|
||||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ class MobileShellSettings : public QObject
|
||||||
|
|
||||||
// navigation panel
|
// navigation panel
|
||||||
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
||||||
|
Q_PROPERTY(bool keyboardButtonEnabled READ keyboardButtonEnabled WRITE setKeyboardButtonEnabled NOTIFY keyboardButtonEnabledChanged)
|
||||||
|
|
||||||
// task switcher
|
// task switcher
|
||||||
Q_PROPERTY(bool taskSwitcherPreviewsEnabled READ taskSwitcherPreviewsEnabled WRITE setTaskSwitcherPreviewsEnabled NOTIFY taskSwitcherPreviewsEnabledChanged)
|
Q_PROPERTY(bool taskSwitcherPreviewsEnabled READ taskSwitcherPreviewsEnabled WRITE setTaskSwitcherPreviewsEnabled NOTIFY taskSwitcherPreviewsEnabledChanged)
|
||||||
|
|
@ -115,6 +116,18 @@ public:
|
||||||
*/
|
*/
|
||||||
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
void setNavigationPanelEnabled(bool navigationPanelEnabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the keyboard toggle button on the navigation panel is enabled.
|
||||||
|
*/
|
||||||
|
bool keyboardButtonEnabled() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the keyboard toggle button on the navigation panel is enabled.
|
||||||
|
*
|
||||||
|
* @param keyboardButtonEnabled Whether the keyboard button on the navigation panel should be enabled.
|
||||||
|
*/
|
||||||
|
void setKeyboardButtonEnabled(bool keyboardButtonEnabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether task switcher application previews are enabled.
|
* Whether task switcher application previews are enabled.
|
||||||
*/
|
*/
|
||||||
|
|
@ -180,6 +193,7 @@ Q_SIGNALS:
|
||||||
void vibrationIntensityChanged();
|
void vibrationIntensityChanged();
|
||||||
void vibrationDurationChanged();
|
void vibrationDurationChanged();
|
||||||
void navigationPanelEnabledChanged();
|
void navigationPanelEnabledChanged();
|
||||||
|
void keyboardButtonEnabledChanged();
|
||||||
void animationsEnabledChanged();
|
void animationsEnabledChanged();
|
||||||
void taskSwitcherPreviewsEnabledChanged();
|
void taskSwitcherPreviewsEnabledChanged();
|
||||||
void actionDrawerTopLeftModeChanged();
|
void actionDrawerTopLeftModeChanged();
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ Item {
|
||||||
property NavigationPanelAction middleAction
|
property NavigationPanelAction middleAction
|
||||||
property NavigationPanelAction rightAction
|
property NavigationPanelAction rightAction
|
||||||
|
|
||||||
|
property NavigationPanelAction leftCornerAction
|
||||||
|
property NavigationPanelAction rightCornerAction
|
||||||
|
|
||||||
DropShadow {
|
DropShadow {
|
||||||
anchors.fill: mouseArea
|
anchors.fill: mouseArea
|
||||||
visible: shadow
|
visible: shadow
|
||||||
|
|
@ -124,6 +127,7 @@ Item {
|
||||||
// button row (anchors provided by state)
|
// button row (anchors provided by state)
|
||||||
NavigationPanelButton {
|
NavigationPanelButton {
|
||||||
id: leftButton
|
id: leftButton
|
||||||
|
visible: root.leftAction.visible
|
||||||
mouseArea: mouseArea
|
mouseArea: mouseArea
|
||||||
colorGroup: root.foregroundColorGroup
|
colorGroup: root.foregroundColorGroup
|
||||||
enabled: root.leftAction.enabled
|
enabled: root.leftAction.enabled
|
||||||
|
|
@ -139,6 +143,7 @@ Item {
|
||||||
NavigationPanelButton {
|
NavigationPanelButton {
|
||||||
id: middleButton
|
id: middleButton
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
visible: root.middleAction.visible
|
||||||
mouseArea: mouseArea
|
mouseArea: mouseArea
|
||||||
colorGroup: root.foregroundColorGroup
|
colorGroup: root.foregroundColorGroup
|
||||||
enabled: root.middleAction.enabled
|
enabled: root.middleAction.enabled
|
||||||
|
|
@ -153,6 +158,7 @@ Item {
|
||||||
|
|
||||||
NavigationPanelButton {
|
NavigationPanelButton {
|
||||||
id: rightButton
|
id: rightButton
|
||||||
|
visible: root.rightAction.visible
|
||||||
mouseArea: mouseArea
|
mouseArea: mouseArea
|
||||||
colorGroup: root.foregroundColorGroup
|
colorGroup: root.foregroundColorGroup
|
||||||
enabled: root.rightAction.enabled
|
enabled: root.rightAction.enabled
|
||||||
|
|
@ -164,6 +170,21 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NavigationPanelButton {
|
||||||
|
id: rightCornerButton
|
||||||
|
visible: root.rightCornerAction.visible
|
||||||
|
mouseArea: mouseArea
|
||||||
|
colorGroup: root.foregroundColorGroup
|
||||||
|
enabled: root.rightCornerButton.enabled
|
||||||
|
iconSizeFactor: root.rightCornerAction.iconSizeFactor
|
||||||
|
iconSource: root.rightCornerAction.iconSource
|
||||||
|
onClicked: {
|
||||||
|
if (enabled) {
|
||||||
|
root.rightCornerAction.triggered();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +194,7 @@ Item {
|
||||||
when: root.width < root.height
|
when: root.width < root.height
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: icons
|
target: icons
|
||||||
buttonLength: Math.min(PlasmaCore.Units.gridUnit * 10, icons.height * 0.8 / 3)
|
buttonLength: Math.min(PlasmaCore.Units.gridUnit * 10, icons.height * 0.7 / 3)
|
||||||
}
|
}
|
||||||
AnchorChanges {
|
AnchorChanges {
|
||||||
target: leftButton
|
target: leftButton
|
||||||
|
|
@ -204,12 +225,24 @@ Item {
|
||||||
height: icons.buttonLength
|
height: icons.buttonLength
|
||||||
width: icons.width
|
width: icons.width
|
||||||
}
|
}
|
||||||
|
AnchorChanges {
|
||||||
|
target: rightCornerButton
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: rightCornerButton
|
||||||
|
height: PlasmaCore.Units.gridUnit * 2
|
||||||
|
width: icons.width
|
||||||
|
}
|
||||||
}, State {
|
}, State {
|
||||||
name: "portrait"
|
name: "portrait"
|
||||||
when: root.width >= root.height
|
when: root.width >= root.height
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: icons
|
target: icons
|
||||||
buttonLength: Math.min(PlasmaCore.Units.gridUnit * 8, icons.width * 0.8 / 3)
|
buttonLength: Math.min(PlasmaCore.Units.gridUnit * 8, icons.width * 0.7 / 3)
|
||||||
}
|
}
|
||||||
AnchorChanges {
|
AnchorChanges {
|
||||||
target: leftButton
|
target: leftButton
|
||||||
|
|
@ -240,6 +273,18 @@ Item {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: icons.buttonLength
|
width: icons.buttonLength
|
||||||
}
|
}
|
||||||
|
AnchorChanges {
|
||||||
|
target: rightCornerButton
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: rightCornerButton
|
||||||
|
height: parent.height
|
||||||
|
width: PlasmaCore.Units.gridUnit * 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import QtQuick 2.15
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
property bool enabled
|
property bool enabled
|
||||||
|
property bool visible: true
|
||||||
property string iconSource
|
property string iconSource
|
||||||
property real iconSizeFactor
|
property real iconSizeFactor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,4 +104,20 @@ MobileShell.NavigationPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rightCornerAction: MobileShell.NavigationPanelAction {
|
||||||
|
id: keyboardToggleAction
|
||||||
|
visible: MobileShell.MobileShellSettings.keyboardButtonEnabled
|
||||||
|
enabled: Keyboards.KWinVirtualKeyboard.available
|
||||||
|
iconSource: "input-keyboard-virtual-symbolic"
|
||||||
|
iconSizeFactor: 0.75
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
if (Keyboards.KWinVirtualKeyboard.visible) {
|
||||||
|
Keyboards.KWinVirtualKeyboard.active = false;
|
||||||
|
} else {
|
||||||
|
Keyboards.KWinVirtualKeyboard.forceActivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ KCM.SimpleKCM {
|
||||||
}
|
}
|
||||||
|
|
||||||
MobileForm.FormSwitchDelegate {
|
MobileForm.FormSwitchDelegate {
|
||||||
|
id: gestureDelegate
|
||||||
text: i18n("Gesture-only Mode")
|
text: i18n("Gesture-only Mode")
|
||||||
description: i18n("Whether to hide the navigation panel.")
|
description: i18n("Whether to hide the navigation panel.")
|
||||||
checked: !MobileShell.MobileShellSettings.navigationPanelEnabled
|
checked: !MobileShell.MobileShellSettings.navigationPanelEnabled
|
||||||
|
|
@ -79,6 +80,25 @@ KCM.SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MobileForm.FormDelegateSeparator {
|
||||||
|
visible: MobileShell.MobileShellSettings.navigationPanelEnabled
|
||||||
|
above: gestureDelegate
|
||||||
|
below: keyboardButtonDelegate
|
||||||
|
}
|
||||||
|
|
||||||
|
MobileForm.FormSwitchDelegate {
|
||||||
|
id: keyboardButtonDelegate
|
||||||
|
visible: MobileShell.MobileShellSettings.navigationPanelEnabled
|
||||||
|
text: i18n("Keyboard Toggle")
|
||||||
|
description: i18n("Whether to show a keyboard button on the navigation panel.")
|
||||||
|
checked: MobileShell.MobileShellSettings.keyboardButtonEnabled
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (checked != MobileShell.MobileShellSettings.keyboardButtonEnabled) {
|
||||||
|
MobileShell.MobileShellSettings.keyboardButtonEnabled = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue