summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/MainWindow.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-10-14 21:46:54 +1000
committerStenzek <stenzek@gmail.com>2018-10-14 21:46:59 +1000
commit211a9bf6d27356693469e4273dfd42825e811b9e (patch)
tree0e4c035ad4aadc5fa908750fc64fc664372b854b /Source/Core/DolphinQt/MainWindow.cpp
parentb5d855caf7a2bed70edca0385922ffc6dfb5286f (diff)
Qt/MainWindow: Lazy initialize child windows
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp57
1 files changed, 34 insertions, 23 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 6330fb7fcf..10c2f1d0b3 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -260,8 +260,6 @@ void MainWindow::CreateComponents()
m_game_list = new GameList(this);
m_render_widget = new RenderWidget;
m_stack = new QStackedWidget(this);
- m_controllers_window = new ControllersWindow(this);
- m_settings_window = new SettingsWindow(this);
for (int i = 0; i < 4; i++)
{
@@ -281,11 +279,7 @@ void MainWindow::CreateComponents()
m_jit_widget = new JITWidget(this);
m_log_widget = new LogWidget(this);
m_log_config_widget = new LogConfigWidget(this);
- m_fifo_window = new FIFOPlayerWindow(this);
m_memory_widget = new MemoryWidget(this);
-
- connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
- [this](const QString& path) { StartGame(path); });
m_register_widget = new RegisterWidget(this);
m_watch_widget = new WatchWidget(this);
m_breakpoint_widget = new BreakpointWidget(this);
@@ -311,20 +305,6 @@ void MainWindow::CreateComponents()
if (Core::GetState() == Core::State::Paused)
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithUpdate);
});
-
-#if defined(HAVE_XRANDR) && HAVE_XRANDR
- m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(
- static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
- "display", windowHandle())),
- winId());
- m_graphics_window = new GraphicsWindow(m_xrr_config.get(), this);
-#else
- m_graphics_window = new GraphicsWindow(nullptr, this);
-#endif
-
- InstallHotkeyFilter(m_controllers_window);
- InstallHotkeyFilter(m_settings_window);
- InstallHotkeyFilter(m_graphics_window);
}
void MainWindow::ConnectMenuBar()
@@ -913,6 +893,12 @@ void MainWindow::HideRenderWidget(bool reinit)
void MainWindow::ShowControllersWindow()
{
+ if (!m_controllers_window)
+ {
+ m_controllers_window = new ControllersWindow(this);
+ InstallHotkeyFilter(m_controllers_window);
+ }
+
m_controllers_window->show();
m_controllers_window->raise();
m_controllers_window->activateWindow();
@@ -920,6 +906,12 @@ void MainWindow::ShowControllersWindow()
void MainWindow::ShowSettingsWindow()
{
+ if (!m_settings_window)
+ {
+ m_settings_window = new SettingsWindow(this);
+ InstallHotkeyFilter(m_settings_window);
+ }
+
m_settings_window->show();
m_settings_window->raise();
m_settings_window->activateWindow();
@@ -927,14 +919,14 @@ void MainWindow::ShowSettingsWindow()
void MainWindow::ShowAudioWindow()
{
- m_settings_window->SelectAudioPane();
ShowSettingsWindow();
+ m_settings_window->SelectAudioPane();
}
void MainWindow::ShowGeneralWindow()
{
- m_settings_window->SelectGeneralPane();
ShowSettingsWindow();
+ m_settings_window->SelectGeneralPane();
}
void MainWindow::ShowAboutDialog()
@@ -956,7 +948,19 @@ void MainWindow::ShowHotkeyDialog()
void MainWindow::ShowGraphicsWindow()
{
- m_graphics_window->Initialize();
+ if (!m_graphics_window)
+ {
+#if defined(HAVE_XRANDR) && HAVE_XRANDR
+ m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(
+ static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
+ "display", windowHandle())),
+ winId());
+ m_graphics_window = new GraphicsWindow(m_xrr_config.get(), this);
+#else
+ m_graphics_window = new GraphicsWindow(nullptr, this);
+#endif
+ }
+
m_graphics_window->show();
m_graphics_window->raise();
m_graphics_window->activateWindow();
@@ -971,6 +975,13 @@ void MainWindow::ShowNetPlaySetupDialog()
void MainWindow::ShowFIFOPlayer()
{
+ if (!m_fifo_window)
+ {
+ m_fifo_window = new FIFOPlayerWindow(this);
+ connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
+ [this](const QString& path) { StartGame(path); });
+ }
+
m_fifo_window->show();
m_fifo_window->raise();
m_fifo_window->activateWindow();