Refactor global shortcuts, simplify debug consoles

- Move out all shortcuts from their central file to the component they
  actually belong to

- Get rid of DebugConsoleLoader and the multiple consoles handling mess,
  have only one global console
This commit is contained in:
miruka
2020-03-28 07:18:00 -04:00
parent af2d5f8cba
commit 1038678a2f
24 changed files with 268 additions and 401 deletions

View File

@@ -3,9 +3,6 @@
import QtQuick 2.12
HPage {
focusTarget: column
default property alias columnData: column.data

View File

@@ -1,11 +1,9 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import "../ShortcutBundles"
HPage {
focusTarget: column
property alias flickable: flickable
default property alias columnData: column.data
@@ -17,6 +15,10 @@ HPage {
contentWidth: parent.width
contentHeight: column.childrenRect.height
FlickShortcuts {
flickable: flickable
}
HColumnLayout {
id: column
width: flickable.width

View File

@@ -8,16 +8,10 @@ Page {
rightPadding: leftPadding
background: null
Component.onCompleted:
if (becomeKeyboardFlickableTarget) shortcuts.flickTarget = focusTarget
property int currentSpacing:
Math.min(theme.spacing * width / 400, theme.spacing)
property Item focusTarget: this
property bool becomeKeyboardFlickableTarget: true
Behavior on leftPadding { HNumberAnimation {} }
}

View File

@@ -0,0 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
QtObject {
default property list<QtObject> data
}

View File

@@ -2,10 +2,12 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "../ShortcutBundles"
SwipeView {
id: swipeView
Component.onCompleted: if (! changed) {
if (becomeKeyboardTabsTarget) shortcuts.tabsTarget = this
setCurrentIndex(window.getState(this, "currentIndex", defaultIndex))
saveEnabled = true
}
@@ -20,10 +22,14 @@ SwipeView {
// Prevent onCurrentIndexChanged from running before Component.onCompleted
property bool saveEnabled: false
property bool becomeKeyboardTabsTarget: true
property int defaultIndex: 0
property bool changed: currentIndex !== defaultIndex
function reset() { setCurrentIndex(defaultIndex) }
TabShortcuts {
container: swipeView
}
}

View File

@@ -2,8 +2,10 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "../ShortcutBundles"
TabBar {
id: tabBar
spacing: 0
position: TabBar.Header
@@ -15,4 +17,9 @@ TabBar {
color: theme.controls.tab.bottomLine
}
}
TabShortcuts {
container: tabBar
}
}

View File

@@ -16,7 +16,6 @@ HColumnLayout {
HTabBar {
id: tabBar
Component.onCompleted: shortcuts.tabsTarget = this
Layout.fillWidth: true