diff --git a/GlosSIConfig/GlosSIConfig.vcxproj b/GlosSIConfig/GlosSIConfig.vcxproj
index a79c58d..f0c35bf 100644
--- a/GlosSIConfig/GlosSIConfig.vcxproj
+++ b/GlosSIConfig/GlosSIConfig.vcxproj
@@ -164,7 +164,6 @@
-
diff --git a/GlosSIConfig/GlosSIConfig.vcxproj.filters b/GlosSIConfig/GlosSIConfig.vcxproj.filters
index 9811199..8999805 100644
--- a/GlosSIConfig/GlosSIConfig.vcxproj.filters
+++ b/GlosSIConfig/GlosSIConfig.vcxproj.filters
@@ -105,9 +105,6 @@
Header Files
-
- Header Files
-
diff --git a/GlosSIConfig/Resource.rc b/GlosSIConfig/Resource.rc
index f5db24c..d4150b5 100644
--- a/GlosSIConfig/Resource.rc
+++ b/GlosSIConfig/Resource.rc
@@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,1,0,2045006300001
- PRODUCTVERSION 0,1,0,2045006300001
+ FILEVERSION 0,1,1,002004500680
+ PRODUCTVERSION 0,1,1,002004500680
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Peter Repukat - FlatspotSoftware"
VALUE "FileDescription", "GlosSI - Config"
- VALUE "FileVersion", "0.1.0.2-45-g63fdab1"
+ VALUE "FileVersion", "0.1.1.0-2-g45bd68e"
VALUE "InternalName", "GlosSIConfig"
VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware"
VALUE "OriginalFilename", "GlosSIConfig.exe"
VALUE "ProductName", "GlosSI"
- VALUE "ProductVersion", "0.1.0.2-45-g63fdab1"
+ VALUE "ProductVersion", "0.1.1.0-2-g45bd68e"
END
END
BLOCK "VarFileInfo"
diff --git a/GlosSIConfig/UIModel.cpp b/GlosSIConfig/UIModel.cpp
index ee67d6d..cddb456 100644
--- a/GlosSIConfig/UIModel.cpp
+++ b/GlosSIConfig/UIModel.cpp
@@ -36,7 +36,6 @@ limitations under the License.
#include "ExeImageProvider.h"
#include "ExeImageProvider.h"
#include "../version.hpp"
-#include "steamgrid_api_keys.h"
UIModel::UIModel() : QObject(nullptr)
{
@@ -375,6 +374,7 @@ QVariantMap UIModel::getDefaultConf() const
{"version", 1},
{"extendedLogging", false},
{"snapshotNotify", false},
+ {"steamgridApiKey", QJsonValue::Null},
{"controller", QJsonObject{{"maxControllers", 1}, {"emulateDS4", false}, {"allowDesktopConfig", false}}},
{"devices",
QJsonObject{
@@ -489,8 +489,11 @@ void UIModel::loadSteamGridImages()
std::filesystem::path path = QCoreApplication::applicationDirPath().toStdWString();
path /= "steamgrid.exe";
+ auto api_key = getDefaultConf().value("steamgridApiKey").toString();
+ steamgrid_output_.clear();
+
steamgrid_proc_.setProgram(path.string().c_str());
- steamgrid_proc_.setArguments({"-nonsteamonly", "--onlymissingartwork", "--steamgriddb", steamgridb_key});
+ steamgrid_proc_.setArguments({"-nonsteamonly", "--onlymissingartwork", "--steamgriddb", api_key});
connect(&steamgrid_proc_, &QProcess::readyReadStandardOutput, this, &UIModel::onSteamGridReadReady);
steamgrid_proc_.start();
steamgrid_proc_.write("\n");
@@ -678,8 +681,12 @@ void UIModel::onAvailFilesResponse(QNetworkReply* reply)
void UIModel::onSteamGridReadReady()
{
- steamgrid_output_.push_back(QString::fromLocal8Bit(steamgrid_proc_.readAllStandardOutput()));
+ const auto output = QString::fromLocal8Bit(steamgrid_proc_.readAllStandardOutput());
+ steamgrid_output_.push_back(output);
emit steamgridOutputChanged();
+ if (output.toLower().contains("token is missing or invalid")) {
+ steamgrid_proc_.kill();
+ }
}
void UIModel::writeTarget(const QJsonObject& json, const QString& name) const
@@ -693,7 +700,10 @@ void UIModel::writeTarget(const QJsonObject& json, const QString& name) const
return;
}
- file.write(QString(QJsonDocument(json).toJson(QJsonDocument::Indented)).toStdString().data());
+ auto json_ob = QJsonDocument(json).object();
+ json_ob.remove("steamgridApiKey");
+
+ file.write(QString(QJsonDocument(json_ob).toJson(QJsonDocument::Indented)).toStdString().data());
file.close();
}
diff --git a/GlosSIConfig/qml/AdvancedTargetSettings.qml b/GlosSIConfig/qml/AdvancedTargetSettings.qml
index 0c7ec8a..5628f4a 100644
--- a/GlosSIConfig/qml/AdvancedTargetSettings.qml
+++ b/GlosSIConfig/qml/AdvancedTargetSettings.qml
@@ -29,6 +29,8 @@ CollapsiblePane {
property var shortcutInfo: ({})
+ readonly property bool isAppSettings: subTitle != ""
+
content:
Column {
spacing: 16
diff --git a/GlosSIConfig/qml/GlobalConf.qml b/GlosSIConfig/qml/GlobalConf.qml
index 989b7ca..97c7a65 100644
--- a/GlosSIConfig/qml/GlobalConf.qml
+++ b/GlosSIConfig/qml/GlobalConf.qml
@@ -81,6 +81,25 @@ Item {
config.snapshotNotify = checked
}
}
+ }
+ Row {
+ leftPadding: 12
+ Row {
+ spacing: 16
+ Label {
+ topPadding: 8
+ id: apiKeyLabel
+ font.bold: true
+ text: qsTr("SteamGridDB-API-Key")
+ }
+ FluentTextInput {
+ width: 128
+ id: apiKeyInput
+ placeholderText: qsTr("...")
+ text: config.steamgridApiKey
+ onTextChanged: config.steamgridApiKey = text
+ }
+ }
}
}
}
diff --git a/GlosSIConfig/qml/SteamGridDialog.qml b/GlosSIConfig/qml/SteamGridDialog.qml
index 097947a..85459e3 100644
--- a/GlosSIConfig/qml/SteamGridDialog.qml
+++ b/GlosSIConfig/qml/SteamGridDialog.qml
@@ -40,6 +40,7 @@ Dialog {
property real backdropOpacity: 1.0
property bool loading: true
+ property bool hasTokenError: false
onOpened: function() {
@@ -80,25 +81,55 @@ Dialog {
font.bold: true
}
- BusyIndicator {
- id: busyIndicator
- running: visible
+ Item {
+ id: topContentContainer
anchors.top: titlelabel.bottom
anchors.topMargin: 8
anchors.horizontalCenter: parent.horizontalCenter
- opacity: loading ? 1 : 0
- height: loading ? 72 : 0
- Behavior on opacity {
- NumberAnimation {
- duration: 350
- easing.type: Easing.InOutQuad
- }
- }
- visible: loading
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: loading || hasTokenError ? 72 : 0
+
+ BusyIndicator {
+ id: busyIndicator
+ running: visible
+ anchors.horizontalCenter: parent.horizontalCenter
+ opacity: loading ? 1 : 0
+ height: loading ? 72 : 0
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 350
+ easing.type: Easing.InOutQuad
+ }
+ }
+ visible: loading
+ }
+
+ Label {
+ id: tokenErrorInfo
+ anchors.horizontalCenter: parent.horizontalCenter
+ opacity: hasTokenError ? 1 : 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.Wrap
+ font.bold: true
+ color: "yellow"
+ textFormat: TextEdit.RichText
+ onLinkActivated: Qt.openUrlExternally(link)
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 350
+ easing.type: Easing.InOutQuad
+ }
+ }
+ visible: hasTokenError
+ text: qsTr("Please go to SteamGridDB and gerenate a new API token. Then paste it into the settings dialog.")
+ }
+
}
ListView {
- anchors.top: busyIndicator.bottom
+ anchors.top: topContentContainer.bottom
anchors.topMargin: 16
anchors.bottom: parent.bottom
anchors.bottomMargin: 16
@@ -110,9 +141,10 @@ Dialog {
model: uiModel.steamgridOutput
ScrollBar.vertical: ScrollBar {
}
- onCountChanged: {
- listview.positionViewAtIndex(listview.count - 1, ListView.Visible)
- loading = !listview.model[listview.count - 1].includes("Press enter")
+ onCountChanged: function() {
+ listview.positionViewAtIndex(listview.count - 1, ListView.Visible);
+ hasTokenError = listview.model.some((l) => l.includes("missing or invalid"));
+ loading = !(listview.model.some((l) => l.includes("Press enter")) || hasTokenError);
}
Behavior on opacity {