mirai/src/qml/SideMenu.qml

160 lines
3.4 KiB
QML
Raw Normal View History

2024-04-10 16:53:18 +02:00
/*
* Mirai. Copyright (C) 2024 Vyn
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
*/
import QtQuick
import QtQuick.Window
import QtQuick.Layouts
2024-04-22 14:34:24 +02:00
import QtQuick.Controls
2024-04-10 16:53:18 +02:00
import Mirai
2024-05-04 17:38:23 +02:00
Rectangle {
2024-04-10 16:53:18 +02:00
2024-05-04 17:38:23 +02:00
color: MiraiColorPalette.pane
2024-05-21 12:26:24 +02:00
implicitWidth: childrenRect.width + 20 + 30
2024-04-14 14:11:41 +02:00
2024-05-04 17:38:23 +02:00
ColumnLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 10
RowLayout {
2024-04-14 14:11:41 +02:00
AppText {
2024-05-04 17:38:23 +02:00
text: "Files"
font.pixelSize: 32
2024-04-14 14:11:41 +02:00
}
2024-05-04 17:38:23 +02:00
Item { Layout.fillWidth: true }
AppIcon {
icon.source: "qrc:/qt/qml/Mirai/src/images/settings.png"
icon.color: colorPalette.selected.textPlaceholder
2024-04-14 14:11:41 +02:00
onClicked: {
2024-05-04 17:38:23 +02:00
filesForm.reset();
filesFormPopup.open();
2024-04-14 14:11:41 +02:00
}
}
}
2024-05-04 17:38:23 +02:00
Item { Layout.preferredHeight: 16 }
2024-04-14 14:11:41 +02:00
2024-05-04 17:38:23 +02:00
Repeater {
model: backend.files
Rectangle {
Layout.preferredHeight: childrenRect.height
Layout.fillWidth: true
color: backend.activeResourcesFilter.includes(modelData.name) ? MiraiColorPalette.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent"
2024-05-04 17:38:23 +02:00
radius: 4
AppText {
text: modelData.name
padding: 4
}
MouseArea {
anchors.fill: parent
onClicked: {
if (backend.activeResourcesFilter.includes(modelData.name)) {
backend.removeResourceFilter(modelData.name)
2024-05-04 17:38:23 +02:00
} else {
backend.addResourceFilter(modelData.name)
2024-05-04 17:38:23 +02:00
}
}
HoverHandler {
id: mouse
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
cursorShape: Qt.PointingHandCursor
}
}
2024-04-22 14:34:24 +02:00
}
}
2024-04-10 16:53:18 +02:00
2024-05-04 17:38:23 +02:00
Item { Layout.preferredHeight: 16 }
2024-04-10 16:53:18 +02:00
2024-05-04 17:38:23 +02:00
RowLayout {
2024-04-10 16:53:18 +02:00
AppText {
2024-05-04 17:38:23 +02:00
text: "Tags"
font.pixelSize: 32
2024-04-10 16:53:18 +02:00
}
2024-05-04 17:38:23 +02:00
Item { Layout.fillWidth: true }
AppIcon {
icon.source: "qrc:/qt/qml/Mirai/src/images/settings.png"
icon.color: colorPalette.selected.textPlaceholder
2024-04-10 16:53:18 +02:00
onClicked: {
2024-05-04 17:38:23 +02:00
tagsForm.reset();
tagsFormPopup.open();
2024-04-10 16:53:18 +02:00
}
}
}
2024-05-04 17:38:23 +02:00
Item { Layout.preferredHeight: 16 }
2024-04-10 16:53:18 +02:00
2024-05-04 17:38:23 +02:00
Repeater {
model: backend.tags
Rectangle {
Layout.preferredHeight: childrenRect.height
Layout.fillWidth: true
color: backend.activeTagsFilter.includes(modelData.name) ? MiraiColorPalette.filterSelected : mouse.hovered ? MiraiColorPalette.filterHovered : "transparent"
radius: 4
QtObject {
id: internal
}
AppText {
text: modelData.name
color: {
return modelData.color
}
padding: 4
}
MouseArea {
anchors.fill: parent
onClicked: {
if (backend.activeTagsFilter.includes(modelData.name)) {
backend.removeTagFilter(modelData.name)
} else {
backend.addTagFilter(modelData.name)
}
}
HoverHandler {
id: mouse
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
cursorShape: Qt.PointingHandCursor
}
}
}
2024-04-10 16:53:18 +02:00
}
2024-04-14 14:11:41 +02:00
2024-05-04 17:38:23 +02:00
Item {
Layout.fillHeight: true
2024-04-22 15:45:26 +02:00
}
2024-05-04 17:38:23 +02:00
Modal {
2024-05-04 17:38:23 +02:00
id: filesFormPopup
fullScreen: root.isPhone
2024-05-04 17:38:23 +02:00
FilesForm {
id: filesForm
width: parent.width
onConfirmed: (filesPath) => {
filesFormPopup.close()
console.log(filesPath)
backend.saveFilesPath(filesPath)
}
}
2024-04-14 14:11:41 +02:00
}
2024-05-04 17:38:23 +02:00
Modal {
2024-05-04 17:38:23 +02:00
id: tagsFormPopup
fullScreen: root.isPhone
2024-05-04 17:38:23 +02:00
TagsConfigForm {
id: tagsForm
width: parent.width
onConfirmed: (tags) => {
tagsFormPopup.close()
backend.saveTagsColor(tags)
}
2024-04-22 14:34:24 +02:00
}
}
}
2024-04-10 16:53:18 +02:00
}