diff --git a/GlosSIConfig/Resource.rc b/GlosSIConfig/Resource.rc index c3879cb..b078961 100644 --- a/GlosSIConfig/Resource.rc +++ b/GlosSIConfig/Resource.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,3,103000945081 - PRODUCTVERSION 0,0,3,103000945081 + FILEVERSION 0,0,3,105001394320 + PRODUCTVERSION 0,0,3,105001394320 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "FileDescription", "GlosSI - Config" - VALUE "FileVersion", "0.0.3.1-3-ge945c81" + VALUE "FileVersion", "0.0.3.1-5-g139432c" VALUE "InternalName", "GlosSIConfig" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "OriginalFilename", "GlosSIConfig.exe" VALUE "ProductName", "GlosSi" - VALUE "ProductVersion", "0.0.3.1-3-ge945c81" + VALUE "ProductVersion", "0.0.3.1-5-g139432c" END END BLOCK "VarFileInfo" @@ -530,6 +530,154 @@ END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GlosSIConfig/UIModel.cpp b/GlosSIConfig/UIModel.cpp index a882683..8d14e02 100644 --- a/GlosSIConfig/UIModel.cpp +++ b/GlosSIConfig/UIModel.cpp @@ -236,6 +236,26 @@ bool UIModel::removeFromSteam(const QString& name, const QString& shortcutspath, return writeShortcutsVDF(L"remove", name.toStdWString(), shortcutspath.toStdWString(), from_cmd); } +QVariantMap UIModel::manualProps(QVariant shortcut) +{ + QDir appDir = QGuiApplication::applicationDirPath(); + const auto map = shortcut.toMap(); + const auto name = map["name"].toString(); + const auto maybeLaunchPath = map["launchPath"].toString(); + const auto launch = map["launch"].toBool(); + + QVariantMap res; + res.insert("name", name); + res.insert("config", name + ".json"); + res.insert("launch", ("\"" + appDir.absolutePath() + "/GlosSITarget.exe" + "\"")); + res.insert("launchDir", ( + launch && !maybeLaunchPath.isEmpty() + ? (QString("\"") + QString::fromStdString(std::filesystem::path(maybeLaunchPath.toStdString()).parent_path().string()) + "\"") + : ("\"" + appDir.absolutePath() + "\"")) + ); + return res; +} + #ifdef _WIN32 QVariantList UIModel::uwpApps() { diff --git a/GlosSIConfig/UIModel.h b/GlosSIConfig/UIModel.h index 22b4758..de51daa 100644 --- a/GlosSIConfig/UIModel.h +++ b/GlosSIConfig/UIModel.h @@ -40,6 +40,7 @@ class UIModel : public QObject { Q_INVOKABLE bool addToSteam(QVariant shortcut, const QString& shortcutspath, bool from_cmd = false); bool addToSteam(const QString& name, const QString& shortcutspath, bool from_cmd = false); Q_INVOKABLE bool removeFromSteam(const QString& name, const QString& shortcutspath, bool from_cmd = false); + Q_INVOKABLE QVariantMap manualProps(QVariant shortcut); #ifdef _WIN32 Q_INVOKABLE QVariantList uwpApps(); #endif diff --git a/GlosSIConfig/qml.qrc b/GlosSIConfig/qml.qrc index d0b1c8d..4c3d545 100644 --- a/GlosSIConfig/qml.qrc +++ b/GlosSIConfig/qml.qrc @@ -11,5 +11,6 @@ svg/steam.svg qml/UWPSelectDialog.qml qml/InfoDialog.qml + steamscreener.png diff --git a/GlosSIConfig/qml/InfoDialog.qml b/GlosSIConfig/qml/InfoDialog.qml index efd7a7a..3dc74e2 100644 --- a/GlosSIConfig/qml/InfoDialog.qml +++ b/GlosSIConfig/qml/InfoDialog.qml @@ -21,6 +21,7 @@ Dialog { property var confirmedParam: null signal confirmed(var param) + signal confirmedExtra(var param) visible: false modal: true @@ -40,6 +41,10 @@ Dialog { property alias titleText: title.text property alias text: text.text + property bool extraButton: false + property alias extraButtonText: extrabutton.text + property var confirmedExtraParam: null + enter: Transition { NumberAnimation{target: content; property: "y"; from: parent.height; to: 16; duration: 300; easing.type: Easing.OutQuad } NumberAnimation{target: background; property: "y"; from: parent.height; to: 0; duration: 300; easing.type: Easing.OutQuad } @@ -84,6 +89,16 @@ Dialog { anchors.top: col.bottom anchors.topMargin: parent.spacing spacing: 16 + + Button { + id: extrabutton + visible: extraButton + onClicked: function(){ + close() + confirmedExtra(confirmedExtraParam) + } + } + Button { text: qsTr("OK") onClicked: function(){ diff --git a/GlosSIConfig/qml/ShortcutCards.qml b/GlosSIConfig/qml/ShortcutCards.qml index 1d7238c..ca0c1c0 100644 --- a/GlosSIConfig/qml/ShortcutCards.qml +++ b/GlosSIConfig/qml/ShortcutCards.qml @@ -40,6 +40,8 @@ GridView { model: uiModel.targetList; GridView.delayRemove: true + property var manualInfo: null + // TODO: animations only properly work with abstractListModel... grrr... addDisplaced: Transition { NumberAnimation { properties: "x,y"; duration: 300 } @@ -65,10 +67,133 @@ GridView { NumberAnimation { properties: "x,y"; duration: 300; easing.type: Easing.InQuad } } + Dialog { + id: manualAddDialog + anchors.centerIn: parent + visible: false + modal: true + dim: true + parent: Overlay.overlay + Overlay.modal: Rectangle { + color: Qt.rgba(0,0,0,0.4) + opacity: backdropOpacity + Behavior on opacity { + NumberAnimation { + duration: 300 + } + } + } + property real backdropOpacity: 1.0 + enter: Transition { + NumberAnimation{target: madcontent; property: "y"; from: parent.height; to: 16; duration: 300; easing.type: Easing.OutQuad } + NumberAnimation{target: madbackground; property: "y"; from: parent.height; to: 0; duration: 300; easing.type: Easing.OutQuad } + NumberAnimation{target: manualAddDialog; property: "backdropOpacity"; from: 0; to: 1; duration: 300; easing.type: Easing.OutQuad } + } + + exit: Transition { + NumberAnimation{target: madcontent; property: "y"; from: 16; to: parent.height; duration: 300; easing.type: Easing.InQuad } + NumberAnimation{target: madbackground; property: "y"; from: 0; to: parent.height; duration: 300; easing.type: Easing.InQuad } + NumberAnimation{target: manualAddDialog; property: "backdropOpacity"; from: 1; to: 0; duration: 300; easing.type: Easing.InQuad } + } + + background: RPane { + id: madbackground + radius: 4 + Material.elevation: 64 + bgOpacity: 0.97 + } + contentItem: Item { + id: madcontent + implicitWidth: steamscreener.width + implicitHeight: madtext.height + 16 + steamscreener.height + 16 + madrow.height + + Label { + id: madtext + text: qsTr("Add \"GlosSITarget\" as game to Steam and change it's properties (in Steam) to this:") + } + + Image { + anchors.top: madtext.bottom + anchors.left: madtext.left + anchors.topMargin: 16 + id: steamscreener + source: "qrc:/steamscreener.png" + } + + FluentTextInput { + id: madnameinput + text: manualInfo ? manualInfo.name : "" + anchors.top: steamscreener.top + anchors.left: steamscreener.left + anchors.topMargin: 72 + anchors.leftMargin: 92 + readOnly: true + background: Item {} + width: 550 + } + + FluentTextInput { + id: glossiPathInput + text: manualInfo ? manualInfo.launch : "" + anchors.top: steamscreener.top + anchors.left: steamscreener.left + anchors.topMargin: 192 + anchors.leftMargin: 24 + readOnly: true + background: Item {} + width: 550 + } + + FluentTextInput { + id: startDirInput + text: manualInfo ? manualInfo.launchDir : "" + anchors.top: steamscreener.top + anchors.left: steamscreener.left + anchors.topMargin: 266 + anchors.leftMargin: 24 + readOnly: true + background: Item {} + width: 550 + } + + FluentTextInput { + id: launchOptsInput + text: manualInfo ? manualInfo.config : "" + anchors.top: steamscreener.top + anchors.left: steamscreener.left + anchors.topMargin: 432 + anchors.leftMargin: 24 + readOnly: true + background: Item {} + width: 550 + } + + Row { + id: madrow + anchors.top: steamscreener.bottom + anchors.topMargin: 16 + spacing: 16 + + Button { + text: qsTr("OK") + onClicked: function(){ + manualAddDialog.close() + } + } + anchors.right: parent.right + } + } + } + InfoDialog { id: writeErrorDialog titleText: qsTr("Error") text: qsTr("Error writing shortcuts.vdf...") + extraButton: true + extraButtonText: qsTr("Manual instructions") + onConfirmedExtra: function(data) { + manualAddDialog.open(); + } } delegate: RPane { @@ -174,9 +299,6 @@ GridView { anchors.bottom: parent.bottom width: 72 onClicked: function(){ - if (steamShortcutsChanged == false) { - steamChangedDialog.open(); - } if (delegateRoot.isInSteam) { if (!uiModel.removeFromSteam(modelData.name, "")) { writeErrorDialog.open(); @@ -184,10 +306,14 @@ GridView { } } else { if (!uiModel.addToSteam(modelData, "")) { + manualInfo = uiModel.manualProps(modelData); writeErrorDialog.open(); return; } } + if (steamShortcutsChanged == false) { + steamChangedDialog.open(); + } delegateRoot.isInSteam = uiModel.isInSteam(modelData) steamShortcutsChanged = true } diff --git a/GlosSIConfig/steamscreener.png b/GlosSIConfig/steamscreener.png new file mode 100644 index 0000000..2c2d181 Binary files /dev/null and b/GlosSIConfig/steamscreener.png differ diff --git a/GlosSITarget/Resource.rc b/GlosSITarget/Resource.rc index 8a537cf..813f509 100644 --- a/GlosSITarget/Resource.rc +++ b/GlosSITarget/Resource.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,2,005001092093 - PRODUCTVERSION 0,0,2,005001092093 + FILEVERSION 0,0,3,105001394320 + PRODUCTVERSION 0,0,3,105001394320 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "FileDescription", "GlosSI - SteamTarget" - VALUE "FileVersion", "0.0.2.0-5-g1b92093" + VALUE "FileVersion", "0.0.3.1-5-g139432c" VALUE "InternalName", "GlosSITarget" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "OriginalFilename", "GlosSITarget.exe" VALUE "ProductName", "GlosSI" - VALUE "ProductVersion", "0.0.2.0-5-g1b92093" + VALUE "ProductVersion", "0.0.3.1-5-g139432c" END END BLOCK "VarFileInfo" @@ -635,6 +635,10 @@ END + + + +