diff options
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/MainWindow.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 42a6a04603..67d4ac46bb 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -108,6 +108,7 @@ #include "DolphinQt/QtUtils/ParallelProgressDialog.h" #include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/RunOnObject.h" +#include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "DolphinQt/QtUtils/WindowActivationEventFilter.h" #include "DolphinQt/RenderWidget.h" #include "DolphinQt/ResourcePackManager.h" @@ -1225,6 +1226,7 @@ void MainWindow::ShowControllersWindow() InstallHotkeyFilter(m_controllers_window); } + SetQWidgetWindowDecorations(m_controllers_window); m_controllers_window->show(); m_controllers_window->raise(); m_controllers_window->activateWindow(); @@ -1238,6 +1240,7 @@ void MainWindow::ShowFreeLookWindow() InstallHotkeyFilter(m_freelook_window); } + SetQWidgetWindowDecorations(m_freelook_window); m_freelook_window->show(); m_freelook_window->raise(); m_freelook_window->activateWindow(); @@ -1251,6 +1254,7 @@ void MainWindow::ShowSettingsWindow() InstallHotkeyFilter(m_settings_window); } + SetQWidgetWindowDecorations(m_settings_window); m_settings_window->show(); m_settings_window->raise(); m_settings_window->activateWindow(); @@ -1271,6 +1275,7 @@ void MainWindow::ShowGeneralWindow() void MainWindow::ShowAboutDialog() { AboutDialog about{this}; + SetQWidgetWindowDecorations(&about); about.exec(); } @@ -1282,6 +1287,7 @@ void MainWindow::ShowHotkeyDialog() InstallHotkeyFilter(m_hotkey_window); } + SetQWidgetWindowDecorations(m_hotkey_window); m_hotkey_window->show(); m_hotkey_window->raise(); m_hotkey_window->activateWindow(); @@ -1304,6 +1310,7 @@ void MainWindow::ShowGraphicsWindow() InstallHotkeyFilter(m_graphics_window); } + SetQWidgetWindowDecorations(m_graphics_window); m_graphics_window->show(); m_graphics_window->raise(); m_graphics_window->activateWindow(); @@ -1311,6 +1318,7 @@ void MainWindow::ShowGraphicsWindow() void MainWindow::ShowNetPlaySetupDialog() { + SetQWidgetWindowDecorations(m_netplay_setup_dialog); m_netplay_setup_dialog->show(); m_netplay_setup_dialog->raise(); m_netplay_setup_dialog->activateWindow(); @@ -1321,6 +1329,7 @@ void MainWindow::ShowNetPlayBrowser() auto* browser = new NetPlayBrowser(this); browser->setAttribute(Qt::WA_DeleteOnClose, true); connect(browser, &NetPlayBrowser::Join, this, &MainWindow::NetPlayJoin); + SetQWidgetWindowDecorations(browser); browser->exec(); } @@ -1333,6 +1342,7 @@ void MainWindow::ShowFIFOPlayer() [this](const QString& path) { StartGame(path, ScanForSecondDisc::No); }); } + SetQWidgetWindowDecorations(m_fifo_window); m_fifo_window->show(); m_fifo_window->raise(); m_fifo_window->activateWindow(); @@ -1345,6 +1355,7 @@ void MainWindow::ShowSkylanderPortal() m_skylander_window = new SkylanderPortalWindow(); } + SetQWidgetWindowDecorations(m_skylander_window); m_skylander_window->show(); m_skylander_window->raise(); m_skylander_window->activateWindow(); @@ -1357,6 +1368,7 @@ void MainWindow::ShowInfinityBase() m_infinity_window = new InfinityBaseWindow(); } + SetQWidgetWindowDecorations(m_infinity_window); m_infinity_window->show(); m_infinity_window->raise(); m_infinity_window->activateWindow(); @@ -1703,6 +1715,36 @@ QSize MainWindow::sizeHint() const return QSize(800, 600); } +#ifdef _WIN32 +bool MainWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) +{ + auto* msg = reinterpret_cast<MSG*>(message); + if (msg && msg->message == WM_SETTINGCHANGE && msg->lParam != NULL && + std::wstring_view(L"ImmersiveColorSet") + .compare(reinterpret_cast<const wchar_t*>(msg->lParam)) == 0) + { + // Windows light/dark theme has changed. Update our flag and refresh the theme. + auto& settings = Settings::Instance(); + const bool was_dark_before = settings.IsSystemDark(); + settings.UpdateSystemDark(); + if (settings.IsSystemDark() != was_dark_before) + { + settings.SetCurrentUserStyle(settings.GetCurrentUserStyle()); + + // force the colors in the Skylander window to update + if (m_skylander_window) + m_skylander_window->RefreshList(); + } + + // TODO: When switching from light to dark, the window decorations remain light. Qt seems very + // convinced that it needs to change these in response to this message, so even if we set them + // to dark here, Qt sets them back to light afterwards. + } + + return false; +} +#endif + void MainWindow::OnBootGameCubeIPL(DiscIO::Region region) { StartGame(std::make_unique<BootParameters>(BootParameters::IPL{region})); @@ -1759,6 +1801,7 @@ void MainWindow::OnImportNANDBackup() dialog.Reset(); }); + SetQWidgetWindowDecorations(dialog.GetRaw()); dialog.GetRaw()->exec(); result.wait(); @@ -1866,6 +1909,7 @@ void MainWindow::ShowTASInput() const auto si_device = Config::Get(Config::GetInfoForSIDevice(i)); if (si_device == SerialInterface::SIDEVICE_GC_GBA_EMULATED) { + SetQWidgetWindowDecorations(m_gba_tas_input_windows[i]); m_gba_tas_input_windows[i]->show(); m_gba_tas_input_windows[i]->raise(); m_gba_tas_input_windows[i]->activateWindow(); @@ -1873,6 +1917,7 @@ void MainWindow::ShowTASInput() else if (si_device != SerialInterface::SIDEVICE_NONE && si_device != SerialInterface::SIDEVICE_GC_GBA) { + SetQWidgetWindowDecorations(m_gc_tas_input_windows[i]); m_gc_tas_input_windows[i]->show(); m_gc_tas_input_windows[i]->raise(); m_gc_tas_input_windows[i]->activateWindow(); @@ -1884,6 +1929,7 @@ void MainWindow::ShowTASInput() if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated && (!Core::IsRunning() || SConfig::GetInstance().bWii)) { + SetQWidgetWindowDecorations(m_wii_tas_input_windows[i]); m_wii_tas_input_windows[i]->show(); m_wii_tas_input_windows[i]->raise(); m_wii_tas_input_windows[i]->activateWindow(); @@ -1910,6 +1956,7 @@ void MainWindow::ShowAchievementsWindow() m_achievements_window = new AchievementsWindow(this); } + SetQWidgetWindowDecorations(m_achievements_window); m_achievements_window->show(); m_achievements_window->raise(); m_achievements_window->activateWindow(); @@ -1920,6 +1967,7 @@ void MainWindow::ShowMemcardManager() { GCMemcardManager manager(this); + SetQWidgetWindowDecorations(&manager); manager.exec(); } @@ -1927,11 +1975,13 @@ void MainWindow::ShowResourcePackManager() { ResourcePackManager manager(this); + SetQWidgetWindowDecorations(&manager); manager.exec(); } void MainWindow::ShowCheatsManager() { + SetQWidgetWindowDecorations(m_cheats_manager); m_cheats_manager->show(); } @@ -1950,6 +2000,7 @@ void MainWindow::ShowRiivolutionBootWidget(const UICommon::GameFile& game) auto& disc = std::get<BootParameters::Disc>(boot_params->parameters); RiivolutionBootWidget w(disc.volume->GetGameID(), disc.volume->GetRevision(), disc.volume->GetDiscNumber(), game.GetFilePath(), this); + SetQWidgetWindowDecorations(&w); w.exec(); if (!w.ShouldBoot()) return; @@ -1961,7 +2012,10 @@ void MainWindow::ShowRiivolutionBootWidget(const UICommon::GameFile& game) void MainWindow::Show() { if (!Settings::Instance().IsBatchModeEnabled()) + { + SetQWidgetWindowDecorations(this); QWidget::show(); + } // If the booting of a game was requested on start up, do that now if (m_pending_boot != nullptr) |
