diff --git a/CMakeModules/EdenModule.cmake b/CMakeModules/EdenModule.cmake new file mode 100644 index 0000000000..2054456ede --- /dev/null +++ b/CMakeModules/EdenModule.cmake @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +cmake_minimum_required(VERSION 3.16) + +function(EdenModule) + set(oneValueArgs + NAME + URI + NATIVE + ) + + set(multiValueArgs + LIBRARIES + QML_FILES + SOURCES + ) + + cmake_parse_arguments(MODULE "" "${oneValueArgs}" "${multiValueArgs}" + "${ARGN}") + + set(LIB_NAME Eden${MODULE_NAME}) + + add_library(${LIB_NAME} STATIC) + + message(STATUS "URI for ${MODULE_NAME}: ${MODULE_URI}") + + qt_add_qml_module(${LIB_NAME} + URI ${MODULE_URI} + NO_PLUGIN + VERSION 0.1 + + QML_FILES ${MODULE_QML_FILES} + SOURCES ${MODULE_SOURCES} + + ${MODULE_UNPARSED_ARGUMENTS} + ) + + add_library(Eden::${MODULE_NAME} ALIAS ${LIB_NAME}) + + if (DEFINED MODULE_LIBRARIES) + target_link_libraries(${LIB_NAME} PRIVATE ${MODULE_LIBRARIES}) + endif() +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3d45bbfe2..525f14e8c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,20 +18,20 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:_DEBUG> $<$>:NDEBUG>) # Set compilation flags -if (MSVC AND NOT CXX_CLANG) +if (MSVC) set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE) # Silence "deprecation" warnings - add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) # Avoid windows.h junk - add_compile_definitions(NOMINMAX) + add_definitions(-DNOMINMAX) # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors. - add_compile_definitions(WIN32_LEAN_AND_MEAN) + add_definitions(-DWIN32_LEAN_AND_MEAN) # Ensure that projects are built with Unicode support. - add_compile_definitions(UNICODE _UNICODE) + add_definitions(-DUNICODE -D_UNICODE) # /W4 - Level 4 warnings # /MP - Multi-threaded compilation @@ -69,6 +69,10 @@ if (MSVC AND NOT CXX_CLANG) /external:anglebrackets # Treats all headers included by #include
, where the header file is enclosed in angle brackets (< >), as external headers /external:W0 # Sets the default warning level to 0 for external headers, effectively disabling warnings for them. + # Warnings + /W4 + /WX- + /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled /we4189 # 'identifier': local variable is initialized but not referenced /we4265 # 'class': class has virtual functions, but destructor is not virtual @@ -93,14 +97,6 @@ if (MSVC AND NOT CXX_CLANG) /wd4702 # unreachable code (when used with LTO) ) - if (NOT CXX_CLANG) - add_compile_options( - # Warnings - /W4 - /WX- - ) - endif() - if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 @@ -122,13 +118,9 @@ if (MSVC AND NOT CXX_CLANG) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) else() - if (NOT MSVC) - add_compile_options( - -fwrapv - ) - endif() - add_compile_options( + -fwrapv + -Werror=all -Werror=extra -Werror=shadow @@ -140,19 +132,14 @@ else() -Wno-missing-field-initializers ) - if (CXX_CLANG OR CXX_ICC) # Clang or AppleClang - if (NOT MSVC) - add_compile_options( - -Werror=shadow-uncaptured-local - -Werror=implicit-fallthrough - -Werror=type-limits - ) - endif() - + if (CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES IntelLLVM) # Clang or AppleClang add_compile_options( -Wno-braced-scalar-init -Wno-unused-private-field -Wno-nullability-completeness + -Werror=shadow-uncaptured-local + -Werror=implicit-fallthrough + -Werror=type-limits ) endif() @@ -160,12 +147,12 @@ else() add_compile_options("-mcx16") endif() - if (APPLE AND CXX_CLANG) + if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) add_compile_options("-stdlib=libc++") endif() # GCC bugs - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CXX_GCC) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # These diagnostics would be great if they worked, but are just completely broken # and produce bogus errors on external libraries like fmt. add_compile_options( @@ -181,15 +168,15 @@ else() # glibc, which may default to 32 bits. glibc allows this to be configured # by setting _FILE_OFFSET_BITS. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) - add_compile_definitions(_FILE_OFFSET_BITS=64) + add_definitions(-D_FILE_OFFSET_BITS=64) endif() if (MINGW) - add_compile_definitions(MINGW_HAS_SECURE_API) + add_definitions(-DMINGW_HAS_SECURE_API) add_compile_options("-msse4.1") if (MINGW_STATIC_BUILD) - add_compile_definitions(QT_STATICPLUGIN) + add_definitions(-DQT_STATICPLUGIN) add_compile_options("-static") endif() endif() @@ -235,7 +222,7 @@ endif() if (ENABLE_QT) add_definitions(-DYUZU_QT_WIDGETS) add_subdirectory(qt_common) - add_subdirectory(eden) + add_subdirectory(Eden) endif() if (ENABLE_WEB_SERVICE) @@ -246,5 +233,3 @@ if (ANDROID) add_subdirectory(android/app/src/main/jni) target_include_directories(yuzu-android PRIVATE android/app/src/main) endif() - -include(GenerateDepHashes) diff --git a/src/Eden/CMakeLists.txt b/src/Eden/CMakeLists.txt new file mode 100644 index 0000000000..d70bcdb90f --- /dev/null +++ b/src/Eden/CMakeLists.txt @@ -0,0 +1,22 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui Quick QuickControls2) + +qt_standard_project_setup(REQUIRES 6.7) + +include(EdenModule) + +include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}") + +add_subdirectory(Interface) +add_subdirectory(Models) + +add_subdirectory(Config) +add_subdirectory(Constants) +add_subdirectory(Items) +add_subdirectory(Util) +add_subdirectory(Main) + +add_subdirectory(Native) diff --git a/src/Eden/Config/CMakeLists.txt b/src/Eden/Config/CMakeLists.txt new file mode 100644 index 0000000000..cb72511f1e --- /dev/null +++ b/src/Eden/Config/CMakeLists.txt @@ -0,0 +1,62 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +EdenModule( + NAME Config + URI Eden.Config + + QML_FILES + GlobalConfigureDialog.qml + Setting.qml + SectionHeader.qml + + pages/SettingsList.qml + pages/global/GlobalTab.qml + pages/global/GlobalTabSwipeView.qml + pages/global/GlobalGeneralPage.qml + pages/global/GlobalSystemPage.qml + pages/global/GlobalCpuPage.qml + pages/global/GlobalGraphicsPage.qml + pages/global/GlobalAudioPage.qml + + pages/general/UiGeneralPage.qml + pages/general/UiGameListPage.qml + + pages/graphics/RendererPage.qml + pages/graphics/RendererAdvancedPage.qml + pages/graphics/RendererExtensionsPage.qml + + pages/system/SystemGeneralPage.qml + pages/system/SystemCorePage.qml + pages/system/FileSystemPage.qml + pages/system/AppletsPage.qml + + pages/cpu/CpuGeneralPage.qml + + pages/audio/AudioGeneralPage.qml + + pages/global/GlobalDebugPage.qml + + pages/debug/DebugGeneralPage.qml + pages/debug/DebugGraphicsPage.qml + pages/debug/DebugAdvancedPage.qml + pages/debug/DebugCpuPage.qml + + fields/ConfigCheckbox.qml + fields/FieldLabel.qml + fields/ConfigComboBox.qml + fields/ConfigIntLine.qml + fields/ConfigTimeEdit.qml + fields/ConfigIntSpin.qml + fields/ConfigHexEdit.qml + fields/ConfigStringEdit.qml + fields/FieldCheckbox.qml + fields/ConfigIntSlider.qml + fields/BaseField.qml + + TestSetting.qml + LIBRARIES Eden::Interface +) diff --git a/src/eden/Eden/Config/GlobalConfigureDialog.qml b/src/Eden/Config/GlobalConfigureDialog.qml similarity index 93% rename from src/eden/Eden/Config/GlobalConfigureDialog.qml rename to src/Eden/Config/GlobalConfigureDialog.qml index 3d4ad2c955..5e5ef127a1 100644 --- a/src/eden/Eden/Config/GlobalConfigureDialog.qml +++ b/src/Eden/Config/GlobalConfigureDialog.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts import Eden.Constants import Eden.Items -import Eden.Native.Interface +import Eden.Interface import Eden.Util AnimatedDialog { @@ -34,7 +34,7 @@ AnimatedDialog { anchors { top: parent.top - topMargin: 55 * Constants.scalar + topMargin: 55 left: parent.left bottom: parent.bottom @@ -65,7 +65,7 @@ AnimatedDialog { top: parent.top bottom: parent.bottom - leftMargin: 5 * Constants.scalar + leftMargin: 5 } clip: true diff --git a/src/eden/Eden/Config/SectionHeader.qml b/src/Eden/Config/SectionHeader.qml similarity index 100% rename from src/eden/Eden/Config/SectionHeader.qml rename to src/Eden/Config/SectionHeader.qml diff --git a/src/eden/Eden/Config/Setting.qml b/src/Eden/Config/Setting.qml similarity index 100% rename from src/eden/Eden/Config/Setting.qml rename to src/Eden/Config/Setting.qml diff --git a/src/eden/Eden/Config/TestSetting.qml b/src/Eden/Config/TestSetting.qml similarity index 90% rename from src/eden/Eden/Config/TestSetting.qml rename to src/Eden/Config/TestSetting.qml index 9029f8dc4b..e429723105 100644 --- a/src/eden/Eden/Config/TestSetting.qml +++ b/src/Eden/Config/TestSetting.qml @@ -4,8 +4,8 @@ import QtQuick.Layouts import Eden.Constants Column { - topPadding: 5 * Constants.scalar - leftPadding: 10 * Constants.scalar + topPadding: 5 + leftPadding: 10 RowLayout { uniformCellSizes: true diff --git a/src/eden/Eden/Config/fields/BaseField.qml b/src/Eden/Config/fields/BaseField.qml similarity index 94% rename from src/eden/Eden/Config/fields/BaseField.qml rename to src/Eden/Config/fields/BaseField.qml index 23973e29d9..359c7d5414 100644 --- a/src/eden/Eden/Config/fields/BaseField.qml +++ b/src/Eden/Config/fields/BaseField.qml @@ -36,7 +36,7 @@ Item { RowLayout { id: content - height: 50 * Constants.scalar + height: 50 spacing: 0 @@ -91,9 +91,9 @@ Item { anchors { left: parent.left - leftMargin: 20 * Constants.scalar + leftMargin: 20 right: parent.right - rightMargin: 20 * Constants.scalar + rightMargin: 20 top: content.bottom topMargin: -height @@ -103,7 +103,7 @@ Item { text: setting.tooltip color: Constants.subText - font.pixelSize: 12 * Constants.scalar + font.pixelSize: 12 wrapMode: Text.WordWrap visible: false diff --git a/src/eden/Eden/Config/fields/ConfigCheckbox.qml b/src/Eden/Config/fields/ConfigCheckbox.qml similarity index 64% rename from src/eden/Eden/Config/fields/ConfigCheckbox.qml rename to src/Eden/Config/fields/ConfigCheckbox.qml index 8b41ae5b8a..8d0f5428e6 100644 --- a/src/eden/Eden/Config/fields/ConfigCheckbox.qml +++ b/src/Eden/Config/fields/ConfigCheckbox.qml @@ -10,12 +10,12 @@ BaseField { // contentItem: CheckBox { // id: control - // Layout.rightMargin: 10 * Constants.scalar + // Layout.rightMargin: 10 // Layout.fillWidth: true - // font.pixelSize: 15 * Constants.scalar - // indicator.implicitHeight: 25 * Constants.scalar - // indicator.implicitWidth: 25 * Constants.scalar + // font.pixelSize: 15 + // indicator.implicitHeight: 25 + // indicator.implicitWidth: 25 // text: setting.label // checked: setting.value diff --git a/src/eden/Eden/Config/fields/ConfigComboBox.qml b/src/Eden/Config/fields/ConfigComboBox.qml similarity index 84% rename from src/eden/Eden/Config/fields/ConfigComboBox.qml rename to src/Eden/Config/fields/ConfigComboBox.qml index bf555d279a..1c22b2da42 100644 --- a/src/eden/Eden/Config/fields/ConfigComboBox.qml +++ b/src/Eden/Config/fields/ConfigComboBox.qml @@ -12,15 +12,15 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 - font.pixelSize: 14 * Constants.scalar + font.pixelSize: 14 model: setting.combo currentIndex: value background: MaterialTextContainer { implicitWidth: 120 - implicitHeight: 40 * Constants.scalar + implicitHeight: 40 outlineColor: (enabled && control.hovered) ? control.Material.primaryTextColor : control.Material.hintTextColor diff --git a/src/eden/Eden/Config/fields/ConfigHexEdit.qml b/src/Eden/Config/fields/ConfigHexEdit.qml similarity index 82% rename from src/eden/Eden/Config/fields/ConfigHexEdit.qml rename to src/Eden/Config/fields/ConfigHexEdit.qml index 043b48ec42..c653f7b15f 100644 --- a/src/eden/Eden/Config/fields/ConfigHexEdit.qml +++ b/src/Eden/Config/fields/ConfigHexEdit.qml @@ -10,13 +10,13 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 validator: RegularExpressionValidator { regularExpression: /[0-9a-fA-F]{0,8}/ } - font.pixelSize: 15 * Constants.scalar + font.pixelSize: 15 text: Number(value).toString(16) suffix: setting.suffix diff --git a/src/eden/Eden/Config/fields/ConfigIntLine.qml b/src/Eden/Config/fields/ConfigIntLine.qml similarity index 82% rename from src/eden/Eden/Config/fields/ConfigIntLine.qml rename to src/Eden/Config/fields/ConfigIntLine.qml index 5dc45343ec..9b18897208 100644 --- a/src/eden/Eden/Config/fields/ConfigIntLine.qml +++ b/src/Eden/Config/fields/ConfigIntLine.qml @@ -10,7 +10,7 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 inputMethodHints: Qt.ImhDigitsOnly validator: IntValidator { @@ -18,7 +18,7 @@ BaseField { top: setting.max } - font.pixelSize: 15 * Constants.scalar + font.pixelSize: 15 text: value suffix: setting.suffix diff --git a/src/eden/Eden/Config/fields/ConfigIntSlider.qml b/src/Eden/Config/fields/ConfigIntSlider.qml similarity index 79% rename from src/eden/Eden/Config/fields/ConfigIntSlider.qml rename to src/Eden/Config/fields/ConfigIntSlider.qml index 7693ad824e..cb8a752669 100644 --- a/src/eden/Eden/Config/fields/ConfigIntSlider.qml +++ b/src/Eden/Config/fields/ConfigIntSlider.qml @@ -23,18 +23,18 @@ BaseField { onMoved: field.value = value - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 snapMode: Slider.SnapAlways } Text { - font.pixelSize: 14 * Constants.scalar + font.pixelSize: 14 color: Constants.text text: field.value + setting.suffix - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 } } } diff --git a/src/eden/Eden/Config/fields/ConfigIntSpin.qml b/src/Eden/Config/fields/ConfigIntSpin.qml similarity index 79% rename from src/eden/Eden/Config/fields/ConfigIntSpin.qml rename to src/Eden/Config/fields/ConfigIntSpin.qml index 8e8c23f76f..6e7d309f6f 100644 --- a/src/eden/Eden/Config/fields/ConfigIntSpin.qml +++ b/src/Eden/Config/fields/ConfigIntSpin.qml @@ -11,12 +11,12 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 from: setting.min to: setting.max - font.pixelSize: 15 * Constants.scalar + font.pixelSize: 15 value: field.value label: setting.suffix diff --git a/src/eden/Eden/Config/fields/ConfigStringEdit.qml b/src/Eden/Config/fields/ConfigStringEdit.qml similarity index 75% rename from src/eden/Eden/Config/fields/ConfigStringEdit.qml rename to src/Eden/Config/fields/ConfigStringEdit.qml index beae2b0362..0100a589c5 100644 --- a/src/eden/Eden/Config/fields/ConfigStringEdit.qml +++ b/src/Eden/Config/fields/ConfigStringEdit.qml @@ -10,9 +10,9 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 - font.pixelSize: 15 * Constants.scalar + font.pixelSize: 15 text: value suffix: setting.suffix diff --git a/src/eden/Eden/Config/fields/ConfigTimeEdit.qml b/src/Eden/Config/fields/ConfigTimeEdit.qml similarity index 81% rename from src/eden/Eden/Config/fields/ConfigTimeEdit.qml rename to src/Eden/Config/fields/ConfigTimeEdit.qml index 01ebc6d6b1..df932d36b4 100644 --- a/src/eden/Eden/Config/fields/ConfigTimeEdit.qml +++ b/src/Eden/Config/fields/ConfigTimeEdit.qml @@ -11,7 +11,7 @@ BaseField { enabled: enable Layout.fillWidth: true - Layout.rightMargin: 10 * Constants.scalar + Layout.rightMargin: 10 inputMethodHints: Qt.ImhDigitsOnly validator: IntValidator { @@ -19,7 +19,7 @@ BaseField { top: setting.max } - font.pixelSize: 15 * Constants.scalar + font.pixelSize: 15 text: value suffix: setting.suffix diff --git a/src/eden/Eden/Config/fields/FieldCheckbox.qml b/src/Eden/Config/fields/FieldCheckbox.qml similarity index 78% rename from src/eden/Eden/Config/fields/FieldCheckbox.qml rename to src/Eden/Config/fields/FieldCheckbox.qml index 531f2bb624..14da7d9505 100644 --- a/src/eden/Eden/Config/fields/FieldCheckbox.qml +++ b/src/Eden/Config/fields/FieldCheckbox.qml @@ -9,8 +9,8 @@ CheckBox { property var setting property var other: setting.other === null ? setting : setting.other - indicator.implicitHeight: 25 * Constants.scalar - indicator.implicitWidth: 25 * Constants.scalar + indicator.implicitHeight: 25 + indicator.implicitWidth: 25 checked: visible ? other.value : true onClicked: if (visible) diff --git a/src/eden/Eden/Config/fields/FieldLabel.qml b/src/Eden/Config/fields/FieldLabel.qml similarity index 75% rename from src/eden/Eden/Config/fields/FieldLabel.qml rename to src/Eden/Config/fields/FieldLabel.qml index d94ee58c92..813c9c392f 100644 --- a/src/eden/Eden/Config/fields/FieldLabel.qml +++ b/src/Eden/Config/fields/FieldLabel.qml @@ -9,9 +9,9 @@ Text { text: setting.label color: Constants.text - font.pixelSize: 14 * Constants.scalar + font.pixelSize: 14 - height: 50 * Constants.scalar + height: 50 ToolTip.text: setting.tooltip Layout.fillWidth: true diff --git a/src/eden/Eden/Config/icons.qrc b/src/Eden/Config/icons.qrc similarity index 100% rename from src/eden/Eden/Config/icons.qrc rename to src/Eden/Config/icons.qrc diff --git a/src/eden/Eden/Config/pages/SettingsList.qml b/src/Eden/Config/pages/SettingsList.qml similarity index 88% rename from src/eden/Eden/Config/pages/SettingsList.qml rename to src/Eden/Config/pages/SettingsList.qml index 73c6b27c76..df6447de7f 100644 --- a/src/eden/Eden/Config/pages/SettingsList.qml +++ b/src/Eden/Config/pages/SettingsList.qml @@ -3,7 +3,7 @@ import QtQuick.Layouts import Eden.Config import Eden.Constants -import Eden.Native.Interface +import Eden.Interface ColumnLayout { required property int category @@ -29,8 +29,8 @@ ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true - Layout.leftMargin: 5 * Constants.scalar - spacing: 8 * Constants.scalar + Layout.leftMargin: 5 + spacing: 8 model: SettingsInterface.category(category, idInclude, idExclude) diff --git a/src/eden/Eden/Config/pages/audio/AudioGeneralPage.qml b/src/Eden/Config/pages/audio/AudioGeneralPage.qml similarity index 90% rename from src/eden/Eden/Config/pages/audio/AudioGeneralPage.qml rename to src/Eden/Config/pages/audio/AudioGeneralPage.qml index 9c86400a8c..e56a7afe38 100644 --- a/src/eden/Eden/Config/pages/audio/AudioGeneralPage.qml +++ b/src/Eden/Config/pages/audio/AudioGeneralPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/cpu/CpuGeneralPage.qml b/src/Eden/Config/pages/cpu/CpuGeneralPage.qml similarity index 90% rename from src/eden/Eden/Config/pages/cpu/CpuGeneralPage.qml rename to src/Eden/Config/pages/cpu/CpuGeneralPage.qml index a3c44e4892..0c78bf35ee 100644 --- a/src/eden/Eden/Config/pages/cpu/CpuGeneralPage.qml +++ b/src/Eden/Config/pages/cpu/CpuGeneralPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/debug/DebugAdvancedPage.qml b/src/Eden/Config/pages/debug/DebugAdvancedPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/debug/DebugAdvancedPage.qml rename to src/Eden/Config/pages/debug/DebugAdvancedPage.qml index 5d0443334f..1709402485 100644 --- a/src/eden/Eden/Config/pages/debug/DebugAdvancedPage.qml +++ b/src/Eden/Config/pages/debug/DebugAdvancedPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/debug/DebugCpuPage.qml b/src/Eden/Config/pages/debug/DebugCpuPage.qml similarity index 90% rename from src/eden/Eden/Config/pages/debug/DebugCpuPage.qml rename to src/Eden/Config/pages/debug/DebugCpuPage.qml index aa58851cd7..b0656e288a 100644 --- a/src/eden/Eden/Config/pages/debug/DebugCpuPage.qml +++ b/src/Eden/Config/pages/debug/DebugCpuPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/debug/DebugGeneralPage.qml b/src/Eden/Config/pages/debug/DebugGeneralPage.qml similarity index 94% rename from src/eden/Eden/Config/pages/debug/DebugGeneralPage.qml rename to src/Eden/Config/pages/debug/DebugGeneralPage.qml index 0c0fb00f72..7862497cc8 100644 --- a/src/eden/Eden/Config/pages/debug/DebugGeneralPage.qml +++ b/src/Eden/Config/pages/debug/DebugGeneralPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/debug/DebugGraphicsPage.qml b/src/Eden/Config/pages/debug/DebugGraphicsPage.qml similarity index 92% rename from src/eden/Eden/Config/pages/debug/DebugGraphicsPage.qml rename to src/Eden/Config/pages/debug/DebugGraphicsPage.qml index bcae356161..9c585054e0 100644 --- a/src/eden/Eden/Config/pages/debug/DebugGraphicsPage.qml +++ b/src/Eden/Config/pages/debug/DebugGraphicsPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/general/UiGameListPage.qml b/src/Eden/Config/pages/general/UiGameListPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/general/UiGameListPage.qml rename to src/Eden/Config/pages/general/UiGameListPage.qml index 930e4fe61b..29f8107e59 100644 --- a/src/eden/Eden/Config/pages/general/UiGameListPage.qml +++ b/src/Eden/Config/pages/general/UiGameListPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/general/UiGeneralPage.qml b/src/Eden/Config/pages/general/UiGeneralPage.qml similarity index 94% rename from src/eden/Eden/Config/pages/general/UiGeneralPage.qml rename to src/Eden/Config/pages/general/UiGeneralPage.qml index 16ee8a6ecc..7d53fb046a 100644 --- a/src/eden/Eden/Config/pages/general/UiGeneralPage.qml +++ b/src/Eden/Config/pages/general/UiGeneralPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/global/GlobalAudioPage.qml b/src/Eden/Config/pages/global/GlobalAudioPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalAudioPage.qml rename to src/Eden/Config/pages/global/GlobalAudioPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalCpuPage.qml b/src/Eden/Config/pages/global/GlobalCpuPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalCpuPage.qml rename to src/Eden/Config/pages/global/GlobalCpuPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalDebugPage.qml b/src/Eden/Config/pages/global/GlobalDebugPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalDebugPage.qml rename to src/Eden/Config/pages/global/GlobalDebugPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalGeneralPage.qml b/src/Eden/Config/pages/global/GlobalGeneralPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalGeneralPage.qml rename to src/Eden/Config/pages/global/GlobalGeneralPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalGraphicsPage.qml b/src/Eden/Config/pages/global/GlobalGraphicsPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalGraphicsPage.qml rename to src/Eden/Config/pages/global/GlobalGraphicsPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalSystemPage.qml b/src/Eden/Config/pages/global/GlobalSystemPage.qml similarity index 100% rename from src/eden/Eden/Config/pages/global/GlobalSystemPage.qml rename to src/Eden/Config/pages/global/GlobalSystemPage.qml diff --git a/src/eden/Eden/Config/pages/global/GlobalTab.qml b/src/Eden/Config/pages/global/GlobalTab.qml similarity index 85% rename from src/eden/Eden/Config/pages/global/GlobalTab.qml rename to src/Eden/Config/pages/global/GlobalTab.qml index 463a7c2d83..322797d30f 100644 --- a/src/eden/Eden/Config/pages/global/GlobalTab.qml +++ b/src/Eden/Config/pages/global/GlobalTab.qml @@ -21,14 +21,14 @@ Item { model: tabs TabButton { - font.pixelSize: 16 * Constants.scalar + font.pixelSize: 16 text: modelData } } background: Rectangle { color: tabBar.Material.backgroundColor - radius: 8 * Constants.scalar + radius: 8 } } } diff --git a/src/eden/Eden/Config/pages/global/GlobalTabSwipeView.qml b/src/Eden/Config/pages/global/GlobalTabSwipeView.qml similarity index 72% rename from src/eden/Eden/Config/pages/global/GlobalTabSwipeView.qml rename to src/Eden/Config/pages/global/GlobalTabSwipeView.qml index eaa63c5265..d0fd210e71 100644 --- a/src/eden/Eden/Config/pages/global/GlobalTabSwipeView.qml +++ b/src/Eden/Config/pages/global/GlobalTabSwipeView.qml @@ -10,7 +10,7 @@ SwipeView { right: parent.right bottom: parent.bottom - leftMargin: 20 * Constants.scalar - topMargin: 10 * Constants.scalar + leftMargin: 20 + topMargin: 10 } } diff --git a/src/eden/Eden/Config/pages/graphics/RendererAdvancedPage.qml b/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/graphics/RendererAdvancedPage.qml rename to src/Eden/Config/pages/graphics/RendererAdvancedPage.qml index f6e8983eae..31197adbe8 100644 --- a/src/eden/Eden/Config/pages/graphics/RendererAdvancedPage.qml +++ b/src/Eden/Config/pages/graphics/RendererAdvancedPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/graphics/RendererExtensionsPage.qml b/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/graphics/RendererExtensionsPage.qml rename to src/Eden/Config/pages/graphics/RendererExtensionsPage.qml index be9efcbd28..33cfedf3c7 100644 --- a/src/eden/Eden/Config/pages/graphics/RendererExtensionsPage.qml +++ b/src/Eden/Config/pages/graphics/RendererExtensionsPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/graphics/RendererPage.qml b/src/Eden/Config/pages/graphics/RendererPage.qml similarity index 90% rename from src/eden/Eden/Config/pages/graphics/RendererPage.qml rename to src/Eden/Config/pages/graphics/RendererPage.qml index d1d63ff717..80ed181ee7 100644 --- a/src/eden/Eden/Config/pages/graphics/RendererPage.qml +++ b/src/Eden/Config/pages/graphics/RendererPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/system/AppletsPage.qml b/src/Eden/Config/pages/system/AppletsPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/system/AppletsPage.qml rename to src/Eden/Config/pages/system/AppletsPage.qml index b3171d9d8b..0f8bc8e2d7 100644 --- a/src/eden/Eden/Config/pages/system/AppletsPage.qml +++ b/src/Eden/Config/pages/system/AppletsPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/system/FileSystemPage.qml b/src/Eden/Config/pages/system/FileSystemPage.qml similarity index 91% rename from src/eden/Eden/Config/pages/system/FileSystemPage.qml rename to src/Eden/Config/pages/system/FileSystemPage.qml index 90f6395f8f..75a2b53f1c 100644 --- a/src/eden/Eden/Config/pages/system/FileSystemPage.qml +++ b/src/Eden/Config/pages/system/FileSystemPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/system/SystemCorePage.qml b/src/Eden/Config/pages/system/SystemCorePage.qml similarity index 90% rename from src/eden/Eden/Config/pages/system/SystemCorePage.qml rename to src/Eden/Config/pages/system/SystemCorePage.qml index 562ba17d60..20e74987ed 100644 --- a/src/eden/Eden/Config/pages/system/SystemCorePage.qml +++ b/src/Eden/Config/pages/system/SystemCorePage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/eden/Eden/Config/pages/system/SystemGeneralPage.qml b/src/Eden/Config/pages/system/SystemGeneralPage.qml similarity index 93% rename from src/eden/Eden/Config/pages/system/SystemGeneralPage.qml rename to src/Eden/Config/pages/system/SystemGeneralPage.qml index 2d2e02b2b4..07a166f51a 100644 --- a/src/eden/Eden/Config/pages/system/SystemGeneralPage.qml +++ b/src/Eden/Config/pages/system/SystemGeneralPage.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Layouts -import Eden.Native.Interface +import Eden.Interface import Eden.Config ScrollView { diff --git a/src/Eden/Constants/CMakeLists.txt b/src/Eden/Constants/CMakeLists.txt new file mode 100644 index 0000000000..52b0b69895 --- /dev/null +++ b/src/Eden/Constants/CMakeLists.txt @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +set_source_files_properties(Constants.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +EdenModule( + NAME Constants + URI Eden.Constants + QML_FILES Constants.qml +) diff --git a/src/eden/Eden/Constants/Constants.qml b/src/Eden/Constants/Constants.qml similarity index 100% rename from src/eden/Eden/Constants/Constants.qml rename to src/Eden/Constants/Constants.qml diff --git a/src/Eden/Interface/CMakeLists.txt b/src/Eden/Interface/CMakeLists.txt new file mode 100644 index 0000000000..f5ef364bb3 --- /dev/null +++ b/src/Eden/Interface/CMakeLists.txt @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +find_package(Qt6 REQUIRED COMPONENTS Core) + +qt_add_library(EdenInterface STATIC) +qt_add_qml_module(EdenInterface + URI Eden.Interface + NO_PLUGIN + SOURCES + SettingsInterface.h SettingsInterface.cpp + QMLSetting.h QMLSetting.cpp + MetaObjectHelper.h + QMLConfig.h + SOURCES TitleManager.h TitleManager.cpp +) + +target_link_libraries(EdenInterface PUBLIC Qt6::Quick) +target_link_libraries(EdenInterface PRIVATE Qt6::Core) + +add_library(Eden::Interface ALIAS EdenInterface) diff --git a/src/eden/Eden/Native/Interface/MetaObjectHelper.h b/src/Eden/Interface/MetaObjectHelper.h similarity index 100% rename from src/eden/Eden/Native/Interface/MetaObjectHelper.h rename to src/Eden/Interface/MetaObjectHelper.h diff --git a/src/eden/Eden/Native/Interface/QMLConfig.h b/src/Eden/Interface/QMLConfig.h similarity index 100% rename from src/eden/Eden/Native/Interface/QMLConfig.h rename to src/Eden/Interface/QMLConfig.h diff --git a/src/eden/Eden/Native/Interface/QMLSetting.cpp b/src/Eden/Interface/QMLSetting.cpp similarity index 99% rename from src/eden/Eden/Native/Interface/QMLSetting.cpp rename to src/Eden/Interface/QMLSetting.cpp index 4e559df26b..36bf8c0ffe 100644 --- a/src/eden/Eden/Native/Interface/QMLSetting.cpp +++ b/src/Eden/Interface/QMLSetting.cpp @@ -1,6 +1,8 @@ #include "QMLSetting.h" #include "common/settings.h" +#include + QMLSetting::QMLSetting(Settings::BasicSetting *setting, QObject *parent, RequestType request) : QObject(parent) , m_setting(setting) diff --git a/src/eden/Eden/Native/Interface/QMLSetting.h b/src/Eden/Interface/QMLSetting.h similarity index 98% rename from src/eden/Eden/Native/Interface/QMLSetting.h rename to src/Eden/Interface/QMLSetting.h index 78349ae4f4..2dbca2b2d8 100644 --- a/src/eden/Eden/Native/Interface/QMLSetting.h +++ b/src/Eden/Interface/QMLSetting.h @@ -2,7 +2,6 @@ #define QMLSETTING_H #include -#include #include "common/settings_common.h" enum class RequestType { diff --git a/src/eden/Eden/Native/Interface/SettingsInterface.cpp b/src/Eden/Interface/SettingsInterface.cpp similarity index 99% rename from src/eden/Eden/Native/Interface/SettingsInterface.cpp rename to src/Eden/Interface/SettingsInterface.cpp index 3760978f47..495751a392 100644 --- a/src/eden/Eden/Native/Interface/SettingsInterface.cpp +++ b/src/Eden/Interface/SettingsInterface.cpp @@ -7,9 +7,9 @@ SettingsInterface::SettingsInterface(QObject* parent) : QObject{parent} , translations{ConfigurationShared::InitializeTranslations(parent)} , combobox_translations{ConfigurationShared::ComboboxEnumeration(parent)} -{} +{ +} -// TODO: idExclude SettingsModel *SettingsInterface::category(SettingsCategories::Category category, QList idInclude, QList idExclude) diff --git a/src/eden/Eden/Native/Interface/SettingsInterface.h b/src/Eden/Interface/SettingsInterface.h similarity index 98% rename from src/eden/Eden/Native/Interface/SettingsInterface.h rename to src/Eden/Interface/SettingsInterface.h index 5b31c02661..89c2a15f6b 100644 --- a/src/eden/Eden/Native/Interface/SettingsInterface.h +++ b/src/Eden/Interface/SettingsInterface.h @@ -6,7 +6,7 @@ #include "QMLSetting.h" #include "qt_common/shared_translation.h" -#include "Native/Models/SettingsModel.h" +#include "Models/SettingsModel.h" namespace SettingsCategories { Q_NAMESPACE @@ -53,7 +53,6 @@ Q_ENUM_NS(Category) class SettingsInterface : public QObject { Q_OBJECT - QML_SINGLETON QML_ELEMENT public: explicit SettingsInterface(QObject* parent = nullptr); diff --git a/src/Eden/Interface/TitleManager.cpp b/src/Eden/Interface/TitleManager.cpp new file mode 100644 index 0000000000..0a3b6eca53 --- /dev/null +++ b/src/Eden/Interface/TitleManager.cpp @@ -0,0 +1,40 @@ +#include "TitleManager.h" +#include "common/scm_rev.h" +#include + +TitleManager::TitleManager(QObject *parent) {} + +const QString TitleManager::title() const +{ + static const std::string description = std::string(Common::g_build_version); + static const std::string build_id = std::string(Common::g_build_id); + static const std::string compiler = std::string(Common::g_compiler_id); + + std::string yuzu_title; + if (Common::g_is_dev_build) { + yuzu_title = fmt::format("Eden Nightly | {}-{} | {}", description, build_id, compiler); + } else { + yuzu_title = fmt::format("Eden | {} | {}", description, compiler); + } + + const auto override_title = fmt::format(fmt::runtime( + std::string(Common::g_title_bar_format_idle)), + build_id); + const auto window_title = override_title.empty() ? yuzu_title : override_title; + + // TODO(crueter): Running + + return QString::fromStdString(window_title); + // if (title_name.empty()) { + // return QString::fromStdString(window_title); + // } else { + // const auto run_title = [window_title, title_name, title_version, gpu_vendor]() { + // if (title_version.empty()) { + // return fmt::format("{} | {} | {}", window_title, title_name, gpu_vendor); + // } + // return fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, + // gpu_vendor); + // }(); + // setWindowTitle(QString::fromStdString(run_title)); + // } +} diff --git a/src/Eden/Interface/TitleManager.h b/src/Eden/Interface/TitleManager.h new file mode 100644 index 0000000000..41f0eba331 --- /dev/null +++ b/src/Eden/Interface/TitleManager.h @@ -0,0 +1,18 @@ +#ifndef TITLEMANAGER_H +#define TITLEMANAGER_H + +#include + +class TitleManager : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString title READ title NOTIFY titleChanged) +public: + explicit TitleManager(QObject *parent = nullptr); + + const QString title() const; +signals: + void titleChanged(); +}; + +#endif // TITLEMANAGER_H diff --git a/src/eden/Eden/Items/AnimatedDialog.qml b/src/Eden/Items/AnimatedDialog.qml similarity index 100% rename from src/eden/Eden/Items/AnimatedDialog.qml rename to src/Eden/Items/AnimatedDialog.qml diff --git a/src/eden/Eden/Items/BetterMenu.qml b/src/Eden/Items/BetterMenu.qml similarity index 100% rename from src/eden/Eden/Items/BetterMenu.qml rename to src/Eden/Items/BetterMenu.qml diff --git a/src/eden/Eden/Items/BetterMenuBar.qml b/src/Eden/Items/BetterMenuBar.qml similarity index 100% rename from src/eden/Eden/Items/BetterMenuBar.qml rename to src/Eden/Items/BetterMenuBar.qml diff --git a/src/Eden/Items/CMakeLists.txt b/src/Eden/Items/CMakeLists.txt new file mode 100644 index 0000000000..b757cd0f5d --- /dev/null +++ b/src/Eden/Items/CMakeLists.txt @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +EdenModule( + NAME Items + 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/Eden/Items/IconButton.qml b/src/Eden/Items/IconButton.qml similarity index 82% rename from src/eden/Eden/Items/IconButton.qml rename to src/Eden/Items/IconButton.qml index 70192e9ea7..09c7894923 100644 --- a/src/eden/Eden/Items/IconButton.qml +++ b/src/Eden/Items/IconButton.qml @@ -8,8 +8,8 @@ Button { bottomInset: 0 topInset: 0 - leftPadding: 5 * Constants.scalar - rightPadding: 5 * Constants.scalar + leftPadding: 5 + rightPadding: 5 width: icon.width height: icon.height diff --git a/src/eden/Eden/Items/SettingsTabButton.qml b/src/Eden/Items/SettingsTabButton.qml similarity index 72% rename from src/eden/Eden/Items/SettingsTabButton.qml rename to src/Eden/Items/SettingsTabButton.qml index e4d7bd0891..aa7955e059 100644 --- a/src/eden/Eden/Items/SettingsTabButton.qml +++ b/src/Eden/Items/SettingsTabButton.qml @@ -9,15 +9,15 @@ TabButton { id: button - implicitHeight: 100 * Constants.scalar - width: 95 * Constants.scalar + implicitHeight: 100 + width: 95 contentItem: ColumnLayout { IconButton { label: button.label - Layout.maximumHeight: 60 * Constants.scalar - Layout.maximumWidth: 65 * Constants.scalar + Layout.maximumHeight: 60 + Layout.maximumWidth: 65 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter @@ -25,7 +25,7 @@ TabButton { } Text { - font.pixelSize: 16 * Constants.scalar + font.pixelSize: 16 text: label Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter diff --git a/src/eden/Eden/Items/StatusBarButton.qml b/src/Eden/Items/StatusBarButton.qml similarity index 92% rename from src/eden/Eden/Items/StatusBarButton.qml rename to src/Eden/Items/StatusBarButton.qml index 47691bc8b4..e4037f0996 100644 --- a/src/eden/Eden/Items/StatusBarButton.qml +++ b/src/Eden/Items/StatusBarButton.qml @@ -25,7 +25,7 @@ MouseArea { Text { id: txt - font.pixelSize: 12 * Constants.scalar + font.pixelSize: 12 leftPadding: 4 rightPadding: 4 diff --git a/src/eden/Eden/Items/VerticalTabBar.qml b/src/Eden/Items/VerticalTabBar.qml similarity index 88% rename from src/eden/Eden/Items/VerticalTabBar.qml rename to src/Eden/Items/VerticalTabBar.qml index b5d8b8c13f..ca15f195e7 100644 --- a/src/eden/Eden/Items/VerticalTabBar.qml +++ b/src/Eden/Items/VerticalTabBar.qml @@ -25,14 +25,14 @@ TabBar { highlight: Item { z: 2 Rectangle { - radius: 5 * Constants.scalar + radius: 5 anchors { right: parent.right verticalCenter: parent.verticalCenter } height: parent.height / 2 - width: 5 * Constants.scalar + width: 5 color: Constants.accent } @@ -41,6 +41,6 @@ TabBar { background: Rectangle { color: control.Material.backgroundColor - radius: 8 * Constants.scalar + radius: 8 } } diff --git a/src/eden/Eden/Items/fields/BetterSpinBox.qml b/src/Eden/Items/fields/BetterSpinBox.qml similarity index 87% rename from src/eden/Eden/Items/fields/BetterSpinBox.qml rename to src/Eden/Items/fields/BetterSpinBox.qml index 0d4980506b..0dd1d76989 100644 --- a/src/eden/Eden/Items/fields/BetterSpinBox.qml +++ b/src/Eden/Items/fields/BetterSpinBox.qml @@ -38,8 +38,8 @@ SpinBox { x: control.mirrored ? 0 : control.width - width - implicitWidth: 40 * Constants.scalar - implicitHeight: 40 * Constants.scalar + implicitWidth: 40 + implicitHeight: 40 height: parent.height width: height / 2 @@ -52,8 +52,8 @@ SpinBox { x: control.mirrored ? control.width - width : 0 - implicitWidth: 40 * Constants.scalar - implicitHeight: 40 * Constants.scalar + implicitWidth: 40 + implicitHeight: 40 height: parent.height width: height / 2 diff --git a/src/eden/Eden/Items/fields/BetterTextField.qml b/src/Eden/Items/fields/BetterTextField.qml similarity index 88% rename from src/eden/Eden/Items/fields/BetterTextField.qml rename to src/Eden/Items/fields/BetterTextField.qml index a72865b18d..22a10097ba 100644 --- a/src/eden/Eden/Items/fields/BetterTextField.qml +++ b/src/Eden/Items/fields/BetterTextField.qml @@ -24,13 +24,13 @@ TextField { id: txt text: suffix - font.pixelSize: 14 * Constants.scalar + font.pixelSize: 14 anchors { verticalCenter: parent.verticalCenter right: parent.right - rightMargin: 5 * Constants.scalar + rightMargin: 5 } color: "gray" diff --git a/src/eden/Eden/Items/fields/FieldFooter.qml b/src/Eden/Items/fields/FieldFooter.qml similarity index 91% rename from src/eden/Eden/Items/fields/FieldFooter.qml rename to src/Eden/Items/fields/FieldFooter.qml index 58d237d1ea..2e5b24715f 100644 --- a/src/eden/Eden/Items/fields/FieldFooter.qml +++ b/src/Eden/Items/fields/FieldFooter.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Material import Eden.Constants Rectangle { - height: 2 * Constants.scalar + height: 2 color: enabled ? Constants.text : Qt.darker(Constants.text, 1.5) width: parent.width diff --git a/src/Eden/Main/CMakeLists.txt b/src/Eden/Main/CMakeLists.txt new file mode 100644 index 0000000000..7c9ceb19db --- /dev/null +++ b/src/Eden/Main/CMakeLists.txt @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +EdenModule( + NAME Main + URI Eden.Main + QML_FILES + Main.qml + StatusBar.qml + GameList.qml + + GameGridCard.qml + GameGrid.qml + MarqueeText.qml + + GameCarouselCard.qml + GameCarousel.qml + LIBRARIES Eden::Interface +) diff --git a/src/Eden/Main/GameCarousel.qml b/src/Eden/Main/GameCarousel.qml new file mode 100644 index 0000000000..09995b6786 --- /dev/null +++ b/src/Eden/Main/GameCarousel.qml @@ -0,0 +1,87 @@ +import QtQuick +import QtQuick.Controls +import Qt.labs.platform +import QtCore + +import Eden.Constants +import Eden.Interface + +ListView { + id: carousel + + focus: true + focusPolicy: Qt.StrongFocus + + model: EdenGameList + orientation: ListView.Horizontal + clip: false + flickDeceleration: 1500 + snapMode: ListView.SnapToItem + + spacing: 20 + + keyNavigationWraps: true + + function increment() { + incrementCurrentIndex() + if (currentIndex === count) + currentIndex = 0 + } + + function decrement() { + decrementCurrentIndex() + if (currentIndex === -1) + currentIndex = count - 1 + } + + // TODO(crueter): handle move/displace/add (requires thread worker on game list and a bunch of other shit) + Rectangle { + id: hg + clip: false + z: 3 + + property var item: carousel.currentItem + + anchors { + centerIn: parent + } + + height: item === null ? 0 : item.height + 10 + width: item === null ? 0 : item.width + 10 + + color: "transparent" + border { + color: "deepskyblue" + width: 4 + } + + radius: 8 + + MarqueeText { + id: container + anchors.bottom: hg.top + anchors.left: hg.left + anchors.right: hg.right + + canMarquee: true + text: hg.item === null ? "" : toTitleCase(hg.item.title) + + font.pixelSize: 22 + font.family: "Monospace" + + color: "lightblue" + background: Constants.bg + } + } + + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: currentItem === null ? 0 : x + width / 2 - currentItem.width / 2 + preferredHighlightEnd: currentItem === null ? 0 : x + width / 2 + currentItem.width / 2 + + highlightMoveDuration: 300 + delegate: GameCarouselCard { + id: game + width: 300 + height: 300 + } +} diff --git a/src/eden/Eden/Main/GameCarouselCard.qml b/src/Eden/Main/GameCarouselCard.qml similarity index 87% rename from src/eden/Eden/Main/GameCarouselCard.qml rename to src/Eden/Main/GameCarouselCard.qml index 51cb3a1f23..ef0e7e30bd 100644 --- a/src/eden/Eden/Main/GameCarouselCard.qml +++ b/src/Eden/Main/GameCarouselCard.qml @@ -17,7 +17,7 @@ Item { anchors.fill: parent color: "transparent" border { - width: 4 * Constants.scalar + width: 4 color: PathView.isCurrentItem ? "deepskyblue" : "transparent" } @@ -32,7 +32,7 @@ Item { anchors { fill: parent - margins: 10 * Constants.scalar + margins: 10 } } } diff --git a/src/eden/Eden/Main/GameGrid.qml b/src/Eden/Main/GameGrid.qml similarity index 63% rename from src/eden/Eden/Main/GameGrid.qml rename to src/Eden/Main/GameGrid.qml index 9231d2b7a8..2c9118607e 100644 --- a/src/eden/Eden/Main/GameGrid.qml +++ b/src/Eden/Main/GameGrid.qml @@ -4,8 +4,7 @@ import Qt.labs.platform import QtCore import Eden.Constants -import Eden.Native.Interface -import Eden.Native.Gamepad +import Eden.Interface GridView { property var setting @@ -17,25 +16,25 @@ GridView { clip: true cellWidth: cellSize - cellHeight: cellSize + 60 * Constants.scalar + cellHeight: cellSize + 20 model: EdenGameList delegate: GameGridCard { id: game - width: grid.cellSize - 20 * Constants.scalar - height: grid.cellHeight - 20 * Constants.scalar + width: grid.cellSize - 20 + height: grid.cellHeight - 20 } highlight: Rectangle { color: "transparent" z: 5 - radius: 16 * Constants.scalar + radius: 16 border { - color: Constants.text - width: 3 + color: "deepskyblue" + width: 4 } } diff --git a/src/eden/Eden/Main/GameGridCard.qml b/src/Eden/Main/GameGridCard.qml similarity index 70% rename from src/eden/Eden/Main/GameGridCard.qml rename to src/Eden/Main/GameGridCard.qml index 634c325974..3e379c1d11 100644 --- a/src/eden/Eden/Main/GameGridCard.qml +++ b/src/Eden/Main/GameGridCard.qml @@ -9,7 +9,7 @@ Rectangle { id: wrapper color: Constants.dialog - radius: 16 * Constants.scalar + radius: 16 Image { id: image @@ -21,13 +21,14 @@ Rectangle { anchors { top: parent.top + bottom: nameText.top left: parent.left right: parent.right - margins: 4 * Constants.scalar + margins: 10 } - height: parent.height - 40 * Constants.scalar + height: parent.height MouseArea { id: mouseArea @@ -50,28 +51,29 @@ Rectangle { } } - Text { + MarqueeText { id: nameText + clip: true anchors { bottom: parent.bottom - bottomMargin: 5 * Constants.scalar + bottomMargin: 5 left: parent.left right: parent.right + + leftMargin: 5 + rightMargin: 5 } - style: Text.Outline - styleColor: Constants.bg + text: toTitleCase(model.name.replace(/-/g, " ")) - text: model.name.replace(/-/g, " ") - wrapMode: Text.WordWrap - horizontalAlignment: Qt.AlignHCenter + font.pixelSize: 18 + font.family: "Monospace" - font { - pixelSize: 15 * Constants.scalar - } + color: "lightblue" + background: Constants.dialog - color: "white" + canMarquee: wrapper.GridView.isCurrentItem } } diff --git a/src/Eden/Main/GameList.qml b/src/Eden/Main/GameList.qml new file mode 100644 index 0000000000..dedcb33f4d --- /dev/null +++ b/src/Eden/Main/GameList.qml @@ -0,0 +1,127 @@ +import QtQuick +import QtQuick.Controls +import Qt.labs.platform +import QtCore + +import Eden.Constants +import Eden.Interface + +// import Eden.Native.Gamepad +Rectangle { + id: root + + property var setting: SettingsInterface.setting("grid_columns") + + property int gx: 0 + property int gy: 0 + + readonly property int deadzone: 8000 + readonly property int repeatTimeMs: 125 + + color: Constants.bg + + // TODO: use the original yuzu backend for dis + // Gamepad { + // id: gamepad + + // // onUpPressed: grid.moveCurrentIndexUp() + // // onDownPressed: grid.moveCurrentIndexDown() + // // onLeftPressed: grid.moveCurrentIndexLeft() + // // onRightPressed: grid.moveCurrentIndexRight() + // onLeftPressed: carousel.decrement() + // onRightPressed: carousel.increment() + // onAPressed: console.log("A pressed") + // onLeftStickMoved: (x, y) => { + // gx = x + // gy = y + // } + // } + + // Timer { + // interval: repeatTimeMs + // running: true + // repeat: true + // onTriggered: { + // if (gx > deadzone) { + // gamepad.rightPressed() + // } else if (gx < -deadzone) { + // gamepad.leftPressed() + // } + + // if (gy > deadzone) { + // gamepad.downPressed() + // } else if (gy < -deadzone) { + // gamepad.upPressed() + // } + // } + // } + // Timer { + // interval: 16 + // running: true + // repeat: true + // onTriggered: gamepad.pollEvents() + // } + FolderDialog { + id: openDir + folder: StandardPaths.writableLocation(StandardPaths.HomeLocation) + onAccepted: { + button.visible = false + view.anchors.bottom = root.bottom + EdenGameList.addDir(folder) + } + } + + Item { + id: view + + anchors { + bottom: button.top + left: parent.left + right: parent.right + top: parent.top + margins: 8 + } + + GameGrid { + setting: root.setting + + id: grid + + anchors.fill: parent + } + // GameCarousel { + // id: carousel + + // height: 300 + + // anchors { + // right: view.right + // left: view.left + + // verticalCenter: view.verticalCenter + // } + // } + } + + Button { + id: button + font.pixelSize: 25 + + anchors { + left: parent.left + right: parent.right + + bottom: parent.bottom + + margins: 8 + } + + text: "Add Directory" + onClicked: openDir.open() + + background: Rectangle { + color: button.pressed ? Constants.accentPressed : Constants.accent + radius: 5 + } + } +} diff --git a/src/eden/Eden/Main/Main.qml b/src/Eden/Main/Main.qml similarity index 99% rename from src/eden/Eden/Main/Main.qml rename to src/Eden/Main/Main.qml index d0be3a27f5..66323ce2d2 100644 --- a/src/eden/Eden/Main/Main.qml +++ b/src/Eden/Main/Main.qml @@ -9,7 +9,7 @@ ApplicationWindow { width: Constants.width height: Constants.height visible: true - title: qsTr("eden") + title: TitleManager.title Material.theme: Material.Dark Material.accent: Material.Red diff --git a/src/Eden/Main/MarqueeText.qml b/src/Eden/Main/MarqueeText.qml new file mode 100644 index 0000000000..2b46dc13fc --- /dev/null +++ b/src/Eden/Main/MarqueeText.qml @@ -0,0 +1,129 @@ +import QtQuick +import QtQuick.Controls + +import Eden.Constants + +Item { + id: container + + anchors {} + + height: txt.contentHeight + clip: true + + // TODO(crueter): util? + function toTitleCase(str) { + return str.replace(/\w\S*/g, text => text.charAt(0).toUpperCase( + ) + text.substring(1).toLowerCase()) + } + + property string text + property string spacing: " " + property string combined: text + spacing + property string display: animate ? combined.substring( + step) + combined.substring( + 0, step) : text + property int step: 0 + property bool animate: canMarquee && txt.contentWidth > parent.width + + property bool canMarquee: false + + property font font + property color color + property color background + + onCanMarqueeChanged: checkMarquee() + + function checkMarquee() { + if (canMarquee && txt.contentWidth > width) { + step = 0 + delay.start() + } else { + delay.stop() + marquee.stop() + } + } + + Timer { + id: marquee + + interval: 150 + running: false + repeat: true + onTriggered: { + parent.step = (parent.step + 1) % parent.combined.length + if (parent.step === 0) { + stop() + delay.start() + } + } + } + + Timer { + id: delay + interval: 1500 + repeat: false + onTriggered: { + marquee.start() + } + } + + // fake container to gauge contentWidth + Text { + id: txt + visible: false + text: parent.text + font: container.font + + onContentWidthChanged: container.checkMarquee() + } + + Text { + anchors { + fill: parent + leftMargin: 10 + rightMargin: 10 + } + + color: container.color + font: container.font + text: parent.display + + horizontalAlignment: Text.AlignLeft + } + + Rectangle { + anchors.fill: parent + z: 2 + + gradient: Gradient { + orientation: Gradient.Horizontal + GradientStop { + position: 0.0 + color: marquee.running ? container.background : "transparent" + Behavior on color { + ColorAnimation { + duration: 200 + } + } + } + GradientStop { + position: 0.1 + color: "transparent" + } + GradientStop { + position: 0.9 + color: "transparent" + } + GradientStop { + position: 1.0 + color: marquee.running ? container.background : "transparent" + Behavior on color { + ColorAnimation { + duration: 200 + } + } + } + } + } +} diff --git a/src/eden/Eden/Main/StatusBar.qml b/src/Eden/Main/StatusBar.qml similarity index 100% rename from src/eden/Eden/Main/StatusBar.qml rename to src/Eden/Main/StatusBar.qml diff --git a/src/Eden/Models/CMakeLists.txt b/src/Eden/Models/CMakeLists.txt new file mode 100644 index 0000000000..f71aa78fe4 --- /dev/null +++ b/src/Eden/Models/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +qt_add_library(EdenModels STATIC + GameListModel.h GameListModel.cpp + SettingsModel.h SettingsModel.cpp +) + +target_link_libraries(EdenModels + PRIVATE + Qt6::Gui +) + +add_library(Eden::Models ALIAS EdenModels) diff --git a/src/eden/Eden/Native/Models/GameListModel.cpp b/src/Eden/Models/GameListModel.cpp similarity index 100% rename from src/eden/Eden/Native/Models/GameListModel.cpp rename to src/Eden/Models/GameListModel.cpp diff --git a/src/eden/Eden/Native/Models/GameListModel.h b/src/Eden/Models/GameListModel.h similarity index 100% rename from src/eden/Eden/Native/Models/GameListModel.h rename to src/Eden/Models/GameListModel.h diff --git a/src/eden/Eden/Native/Models/SettingsModel.cpp b/src/Eden/Models/SettingsModel.cpp similarity index 100% rename from src/eden/Eden/Native/Models/SettingsModel.cpp rename to src/Eden/Models/SettingsModel.cpp diff --git a/src/eden/Eden/Native/Models/SettingsModel.h b/src/Eden/Models/SettingsModel.h similarity index 95% rename from src/eden/Eden/Native/Models/SettingsModel.h rename to src/Eden/Models/SettingsModel.h index 26729f45aa..215ce32b00 100644 --- a/src/eden/Eden/Native/Models/SettingsModel.h +++ b/src/Eden/Models/SettingsModel.h @@ -2,7 +2,7 @@ #define SETTINGSMODEL_H #include -#include "Native/Interface/QMLSetting.h" +#include "Interface/QMLSetting.h" class SettingsModel : public QAbstractListModel { Q_OBJECT diff --git a/src/Eden/Native/CMakeLists.txt b/src/Eden/Native/CMakeLists.txt new file mode 100644 index 0000000000..c3367c3cd0 --- /dev/null +++ b/src/Eden/Native/CMakeLists.txt @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +qt_add_executable(eden + main.cpp + icons.qrc +) + +set(MODULES + Eden::Util + Eden::Items + Eden::Config + Eden::Interface + Eden::Constants + Eden::Main + Eden::Models +) + +# if (ENABLE_SDL2) +# add_subdirectory(Gamepad) +# set(MODULES ${MODULES} Eden::Gamepad) +# endif() + +target_link_libraries(eden + PRIVATE + Qt6::Core + Qt6::Widgets + Qt6::Gui + Qt6::Quick + Qt6::QuickControls2 + + ${MODULES} +) + +target_link_libraries(eden PRIVATE common core input_common frontend_common qt_common network video_core) +target_link_libraries(eden PRIVATE Boost::headers glad fmt) +target_link_libraries(eden PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) + +target_link_libraries(eden PRIVATE Vulkan::Headers) + +target_compile_definitions(eden PRIVATE + # Use QStringBuilder for string concatenation to reduce + # the overall number of temporary strings created. + -DQT_USE_QSTRINGBUILDER + + # Disable implicit type narrowing in signal/slot connect() calls. + -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT + + # Disable unsafe overloads of QProcess' start() function. + -DQT_NO_PROCESS_COMBINED_ARGUMENT_START + + # Disable implicit QString->QUrl conversions to enforce use of proper resolving functions. + -DQT_NO_URL_CAST_FROM_STRING +) + +set_target_properties(eden PROPERTIES OUTPUT_NAME "eden") +include(GNUInstallDirs) +install(TARGETS eden + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/Eden/Native/Gamepad/CMakeLists.txt b/src/Eden/Native/Gamepad/CMakeLists.txt new file mode 100644 index 0000000000..c81555db2f --- /dev/null +++ b/src/Eden/Native/Gamepad/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +EdenModule( + NAME Gamepad + URI Eden.Native.Gamepad + SOURCES gamepad.h gamepad.cpp +) diff --git a/src/eden/Eden/Native/Gamepad/gamepad.cpp b/src/Eden/Native/Gamepad/gamepad.cpp similarity index 100% rename from src/eden/Eden/Native/Gamepad/gamepad.cpp rename to src/Eden/Native/Gamepad/gamepad.cpp diff --git a/src/eden/Eden/Native/Gamepad/gamepad.h b/src/Eden/Native/Gamepad/gamepad.h similarity index 100% rename from src/eden/Eden/Native/Gamepad/gamepad.h rename to src/Eden/Native/Gamepad/gamepad.h diff --git a/src/eden/Eden/Native/icons.qrc b/src/Eden/Native/icons.qrc similarity index 84% rename from src/eden/Eden/Native/icons.qrc rename to src/Eden/Native/icons.qrc index 9844c5ff9e..21c212b6a1 100644 --- a/src/eden/Eden/Native/icons.qrc +++ b/src/Eden/Native/icons.qrc @@ -10,5 +10,6 @@ icons/forward.svg icons/back.svg icons/help.svg + ../../../dist/dev.eden_emu.eden.svg diff --git a/src/eden/Eden/Native/icons/audio.svg b/src/Eden/Native/icons/audio.svg similarity index 100% rename from src/eden/Eden/Native/icons/audio.svg rename to src/Eden/Native/icons/audio.svg diff --git a/src/eden/Eden/Native/icons/back.svg b/src/Eden/Native/icons/back.svg similarity index 100% rename from src/eden/Eden/Native/icons/back.svg rename to src/Eden/Native/icons/back.svg diff --git a/src/eden/Eden/Native/icons/controls.svg b/src/Eden/Native/icons/controls.svg similarity index 100% rename from src/eden/Eden/Native/icons/controls.svg rename to src/Eden/Native/icons/controls.svg diff --git a/src/eden/Eden/Native/icons/cpu.svg b/src/Eden/Native/icons/cpu.svg similarity index 100% rename from src/eden/Eden/Native/icons/cpu.svg rename to src/Eden/Native/icons/cpu.svg diff --git a/src/eden/Eden/Native/icons/debug.svg b/src/Eden/Native/icons/debug.svg similarity index 100% rename from src/eden/Eden/Native/icons/debug.svg rename to src/Eden/Native/icons/debug.svg diff --git a/src/eden/Eden/Native/icons/forward.svg b/src/Eden/Native/icons/forward.svg similarity index 100% rename from src/eden/Eden/Native/icons/forward.svg rename to src/Eden/Native/icons/forward.svg diff --git a/src/eden/Eden/Native/icons/general.svg b/src/Eden/Native/icons/general.svg similarity index 100% rename from src/eden/Eden/Native/icons/general.svg rename to src/Eden/Native/icons/general.svg diff --git a/src/eden/Eden/Native/icons/graphics.svg b/src/Eden/Native/icons/graphics.svg similarity index 100% rename from src/eden/Eden/Native/icons/graphics.svg rename to src/Eden/Native/icons/graphics.svg diff --git a/src/eden/Eden/Native/icons/help.svg b/src/Eden/Native/icons/help.svg similarity index 100% rename from src/eden/Eden/Native/icons/help.svg rename to src/Eden/Native/icons/help.svg diff --git a/src/eden/Eden/Native/icons/system.svg b/src/Eden/Native/icons/system.svg similarity index 100% rename from src/eden/Eden/Native/icons/system.svg rename to src/Eden/Native/icons/system.svg diff --git a/src/eden/Eden/Native/main.cpp b/src/Eden/Native/main.cpp similarity index 72% rename from src/eden/Eden/Native/main.cpp rename to src/Eden/Native/main.cpp index 6fbf1e57d9..5dd0446fec 100644 --- a/src/eden/Eden/Native/main.cpp +++ b/src/Eden/Native/main.cpp @@ -1,10 +1,11 @@ #include #include #include +#include "Interface/QMLConfig.h" +#include "Interface/SettingsInterface.h" +#include "Interface/TitleManager.h" +#include "Models/GameListModel.h" #include "core/core.h" -#include "Native/Interface/QMLConfig.h" -#include "Native/Models/GameListModel.h" -#include "Native/Interface/SettingsInterface.h" #include @@ -17,6 +18,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationName(QStringLiteral("eden-emu")); QCoreApplication::setApplicationName(QStringLiteral("eden")); QApplication::setDesktopFileName(QStringLiteral("org.eden-emu.eden")); + QGuiApplication::setWindowIcon(QIcon(":/icons/eden.svg")); /// Settings, etc Settings::SetConfiguringGlobal(true); @@ -39,12 +41,20 @@ int main(int argc, char *argv[]) ctx->setContextProperty(QStringLiteral("QtConfig"), QVariant::fromValue(config)); // Enums - qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject, "Eden.Native.Interface", 1, 0, "SettingsCategories", QString()); + qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject, "Eden.Interface", 1, 0, "SettingsCategories", QString()); // Directory List GameListModel *gameListModel = new GameListModel(&app); ctx->setContextProperty(QStringLiteral("EdenGameList"), gameListModel); + // Settings Interface + SettingsInterface *interface = new SettingsInterface(&engine); + ctx->setContextProperty(QStringLiteral("SettingsInterface"), interface); + + // Title Manager + TitleManager *title = new TitleManager(&engine); + ctx->setContextProperty(QStringLiteral("TitleManager"), title); + /// LOAD QObject::connect( &engine, diff --git a/src/Eden/Util/CMakeLists.txt b/src/Eden/Util/CMakeLists.txt new file mode 100644 index 0000000000..f2841da2c1 --- /dev/null +++ b/src/Eden/Util/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# SPDX-FileCopyrightText: Copyright 2025 crueter +# SPDX-License-Identifier: GPL-3.0-or-later + +set_source_files_properties(Util.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +EdenModule( + NAME Util + URI Eden.Util + QML_FILES + Util.qml +) diff --git a/src/eden/Eden/Util/Util.qml b/src/Eden/Util/Util.qml similarity index 100% rename from src/eden/Eden/Util/Util.qml rename to src/Eden/Util/Util.qml diff --git a/src/eden/.gitignore b/src/eden/.gitignore deleted file mode 100644 index aa3808c5a9..0000000000 --- a/src/eden/.gitignore +++ /dev/null @@ -1,82 +0,0 @@ -# This file is used to ignore files which are generated -# ---------------------------------------------------------------------------- - -*~ -*.autosave -*.a -*.core -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -*.qm -.#* -*.*# -core -!core/ -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -Thumbs.db -*.res -*.rc -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -*.pro.user* -*.qbs.user* -CMakeLists.txt.user* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - -# Directories with generated files -.moc/ -.obj/ -.pch/ -.rcc/ -.uic/ -/build*/ diff --git a/src/eden/CMakeLists.txt b/src/eden/CMakeLists.txt deleted file mode 100644 index 329b07bae7..0000000000 --- a/src/eden/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui Quick QuickControls2) - -qt_standard_project_setup(REQUIRES 6.7) - -add_subdirectory(Eden) diff --git a/src/eden/Eden/CMakeLists.txt b/src/eden/Eden/CMakeLists.txt deleted file mode 100644 index c3904c36d0..0000000000 --- a/src/eden/Eden/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}") - -add_subdirectory(Config) -add_subdirectory(Constants) -add_subdirectory(Items) -add_subdirectory(Util) -add_subdirectory(Main) - -add_subdirectory(Native) diff --git a/src/eden/Eden/Config/CMakeLists.txt b/src/eden/Eden/Config/CMakeLists.txt deleted file mode 100644 index d5aefc012b..0000000000 --- a/src/eden/Eden/Config/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -qt_add_library(EdenConfig STATIC) -qt_add_qml_module(EdenConfig - URI Eden.Config - VERSION 1.0 - - QML_FILES GlobalConfigureDialog.qml - QML_FILES Setting.qml - QML_FILES SectionHeader.qml - - QML_FILES pages/SettingsList.qml - - QML_FILES pages/global/GlobalTab.qml - QML_FILES pages/global/GlobalTabSwipeView.qml - QML_FILES pages/global/GlobalGeneralPage.qml - - QML_FILES pages/global/GlobalSystemPage.qml - QML_FILES pages/global/GlobalCpuPage.qml - QML_FILES pages/global/GlobalGraphicsPage.qml - QML_FILES pages/global/GlobalAudioPage.qml - - QML_FILES pages/general/UiGeneralPage.qml - QML_FILES pages/general/UiGameListPage.qml - QML_FILES - - QML_FILES pages/graphics/RendererPage.qml - QML_FILES pages/graphics/RendererAdvancedPage.qml - QML_FILES pages/graphics/RendererExtensionsPage.qml - - QML_FILES pages/system/SystemGeneralPage.qml - QML_FILES - QML_FILES pages/system/FileSystemPage.qml - QML_FILES pages/system/AppletsPage.qml - - QML_FILES pages/cpu/CpuGeneralPage.qml - - QML_FILES pages/audio/AudioGeneralPage.qml - QML_FILES pages/global/GlobalDebugPage.qml - QML_FILES pages/debug/DebugGeneralPage.qml - QML_FILES pages/debug/DebugGraphicsPage.qml - QML_FILES pages/debug/DebugAdvancedPage.qml - QML_FILES pages/debug/DebugCpuPage.qml - QML_FILES fields/ConfigCheckbox.qml - QML_FILES fields/FieldLabel.qml - QML_FILES fields/ConfigComboBox.qml - QML_FILES TestSetting.qml - QML_FILES fields/ConfigIntLine.qml - QML_FILES fields/ConfigTimeEdit.qml - QML_FILES fields/ConfigIntSpin.qml - QML_FILES fields/ConfigHexEdit.qml - QML_FILES fields/ConfigStringEdit.qml - QML_FILES fields/FieldCheckbox.qml - QML_FILES fields/ConfigIntSlider.qml - QML_FILES pages/system/SystemCorePage.qml - QML_FILES fields/BaseField.qml -) diff --git a/src/eden/Eden/Constants/CMakeLists.txt b/src/eden/Eden/Constants/CMakeLists.txt deleted file mode 100644 index 3fb7aec6d0..0000000000 --- a/src/eden/Eden/Constants/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -find_package(Qt6 REQUIRED COMPONENTS Quick) - -set_source_files_properties(Constants.qml - PROPERTIES - QT_QML_SINGLETON_TYPE true -) - -qt_add_library(EdenConstants STATIC) -qt_add_qml_module(EdenConstants - URI Eden.Constants - OUTPUT_DIRECTORY EdenConstants - VERSION 1.0 - QML_FILES - - Constants.qml -) - -target_link_libraries(EdenConstants - PRIVATE - Qt6::Quick -) diff --git a/src/eden/Eden/Items/CMakeLists.txt b/src/eden/Eden/Items/CMakeLists.txt deleted file mode 100644 index 06764ee7bb..0000000000 --- a/src/eden/Eden/Items/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -qt_add_library(EdenItems STATIC) - -qt_add_qml_module(EdenItems - URI Eden.Items - VERSION 1.0 - QML_FILES - - StatusBarButton.qml - BetterMenu.qml - AnimatedDialog.qml - BetterMenuBar.qml - - SettingsTabButton.qml - IconButton.qml - QML_FILES VerticalTabBar.qml - QML_FILES - QML_FILES fields/BetterSpinBox.qml - QML_FILES fields/BetterTextField.qml - QML_FILES fields/FieldFooter.qml -) diff --git a/src/eden/Eden/Main/CMakeLists.txt b/src/eden/Eden/Main/CMakeLists.txt deleted file mode 100644 index b802ab1b40..0000000000 --- a/src/eden/Eden/Main/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -qt_add_library(EdenMain STATIC) -qt_add_qml_module(EdenMain - URI Eden.Main - VERSION 1.0 - QML_FILES - - Main.qml - StatusBar.qml - GameList.qml - GameGridCard.qml - MarqueeText.qml - GameGrid.qml - - GameCarouselCard.qml - GameCarousel.qml -) diff --git a/src/eden/Eden/Main/GameCarousel.qml b/src/eden/Eden/Main/GameCarousel.qml deleted file mode 100644 index 599310a15f..0000000000 --- a/src/eden/Eden/Main/GameCarousel.qml +++ /dev/null @@ -1,195 +0,0 @@ -import QtQuick -import QtQuick.Controls -import Qt.labs.platform -import QtCore - -import Eden.Constants -import Eden.Native.Interface - -ListView { - id: carousel - - focus: true - focusPolicy: Qt.StrongFocus - - model: EdenGameList - orientation: ListView.Horizontal - clip: false - flickDeceleration: 1500 - snapMode: ListView.SnapToItem - - onHeightChanged: console.log(width, height) - - spacing: 20 - - keyNavigationWraps: true - - function increment() { - incrementCurrentIndex() - if (currentIndex === count) - currentIndex = 0 - } - - function decrement() { - decrementCurrentIndex() - if (currentIndex === -1) - currentIndex = count - 1 - } - - // TODO(crueter): handle move/displace/add (requires thread worker on game list and a bunch of other shit) - Rectangle { - id: hg - clip: false - z: 3 - - property var item: carousel.currentItem - - anchors { - centerIn: parent - } - - height: item === null ? 0 : item.height + 10 - width: item === null ? 0 : item.width + 10 - - color: "transparent" - border { - color: "deepskyblue" - width: 4 * Constants.scalar - } - - radius: 8 * Constants.scalar - - Item { - id: container - - anchors { - bottom: hg.top - - left: hg.left - right: hg.right - } - - height: txt.contentHeight - clip: true - - function toTitleCase(str) { - return str.replace(/\w\S*/g, text => text.charAt(0).toUpperCase( - ) + text.substring(1).toLowerCase()) - } - - property string text: hg.item === null ? "" : toTitleCase( - hg.item.title) - property string spacing: " " - property string combined: text + spacing - property string display: animate ? combined.substring( - step) + combined.substring( - 0, step) : text - property int step: 0 - property bool animate: txt.contentWidth > hg.width - - Timer { - id: marquee - - interval: 150 - running: false - repeat: true - onTriggered: { - parent.step = (parent.step + 1) % parent.combined.length - if (parent.step === 0) { - stop() - delay.start() - } - } - } - - Timer { - id: delay - interval: 1500 - repeat: false - onTriggered: { - marquee.start() - } - } - - // fake container to gauge contentWidth - Text { - id: txt - visible: false - text: parent.text - font.pixelSize: 22 * Constants.scalar - font.family: "Monospace" - - onContentWidthChanged: { - if (txt.contentWidth > hg.width) { - container.step = 0 - delay.start() - } else { - delay.stop() - marquee.stop() - } - } - } - - Text { - anchors { - fill: parent - leftMargin: 10 - rightMargin: 10 - } - - color: "lightblue" - font.pixelSize: 22 * Constants.scalar - font.family: "Monospace" - text: parent.display - - horizontalAlignment: container.animate ? Text.AlignLeft : Text.AlignHCenter - } - - Rectangle { - anchors.fill: parent - z: 2 - - gradient: Gradient { - orientation: Gradient.Horizontal - GradientStop { - position: 0.0 - color: marquee.running ? Constants.bg : "transparent" - Behavior on color { - ColorAnimation { - duration: 200 - } - } - } - GradientStop { - position: 0.1 - color: "transparent" - } - GradientStop { - position: 0.9 - color: "transparent" - } - GradientStop { - position: 1.0 - color: marquee.running ? Constants.bg : "transparent" - Behavior on color { - ColorAnimation { - duration: 200 - } - } - } - } - } - } - } - - highlightRangeMode: ListView.StrictlyEnforceRange - preferredHighlightBegin: currentItem === null ? 0 : x + width / 2 - currentItem.width / 2 - preferredHighlightEnd: currentItem === null ? 0 : x + width / 2 + currentItem.width / 2 - - highlightMoveDuration: 300 - delegate: GameCarouselCard { - id: game - width: 300 - height: 300 - } -} diff --git a/src/eden/Eden/Main/GameList.qml b/src/eden/Eden/Main/GameList.qml deleted file mode 100644 index 7af19bbe88..0000000000 --- a/src/eden/Eden/Main/GameList.qml +++ /dev/null @@ -1,127 +0,0 @@ -import QtQuick -import QtQuick.Controls -import Qt.labs.platform -import QtCore - -import Eden.Constants -import Eden.Native.Interface -import Eden.Native.Gamepad - -Rectangle { - id: root - - property var setting: SettingsInterface.setting("grid_columns") - - property int gx: 0 - property int gy: 0 - - readonly property int deadzone: 8000 - readonly property int repeatTimeMs: 125 - - color: Constants.bg - - // TODO: use the original yuzu backend for dis - Gamepad { - id: gamepad - - // onUpPressed: grid.moveCurrentIndexUp() - // onDownPressed: grid.moveCurrentIndexDown() - // onLeftPressed: grid.moveCurrentIndexLeft() - // onRightPressed: grid.moveCurrentIndexRight() - onLeftPressed: carousel.decrement() - onRightPressed: carousel.increment() - onAPressed: console.log("A pressed") - onLeftStickMoved: (x, y) => { - gx = x - gy = y - } - } - - Timer { - interval: repeatTimeMs - running: true - repeat: true - onTriggered: { - if (gx > deadzone) { - gamepad.rightPressed() - } else if (gx < -deadzone) { - gamepad.leftPressed() - } - - if (gy > deadzone) { - gamepad.downPressed() - } else if (gy < -deadzone) { - gamepad.upPressed() - } - } - } - Timer { - interval: 16 - running: true - repeat: true - onTriggered: gamepad.pollEvents() - } - FolderDialog { - id: openDir - folder: StandardPaths.writableLocation(StandardPaths.HomeLocation) - onAccepted: { - button.visible = false - view.anchors.bottom = root.bottom - EdenGameList.addDir(folder) - } - } - - Item { - id: view - - anchors { - bottom: button.top - left: parent.left - right: parent.right - top: parent.top - margins: 8 * Constants.scalar - } - - // GameGrid { - // setting: root.setting - - // id: grid - - // anchors.fill: parent - // } - GameCarousel { - id: carousel - - height: 300 - - anchors { - right: view.right - left: view.left - - verticalCenter: view.verticalCenter - } - } - } - - Button { - id: button - font.pixelSize: 25 - - anchors { - left: parent.left - right: parent.right - - bottom: parent.bottom - - margins: 8 - } - - text: "Add Directory" - onClicked: openDir.open() - - background: Rectangle { - color: button.pressed ? Constants.accentPressed : Constants.accent - radius: 5 - } - } -} diff --git a/src/eden/Eden/Main/MarqueeText.qml b/src/eden/Eden/Main/MarqueeText.qml deleted file mode 100644 index 7a70c53141..0000000000 --- a/src/eden/Eden/Main/MarqueeText.qml +++ /dev/null @@ -1,43 +0,0 @@ -import QtQuick - -Item { - required property string text - - property int spacing: 30 - property int startDelay: 2000 - property int speed: 40 - - property alias font: t1.font - property alias color: t1.color - - id: root - - width: t1.width + spacing - height: t1.height - clip: true - - Text { - id: t1 - - SequentialAnimation on x { - loops: Animation.Infinite - running: true - - PauseAnimation { - duration: root.startDelay - } - - NumberAnimation { - from: root.width - to: -t1.width - duration: (root.width + t1.width) * 1000 / root.speed - easing.type: Easing.Linear - } - } - - Text { - x: root.width - text: t1.text - } - } -} diff --git a/src/eden/Eden/Native/CMakeLists.txt b/src/eden/Eden/Native/CMakeLists.txt deleted file mode 100644 index 289504b4cf..0000000000 --- a/src/eden/Eden/Native/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -qt_add_executable(eden - main.cpp - icons.qrc -) - -add_subdirectory(Interface) -add_subdirectory(Models) - -set(PLUGINS - EdenUtilplugin - EdenItemsplugin - EdenConfigplugin - EdenInterfaceplugin - EdenConstantsplugin - EdenMainplugin -) - -if (ENABLE_SDL2) - add_subdirectory(Gamepad) - set(PLUGINS ${PLUGINS} edenGamepadplugin) -endif() - -target_link_libraries(eden - PRIVATE - Qt6::Core - Qt6::Widgets - Qt6::Gui - Qt6::Quick - Qt6::QuickControls2 - EdenModels - - # Explicitly link to static plugins - ${PLUGINS} -) - -set(NATIVE_MODULES eden EdenInterface) - -foreach(MODULE ${NATIVE_MODULES}) - target_link_libraries(${MODULE} PRIVATE common core input_common frontend_common qt_common network video_core) - target_link_libraries(${MODULE} PRIVATE Boost::headers glad fmt) - target_link_libraries(${MODULE} PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) - - target_link_libraries(${MODULE} PRIVATE Vulkan::Headers) - - if (UNIX AND NOT APPLE) - target_link_libraries(${MODULE} PRIVATE Qt6::DBus) - endif() - - target_compile_definitions(${MODULE} PRIVATE - # Use QStringBuilder for string concatenation to reduce - # the overall number of temporary strings created. - -DQT_USE_QSTRINGBUILDER - - # Disable implicit type narrowing in signal/slot connect() calls. - -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT - - # Disable unsafe overloads of QProcess' start() function. - -DQT_NO_PROCESS_COMBINED_ARGUMENT_START - - # Disable implicit QString->QUrl conversions to enforce use of proper resolving functions. - -DQT_NO_URL_CAST_FROM_STRING - ) -endforeach() - -set_target_properties(eden PROPERTIES OUTPUT_NAME "eden") -include(GNUInstallDirs) -install(TARGETS eden - BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) diff --git a/src/eden/Eden/Native/Gamepad/CMakeLists.txt b/src/eden/Eden/Native/Gamepad/CMakeLists.txt deleted file mode 100644 index 70a69b35ad..0000000000 --- a/src/eden/Eden/Native/Gamepad/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -qt_add_library(edenGamepad STATIC) - -qt_add_qml_module(edenGamepad - URI Eden.Native.Gamepad - VERSION 1.0 - SOURCES gamepad.h gamepad.cpp -) diff --git a/src/eden/Eden/Native/Interface/CMakeLists.txt b/src/eden/Eden/Native/Interface/CMakeLists.txt deleted file mode 100644 index 3c35df6ce5..0000000000 --- a/src/eden/Eden/Native/Interface/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -qt_add_library(EdenInterface STATIC) -qt_add_qml_module(EdenInterface - URI Eden.Native.Interface - VERSION 1.0 - SOURCES - SettingsInterface.h SettingsInterface.cpp - QMLSetting.h QMLSetting.cpp - MetaObjectHelper.h - SOURCES QMLConfig.h - -) diff --git a/src/eden/Eden/Native/Models/CMakeLists.txt b/src/eden/Eden/Native/Models/CMakeLists.txt deleted file mode 100644 index 3a86bed1c4..0000000000 --- a/src/eden/Eden/Native/Models/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -# TODO: This might not need to be exposed to QML? -qt_add_library(EdenModels STATIC) -qt_add_qml_module(EdenModels - URI Eden.Native.Models - VERSION 1.0 - SOURCES - GameListModel.h GameListModel.cpp - SettingsModel.h SettingsModel.cpp -) - -target_link_libraries(EdenModels - PRIVATE - Qt6::Gui -) diff --git a/src/eden/Eden/Util/CMakeLists.txt b/src/eden/Eden/Util/CMakeLists.txt deleted file mode 100644 index 5761da0b3f..0000000000 --- a/src/eden/Eden/Util/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(CMAKE_AUTOMOC ON) - -find_package(Qt6 REQUIRED COMPONENTS Quick) - -set_source_files_properties(Util.qml - PROPERTIES - QT_QML_SINGLETON_TYPE true -) - -qt_add_library(EdenUtil STATIC) -qt_add_qml_module(EdenUtil - URI Eden.Util - OUTPUT_DIRECTORY EdenUtil - VERSION 1.0 - QML_FILES - - Util.qml -) - -target_link_libraries(EdenUtil - PRIVATE - Qt6::Quick -) diff --git a/src/qt_common/CMakeLists.txt b/src/qt_common/CMakeLists.txt index aebd11a52b..a5fec0ffaf 100644 --- a/src/qt_common/CMakeLists.txt +++ b/src/qt_common/CMakeLists.txt @@ -4,9 +4,6 @@ # SPDX-FileCopyrightText: 2023 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(Qt6 REQUIRED COMPONENTS Core) -find_package(Qt6 REQUIRED COMPONENTS Core) - add_library(qt_common STATIC qt_common.h qt_common.cpp @@ -32,7 +29,6 @@ add_library(qt_common STATIC # Extra deps add_subdirectory(externals) -target_link_libraries(qt_common PUBLIC QuaZip::QuaZip) create_target_directory_groups(qt_common) @@ -41,8 +37,6 @@ if (ENABLE_QT) target_link_libraries(qt_common PRIVATE Qt6::Widgets) endif() -add_subdirectory(externals) - target_link_libraries(qt_common PRIVATE core Qt6::Core SimpleIni::SimpleIni QuaZip::QuaZip frozen::frozen) if (NOT WIN32)