diff --git a/CMakeModules/EdenModule.cmake b/CMakeModules/EdenModule.cmake index 2054456ede..861d8b78e3 100644 --- a/CMakeModules/EdenModule.cmake +++ b/CMakeModules/EdenModule.cmake @@ -44,4 +44,6 @@ function(EdenModule) if (DEFINED MODULE_LIBRARIES) target_link_libraries(${LIB_NAME} PRIVATE ${MODULE_LIBRARIES}) endif() + + target_link_libraries(${LIB_NAME} PRIVATE Carboxyl::Base Carboxyl::Styles) endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f64afb8191..5db6cf1209 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,10 @@ endif() set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:_DEBUG> $<$>:NDEBUG>) +if (ENABLE_QT) + add_compile_definitions(YUZU_QT_WIDGETS YUZU_QT_QML) +endif() + # Set compilation flags if (MSVC) set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE) @@ -235,7 +239,6 @@ if (YUZU_ROOM_STANDALONE) endif() if (ENABLE_QT) - add_definitions(-DYUZU_QT_WIDGETS) add_subdirectory(qt_common) add_subdirectory(Eden) endif() diff --git a/src/Eden/Config/CMakeLists.txt b/src/Eden/Config/CMakeLists.txt index cb72511f1e..b5af0ffb30 100644 --- a/src/Eden/Config/CMakeLists.txt +++ b/src/Eden/Config/CMakeLists.txt @@ -14,6 +14,8 @@ EdenModule( SectionHeader.qml pages/SettingsList.qml + pages/PageScrollView.qml + pages/global/GlobalTab.qml pages/global/GlobalTabSwipeView.qml pages/global/GlobalGeneralPage.qml diff --git a/src/Eden/Config/GlobalConfigureDialog.qml b/src/Eden/Config/GlobalConfigureDialog.qml index 5e5ef127a1..64c074562e 100644 --- a/src/Eden/Config/GlobalConfigureDialog.qml +++ b/src/Eden/Config/GlobalConfigureDialog.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Constants @@ -7,57 +7,82 @@ import Eden.Items import Eden.Interface import Eden.Util -AnimatedDialog { +import Carboxyl.Base + +Dialog { property list configs - preferredWidth: 1280 + popupType: Dialog.Native + + anchors.centerIn: Overlay.overlay + + implicitWidth: 1000 + implicitHeight: 700 - title: "Configuration" + title: qsTr("Configuration") standardButtons: Dialog.Ok | Dialog.Cancel Component.onCompleted: configs = Util.searchItem(swipe, "BaseField") - onAccepted: { + console.log("Accepted") configs.forEach(config => { config.apply() - // console.log(config.setting.label) + console.log(config.setting.label) }) QtConfig.save() } onRejected: { + console.log("Rejected") configs.forEach(config => config.sync()) - QtConfig.reload() + // QtConfig.reload() } - VerticalTabBar { + CarboxylTabBar { id: tabBar + vertical: true anchors { top: parent.top topMargin: 55 left: parent.left + leftMargin: 10 bottom: parent.bottom } contentWidth: 100 + contentHeight: 60 + + position: TabBar.Footer currentIndex: swipe.currentIndex + height: contentHeight * count + 20 + width: contentWidth + Repeater { - model: ["General", "System", "CPU", "Graphics", "Audio", "Debug", "Controls"] + model: [qsTr("General"), qsTr("System"), qsTr("CPU"), qsTr( + "Graphics"), qsTr("Audio"), qsTr("Debug"), qsTr("Controls")] + + CarboxylTabButton { + text: modelData + coloredIcon: true + inlineIcon: false // TODO: fix inlineIcon - SettingsTabButton { - required property string modelData - label: modelData - onClicked: tabBar.currentIndex = TabBar.index + icon.source: "qrc:/icons/" + modelData.toLowerCase() + ".svg" + icon.width: 20 + icon.height: 20 } } } - SwipeView { id: swipe currentIndex: tabBar.currentIndex + width: 1000 + height: 700 + + interactive: false + orientation: Qt.Vertical anchors { left: tabBar.right diff --git a/src/Eden/Config/SectionHeader.qml b/src/Eden/Config/SectionHeader.qml index 47da4fb070..8ac81ec43f 100644 --- a/src/Eden/Config/SectionHeader.qml +++ b/src/Eden/Config/SectionHeader.qml @@ -1,8 +1,7 @@ import QtQuick -import Eden.Constants +import Carboxyl.Base -Text { - color: Constants.text +Label { font.pixelSize: 16 } diff --git a/src/Eden/Config/TestSetting.qml b/src/Eden/Config/TestSetting.qml index e429723105..fcc4cc3f11 100644 --- a/src/Eden/Config/TestSetting.qml +++ b/src/Eden/Config/TestSetting.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Layouts -import Eden.Constants +import Carboxyl.Base Column { topPadding: 5 @@ -9,10 +9,9 @@ Column { RowLayout { uniformCellSizes: true - Text { + Label { Layout.fillWidth: true text: model.label - color: Constants.text font.pixelSize: 16 height: 40 diff --git a/src/Eden/Config/fields/BaseField.qml b/src/Eden/Config/fields/BaseField.qml index 359c7d5414..550deae535 100644 --- a/src/Eden/Config/fields/BaseField.qml +++ b/src/Eden/Config/fields/BaseField.qml @@ -18,11 +18,12 @@ Item { readonly property string typeName: "BaseField" clip: true - height: content.height + (helpText.height + helpText.anchors.topMargin) + height: 40 + (helpText.height + helpText.anchors.topMargin) Component.onCompleted: sync() function apply() { + console.log("Applying value", value, "to", setting.label) if (setting.value !== value) { setting.value = value } @@ -34,56 +35,65 @@ Item { } } - RowLayout { - id: content - height: 50 + IconButton { + id: help + + label: "help" + icon.width: 30 + icon.height: 30 - spacing: 0 + onClicked: helpText.toggle() + icon.color: palette.text + visible: setting.tooltip !== "" anchors { left: parent.left - right: parent.right + top: parent.top + topMargin: 5 } z: 2 + } - IconButton { - label: "help" - icon.width: 20 - icon.height: 20 + FieldCheckbox { + id: enable + setting: field.setting + z: 2 + force: field.forceCheckbox - onClicked: helpText.toggle() - icon.color: setting.tooltip !== "" ? Constants.text : Constants.dialog - z: 2 - } + height: 40 - FieldCheckbox { - id: enable - setting: field.setting - z: 2 - force: field.forceCheckbox + anchors { + left: help.right } + } - RowLayout { - Layout.fillWidth: true - uniformCellSizes: true - spacing: 0 - z: 2 + FieldLabel { + z: 2 + id: label + setting: field.setting - FieldLabel { - z: 2 - id: label - setting: field.setting - } + height: 40 + verticalAlignment: Text.AlignVCenter - children: showLabel ? [label, contentItem] : [contentItem] + anchors { + left: (enable.visible ? enable : help).right + right: parent.horizontalCenter } } - Rectangle { - color: Constants.dialog - anchors.fill: content - z: 0 + RowLayout { + id: content + + height: 40 + visible: showLabel + + anchors { + left: parent.horizontalCenter + right: parent.right + } + + children: [contentItem] } Text { @@ -95,14 +105,14 @@ Item { right: parent.right rightMargin: 20 - top: content.bottom + top: label.bottom topMargin: -height } z: -1 text: setting.tooltip - color: Constants.subText + color: palette.toolTipText font.pixelSize: 12 wrapMode: Text.WordWrap diff --git a/src/Eden/Config/fields/ConfigCheckbox.qml b/src/Eden/Config/fields/ConfigCheckbox.qml index 8d0f5428e6..750c0a3560 100644 --- a/src/Eden/Config/fields/ConfigCheckbox.qml +++ b/src/Eden/Config/fields/ConfigCheckbox.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Constants diff --git a/src/Eden/Config/fields/ConfigComboBox.qml b/src/Eden/Config/fields/ConfigComboBox.qml index 1c22b2da42..a030856c71 100644 --- a/src/Eden/Config/fields/ConfigComboBox.qml +++ b/src/Eden/Config/fields/ConfigComboBox.qml @@ -1,7 +1,6 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts -import QtQuick.Controls.Material.impl import Eden.Constants import Eden.Config @@ -17,17 +16,5 @@ BaseField { font.pixelSize: 14 model: setting.combo currentIndex: value - - background: MaterialTextContainer { - implicitWidth: 120 - implicitHeight: 40 - - outlineColor: (enabled - && control.hovered) ? control.Material.primaryTextColor : control.Material.hintTextColor - focusedOutlineColor: control.Material.accentColor - controlHasActiveFocus: control.activeFocus - controlHasText: true - horizontalPadding: control.Material.textFieldHorizontalPadding - } } } diff --git a/src/Eden/Config/fields/ConfigHexEdit.qml b/src/Eden/Config/fields/ConfigHexEdit.qml index c653f7b15f..62d70881fb 100644 --- a/src/Eden/Config/fields/ConfigHexEdit.qml +++ b/src/Eden/Config/fields/ConfigHexEdit.qml @@ -1,12 +1,13 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Controls import Eden.Items import Eden.Config import Eden.Constants BaseField { - contentItem: BetterTextField { + contentItem: TextField { enabled: enable Layout.fillWidth: true @@ -19,8 +20,8 @@ BaseField { font.pixelSize: 15 text: Number(value).toString(16) - suffix: setting.suffix + // suffix: setting.suffix onTextEdited: value = Number("0x" + text) } } diff --git a/src/Eden/Config/fields/ConfigIntLine.qml b/src/Eden/Config/fields/ConfigIntLine.qml index 9b18897208..0e8e50624e 100644 --- a/src/Eden/Config/fields/ConfigIntLine.qml +++ b/src/Eden/Config/fields/ConfigIntLine.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Controls import QtQuick.Layouts import Eden.Items @@ -6,7 +7,7 @@ import Eden.Config import Eden.Constants BaseField { - contentItem: BetterTextField { + contentItem: TextField { enabled: enable Layout.fillWidth: true @@ -21,8 +22,8 @@ BaseField { font.pixelSize: 15 text: value - suffix: setting.suffix + // suffix: setting.suffix onTextEdited: value = parseInt(text) } } diff --git a/src/Eden/Config/fields/ConfigIntSlider.qml b/src/Eden/Config/fields/ConfigIntSlider.qml index cb8a752669..d56e23c837 100644 --- a/src/Eden/Config/fields/ConfigIntSlider.qml +++ b/src/Eden/Config/fields/ConfigIntSlider.qml @@ -1,10 +1,10 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Items import Eden.Config -import Eden.Constants +import Carboxyl.Base // Lots of cancer but idrc BaseField { @@ -28,9 +28,8 @@ BaseField { snapMode: Slider.SnapAlways } - Text { + Label { font.pixelSize: 14 - color: Constants.text text: field.value + setting.suffix diff --git a/src/Eden/Config/fields/ConfigIntSpin.qml b/src/Eden/Config/fields/ConfigIntSpin.qml index 6e7d309f6f..77dcaf972d 100644 --- a/src/Eden/Config/fields/ConfigIntSpin.qml +++ b/src/Eden/Config/fields/ConfigIntSpin.qml @@ -1,5 +1,6 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Controls import Eden.Items import Eden.Config @@ -7,7 +8,7 @@ import Eden.Constants BaseField { id: field - contentItem: BetterSpinBox { + contentItem: SpinBox { enabled: enable Layout.fillWidth: true @@ -19,8 +20,8 @@ BaseField { font.pixelSize: 15 value: field.value - label: setting.suffix + // label: setting.suffix onValueModified: field.value = value } } diff --git a/src/Eden/Config/fields/ConfigStringEdit.qml b/src/Eden/Config/fields/ConfigStringEdit.qml index 0100a589c5..9278992644 100644 --- a/src/Eden/Config/fields/ConfigStringEdit.qml +++ b/src/Eden/Config/fields/ConfigStringEdit.qml @@ -1,12 +1,13 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Controls import Eden.Items import Eden.Config import Eden.Constants BaseField { - contentItem: BetterTextField { + contentItem: TextField { enabled: enable Layout.fillWidth: true @@ -15,8 +16,8 @@ BaseField { font.pixelSize: 15 text: value - suffix: setting.suffix + // suffix: setting.suffix onTextEdited: value = text } } diff --git a/src/Eden/Config/fields/ConfigTimeEdit.qml b/src/Eden/Config/fields/ConfigTimeEdit.qml index df932d36b4..24374053c3 100644 --- a/src/Eden/Config/fields/ConfigTimeEdit.qml +++ b/src/Eden/Config/fields/ConfigTimeEdit.qml @@ -1,5 +1,6 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Controls import Eden.Items import Eden.Config @@ -7,7 +8,7 @@ import Eden.Constants BaseField { // TODO: real impl - contentItem: BetterTextField { + contentItem: TextField { enabled: enable Layout.fillWidth: true @@ -22,6 +23,6 @@ BaseField { font.pixelSize: 15 text: value - suffix: setting.suffix + // suffix: setting.suffix } } diff --git a/src/Eden/Config/fields/FieldLabel.qml b/src/Eden/Config/fields/FieldLabel.qml index 813c9c392f..e4e51fcc78 100644 --- a/src/Eden/Config/fields/FieldLabel.qml +++ b/src/Eden/Config/fields/FieldLabel.qml @@ -2,13 +2,12 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Eden.Constants +import Carboxyl.Base -Text { +Label { property var setting text: setting.label - color: Constants.text font.pixelSize: 14 height: 50 diff --git a/src/Eden/Config/pages/PageScrollView.qml b/src/Eden/Config/pages/PageScrollView.qml new file mode 100644 index 0000000000..22078b1105 --- /dev/null +++ b/src/Eden/Config/pages/PageScrollView.qml @@ -0,0 +1,18 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ScrollView { + id: scroll + + WheelHandler { + target: scroll + onWheel: event => { + const sensitivity = 1 / 1500 + scroll.ScrollBar.vertical.position -= event.angleDelta.y * sensitivity + scroll.ScrollBar.vertical.position = Math.max( + Math.min(scroll.ScrollBar.vertical.position, + 1.0 - scroll.ScrollBar.vertical.size), 0.0) + } + } +} diff --git a/src/Eden/Config/pages/SettingsList.qml b/src/Eden/Config/pages/SettingsList.qml index df6447de7f..5370d45dc8 100644 --- a/src/Eden/Config/pages/SettingsList.qml +++ b/src/Eden/Config/pages/SettingsList.qml @@ -2,10 +2,9 @@ import QtQuick import QtQuick.Layouts import Eden.Config -import Eden.Constants import Eden.Interface -ColumnLayout { +ListView { required property int category property bool inset: false @@ -13,35 +12,28 @@ ColumnLayout { property list idInclude: [] property list idExclude: [] - SectionHeader { - text: header - visible: header != "" - } - - ListView { - clip: true - boundsBehavior: Flickable.StopAtBounds + clip: true + boundsBehavior: Flickable.StopAtBounds - interactive: false + interactive: false - implicitHeight: contentHeight - delegate: Setting {} + implicitHeight: contentHeight + delegate: Setting {} - Layout.fillHeight: true - Layout.fillWidth: true - Layout.leftMargin: 5 - spacing: 8 + Layout.fillHeight: true + Layout.fillWidth: true + Layout.leftMargin: 5 + spacing: 0 - model: SettingsInterface.category(category, idInclude, idExclude) + model: SettingsInterface.category(category, idInclude, idExclude) - Rectangle { - anchors.fill: parent - color: "transparent" + Rectangle { + anchors.fill: parent + color: "transparent" - border { - color: inset ? Constants.text : "transparent" - width: 1 - } + border { + color: inset ? palette.text : "transparent" + width: 1 } } } diff --git a/src/Eden/Config/pages/audio/AudioGeneralPage.qml b/src/Eden/Config/pages/audio/AudioGeneralPage.qml index e56a7afe38..df4c279bb6 100644 --- a/src/Eden/Config/pages/audio/AudioGeneralPage.qml +++ b/src/Eden/Config/pages/audio/AudioGeneralPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/cpu/CpuGeneralPage.qml b/src/Eden/Config/pages/cpu/CpuGeneralPage.qml index 0c78bf35ee..6438e59a02 100644 --- a/src/Eden/Config/pages/cpu/CpuGeneralPage.qml +++ b/src/Eden/Config/pages/cpu/CpuGeneralPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/debug/DebugAdvancedPage.qml b/src/Eden/Config/pages/debug/DebugAdvancedPage.qml index 1709402485..35a5a7bbc2 100644 --- a/src/Eden/Config/pages/debug/DebugAdvancedPage.qml +++ b/src/Eden/Config/pages/debug/DebugAdvancedPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { diff --git a/src/Eden/Config/pages/debug/DebugCpuPage.qml b/src/Eden/Config/pages/debug/DebugCpuPage.qml index b0656e288a..213720e4a6 100644 --- a/src/Eden/Config/pages/debug/DebugCpuPage.qml +++ b/src/Eden/Config/pages/debug/DebugCpuPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { diff --git a/src/Eden/Config/pages/debug/DebugGeneralPage.qml b/src/Eden/Config/pages/debug/DebugGeneralPage.qml index 7862497cc8..16652e4a4d 100644 --- a/src/Eden/Config/pages/debug/DebugGeneralPage.qml +++ b/src/Eden/Config/pages/debug/DebugGeneralPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { diff --git a/src/Eden/Config/pages/debug/DebugGraphicsPage.qml b/src/Eden/Config/pages/debug/DebugGraphicsPage.qml index 9c585054e0..9626a68683 100644 --- a/src/Eden/Config/pages/debug/DebugGraphicsPage.qml +++ b/src/Eden/Config/pages/debug/DebugGraphicsPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { diff --git a/src/Eden/Config/pages/general/UiGameListPage.qml b/src/Eden/Config/pages/general/UiGameListPage.qml index 29f8107e59..db17fa9104 100644 --- a/src/Eden/Config/pages/general/UiGameListPage.qml +++ b/src/Eden/Config/pages/general/UiGameListPage.qml @@ -1,12 +1,13 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll + // TODO: language, theme ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/general/UiGeneralPage.qml b/src/Eden/Config/pages/general/UiGeneralPage.qml index 7d53fb046a..91feba70ed 100644 --- a/src/Eden/Config/pages/general/UiGeneralPage.qml +++ b/src/Eden/Config/pages/general/UiGeneralPage.qml @@ -1,23 +1,35 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth SettingsList { category: SettingsCategories.UiGeneral - // onContentHeightChanged: console.log(height, parent.height) + } + + SectionHeader { + text: qsTr("Linux") + visible: Qt.platform.os === "linux" } SettingsList { category: SettingsCategories.Linux visible: Qt.platform.os === "linux" } + + SectionHeader { + text: qsTr("Theming") + } + + // SettingsList { + // category: SettingsCategories.UiLayout + // } } } diff --git a/src/Eden/Config/pages/global/GlobalTab.qml b/src/Eden/Config/pages/global/GlobalTab.qml index 322797d30f..82919d36dd 100644 --- a/src/Eden/Config/pages/global/GlobalTab.qml +++ b/src/Eden/Config/pages/global/GlobalTab.qml @@ -1,13 +1,15 @@ import QtQuick 2.15 -import QtQuick.Controls.Material +import QtQuick.Controls import Eden.Constants +import Carboxyl.Base + Item { required property list tabs property alias tabBar: tabBar - TabBar { + CarboxylTabBar { id: tabBar currentIndex: swipe.currentIndex @@ -20,15 +22,10 @@ Item { Repeater { model: tabs - TabButton { + CarboxylTabButton { font.pixelSize: 16 text: modelData } } - - background: Rectangle { - color: tabBar.Material.backgroundColor - radius: 8 - } } } diff --git a/src/Eden/Config/pages/global/GlobalTabSwipeView.qml b/src/Eden/Config/pages/global/GlobalTabSwipeView.qml index d0fd210e71..e35ea61fe6 100644 --- a/src/Eden/Config/pages/global/GlobalTabSwipeView.qml +++ b/src/Eden/Config/pages/global/GlobalTabSwipeView.qml @@ -1,9 +1,10 @@ import QtQuick 2.15 -import QtQuick.Controls.Material +import QtQuick.Controls import Eden.Constants SwipeView { + interactive: false anchors { top: tabBar.bottom left: parent.left diff --git a/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml b/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml index 31197adbe8..d27b30abd7 100644 --- a/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml +++ b/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml b/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml index 33cfedf3c7..1bb54b7bbd 100644 --- a/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml +++ b/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/graphics/RendererPage.qml b/src/Eden/Config/pages/graphics/RendererPage.qml index 80ed181ee7..a5389ed16a 100644 --- a/src/Eden/Config/pages/graphics/RendererPage.qml +++ b/src/Eden/Config/pages/graphics/RendererPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/system/AppletsPage.qml b/src/Eden/Config/pages/system/AppletsPage.qml index 0f8bc8e2d7..d0e477b773 100644 --- a/src/Eden/Config/pages/system/AppletsPage.qml +++ b/src/Eden/Config/pages/system/AppletsPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/system/FileSystemPage.qml b/src/Eden/Config/pages/system/FileSystemPage.qml index 75a2b53f1c..f9dfb9f917 100644 --- a/src/Eden/Config/pages/system/FileSystemPage.qml +++ b/src/Eden/Config/pages/system/FileSystemPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/system/SystemCorePage.qml b/src/Eden/Config/pages/system/SystemCorePage.qml index 20e74987ed..be822bf1a3 100644 --- a/src/Eden/Config/pages/system/SystemCorePage.qml +++ b/src/Eden/Config/pages/system/SystemCorePage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Config/pages/system/SystemGeneralPage.qml b/src/Eden/Config/pages/system/SystemGeneralPage.qml index 07a166f51a..1f59b29e98 100644 --- a/src/Eden/Config/pages/system/SystemGeneralPage.qml +++ b/src/Eden/Config/pages/system/SystemGeneralPage.qml @@ -1,11 +1,11 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Interface import Eden.Config -ScrollView { +PageScrollView { id: scroll ColumnLayout { width: scroll.width - scroll.effectiveScrollBarWidth diff --git a/src/Eden/Constants/Constants.qml b/src/Eden/Constants/Constants.qml index 6ca069e3b8..c7937b5f60 100644 --- a/src/Eden/Constants/Constants.qml +++ b/src/Eden/Constants/Constants.qml @@ -5,20 +5,4 @@ import QtQuick QtObject { readonly property int width: 1200 readonly property int height: 1000 - - property color accent: "#FF4444" - property color accentPressed: "#ff5252" - - readonly property color bg: "#111111" - readonly property color dialog: "#222222" - readonly property color dialogButton: "#000000" - readonly property color sub: "#181818" - - readonly property color button: "#1E1E1E" - readonly property color buttonHighlighted: "#4A4A4A" - - readonly property color text: "#EEEEEE" - readonly property color subText: "#AAAAAA" - - property real scalar: 1.0 } diff --git a/src/Eden/Interface/QMLConfig.h b/src/Eden/Interface/QMLConfig.h index e22926bb23..540ce3d744 100644 --- a/src/Eden/Interface/QMLConfig.h +++ b/src/Eden/Interface/QMLConfig.h @@ -1,9 +1,10 @@ #ifndef QMLCONFIG_H #define QMLCONFIG_H -#include "qt_common/qt_config.h" +#include "qt_common/config/qt_config.h" #include +#include class QMLConfig : public QObject { Q_OBJECT @@ -16,9 +17,11 @@ public: {} Q_INVOKABLE inline void reload() { + qDebug() << "Reloading"; m_config->ReloadAllValues(); } Q_INVOKABLE inline void save() { + qDebug() << "Saving"; m_config->SaveAllValues(); } }; diff --git a/src/Eden/Interface/SettingsInterface.cpp b/src/Eden/Interface/SettingsInterface.cpp index 495751a392..a545a93b92 100644 --- a/src/Eden/Interface/SettingsInterface.cpp +++ b/src/Eden/Interface/SettingsInterface.cpp @@ -1,7 +1,7 @@ #include "SettingsInterface.h" #include "common/settings.h" #include "common/logging/log.h" -#include "qt_common/uisettings.h" +#include "qt_common/config/uisettings.h" SettingsInterface::SettingsInterface(QObject* parent) : QObject{parent} diff --git a/src/Eden/Interface/SettingsInterface.h b/src/Eden/Interface/SettingsInterface.h index 89c2a15f6b..7b466a015a 100644 --- a/src/Eden/Interface/SettingsInterface.h +++ b/src/Eden/Interface/SettingsInterface.h @@ -5,7 +5,7 @@ #include #include "QMLSetting.h" -#include "qt_common/shared_translation.h" +#include "qt_common/config/shared_translation.h" #include "Models/SettingsModel.h" namespace SettingsCategories { diff --git a/src/Eden/Items/AnimatedDialog.qml b/src/Eden/Items/AnimatedDialog.qml deleted file mode 100644 index c623574ae1..0000000000 --- a/src/Eden/Items/AnimatedDialog.qml +++ /dev/null @@ -1,79 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material - -import Eden.Constants - -Dialog { - id: dia - - property int preferredWidth: Overlay.overlay.width / 2 - property int preferredHeight: Overlay.overlay.height / 1.25 - - width: Math.min(preferredWidth, Overlay.overlay.width) - height: Math.min(preferredHeight, Overlay.overlay.height) - - property int radius: 12 - property bool colorful: false - - anchors.centerIn: Overlay.overlay - - enter: Transition { - NumberAnimation { - property: "opacity" - duration: 200 - - from: 0.0 - to: 1.0 - } - } - - exit: Transition { - NumberAnimation { - property: "opacity" - duration: 200 - - from: 1.0 - to: 0.0 - } - } - - header: Rectangle { - topLeftRadius: dia.radius - topRightRadius: dia.radius - - color: colorful ? Qt.alpha(Constants.accent, 0.5) : Constants.dialog - - height: 50 - - Text { - anchors.fill: parent - font.pixelSize: Math.round(25) - - text: title - color: Constants.text - - font.bold: true - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - - background: Rectangle { - radius: dia.radius - - color: Constants.dialog - } - - footer: DialogButtonBox { - id: control - - background: Item {} - - delegate: Button { - id: btn - } - } - Overlay.modal: Item {} - Overlay.modeless: Item {} -} diff --git a/src/Eden/Items/BetterMenu.qml b/src/Eden/Items/BetterMenu.qml deleted file mode 100644 index 97bd3ca244..0000000000 --- a/src/Eden/Items/BetterMenu.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick -import QtQuick.Controls - -import Eden.Constants - -Menu { - background: Rectangle { - implicitWidth: 200 - implicitHeight: 40 - color: Constants.button - - radius: 10 - } - - function fixAmpersands(originalText) { - var regex = /&(\w)/g - return originalText.replace(regex, "$1") - } - - delegate: MenuItem { - id: control - - font.pixelSize: 14 - - background: Rectangle { - color: control.down || control.hovered - || control.highlighted ? Constants.buttonHighlighted : Constants.button - } - - contentItem: Item { - Text { - anchors { - left: parent.left - leftMargin: 5 + (control.checkable ? control.indicator.width : 0) - verticalCenter: parent.verticalCenter - } - - text: fixAmpersands(control.text) - color: Constants.text - font: control.font - } - - Text { - anchors { - right: parent.right - rightMargin: 5 - verticalCenter: parent.verticalCenter - } - - Component.onCompleted: if (control.action != null - && typeof control.action.shortcut !== 'undefined') - text = control.action.shortcut - - color: Constants.text - font: control.font - } - } - } -} diff --git a/src/Eden/Items/BetterMenuBar.qml b/src/Eden/Items/BetterMenuBar.qml deleted file mode 100644 index be35c7ded5..0000000000 --- a/src/Eden/Items/BetterMenuBar.qml +++ /dev/null @@ -1,33 +0,0 @@ -import QtQuick -import QtQuick.Controls - -import Eden.Constants - -MenuBar { - background: Rectangle { - implicitHeight: 30 - color: Constants.button - } - - function fixAmpersands(originalText) { - var regex = /&(\w)/g - return originalText.replace(regex, "$1") - } - - delegate: MenuBarItem { - id: control - - font.pixelSize: 16 - - background: Rectangle { - color: control.down || control.hovered - || control.highlighted ? Constants.buttonHighlighted : Constants.button - } - - contentItem: Text { - text: fixAmpersands(control.text) - color: Constants.text - font: control.font - } - } -} diff --git a/src/Eden/Items/CMakeLists.txt b/src/Eden/Items/CMakeLists.txt index b757cd0f5d..dc673994fd 100644 --- a/src/Eden/Items/CMakeLists.txt +++ b/src/Eden/Items/CMakeLists.txt @@ -9,14 +9,7 @@ EdenModule( URI Eden.Items QML_FILES StatusBarButton.qml - BetterMenu.qml - AnimatedDialog.qml - BetterMenuBar.qml - - SettingsTabButton.qml IconButton.qml - VerticalTabBar.qml - fields/BetterSpinBox.qml - fields/BetterTextField.qml - fields/FieldFooter.qml + + ) diff --git a/src/Eden/Items/IconButton.qml b/src/Eden/Items/IconButton.qml index 09c7894923..ac46c8d45a 100644 --- a/src/Eden/Items/IconButton.qml +++ b/src/Eden/Items/IconButton.qml @@ -1,7 +1,5 @@ import QtQuick -import QtQuick.Controls.Material - -import Eden.Constants +import QtQuick.Controls Button { required property string label @@ -15,9 +13,6 @@ Button { height: icon.height icon.source: "qrc:/icons/" + label.toLowerCase() + ".svg" - icon.width: 45 - icon.height: 45 - icon.color: Constants.text background: Item {} } diff --git a/src/Eden/Items/SettingsTabButton.qml b/src/Eden/Items/SettingsTabButton.qml deleted file mode 100644 index aa7955e059..0000000000 --- a/src/Eden/Items/SettingsTabButton.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material -import QtQuick.Layouts - -import Eden.Constants - -TabButton { - required property string label - - id: button - - implicitHeight: 100 - width: 95 - - contentItem: ColumnLayout { - IconButton { - label: button.label - - Layout.maximumHeight: 60 - Layout.maximumWidth: 65 - - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - - onClicked: button.clicked() - } - - Text { - font.pixelSize: 16 - text: label - - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - - color: Constants.text - } - } - - // background: Rectangle { - // color: button.Material.backgroundColor - // } -} diff --git a/src/Eden/Items/StatusBarButton.qml b/src/Eden/Items/StatusBarButton.qml index e4037f0996..d5918ca601 100644 --- a/src/Eden/Items/StatusBarButton.qml +++ b/src/Eden/Items/StatusBarButton.qml @@ -4,17 +4,18 @@ import QtQuick.Layouts import Eden.Constants +// TODO: ToolButton? MouseArea { id: button required property string text - property color textColor: Constants.text + property color textColor: palette.text implicitHeight: 20 implicitWidth: txt.width hoverEnabled: true - onHoveredChanged: rect.color = containsMouse ? Constants.buttonHighlighted : "transparent" + onHoveredChanged: rect.color = containsMouse ? palette.alternateBase : "transparent" Rectangle { id: rect diff --git a/src/Eden/Items/VerticalTabBar.qml b/src/Eden/Items/VerticalTabBar.qml deleted file mode 100644 index ca15f195e7..0000000000 --- a/src/Eden/Items/VerticalTabBar.qml +++ /dev/null @@ -1,46 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material - -import Eden.Constants - -TabBar { - clip: true - id: control - - contentItem: ListView { - model: control.contentModel - currentIndex: control.currentIndex - - spacing: control.spacing - orientation: ListView.Vertical - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.AutoFlickIfNeeded - snapMode: ListView.SnapToItem - - highlightMoveDuration: 300 - highlightRangeMode: ListView.ApplyRange - preferredHighlightBegin: 40 - preferredHighlightEnd: height - 40 - - highlight: Item { - z: 2 - Rectangle { - radius: 5 - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - } - - height: parent.height / 2 - width: 5 - - color: Constants.accent - } - } - } - - background: Rectangle { - color: control.Material.backgroundColor - radius: 8 - } -} diff --git a/src/Eden/Items/fields/BetterSpinBox.qml b/src/Eden/Items/fields/BetterSpinBox.qml deleted file mode 100644 index 0dd1d76989..0000000000 --- a/src/Eden/Items/fields/BetterSpinBox.qml +++ /dev/null @@ -1,68 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material -import QtQuick.Controls.impl - -import Eden.Constants - -SpinBox { - id: control - property string label: "" - - from: -0x7FFFFFFF - to: 0x7FFFFFFF - - contentItem: BetterTextField { - text: parent.textFromValue(parent.value, parent.locale) - - placeholderText: parent.label - - width: parent.width - - font: parent.font - - horizontalAlignment: Qt.AlignHCenter - verticalAlignment: Qt.AlignVCenter - - inputMethodHints: Qt.ImhFormattedNumbersOnly - - onEditingFinished: { - control.value = parseFloat(text.replace(/,/g, "")) - valueModified() - } - } - - up.indicator: IconLabel { - icon { - source: "qrc:/icons/forward.svg" - } - - x: control.mirrored ? 0 : control.width - width - - implicitWidth: 40 - implicitHeight: 40 - - height: parent.height - width: height / 2 - } - - down.indicator: IconLabel { - icon { - source: "qrc:/icons/back.svg" - } - - x: control.mirrored ? control.width - width : 0 - - implicitWidth: 40 - implicitHeight: 40 - - height: parent.height - width: height / 2 - } - background: Item {} - - FieldFooter { - anchors { - bottom: contentItem.bottom - } - } -} diff --git a/src/Eden/Items/fields/BetterTextField.qml b/src/Eden/Items/fields/BetterTextField.qml deleted file mode 100644 index 22a10097ba..0000000000 --- a/src/Eden/Items/fields/BetterTextField.qml +++ /dev/null @@ -1,38 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material - -import Eden.Constants -import Eden.Items - -TextField { - property string suffix: "" - - placeholderTextColor: enabled && activeFocus ? Constants.accent : Qt.darker( - Constants.text, 1.3) - - color: enabled ? Constants.text : Qt.darker(Constants.text, 1.5) - - background: Rectangle { - color: "transparent" - } - - FieldFooter {} - - horizontalAlignment: "AlignHCenter" - - Text { - id: txt - text: suffix - - font.pixelSize: 14 - - anchors { - verticalCenter: parent.verticalCenter - right: parent.right - - rightMargin: 5 - } - - color: "gray" - } -} diff --git a/src/Eden/Items/fields/FieldFooter.qml b/src/Eden/Items/fields/FieldFooter.qml deleted file mode 100644 index 2e5b24715f..0000000000 --- a/src/Eden/Items/fields/FieldFooter.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick -import QtQuick.Controls.Material -import Eden.Constants - -Rectangle { - height: 2 - color: enabled ? Constants.text : Qt.darker(Constants.text, 1.5) - width: parent.width - - anchors { - bottom: parent.bottom - left: parent.left - } - - Behavior on color { - ColorAnimation { - duration: 250 - } - } -} diff --git a/src/Eden/Main/GameCarousel.qml b/src/Eden/Main/GameCarousel.qml index 09995b6786..29bcb2df17 100644 --- a/src/Eden/Main/GameCarousel.qml +++ b/src/Eden/Main/GameCarousel.qml @@ -70,7 +70,7 @@ ListView { font.family: "Monospace" color: "lightblue" - background: Constants.bg + background: "transparent" } } diff --git a/src/Eden/Main/GameGrid.qml b/src/Eden/Main/GameGrid.qml index 2c9118607e..11c4336219 100644 --- a/src/Eden/Main/GameGrid.qml +++ b/src/Eden/Main/GameGrid.qml @@ -11,6 +11,17 @@ GridView { id: grid property int cellSize: Math.floor(width / setting.value) + boundsBehavior: Flickable.StopAtBounds + + WheelHandler { + target: grid + onWheel: event => { + const sensitivity = 1.0 + grid.contentY -= event.angleDelta.y * sensitivity + grid.contentY = Math.min(Math.max(grid.contentY, 0.0), + grid.contentHeight - grid.height) + } + } highlightFollowsCurrentItem: true clip: true diff --git a/src/Eden/Main/GameGridCard.qml b/src/Eden/Main/GameGridCard.qml index a20336c0b8..3f2f03e032 100644 --- a/src/Eden/Main/GameGridCard.qml +++ b/src/Eden/Main/GameGridCard.qml @@ -8,7 +8,7 @@ import Eden.Constants Rectangle { id: wrapper - color: Constants.dialog + color: palette.alternateBase radius: 16 Image { @@ -74,7 +74,7 @@ Rectangle { font.family: "Monospace" color: "lightblue" - background: Constants.dialog + background: "transparent" canMarquee: wrapper.GridView.isCurrentItem } diff --git a/src/Eden/Main/GameList.qml b/src/Eden/Main/GameList.qml index a657b989a8..5fb320bbc9 100644 --- a/src/Eden/Main/GameList.qml +++ b/src/Eden/Main/GameList.qml @@ -18,7 +18,7 @@ Rectangle { readonly property int deadzone: 8000 readonly property int repeatTimeMs: 125 - color: Constants.bg + color: palette.base // TODO: use the original yuzu backend for dis // Gamepad { @@ -65,7 +65,7 @@ Rectangle { id: view anchors { - bottom: button.top + bottom: parent.bottom left: parent.left right: parent.right top: parent.top diff --git a/src/Eden/Main/Main.qml b/src/Eden/Main/Main.qml index 66323ce2d2..988bbd40af 100644 --- a/src/Eden/Main/Main.qml +++ b/src/Eden/Main/Main.qml @@ -1,20 +1,19 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import Eden.Config import Eden.Items import Eden.Constants +import Carboxyl.Base + ApplicationWindow { width: Constants.width height: Constants.height visible: true title: TitleManager.title - Material.theme: Material.Dark - Material.accent: Material.Red - - Material.roundedScale: Material.NotRounded + palette: Palettes.theme GameList { anchors { @@ -30,8 +29,8 @@ ApplicationWindow { id: globalConfig } - menuBar: BetterMenuBar { - BetterMenu { + menuBar: MenuBar { + Menu { title: qsTr("&File") contentWidth: 225 @@ -51,7 +50,7 @@ ApplicationWindow { MenuSeparator {} - BetterMenu { + Menu { title: "&Recent Files" } @@ -75,7 +74,7 @@ ApplicationWindow { shortcut: "Ctrl+Q" } } - BetterMenu { + Menu { title: qsTr("&Emulation") contentWidth: 240 @@ -108,7 +107,7 @@ ApplicationWindow { } } - BetterMenu { + Menu { title: qsTr("&View") contentWidth: 260 @@ -143,7 +142,7 @@ ApplicationWindow { MenuSeparator {} } - BetterMenu { + Menu { title: qsTr("&Tools") contentWidth: 225 @@ -161,7 +160,7 @@ ApplicationWindow { MenuSeparator {} - BetterMenu { + Menu { title: qsTr("&Amiibo") } @@ -188,7 +187,7 @@ ApplicationWindow { shortcut: "Ctrl+P" } - BetterMenu { + Menu { title: "&TAS" } } diff --git a/src/Eden/Main/MarqueeText.qml b/src/Eden/Main/MarqueeText.qml index 2b46dc13fc..89dd6379f6 100644 --- a/src/Eden/Main/MarqueeText.qml +++ b/src/Eden/Main/MarqueeText.qml @@ -24,7 +24,7 @@ Item { step) + combined.substring( 0, step) : text property int step: 0 - property bool animate: canMarquee && txt.contentWidth > parent.width + property bool animate: canMarquee && txt.contentWidth > width property bool canMarquee: false diff --git a/src/Eden/Main/StatusBar.qml b/src/Eden/Main/StatusBar.qml index d47acd82ee..79626962d5 100644 --- a/src/Eden/Main/StatusBar.qml +++ b/src/Eden/Main/StatusBar.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Controls.Material +import QtQuick.Controls import QtQuick.Layouts import Eden.Constants @@ -20,7 +20,7 @@ ToolBar { implicitHeight: 30 background: Rectangle { - color: Constants.bg + color: palette.dark } // TODO: reduce duplicate code @@ -72,7 +72,7 @@ ToolBar { text: value.toUpperCase() - textColor: Constants.text + textColor: palette.text onClicked: { if (value === "docked") { diff --git a/src/Eden/Models/GameIconProvider.cpp b/src/Eden/Models/GameIconProvider.cpp index f64ccf1efd..e7fc279260 100644 --- a/src/Eden/Models/GameIconProvider.cpp +++ b/src/Eden/Models/GameIconProvider.cpp @@ -1,6 +1,6 @@ #include #include "GameIconProvider.h" -#include "qt_common/uisettings.h" +#include "qt_common/config/uisettings.h" /** * Gets the default icon (for games without valid title metadata) diff --git a/src/Eden/Models/GameListModel.cpp b/src/Eden/Models/GameListModel.cpp index 413e9b9f4c..522400ded2 100644 --- a/src/Eden/Models/GameListModel.cpp +++ b/src/Eden/Models/GameListModel.cpp @@ -10,7 +10,7 @@ #include "core/hle/service/filesystem/filesystem.h" #include "hid_core/hid_core.h" #include "qt_common/qt_common.h" -#include "qt_common/qt_meta.h" +#include "qt_common/util/meta.h" GameListModel::GameListModel(QObject *parent, QQmlEngine *engine) { QHash rez = QStandardItemModel::roleNames(); @@ -85,7 +85,6 @@ void GameListModel::addEntry(QStandardItem *entry, const UISettings::GameDir &pa QString text = entry->data(GLMRoleTypes::NAME).toString(); QPixmap pixmap = entry->data(GLMRoleTypes::ICON).value(); - qDebug() << "Adding pixmap" << text; m_provider->addPixmap(text, pixmap); invisibleRootItem()->appendRow(entry); } diff --git a/src/Eden/Models/GameListModel.h b/src/Eden/Models/GameListModel.h index 2ed6c54b6b..ed1706ed1e 100644 --- a/src/Eden/Models/GameListModel.h +++ b/src/Eden/Models/GameListModel.h @@ -5,7 +5,7 @@ #include #include #include -#include "qt_common/uisettings.h" +#include "qt_common/config/uisettings.h" typedef struct Game { QString absPath; diff --git a/src/Eden/Models/GameListWorker.cpp b/src/Eden/Models/GameListWorker.cpp index b5697885b3..2b7417617f 100644 --- a/src/Eden/Models/GameListWorker.cpp +++ b/src/Eden/Models/GameListWorker.cpp @@ -29,7 +29,7 @@ #include "core/file_sys/submission_package.h" #include "core/loader/loader.h" #include "qt_common/qt_common.h" -#include "qt_common/uisettings.h" +#include "qt_common/config/uisettings.h" namespace { @@ -238,7 +238,9 @@ QStandardItem* MakeGameListEntry(const std::string& path, item->setData(QString::fromStdString(name), GameListModel::NAME); item->setData(QString::fromStdString(path), GameListModel::PATH); - const u32 pic_size = UISettings::values.game_icon_size.GetValue(); + // We should always choose 256 + // Good balance of size and not looking stupid + const u32 pic_size = 256; QPixmap picture; if (!picture.loadFromData(icon.data(), static_cast(icon.size()))) { diff --git a/src/Eden/Models/GameListWorker.h b/src/Eden/Models/GameListWorker.h index 20b3594415..df68b091bb 100644 --- a/src/Eden/Models/GameListWorker.h +++ b/src/Eden/Models/GameListWorker.h @@ -15,7 +15,7 @@ #include "common/thread.h" #include "core/file_sys/registered_cache.h" -#include "qt_common/uisettings.h" +#include "qt_common/config/uisettings.h" namespace Core { class System; } diff --git a/src/Eden/Native/CMakeLists.txt b/src/Eden/Native/CMakeLists.txt index c3367c3cd0..db516305b8 100644 --- a/src/Eden/Native/CMakeLists.txt +++ b/src/Eden/Native/CMakeLists.txt @@ -32,6 +32,8 @@ target_link_libraries(eden Qt6::Quick Qt6::QuickControls2 + Carboxyl::Base + ${MODULES} ) diff --git a/src/Eden/Native/icons/graphics.svg b/src/Eden/Native/icons/graphics.svg index 47b5bc7ca8..47a9c1bbd1 100644 --- a/src/Eden/Native/icons/graphics.svg +++ b/src/Eden/Native/icons/graphics.svg @@ -2,7 +2,7 @@ + style="fill:#FFFFFF;fill-opacity:1"> + style="fill:#FFFFFF;fill-opacity:1"> + style="fill:#FFFFFF;fill-opacity:1"> + style="fill:#FFFFFF;fill-opacity:1" /> + style="fill:#FFFFFF;fill-opacity:1" /> + style="fill:#FFFFFF;fill-opacity:1" /> diff --git a/src/Eden/Native/main.cpp b/src/Eden/Native/main.cpp index 44f07e9fb7..e691409d55 100644 --- a/src/Eden/Native/main.cpp +++ b/src/Eden/Native/main.cpp @@ -1,26 +1,27 @@ #include #include #include +#include "CarboxylApplication.h" #include "Interface/QMLConfig.h" #include "Interface/SettingsInterface.h" #include "Interface/TitleManager.h" #include "Models/GameListModel.h" -#include "core/core.h" +#include "common/settings_enums.h" +#include "qt_common/config/uisettings.h" #include "qt_common/qt_common.h" #include -#include +#include int main(int argc, char *argv[]) { QApplication app(argc, argv); - - QQuickStyle::setStyle(QObject::tr("Material")); + QQmlApplicationEngine engine; QCoreApplication::setOrganizationName(QStringLiteral("eden-emu")); QCoreApplication::setApplicationName(QStringLiteral("eden")); - QApplication::setDesktopFileName(QStringLiteral("org.eden-emu.eden")); - QGuiApplication::setWindowIcon(QIcon(":/icons/eden.svg")); + QApplication::setDesktopFileName(QStringLiteral("dev.eden-emu.eden")); + QGuiApplication::setWindowIcon(QIcon(QStringLiteral(":/icons/eden.svg"))); /// QtCommon QtCommon::Init(new QWidget); @@ -34,13 +35,21 @@ int main(int argc, char *argv[]) config->save(); }); - /// Expose Enums + // carboxyl setup + auto translations = ConfigurationShared::ComboboxEnumeration(&app); - // Core - std::unique_ptr system = std::make_unique(); + const auto enumeration = &translations->at(Settings::EnumMetadata::Index()); + QString style; + for (const auto &[idx, name] : *enumeration) { + if (idx == (u32) UISettings::values.carboxyl_style.GetValue()) { + style = name; + } + } + + CarboxylApplication *carboxylApp = new CarboxylApplication(app, &engine, style, QStringLiteral("Trioxide")); + carboxylApp->setParent(&app); /// CONTEXT - QQmlApplicationEngine engine; auto ctx = engine.rootContext(); ctx->setContextProperty(QStringLiteral("QtConfig"), QVariant::fromValue(config)); diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index c2d443ce1c..15dbc40c9f 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -152,6 +152,12 @@ ENUM(SpirvOptimizeMode, Never, OnLoad, Always); ENUM(GpuOverclock, Low, Medium, High) ENUM(TemperatureUnits, Celsius, Fahrenheit) +#ifdef YUZU_QT_QML +ENUM(Accent, System, Red, Blue, Orange, Gold, Forest, Violet, Pink, Cyan, Steel); +ENUM(Theme, System, Light, Dark, Midnight); +ENUM(Style, Trioxide, Graphide, Basalt, Hydrogen, Helios); +#endif + template inline std::string_view CanonicalizeEnum(Type id) { const auto group = EnumMetadata::Canonicalizations(); diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index 48190eda79..22235829c7 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -403,6 +403,11 @@ std::unique_ptr InitializeTranslations(QObject* parent) // Web Service // Ui + INSERT(UISettings, carboxyl_accent, tr("Accent"), tr("What accent color to use throughout the application.")); + INSERT(UISettings, carboxyl_theme, tr("Theme"), tr("The palette to use throughout the application.")); + + // TODO: brief explanations, link to Carboxyl? + INSERT(UISettings, carboxyl_style, tr("Style"), tr("The control style to use throughout the application.")); // Ui General INSERT(UISettings, @@ -727,6 +732,51 @@ std::unique_ptr ComboboxEnumeration(QObject* parent) PAIR(GpuOverclock, High, tr("High (512)")), }}); +#ifdef YUZU_QT_QML + +#define ACCENT(name) PAIR(Accent, name, tr(#name)) + translations->insert({Settings::EnumMetadata::Index(), + { + ACCENT(System), + ACCENT(Red), + ACCENT(Blue), + ACCENT(Orange), + ACCENT(Gold), + ACCENT(Forest), + ACCENT(Violet), + ACCENT(Pink), + ACCENT(Cyan), + ACCENT(Steel), + }}); +#undef ACCENT + +#define THEME(name) PAIR(Theme, name, tr(#name)) + + translations->insert({Settings::EnumMetadata::Index(), + { + THEME(System), + THEME(Light), + THEME(Dark), + THEME(Midnight), + }}); + +#undef THEME + +#define STYLE(name) PAIR(Style, name, tr(#name)) + + translations->insert({Settings::EnumMetadata::Index(), + { + STYLE(Trioxide), + STYLE(Graphide), + STYLE(Basalt), + STYLE(Hydrogen), + STYLE(Helios), + }}); + +#undef STYLE + +#endif + #undef PAIR #undef CTX_PAIR diff --git a/src/qt_common/config/uisettings.h b/src/qt_common/config/uisettings.h index 7b8fc77348..d1a97966fb 100644 --- a/src/qt_common/config/uisettings.h +++ b/src/qt_common/config/uisettings.h @@ -150,11 +150,19 @@ struct Values { false, #endif "enable_gamemode", Category::UiGeneral}; + #ifdef __unix__ SwitchableSetting gui_force_x11{linkage, false, "gui_force_x11", Category::UiGeneral}; Setting gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::UiGeneral}; #endif +#ifdef YUZU_QT_QML + // TODO: native-like style default + Setting carboxyl_theme{linkage, Settings::Theme::System, "carboyl_theme", Category::UiLayout}; + Setting carboxyl_style{linkage, Settings::Style::Trioxide, "carboyl_style", Category::UiLayout}; + Setting carboxyl_accent{linkage, Settings::Accent::System, "carboyl_accent", Category::UiLayout}; +#endif + // Discord RPC Setting enable_discord_presence{linkage, false, "enable_discord_presence", Category::Ui}; diff --git a/src/qt_common/externals/CMakeLists.txt b/src/qt_common/externals/CMakeLists.txt index b998090d90..e44c90424e 100644 --- a/src/qt_common/externals/CMakeLists.txt +++ b/src/qt_common/externals/CMakeLists.txt @@ -17,3 +17,9 @@ AddJsonPackage(quazip) # frozen AddJsonPackage(frozen) + +# Carboxyl +# TODO +if (ENABLE_QT) + AddJsonPackage(carboxyl) +endif() diff --git a/src/qt_common/externals/cpmfile.json b/src/qt_common/externals/cpmfile.json index 8d90fdc77c..d7aedb256e 100644 --- a/src/qt_common/externals/cpmfile.json +++ b/src/qt_common/externals/cpmfile.json @@ -14,5 +14,16 @@ "repo": "serge-sans-paille/frozen", "sha": "61dce5ae18", "hash": "b8dfe741c82bc178dfc9749d4ab5a130cee718d9ee7b71d9b547cf5f7f23027ed0152ad250012a8546399fcc1e12187efc68d89d6731256c4d2df7d04eef8d5c" + }, + "carboxyl": { + "package": "Carboxyl", + "repo": "crueter/Carboxyl", + "git_host": "git.crueter.xyz", + "sha": "a9071022e2", + "hash": "340ae7e3fbc5b01b321e1cd9c8c8b3da4047b00abc5bf5d6388e47f253139d7551bcc006c5606665565f04d3bfc21cd2228e11c221090ea78746a6f72898ecc4", + "bundled": "true", + "options": [ + "CARBOXYL_DEMO OFF" + ] } } diff --git a/src/qt_common/qt_common.cpp b/src/qt_common/qt_common.cpp index f2091df866..c0f7a6bec7 100644 --- a/src/qt_common/qt_common.cpp +++ b/src/qt_common/qt_common.cpp @@ -36,8 +36,14 @@ std::unique_ptr system = nullptr; std::shared_ptr vfs = nullptr; std::unique_ptr provider = nullptr; -Core::Frontend::WindowSystemType GetWindowSystemType() -{ +const QStringList supported_file_extensions = {QStringLiteral("nro"), + QStringLiteral("nso"), + QStringLiteral("nca"), + QStringLiteral("xci"), + QStringLiteral("nsp"), + QStringLiteral("kip")}; + +Core::Frontend::WindowSystemType GetWindowSystemType() { // Determine WSI type based on Qt platform. QString platform_name = QGuiApplication::platformName(); if (platform_name == QStringLiteral("windows")) diff --git a/src/qt_common/qt_common.h b/src/qt_common/qt_common.h index a2700427ab..df5ae465d9 100644 --- a/src/qt_common/qt_common.h +++ b/src/qt_common/qt_common.h @@ -23,6 +23,7 @@ extern QObject *rootObject; extern std::unique_ptr system; extern std::shared_ptr vfs; extern std::unique_ptr provider; +extern const QStringList supported_file_extensions; typedef std::function QtProgressCallback;