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:
@@ -3,9 +3,6 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
HPage {
|
||||
focusTarget: column
|
||||
|
||||
|
||||
default property alias columnData: column.data
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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 {} }
|
||||
}
|
||||
|
7
src/gui/Base/HQtObject.qml
Normal file
7
src/gui/Base/HQtObject.qml
Normal file
@@ -0,0 +1,7 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
|
||||
QtObject {
|
||||
default property list<QtObject> data
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ HColumnLayout {
|
||||
|
||||
HTabBar {
|
||||
id: tabBar
|
||||
Component.onCompleted: shortcuts.tabsTarget = this
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
Reference in New Issue
Block a user