refactor: added state module
This commit is contained in:
parent
d3ecbc1b64
commit
1c523240d8
5 changed files with 55 additions and 27 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import Quickshell.Bluetooth
|
||||
import QtQuick
|
||||
import "./state"
|
||||
|
||||
QtObject {
|
||||
readonly property list<string> panes: ["network", "bluetooth", "audio", "appearance", "taskbar", "launcher"]
|
||||
|
|
@ -10,33 +10,12 @@ QtObject {
|
|||
property int activeIndex: 0
|
||||
property bool navExpanded: false
|
||||
|
||||
readonly property Bt bt: Bt {}
|
||||
readonly property Network network: Network {}
|
||||
readonly property Ethernet ethernet: Ethernet {}
|
||||
readonly property Launcher launcher: Launcher {}
|
||||
// Pane-specific state objects
|
||||
readonly property BluetoothState bt: BluetoothState {}
|
||||
readonly property NetworkState network: NetworkState {}
|
||||
readonly property EthernetState ethernet: EthernetState {}
|
||||
readonly property LauncherState launcher: LauncherState {}
|
||||
|
||||
onActiveChanged: activeIndex = panes.indexOf(active)
|
||||
onActiveIndexChanged: active = panes[activeIndex]
|
||||
|
||||
component Bt: QtObject {
|
||||
property BluetoothDevice active
|
||||
property BluetoothAdapter currentAdapter: Bluetooth.defaultAdapter
|
||||
property bool editingAdapterName
|
||||
property bool fabMenuOpen
|
||||
property bool editingDeviceName
|
||||
}
|
||||
|
||||
component Network: QtObject {
|
||||
property var active
|
||||
property bool showPasswordDialog: false
|
||||
property var pendingNetwork
|
||||
}
|
||||
|
||||
component Ethernet: QtObject {
|
||||
property var active
|
||||
}
|
||||
|
||||
component Launcher: QtObject {
|
||||
property var active
|
||||
}
|
||||
}
|
||||
|
|
|
|||
18
modules/controlcenter/state/BluetoothState.qml
Normal file
18
modules/controlcenter/state/BluetoothState.qml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import Quickshell.Bluetooth
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Active selected device
|
||||
property BluetoothDevice active: null
|
||||
|
||||
// Current adapter being used
|
||||
property BluetoothAdapter currentAdapter: Bluetooth.defaultAdapter
|
||||
|
||||
// UI state flags
|
||||
property bool editingAdapterName: false
|
||||
property bool fabMenuOpen: false
|
||||
property bool editingDeviceName: false
|
||||
}
|
||||
|
||||
9
modules/controlcenter/state/EthernetState.qml
Normal file
9
modules/controlcenter/state/EthernetState.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Active selected ethernet interface
|
||||
property var active: null
|
||||
}
|
||||
|
||||
9
modules/controlcenter/state/LauncherState.qml
Normal file
9
modules/controlcenter/state/LauncherState.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Active selected application
|
||||
property var active: null
|
||||
}
|
||||
|
||||
13
modules/controlcenter/state/NetworkState.qml
Normal file
13
modules/controlcenter/state/NetworkState.qml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Active selected wireless network
|
||||
property var active: null
|
||||
|
||||
// Password dialog state
|
||||
property bool showPasswordDialog: false
|
||||
property var pendingNetwork: null
|
||||
}
|
||||
|
||||
Loading…
Add table
Reference in a new issue