Browse Source
ui fixes, tab inline, auto reload
ui fixes, tab inline, auto reload
Signed-off-by: crueter <crueter@eden-emu.dev>pull/3016/head
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
17 changed files with 187 additions and 91 deletions
-
23src/Eden/Config/GlobalConfigureDialog.qml
-
1src/Eden/Config/fields/BaseField.qml
-
1src/Eden/Config/fields/ConfigComboBox.qml
-
3src/Eden/Config/fields/ConfigHexEdit.qml
-
3src/Eden/Config/fields/ConfigIntLine.qml
-
2src/Eden/Config/fields/ConfigIntSlider.qml
-
3src/Eden/Config/fields/ConfigIntSpin.qml
-
4src/Eden/Config/fields/ConfigStringEdit.qml
-
3src/Eden/Config/fields/ConfigTimeEdit.qml
-
4src/Eden/Config/pages/general/UiGeneralPage.qml
-
2src/Eden/Config/pages/global/GlobalTab.qml
-
1src/Eden/Native/CMakeLists.txt
-
116src/Eden/Native/EdenApplication.cpp
-
22src/Eden/Native/EdenApplication.h
-
83src/Eden/Native/main.cpp
-
3src/qt_common/config/shared_translation.cpp
-
4src/qt_common/externals/cpmfile.json
@ -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; |
||||
|
} |
||||
@ -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; |
||||
|
}; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue