forked from Shinonome/dots-hyprland
163 lines
5.4 KiB
QML
163 lines
5.4 KiB
QML
//@ pragma UseQApplication
|
|
//@ pragma Env QS_NO_RELOAD_POPUP=1
|
|
//@ pragma Env QT_QUICK_CONTROLS_STYLE=Basic
|
|
|
|
// Adjust this to make the app smaller or larger
|
|
//@ pragma Env QT_SCALE_FACTOR=1
|
|
|
|
import Qt5Compat.GraphicalEffects
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import QtQuick.Window
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import Quickshell.Hyprland
|
|
import "root:/services/"
|
|
import "root:/modules/common/"
|
|
import "root:/modules/common/widgets/"
|
|
import "root:/modules/common/functions/color_utils.js" as ColorUtils
|
|
import "root:/modules/common/functions/file_utils.js" as FileUtils
|
|
import "root:/modules/common/functions/string_utils.js" as StringUtils
|
|
|
|
ApplicationWindow {
|
|
id: root
|
|
property string firstRunFilePath: FileUtils.trimFileProtocol(`${Directories.state}/user/first_run.txt`)
|
|
property string firstRunFileContent: "This file is just here to confirm you've been greeted :>"
|
|
property real contentPadding: 8
|
|
property bool showNextTime: false
|
|
property int currentPage: 0
|
|
visible: true
|
|
onClosing: Qt.quit()
|
|
title: "illogical-impulse Settings"
|
|
|
|
Component.onCompleted: {
|
|
MaterialThemeLoader.reapplyTheme()
|
|
ConfigLoader.loadConfig()
|
|
}
|
|
|
|
minimumWidth: 600
|
|
minimumHeight: 400
|
|
width: 900
|
|
height: 650
|
|
color: Appearance.m3colors.m3background
|
|
|
|
component Section: ColumnLayout {
|
|
id: sectionRoot
|
|
property string title
|
|
default property alias data: sectionContent.data
|
|
|
|
Layout.fillWidth: true
|
|
spacing: 8
|
|
StyledText {
|
|
text: sectionRoot.title
|
|
font.pixelSize: Appearance.font.pixelSize.larger
|
|
}
|
|
ColumnLayout {
|
|
id: sectionContent
|
|
spacing: 5
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
anchors {
|
|
fill: parent
|
|
margins: contentPadding
|
|
}
|
|
|
|
Item { // Titlebar
|
|
visible: ConfigOptions?.windows.showTitlebar
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: false
|
|
implicitHeight: Math.max(titleText.implicitHeight, windowControlsRow.implicitHeight)
|
|
StyledText {
|
|
id: titleText
|
|
anchors.centerIn: parent
|
|
color: Appearance.colors.colOnLayer0
|
|
text: "Settings"
|
|
font.pixelSize: Appearance.font.pixelSize.title
|
|
font.family: Appearance.font.family.title
|
|
}
|
|
RowLayout { // Window controls row
|
|
id: windowControlsRow
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.right: parent.right
|
|
RippleButton {
|
|
buttonRadius: Appearance.rounding.full
|
|
implicitWidth: 35
|
|
implicitHeight: 35
|
|
onClicked: root.close()
|
|
contentItem: MaterialSymbol {
|
|
anchors.centerIn: parent
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: "close"
|
|
iconSize: 20
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
RowLayout { // Window content with navigation rail and content pane
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
spacing: contentPadding
|
|
NavigationRail { // Window content with navigation rail and content pane
|
|
id: navRail
|
|
Layout.fillHeight: true
|
|
Layout.margins: 5
|
|
spacing: 10
|
|
expanded: root.width > 900
|
|
|
|
NavigationRailExpandButton {}
|
|
|
|
FloatingActionButton {
|
|
id: fab
|
|
iconText: "edit"
|
|
buttonText: "Edit config"
|
|
expanded: navRail.expanded
|
|
onClicked: {
|
|
Qt.openUrlExternally(`${Directories.config}/illogical-impulse/config.json`);
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
Layout.topMargin: 25
|
|
spacing: 4
|
|
|
|
NavigationRailButton {
|
|
toggled: root.currentPage === 0
|
|
onClicked: root.currentPage = 0;
|
|
expanded: navRail.expanded
|
|
buttonIcon: "tune"
|
|
buttonText: "General"
|
|
}
|
|
NavigationRailButton {
|
|
toggled: root.currentPage === 1
|
|
onClicked: root.currentPage = 1;
|
|
expanded: navRail.expanded
|
|
buttonIcon: "dashboard"
|
|
buttonText: "Widgets"
|
|
}
|
|
NavigationRailButton {
|
|
toggled: root.currentPage === 2
|
|
onClicked: root.currentPage = 2;
|
|
expanded: navRail.expanded
|
|
buttonIcon: "settings"
|
|
buttonText: "Services"
|
|
}
|
|
}
|
|
|
|
Item {
|
|
Layout.fillHeight: true
|
|
}
|
|
}
|
|
Rectangle { // Content container
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
color: Appearance.m3colors.m3surfaceContainerLow
|
|
radius: Appearance.rounding.windowRounding - root.contentPadding
|
|
}
|
|
}
|
|
}
|
|
}
|