refactor/fix stupid qml shit

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

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,1,0,2034000568418 FILEVERSION 0,1,0,2035000100080
PRODUCTVERSION 0,1,0,2034000568418 PRODUCTVERSION 0,1,0,2035000100080
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "CompanyName", "Peter Repukat - FlatspotSoftware"
VALUE "FileDescription", "GlosSI - Config" VALUE "FileDescription", "GlosSI - Config"
VALUE "FileVersion", "0.1.0.2-34-gb568418" VALUE "FileVersion", "0.1.0.2-35-g01efd8d"
VALUE "InternalName", "GlosSIConfig" VALUE "InternalName", "GlosSIConfig"
VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware"
VALUE "OriginalFilename", "GlosSIConfig.exe" VALUE "OriginalFilename", "GlosSIConfig.exe"
VALUE "ProductName", "GlosSI" VALUE "ProductName", "GlosSI"
VALUE "ProductVersion", "0.1.0.2-34-gb568418" VALUE "ProductVersion", "0.1.0.2-35-g01efd8d"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

@ -20,6 +20,7 @@ limitations under the License.
#include <QJsonDocument> #include <QJsonDocument>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QFont>
#include <WinReg/WinReg.hpp> #include <WinReg/WinReg.hpp>
@ -60,6 +61,11 @@ UIModel::UIModel() : QObject(nullptr)
parseShortcutVDF(); parseShortcutVDF();
readTargetConfigs(); readTargetConfigs();
updateCheck(); updateCheck();
auto font = QGuiApplication::font();
font.setPointSize(11);
font.setFamily("Roboto");
QGuiApplication::setFont(font);
} }
void UIModel::readTargetConfigs() void UIModel::readTargetConfigs()

@ -15,6 +15,9 @@ limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick 6.2
import QtQuick.Controls 6.2 import QtQuick.Controls 6.2
import QtQuick.Controls.Material 6.2
import QtQuick.Dialogs 6.2
Dialog { Dialog {
id: dlg id: dlg
anchors.centerIn: parent anchors.centerIn: parent

@ -15,6 +15,9 @@ limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick 6.2
import QtQuick.Controls 6.2 import QtQuick.Controls 6.2
import QtQuick.Controls.Material 6.2
import QtQuick.Dialogs 6.2
Dialog { Dialog {
id: dlg id: dlg
anchors.centerIn: parent anchors.centerIn: parent

@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick
import QtQuick.Layouts 6.2 import QtQuick.Layouts
import QtQuick.Controls 6.2 import QtQuick.Controls
import QtQuick.Controls.Material 6.2 import QtQuick.Controls.Material
import QtQuick.Dialogs 6.2 import QtQuick.Dialogs
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
GridView { GridView {
@ -40,8 +40,6 @@ GridView {
model: uiModel.targetList; model: uiModel.targetList;
GridView.delayRemove: true GridView.delayRemove: true
property var manualInfo: null
// TODO: animations only properly work with abstractListModel... grrr... // TODO: animations only properly work with abstractListModel... grrr...
addDisplaced: Transition { addDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 300 } NumberAnimation { properties: "x,y"; duration: 300 }
@ -67,134 +65,6 @@ GridView {
NumberAnimation { properties: "x,y"; duration: 300; easing.type: Easing.InQuad } 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...\nPlease make sure Steam is running")
extraButton: true
extraButtonText: qsTr("Manual instructions")
onConfirmedExtra: function(data) {
manualAddDialog.open();
}
}
delegate: RPane { delegate: RPane {
id: delegateRoot id: delegateRoot

@ -13,11 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick
import QtQuick.Controls 6.2 import QtQuick.Layouts
import QtQuick.Layouts 6.2 import QtQuick.Controls
import QtQuick.Controls.Material 6.2 import QtQuick.Controls.Material
import QtQuick.Dialogs 6.2 import QtQuick.Dialogs
import Qt5Compat.GraphicalEffects
Item { Item {
@ -54,7 +55,6 @@ Item {
advancedTargetSettings.shortcutInfo = shortcutInfo; advancedTargetSettings.shortcutInfo = shortcutInfo;
} }
if (maybeIcon) { if (maybeIcon) {
console.log("meh");
maybeIcon.source = shortcutInfo.icon maybeIcon.source = shortcutInfo.icon
? shortcutInfo.icon.endsWith(".exe") ? shortcutInfo.icon.endsWith(".exe")
? "image://exe/" + shortcutInfo.icon ? "image://exe/" + shortcutInfo.icon
@ -221,6 +221,13 @@ Item {
visible: uiModel.isWindows visible: uiModel.isWindows
onClicked: uwpSelectDialog.open(); onClicked: uwpSelectDialog.open();
} }
Button {
Layout.preferredWidth: 64
Layout.alignment: Qt.AlignBottom
text: qsTr("EGS")
visible: uiModel.isWindows
onClicked: egsSelectDialog.open();
}
Item { Item {
height: 1 height: 1
Layout.preferredWidth: 12 Layout.preferredWidth: 12
@ -255,7 +262,6 @@ Item {
AdvancedTargetSettings { AdvancedTargetSettings {
id: advancedTargetSettings id: advancedTargetSettings
shortcutInfo: shortcutInfo
} }
Item { Item {

@ -13,10 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick
import QtQuick.Controls 6.2 import QtQuick.Layouts
import QtQuick.Layouts 6.2 import QtQuick.Controls
import QtQuick.Controls.Material 6.2 import QtQuick.Controls.Material
import QtQuick.Dialogs
import Qt5Compat.GraphicalEffects
Dialog { Dialog {
id: dlg id: dlg
@ -80,10 +82,6 @@ Dialog {
} }
Button { Button {
anchors.right: parent.right
anchors.top: listview.bottom
anchors.topMargin: 16
anchors.rightMargin: 2
text: qsTr("Ok") text: qsTr("Ok")
onClicked: dlg.close() onClicked: dlg.close()
} }

@ -13,9 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import QtQuick 6.2 import QtQuick
import QtQuick.Layouts 6.2 import QtQuick.Layouts
import QtQuick.Controls.Material 6.2 import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Dialogs
import Qt5Compat.GraphicalEffects
Window { Window {
id: window id: window
@ -26,6 +29,7 @@ Window {
Material.accent: Material.color(Material.Blue, Material.Shade900) Material.accent: Material.color(Material.Blue, Material.Shade900)
property bool itemSelected: false; property bool itemSelected: false;
property var manualInfo: null
title: qsTr("GlosSI - Config") title: qsTr("GlosSI - Config")
@ -125,6 +129,135 @@ Window {
extraButtonText: qsTr("Remind me later") extraButtonText: qsTr("Remind me later")
visible: !!uiModel.newVersionName visible: !!uiModel.newVersionName
} }
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...\nPlease make sure Steam is running")
extraButton: true
extraButtonText: qsTr("Manual instructions")
onConfirmedExtra: function(data) {
manualAddDialog.open();
}
}
Rectangle { Rectangle {
id: titleBar id: titleBar
@ -318,7 +451,14 @@ Window {
if (windowContent.editedIndex < 0) { if (windowContent.editedIndex < 0) {
uiModel.addTarget(shortcut) uiModel.addTarget(shortcut)
} else { } else {
uiModel.updateTarget(windowContent.editedIndex, shortcut) if (uiModel.updateTarget(windowContent.editedIndex, shortcut)) {
if (steamShortcutsChanged == false) {
steamChangedDialog.open();
}
} else {
manualInfo = uiModel.manualProps(shortcut);
writeErrorDialog.open();
}
} }
} }
} }

Loading…
Cancel
Save