-
-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathwaffleSettings.qml
More file actions
214 lines (188 loc) · 6.58 KB
/
Copy pathwaffleSettings.qml
File metadata and controls
214 lines (188 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//@ pragma UseQApplication
//@ pragma Env QS_NO_RELOAD_POPUP=1
//@ pragma Env INIR_STANDALONE_WINDOW=1
//@ pragma Env QT_QUICK_CONTROLS_STYLE=Basic
//@ pragma Env QT_QUICK_FLICKABLE_WHEEL_DECELERATION=10000
// Launcher keeps QT_SCALE_FACTOR=1; shell scaling lives in appearance.typography.sizeScale
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import Quickshell
import qs.services
import qs.modules.common
import qs.modules.common.functions as CF
import qs.modules.waffle.looks
import qs.modules.waffle.settings
ApplicationWindow {
id: root
property bool uiReady: Config.ready
property string pendingStartSection: ""
property var pages: [
{
name: Translation.tr("Quick"),
icon: "flash-on",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WQuickPage.qml")
},
{
name: Translation.tr("General"),
icon: "settings",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WGeneralPage.qml")
},
{
name: Translation.tr("Taskbar"),
icon: "desktop",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WBarPage.qml")
},
{
name: Translation.tr("Background"),
icon: "image",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WBackgroundPage.qml")
},
{
name: Translation.tr("Themes"),
icon: "dark-theme",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WThemesPage.qml")
},
{
name: Translation.tr("Gowall"),
icon: "wand",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WGowallPage.qml")
},
{
name: Translation.tr("Interface"),
icon: "apps",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WInterfacePage.qml")
},
{
name: Translation.tr("Modules"),
icon: "settings-cog-multiple",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WModulesPage.qml")
},
{
name: Translation.tr("Waffle Style"),
icon: "desktop",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WWaffleStylePage.qml")
},
{
name: Translation.tr("Shortcuts"),
icon: "keyboard",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WShortcutsPage.qml")
},
{
name: Translation.tr("About"),
icon: "info",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WAboutPage.qml")
},
{
name: Translation.tr("Monitors"),
icon: "desktop",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WMonitorVisibilityPage.qml")
}
]
property int currentPage: 0
visible: true
onClosing: Qt.quit()
title: "Settings — iNiR"
function tryOpenPendingSection(): void {
if (!root.pendingStartSection || !root.uiReady)
return
const targetLabel = root.pendingStartSection
root.pendingStartSection = ""
Qt.callLater(() => {
settingsContent.openSearchResult({
pageIndex: root.currentPage,
targetLabel: targetLabel
})
})
}
Component.onCompleted: {
Quickshell.watchFiles = false
Config.readWriteDelay = 0
const startPage = Quickshell.env("QS_SETTINGS_PAGE");
if (startPage) root.currentPage = parseInt(startPage);
const startSection = Quickshell.env("QS_SETTINGS_SECTION");
if (startSection)
root.pendingStartSection = startSection;
root.tryOpenPendingSection()
}
Connections {
target: Config
function onReadyChanged() {
if (Config.ready) ThemeService.applyCurrentTheme()
root.tryOpenPendingSection()
}
}
minimumWidth: 700
minimumHeight: 450
width: 1000
height: 650
color: root.uiReady ? Looks.colors.bg0Opaque : "transparent"
// Loading state
Item {
anchors.fill: parent
visible: !root.uiReady
ColumnLayout {
anchors.centerIn: parent
spacing: 16
FluentIcon {
Layout.alignment: Qt.AlignHCenter
icon: "settings"
implicitSize: 32
color: Looks.colors.accent
opacity: loadingPulse.running ? 1 : 0.6
SequentialAnimation on opacity {
id: loadingPulse
running: !root.uiReady
loops: Animation.Infinite
NumberAnimation { to: 0.3; duration: 800; easing.type: Easing.InOutQuad }
NumberAnimation { to: 0.9; duration: 800; easing.type: Easing.InOutQuad }
}
RotationAnimation on rotation {
running: !root.uiReady
from: 0; to: 360
duration: 3000
loops: Animation.Infinite
}
}
WText {
Layout.alignment: Qt.AlignHCenter
text: Translation.tr("Loading...")
font.pixelSize: Looks.font.pixelSize.normal
color: Looks.colors.subfg
}
}
}
// Main content
WSettingsContent {
id: settingsContent
anchors.fill: parent
visible: root.uiReady
opacity: visible ? 1 : 0
pages: root.pages
currentPage: root.currentPage
onCurrentPageChanged: root.currentPage = currentPage
onCloseRequested: root.close()
Component.onCompleted: root.tryOpenPendingSection()
Behavior on opacity {
NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
}
}
// Keyboard shortcuts
Shortcut {
sequence: "Ctrl+PageDown"
onActivated: root.currentPage = Math.min(root.currentPage + 1, root.pages.length - 1)
}
Shortcut {
sequence: "Ctrl+PageUp"
onActivated: root.currentPage = Math.max(root.currentPage - 1, 0)
}
Shortcut {
sequence: "Ctrl+Tab"
onActivated: root.currentPage = (root.currentPage + 1) % root.pages.length
}
Shortcut {
sequence: "Ctrl+Shift+Tab"
onActivated: root.currentPage = (root.currentPage - 1 + root.pages.length) % root.pages.length
}
}