GlosSIConfig: Show non-Steam-Shortcut AppIDs in Debug builds

pull/192/head
Peter Repukat 2 years ago
parent c4f2382928
commit 3458f907ca

@ -167,6 +167,22 @@ bool UIModel::isInSteam(QVariant shortcut)
return false;
}
uint32_t UIModel::getAppId(QVariant shortcut)
{
if (!isInSteam(shortcut)) {
return 0;
}
const auto map = shortcut.toMap();
for (auto& steam_shortcut : shortcuts_vdf_) {
if (map["name"].toString() == QString::fromStdString(steam_shortcut.appname)) {
if (QString::fromStdString(steam_shortcut.exe).toLower().contains("glossitarget.exe")) {
return steam_shortcut.appid;
}
}
}
return 0;
}
bool UIModel::addToSteam(QVariant shortcut, const QString& shortcutspath, bool from_cmd)
{
QDir appDir = QGuiApplication::applicationDirPath();
@ -523,6 +539,15 @@ bool UIModel::writeShortcutsVDF(const std::wstring& mode, const std::wstring& na
#endif
}
bool UIModel::getIsDebug() const
{
#ifdef _DEBUG
return true;
#else
return false;
#endif
}
bool UIModel::getIsWindows() const { return is_windows_; }
bool UIModel::hasAcrylicEffect() const { return has_acrylic_affect_; }

@ -25,6 +25,7 @@ class QNetworkReply;
class UIModel : public QObject {
Q_OBJECT
Q_PROPERTY(bool isDebug READ getIsDebug CONSTANT)
Q_PROPERTY(bool isWindows READ getIsWindows CONSTANT)
Q_PROPERTY(bool hasAcrlyicEffect READ hasAcrylicEffect NOTIFY acrylicChanged)
Q_PROPERTY(QVariantList targetList READ getTargetList NOTIFY targetListChanged)
@ -45,6 +46,7 @@ class UIModel : public QObject {
Q_INVOKABLE bool updateTarget(int index, QVariant shortcut);
Q_INVOKABLE void deleteTarget(int index);
Q_INVOKABLE bool isInSteam(QVariant shortcut);
Q_INVOKABLE uint32_t getAppId(QVariant shortcut);
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);
@ -66,6 +68,7 @@ class UIModel : public QObject {
[[nodiscard]] bool writeShortcutsVDF(const std::wstring& mode, const std::wstring& name,
const std::wstring& shortcutspath, bool is_admin_try = false) const;
bool getIsDebug() const;
bool getIsWindows() const;
[[nodiscard]] bool hasAcrylicEffect() const;
void setAcrylicEffect(bool has_acrylic_affect);

@ -130,34 +130,14 @@ GridView {
}
}
Row {
visible: false // TODO: dunno about this...
visible: uiModel.isDebug
spacing: 4
Label {
text: qsTr("Is in")
text: qsTr("AppID: ")
font.bold: true
}
Image {
anchors.verticalCenter: parent.verticalCenter
source: "qrc:/svg/steam.svg"
width: 16
height: 16
smooth: true
mipmap: true
ColorOverlay {
anchors.fill: parent
source: parent
color: "white"
}
}
Item {
width: 4
height: 1
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: delegateRoot.isInSteam ? qsTr("Yes") : qsTr("No")
width: 292 - typeLabel.width - 72
elide: Text.ElideRight
text: uiModel.getAppId(modelData)
}
}
}

Loading…
Cancel
Save