diff --git a/GlosSIConfig/qml.qrc b/GlosSIConfig/qml.qrc index b86653f..118be03 100644 --- a/GlosSIConfig/qml.qrc +++ b/GlosSIConfig/qml.qrc @@ -6,5 +6,8 @@ qml/ShortcutCards.qml qml/ShortcutProps.qml qml/FluentTextInput.qml + svg/delete_white_24dp.svg + svg/edit_white_24dp.svg + svg/steam.svg diff --git a/GlosSIConfig/qml/AddSelectTypeDialog.qml b/GlosSIConfig/qml/AddSelectTypeDialog.qml index ce2c259..1895438 100644 --- a/GlosSIConfig/qml/AddSelectTypeDialog.qml +++ b/GlosSIConfig/qml/AddSelectTypeDialog.qml @@ -77,23 +77,25 @@ Dialog { highlighted: true onClicked: function(){ close() - confirmed("uwp") + confirmed("man") } } Button { - text: qsTr("Win32 Program") + text: uiModel.isWindows ? qsTr("Win32 Program") : qsTr("Launch Program") highlighted: true onClicked: function(){ close() - confirmed("uwp") + confirmed("launch") } } Button { + visible: uiModel.isWindows text: qsTr("UWP App") highlighted: true onClicked: function(){ close() confirmed("uwp") + const wtf = uiModel.uwpList; } } } diff --git a/GlosSIConfig/qml/ShortcutCards.qml b/GlosSIConfig/qml/ShortcutCards.qml index 484fc28..9cb1e5a 100644 --- a/GlosSIConfig/qml/ShortcutCards.qml +++ b/GlosSIConfig/qml/ShortcutCards.qml @@ -17,6 +17,7 @@ import QtQuick 6.2 import QtQuick.Layouts 6.2 import QtQuick.Controls 6.2 import QtQuick.Controls.Material 6.2 +import Qt5Compat.GraphicalEffects GridView { id: shortcutgrid @@ -27,42 +28,142 @@ GridView { visible: model.length > 0 signal editClicked(var index, var shortcutInfo) + property real margins: 16 - cellWidth: 242 + 8 - cellHeight: 149 + 8 + cellWidth: 292 + 16 + cellHeight: 190 + 16 readonly property real displayedItems: Math.floor((parent.width - margins*2) / cellWidth) width: displayedItems * cellWidth model: uiModel.targetList; + GridView.delayRemove: true + + // TODO: animations only properly work with abstractListModel... grrr... + addDisplaced: Transition { + NumberAnimation { properties: "x,y"; duration: 300 } + } + add: Transition { + ParallelAnimation { + NumberAnimation { property: "opacity"; from: 0; duration: 300; easing.type: Easing.OutQuad } + NumberAnimation { properties: "x,y"; from: height; duration: 300; easing.type: Easing.OutQuad } + } + } + + populate: Transition { + ParallelAnimation { + NumberAnimation { property: "opacity"; from: 0; duration: 300; easing.type: Easing.OutQuad } + NumberAnimation { properties: "x,y"; duration: 300; easing.type: Easing.OutQuad } + } + } + + remove: Transition { + NumberAnimation { property: "opacity"; to: 0; duration: 300; easing.type: Easing.InQuad } + } + removeDisplaced: Transition { + NumberAnimation { properties: "x,y"; duration: 300; easing.type: Easing.InQuad } + } + delegate: RPane { color: Qt.lighter(Material.background, 1.6) bgOpacity: 0.3 radius: 8 - width: 242 - height: 149 + width: 292 + height: 190 Material.elevation: 4 - + clip: true Label { + id: label anchors.top: parent.top anchors.left: parent.left + anchors.right: parent.right + wrapMode: Text.WordWrap text: modelData.name font.bold: true font.pixelSize: 16 } + Column { + anchors.top: label.bottom + anchors.left: parent.left + anchors.bottom: row.top + anchors.margins: 12 + spacing: 4 + Row { + spacing: 8 + visible: modelData.launchPath && modelData.launchPath.length > 0 + Label { + text: uiModel.isWindows && modelData.launchPath + ? modelData.launchPath.replace(/^.{1,3}:/, "").length < modelData.launchPath.length + ? "Win32" + : "UWP" + : qsTr("Launch") + font.bold: true + } + Label { + property string te: modelData.launchPath + ? modelData.launchPath.replace(/.*(\\|\/)/gm, "") + : "" + text: uiModel.isWindows ? te : te.replace(/\..{3}$/, "") + } + } + } + + Button { + anchors.left: parent.left + anchors.bottom: parent.bottom + width: 72 + onClicked: console.log("TODO") // TODO + Row { + anchors.centerIn: parent + spacing: 8 + Label { + anchors.verticalCenter: parent.verticalCenter + text: "+" + font.bold: true + font.pixelSize: 24 + } + Image { + anchors.verticalCenter: parent.verticalCenter + source: "qrc:/svg/steam.svg" + width: 22 + height: 22 + smooth: true + mipmap: true + ColorOverlay { + anchors.fill: parent + source: parent + color: "white" + } + } + } + } + Row { + id: row anchors.right: parent.right anchors.bottom: parent.bottom spacing: 4 - Button { - text: qsTr("Add to Steam") // TODO - onClicked: console.log("TODO") // TODO + RoundButton { + onClicked: uiModel.deleteTarget(index) highlighted: true + Material.accent: Material.color(Material.Red, Material.Shade900) + Image { + anchors.centerIn: parent + source: "qrc:/svg/delete_white_24dp.svg" + width: 16 + height: 16 + } } - Button { - text: qsTr("Edit") + RoundButton { onClicked: editClicked(index, modelData) + highlighted: true + Image { + anchors.centerIn: parent + source: "qrc:/svg/edit_white_24dp.svg" + width: 16 + height: 16 + } } } diff --git a/GlosSIConfig/qml/ShortcutProps.qml b/GlosSIConfig/qml/ShortcutProps.qml index acdbd10..58cf598 100644 --- a/GlosSIConfig/qml/ShortcutProps.qml +++ b/GlosSIConfig/qml/ShortcutProps.qml @@ -24,6 +24,7 @@ Item { id: propsContent anchors.fill: parent + property alias fileDialog: fileDialog signal cancel() signal done(var shortcut) @@ -92,6 +93,7 @@ Item { placeholderText: qsTr("...") text: shortcutInfo.name onTextChanged: shortcutInfo.name = text + validator: RegularExpressionValidator { regularExpression: /([0-z]|\s|.)+/gm } } } Item { @@ -251,6 +253,7 @@ Item { Button { text: qsTr("Done") highlighted: true + enabled: nameInput.acceptableInput onClicked: function() { done(shortcutInfo) } diff --git a/GlosSIConfig/qml/main.qml b/GlosSIConfig/qml/main.qml index 0c51736..0dcd011 100644 --- a/GlosSIConfig/qml/main.qml +++ b/GlosSIConfig/qml/main.qml @@ -29,7 +29,7 @@ Window { title: qsTr("GlosSI - Config") - color: uiModel.hasAcrlyicEffect ? colorAlpha(Qt.darker(Material.background, 2), 0.7) : colorAlpha(Qt.darker(Material.background, 1.5), 0.98) + color: uiModel.hasAcrlyicEffect ? colorAlpha(Qt.darker(Material.background, 2), 0.65) : colorAlpha(Qt.darker(Material.background, 1.5), 0.98) function toggleMaximized() { if (window.visibility === Window.Maximized || window.visibility === Window.FullScreen) { @@ -219,9 +219,14 @@ Window { onConfirmed: function(param) { shortcutProps.opacity = 1; homeContent.opacity = 0; - // TODO Which dialog props.resetInfo() windowContent.editedIndex = -1 + if (param == "launch") { + props.fileDialog.open(); + } + if (param == "uwp") { + // props.fileDIalog.open(); + } } } diff --git a/GlosSIConfig/svg/delete_white_24dp.svg b/GlosSIConfig/svg/delete_white_24dp.svg new file mode 100644 index 0000000..8e06c2f --- /dev/null +++ b/GlosSIConfig/svg/delete_white_24dp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/GlosSIConfig/svg/edit_white_24dp.svg b/GlosSIConfig/svg/edit_white_24dp.svg new file mode 100644 index 0000000..6c7849f --- /dev/null +++ b/GlosSIConfig/svg/edit_white_24dp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/GlosSIConfig/svg/steam.svg b/GlosSIConfig/svg/steam.svg new file mode 100644 index 0000000..0bfb16d --- /dev/null +++ b/GlosSIConfig/svg/steam.svg @@ -0,0 +1 @@ + \ No newline at end of file