Browse Source

ui fixes, tab inline, auto reload

Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3016/head
crueter 1 month ago
parent
commit
3e2a91d7b1
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 23
      src/Eden/Config/GlobalConfigureDialog.qml
  2. 1
      src/Eden/Config/fields/BaseField.qml
  3. 1
      src/Eden/Config/fields/ConfigComboBox.qml
  4. 3
      src/Eden/Config/fields/ConfigHexEdit.qml
  5. 3
      src/Eden/Config/fields/ConfigIntLine.qml
  6. 2
      src/Eden/Config/fields/ConfigIntSlider.qml
  7. 3
      src/Eden/Config/fields/ConfigIntSpin.qml
  8. 4
      src/Eden/Config/fields/ConfigStringEdit.qml
  9. 3
      src/Eden/Config/fields/ConfigTimeEdit.qml
  10. 4
      src/Eden/Config/pages/general/UiGeneralPage.qml
  11. 2
      src/Eden/Config/pages/global/GlobalTab.qml
  12. 1
      src/Eden/Native/CMakeLists.txt
  13. 116
      src/Eden/Native/EdenApplication.cpp
  14. 22
      src/Eden/Native/EdenApplication.h
  15. 83
      src/Eden/Native/main.cpp
  16. 3
      src/qt_common/config/shared_translation.cpp
  17. 4
      src/qt_common/externals/cpmfile.json

23
src/Eden/Config/GlobalConfigureDialog.qml

@ -22,10 +22,11 @@ Dialog {
padding: 5
title: qsTr("Configuration")
standardButtons: Dialog.Ok | Dialog.Cancel
standardButtons: Dialog.Ok | Dialog.Apply | Dialog.Cancel
Component.onCompleted: configs = Util.searchItem(swipe, "PageScrollView")
onAccepted: {
function applyConfigs() {
configs.forEach(config => {
config.apply()
})
@ -33,8 +34,22 @@ Dialog {
// console.log("Saving")
QtConfig.save()
}
onAccepted: {
applyConfigs()
if (EdenApplication.shouldReload) {
EdenApplication.shouldReload = false
EdenApplication.reload()
}
}
onApplied: {
applyConfigs()
}
onRejected: {
console.log("Rejected")
// TODO
// configs.forEach(config => config.sync())
// QtConfig.reload()
@ -75,7 +90,7 @@ Dialog {
CarboxylTabButton {
text: modelData
coloredIcon: true
inlineIcon: false // TODO: fix inlineIcon
inlineIcon: true
icon.source: "qrc:/icons/" + modelData.toLowerCase() + ".svg"
icon.width: 20

1
src/Eden/Config/fields/BaseField.qml

@ -14,6 +14,7 @@ Item {
property alias enable: enable.checked
property Item contentItem
property bool unsaved: value !== setting.value
readonly property string typeName: "BaseField"

1
src/Eden/Config/fields/ConfigComboBox.qml

@ -16,6 +16,7 @@ BaseField {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.maximumHeight: 30
font.pixelSize: 14
model: runtimeModel !== null ? runtimeModel : setting.combo

3
src/Eden/Config/fields/ConfigHexEdit.qml

@ -12,12 +12,13 @@ BaseField {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.maximumHeight: 30
validator: RegularExpressionValidator {
regularExpression: /[0-9a-fA-F]{0,8}/
}
font.pixelSize: 15
font.pixelSize: 14
text: Number(value).toString(16)

3
src/Eden/Config/fields/ConfigIntLine.qml

@ -12,6 +12,7 @@ BaseField {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.maximumHeight: 30
inputMethodHints: Qt.ImhDigitsOnly
validator: IntValidator {
@ -19,7 +20,7 @@ BaseField {
top: setting.max
}
font.pixelSize: 15
font.pixelSize: 14
text: value

2
src/Eden/Config/fields/ConfigIntSlider.qml

@ -24,6 +24,7 @@ BaseField {
onMoved: field.value = value
Layout.rightMargin: 10
Layout.maximumHeight: 30
snapMode: Slider.SnapAlways
}
@ -34,6 +35,7 @@ BaseField {
text: field.value + setting.suffix
Layout.rightMargin: 10
Layout.maximumHeight: 30
}
}
}

3
src/Eden/Config/fields/ConfigIntSpin.qml

@ -13,11 +13,12 @@ BaseField {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.maximumHeight: 30
from: setting.min
to: setting.max
font.pixelSize: 15
font.pixelSize: 14
value: field.value

4
src/Eden/Config/fields/ConfigStringEdit.qml

@ -10,10 +10,12 @@ BaseField {
contentItem: TextField {
enabled: enable
Layout.maximumHeight: 30
Layout.fillWidth: true
Layout.rightMargin: 10
font.pixelSize: 15
font.pixelSize: 14
text: value

3
src/Eden/Config/fields/ConfigTimeEdit.qml

@ -13,6 +13,7 @@ BaseField {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.maximumHeight: 30
inputMethodHints: Qt.ImhDigitsOnly
validator: IntValidator {
@ -20,7 +21,7 @@ BaseField {
top: setting.max
}
font.pixelSize: 15
font.pixelSize: 14
text: value
// suffix: setting.suffix

4
src/Eden/Config/pages/general/UiGeneralPage.qml

@ -10,6 +10,10 @@ import Carboxyl.Base
PageScrollView {
id: scroll
function apply() {
if (style.unsaved) {
EdenApplication.shouldReload = true
}
ui.apply()
style.apply()
theme.apply()

2
src/Eden/Config/pages/global/GlobalTab.qml

@ -13,6 +13,8 @@ Item {
id: tabBar
currentIndex: swipe.currentIndex
contentHeight: 35
anchors {
top: parent.top
left: parent.left

1
src/Eden/Native/CMakeLists.txt

@ -7,6 +7,7 @@
qt_add_executable(eden
main.cpp
icons.qrc
EdenApplication.h EdenApplication.cpp
)
set(MODULES

116
src/Eden/Native/EdenApplication.cpp

@ -0,0 +1,116 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "EdenApplication.h"
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "CarboxylApplication.h"
#include "Eden/Interface/QMLConfig.h"
#include "Eden/Interface/SettingsInterface.h"
#include "Eden/Interface/TitleManager.h"
#include "Eden/Models/GameListModel.h"
#include "common/settings_enums.h"
#include "qt_common/config/uisettings.h"
#include "qt_common/qt_common.h"
#include <QQuickStyle>
#include <QWidget>
static constexpr const int EXIT_RELOAD = -2;
EdenApplication::EdenApplication(int &argc, char *argv[])
: QApplication(argc, argv)
{
QCoreApplication::setOrganizationName(QStringLiteral("eden-emu"));
QCoreApplication::setApplicationName(QStringLiteral("eden"));
QApplication::setDesktopFileName(QStringLiteral("dev.eden-emu.eden"));
QGuiApplication::setWindowIcon(QIcon(QStringLiteral(":/icons/eden.svg")));
/// QtCommon
QtCommon::Init(new QWidget);
/// Settings, etc
Settings::SetConfiguringGlobal(true);
config = new QMLConfig;
// TODO: Save all values on launch and per game etc
connect(this, &QCoreApplication::aboutToQuit, this, [this]() { config->save(); });
}
void EdenApplication::reload()
{
exit(EXIT_RELOAD);
}
int EdenApplication::run() {
int ret = EXIT_SUCCESS;
do {
if (ret == EXIT_RELOAD)
qmlClearTypeRegistrations();
QQmlApplicationEngine engine;
// carboxyl setup
auto translations = ConfigurationShared::ComboboxEnumeration(this);
const auto enumeration = &translations->at(Settings::EnumMetadata<Settings::Style>::Index());
QString style;
for (const auto &[idx, name] : *enumeration) {
if (idx == (u32) UISettings::values.carboxyl_style.GetValue()) {
style = name;
}
}
CarboxylApplication *carboxylApp = new CarboxylApplication(*this,
&engine,
style,
QStringLiteral("Trioxide"));
carboxylApp->setParent(this);
/// CONTEXT
auto ctx = engine.rootContext();
ctx->setContextProperty(QStringLiteral("QtConfig"), QVariant::fromValue(config));
// Enums
qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject,
"Eden.Interface",
1,
0,
"SettingsCategories",
QString());
// Directory List
GameListModel *gameListModel = new GameListModel(this, &engine);
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);
// :)
ctx->setContextProperty(QStringLiteral("EdenApplication"), this);
/// LOAD
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
this,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("Eden.Main", "Main");
ret = exec();
} while (ret == EXIT_RELOAD);
return ret;
}

22
src/Eden/Native/EdenApplication.h

@ -0,0 +1,22 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QApplication>
#include "Eden/Interface/QMLConfig.h"
class EdenApplication : public QApplication
{
Q_OBJECT
Q_PROPERTY(bool shouldReload MEMBER m_shouldReload)
public:
EdenApplication(int &argc, char *argv[]);
public slots:
void reload();
int run();
private:
QMLConfig *config;
bool m_shouldReload = false;
};

83
src/Eden/Native/main.cpp

@ -6,90 +6,13 @@
#undef VMA_IMPLEMENTATION
#endif
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "CarboxylApplication.h"
#include "Eden/Interface/QMLConfig.h"
#include "Eden/Interface/SettingsInterface.h"
#include "Eden/Interface/TitleManager.h"
#include "Eden/Models/GameListModel.h"
#include "common/settings_enums.h"
#include "qt_common/config/uisettings.h"
#include "qt_common/qt_common.h"
#include <QQuickStyle>
#include <QWidget>
#include "EdenApplication.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
QCoreApplication::setOrganizationName(QStringLiteral("eden-emu"));
QCoreApplication::setApplicationName(QStringLiteral("eden"));
QApplication::setDesktopFileName(QStringLiteral("dev.eden-emu.eden"));
QGuiApplication::setWindowIcon(QIcon(QStringLiteral(":/icons/eden.svg")));
/// QtCommon
QtCommon::Init(new QWidget);
/// Settings, etc
Settings::SetConfiguringGlobal(true);
QMLConfig *config = new QMLConfig;
// TODO: Save all values on launch and per game etc
app.connect(&app, &QCoreApplication::aboutToQuit, &app, [config]() {
config->save();
});
// carboxyl setup
auto translations = ConfigurationShared::ComboboxEnumeration(&app);
const auto enumeration = &translations->at(Settings::EnumMetadata<Settings::Style>::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
auto ctx = engine.rootContext();
ctx->setContextProperty(QStringLiteral("QtConfig"), QVariant::fromValue(config));
// Enums
qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject, "Eden.Interface", 1, 0, "SettingsCategories", QString());
// Directory List
GameListModel *gameListModel = new GameListModel(&app, &engine);
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,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("Eden.Main", "Main");
EdenApplication app(argc, argv);
return app.exec();
return app.run();
}
#if !defined(QT_STATICPLUGIN) || defined(__APPLE__)

3
src/qt_common/config/shared_translation.cpp

@ -403,11 +403,14 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent)
// Web Service
// Ui
#ifdef YUZU_QT_QML
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."));
#endif
// Ui General
INSERT(UISettings,

4
src/qt_common/externals/cpmfile.json

@ -19,8 +19,8 @@
"package": "Carboxyl",
"repo": "crueter/Carboxyl",
"git_host": "git.crueter.xyz",
"sha": "7bb3818c24",
"hash": "57f61145a1bbb976537af1ef9f3b99d4c442ca47f2dd5d86e65e1a612ecf879d3e7f383bef565bd52606e2b3a68264d8d0c8f53375cd0fe4bdd5175bd3f06ec9",
"sha": "6789e1b2c9",
"hash": "e067c5a5ddb4ef77fee58afd4fb47ef4058b68213a33bc52a349b597aa25b8eb9cbb695c580ae59b82373531d0c96c24f192ada11dc7e198c9c33364a213b90d",
"bundled": "true",
"options": [
"CARBOXYL_DEMO OFF"

Loading…
Cancel
Save