103 lines
3.3 KiB
QML
103 lines
3.3 KiB
QML
pragma ComponentBehavior: Bound
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import QtQml.Models
|
|
import Qt.labs.folderlistmodel 2.11
|
|
|
|
import qs
|
|
import qs.settings
|
|
import qs.widgets
|
|
import qs.modules.Services
|
|
|
|
Rectangle {
|
|
id: child
|
|
implicitWidth: contentLayout.implicitWidth + contentLayout.anchors.margins * 2 + container.anchors.margins * 2
|
|
implicitHeight: 600
|
|
color: Colors.c.base00
|
|
radius: Config.cfg.appearance.rounding
|
|
border.width: 1
|
|
border.color: Colors.c.base03
|
|
MouseArea {
|
|
acceptedButtons: Qt.AllButtons
|
|
anchors.fill: parent
|
|
}
|
|
FolderListModel {
|
|
id: schemeModel
|
|
folder: Qt.resolvedUrl(Quickshell.shellDir + "/schemes/")
|
|
nameFilters: searchBar.text == "" ? [] : ["*" + searchBar.text + "*"]
|
|
}
|
|
Rectangle {
|
|
id: container
|
|
anchors.fill: parent
|
|
anchors.centerIn: parent
|
|
anchors.margins: 10
|
|
radius: Config.cfg.appearance.rounding
|
|
color: Colors.c.base00
|
|
clip: true
|
|
ColumnLayout {
|
|
id: contentLayout
|
|
anchors.fill: parent
|
|
anchors.margins: 30
|
|
anchors.centerIn: parent
|
|
spacing: 40
|
|
TextField {
|
|
id: searchBar
|
|
placeholderText: "enter scheme name:"
|
|
placeholderTextColor: Colors.c.base04
|
|
leftPadding: 10
|
|
font.family: Config.cfg.appearance.font
|
|
color: Colors.font
|
|
background: Rectangle {
|
|
color: Colors.c.base02
|
|
implicitWidth: 300
|
|
implicitHeight: 30
|
|
radius: Config.cfg.appearance.rounding
|
|
border.width: 1
|
|
border.color: Colors.c.base03
|
|
}
|
|
}
|
|
|
|
ListView {
|
|
id: schemeList
|
|
spacing: 5
|
|
Layout.fillHeight: true
|
|
model: schemeModel
|
|
implicitWidth: 300
|
|
delegate: Rectangle {
|
|
id: container
|
|
required property var modelData
|
|
border.width: 1
|
|
border.color: Colors.c.base03
|
|
color: Colors.c.base02
|
|
height: 30
|
|
radius: Config.cfg.appearance.rounding
|
|
implicitWidth: 300
|
|
StyledText {
|
|
id: schemeName
|
|
anchors.centerIn: parent
|
|
text: container.modelData.fileBaseName
|
|
}
|
|
MouseArea {
|
|
id: schemeSetter
|
|
anchors.fill: container
|
|
acceptedButtons: Qt.LeftButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: {
|
|
setTheme.themeName = modelData.fileBaseName;
|
|
setTheme.running = true;
|
|
Config.cfg.appearance.currentTheme = modelData.fileName;
|
|
}
|
|
Process {
|
|
id: setTheme
|
|
property string themeName
|
|
command: ["tinty", "apply", themeName]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|