From cc266d921d51e6170f1f5b39dd1893391f1ad94c Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Sun, 24 Oct 2021 22:27:20 +0200 Subject: [PATCH] GlossiConfig: Fix build; Actually delete fiels when renaming --- GlosSIConfig/UIModel.cpp | 9 ++++++--- GlosSIConfig/qml/ShortcutCards.qml | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GlosSIConfig/UIModel.cpp b/GlosSIConfig/UIModel.cpp index e370812..b329c1c 100644 --- a/GlosSIConfig/UIModel.cpp +++ b/GlosSIConfig/UIModel.cpp @@ -20,9 +20,6 @@ limitations under the License. #include -#include "TargetConfig.h" - - UIModel::UIModel() : QObject(nullptr) { auto path = std::filesystem::temp_directory_path() @@ -100,6 +97,12 @@ void UIModel::updateTarget(int index, QVariant shortcut) writeTarget(wtf, map["name"].toString()); + auto oldName = targets_[index].toMap()["name"].toString() + ".json"; + auto path = config_path_; + path /= config_dir_name_.toStdString(); + path /= (oldName).toStdString(); + std::filesystem::remove(path); + targets_.replace(index, json.toVariant()); emit targetListChanged(); } diff --git a/GlosSIConfig/qml/ShortcutCards.qml b/GlosSIConfig/qml/ShortcutCards.qml index 88fd242..484fc28 100644 --- a/GlosSIConfig/qml/ShortcutCards.qml +++ b/GlosSIConfig/qml/ShortcutCards.qml @@ -49,11 +49,21 @@ GridView { font.pixelSize: 16 } - Button { - text: qsTr("Edit") + Row { anchors.right: parent.right anchors.bottom: parent.bottom - onClicked: editClicked(index, modelData) + spacing: 4 + + Button { + text: qsTr("Add to Steam") // TODO + onClicked: console.log("TODO") // TODO + highlighted: true + } + + Button { + text: qsTr("Edit") + onClicked: editClicked(index, modelData) + } } }