mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
main: Move meta type registration into its own function
Moves the existing meta type registration into its own function and adds registration of common integral, floating point and string types. This function is also now called in the constructor of the GMainWindow instead of on starting a game.
This commit is contained in:
parent
aa3adf6c3f
commit
4a5f9f5a6d
2 changed files with 65 additions and 9 deletions
|
@ -227,6 +227,8 @@ GMainWindow::GMainWindow()
|
||||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
||||||
discord_rpc->Update();
|
discord_rpc->Update();
|
||||||
|
|
||||||
|
RegisterMetaTypes();
|
||||||
|
|
||||||
InitializeWidgets();
|
InitializeWidgets();
|
||||||
InitializeDebugWidgets();
|
InitializeDebugWidgets();
|
||||||
InitializeRecentFileMenuActions();
|
InitializeRecentFileMenuActions();
|
||||||
|
@ -375,6 +377,55 @@ GMainWindow::~GMainWindow() {
|
||||||
delete render_window;
|
delete render_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::RegisterMetaTypes() {
|
||||||
|
// Register integral and floating point types
|
||||||
|
qRegisterMetaType<u8>("u8");
|
||||||
|
qRegisterMetaType<u16>("u16");
|
||||||
|
qRegisterMetaType<u32>("u32");
|
||||||
|
qRegisterMetaType<u64>("u64");
|
||||||
|
qRegisterMetaType<u128>("u128");
|
||||||
|
qRegisterMetaType<s8>("s8");
|
||||||
|
qRegisterMetaType<s16>("s16");
|
||||||
|
qRegisterMetaType<s32>("s32");
|
||||||
|
qRegisterMetaType<s64>("s64");
|
||||||
|
qRegisterMetaType<f32>("f32");
|
||||||
|
qRegisterMetaType<f64>("f64");
|
||||||
|
|
||||||
|
// Register string types
|
||||||
|
qRegisterMetaType<std::string>("std::string");
|
||||||
|
qRegisterMetaType<std::wstring>("std::wstring");
|
||||||
|
qRegisterMetaType<std::u8string>("std::u8string");
|
||||||
|
qRegisterMetaType<std::u16string>("std::u16string");
|
||||||
|
qRegisterMetaType<std::u32string>("std::u32string");
|
||||||
|
qRegisterMetaType<std::string_view>("std::string_view");
|
||||||
|
qRegisterMetaType<std::wstring_view>("std::wstring_view");
|
||||||
|
qRegisterMetaType<std::u8string_view>("std::u8string_view");
|
||||||
|
qRegisterMetaType<std::u16string_view>("std::u16string_view");
|
||||||
|
qRegisterMetaType<std::u32string_view>("std::u32string_view");
|
||||||
|
|
||||||
|
// Register applet types
|
||||||
|
|
||||||
|
// Controller Applet
|
||||||
|
qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters");
|
||||||
|
|
||||||
|
// Software Keyboard Applet
|
||||||
|
qRegisterMetaType<Core::Frontend::KeyboardInitializeParameters>(
|
||||||
|
"Core::Frontend::KeyboardInitializeParameters");
|
||||||
|
qRegisterMetaType<Core::Frontend::InlineAppearParameters>(
|
||||||
|
"Core::Frontend::InlineAppearParameters");
|
||||||
|
qRegisterMetaType<Core::Frontend::InlineTextParameters>("Core::Frontend::InlineTextParameters");
|
||||||
|
qRegisterMetaType<Service::AM::Applets::SwkbdResult>("Service::AM::Applets::SwkbdResult");
|
||||||
|
qRegisterMetaType<Service::AM::Applets::SwkbdTextCheckResult>(
|
||||||
|
"Service::AM::Applets::SwkbdTextCheckResult");
|
||||||
|
qRegisterMetaType<Service::AM::Applets::SwkbdReplyType>("Service::AM::Applets::SwkbdReplyType");
|
||||||
|
|
||||||
|
// Web Browser Applet
|
||||||
|
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
|
||||||
|
|
||||||
|
// Register loader types
|
||||||
|
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::ControllerSelectorReconfigureControllers(
|
void GMainWindow::ControllerSelectorReconfigureControllers(
|
||||||
const Core::Frontend::ControllerParameters& parameters) {
|
const Core::Frontend::ControllerParameters& parameters) {
|
||||||
QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get());
|
QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get());
|
||||||
|
@ -2166,13 +2217,6 @@ void GMainWindow::OnStartGame() {
|
||||||
|
|
||||||
emu_thread->SetRunning(true);
|
emu_thread->SetRunning(true);
|
||||||
|
|
||||||
qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters");
|
|
||||||
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
|
|
||||||
qRegisterMetaType<std::string>("std::string");
|
|
||||||
qRegisterMetaType<std::optional<std::u16string>>("std::optional<std::u16string>");
|
|
||||||
qRegisterMetaType<std::string_view>("std::string_view");
|
|
||||||
qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
|
|
||||||
|
|
||||||
connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
|
connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
|
||||||
|
|
||||||
ui.action_Start->setEnabled(false);
|
ui.action_Start->setEnabled(false);
|
||||||
|
|
|
@ -37,9 +37,13 @@ enum class GameListRemoveTarget;
|
||||||
enum class InstalledEntryType;
|
enum class InstalledEntryType;
|
||||||
class GameListPlaceholder;
|
class GameListPlaceholder;
|
||||||
|
|
||||||
|
class QtSoftwareKeyboardDialog;
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
struct ControllerParameters;
|
struct ControllerParameters;
|
||||||
struct SoftwareKeyboardParameters;
|
struct InlineAppearParameters;
|
||||||
|
struct InlineTextParameters;
|
||||||
|
struct KeyboardInitializeParameters;
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
||||||
namespace DiscordRPC {
|
namespace DiscordRPC {
|
||||||
|
@ -57,8 +61,11 @@ class InputSubsystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
enum class SwkbdResult : u32;
|
||||||
|
enum class SwkbdTextCheckResult : u32;
|
||||||
|
enum class SwkbdReplyType : u32;
|
||||||
enum class WebExitReason : u32;
|
enum class WebExitReason : u32;
|
||||||
}
|
} // namespace Service::AM::Applets
|
||||||
|
|
||||||
enum class EmulatedDirectoryTarget {
|
enum class EmulatedDirectoryTarget {
|
||||||
NAND,
|
NAND,
|
||||||
|
@ -143,6 +150,8 @@ public slots:
|
||||||
void OnAppFocusStateChanged(Qt::ApplicationState state);
|
void OnAppFocusStateChanged(Qt::ApplicationState state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void RegisterMetaTypes();
|
||||||
|
|
||||||
void InitializeWidgets();
|
void InitializeWidgets();
|
||||||
void InitializeDebugWidgets();
|
void InitializeDebugWidgets();
|
||||||
void InitializeRecentFileMenuActions();
|
void InitializeRecentFileMenuActions();
|
||||||
|
@ -329,6 +338,9 @@ private:
|
||||||
// Disables the web applet for the rest of the emulated session
|
// Disables the web applet for the rest of the emulated session
|
||||||
bool disable_web_applet{};
|
bool disable_web_applet{};
|
||||||
|
|
||||||
|
// Applets
|
||||||
|
QtSoftwareKeyboardDialog* software_keyboard = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
|
Loading…
Reference in a new issue