dolphin icon indicating copy to clipboard operation
dolphin copied to clipboard

[WIP] DolphinQt: Add dark theme for Windows

Open AdmiralCurtiss opened this issue 1 year ago • 18 comments

Rebase of #11446 with the user style handling changes removed and Qt embedding added -- that is, this is only adding the dark theme for Windows, none of the other things that PR does.

Open questions:

  • Do we want this theme (which is supposedly based on 'QDarkStyle' but I can't actually find the exact source...?), do we want a different one? Do we want to make a custom one instead?
  • If we take an existing one, how do we ship the license?

I'm kinda leaning towards finding or making a theme that looks closer to how actual Windows apps look in dark mode, but ymmv.

Clipboard023

AdmiralCurtiss avatar Mar 19 '23 04:03 AdmiralCurtiss

I'm kinda leaning towards finding or making a theme that looks closer to how actual Windows apps look in dark mode, but ymmv.

That probably would be best, imo.

MayImilae avatar Mar 19 '23 05:03 MayImilae

I'm not 100% positive, but wouldn't this be fixed by using QT 6.5+?

https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5

cobalt2727 avatar Mar 19 '23 22:03 cobalt2727

Oh, yeah that sure sounds like it! Maybe we should just wait for that then and do a Windows Qt version bump.

(I did definitely search for Qt dark style stuff and all I ever found was 'yeah Qt does not support this on Windows, you have to do it manually'. Oh well.)

AdmiralCurtiss avatar Mar 19 '23 23:03 AdmiralCurtiss

Assuming the screenshot at the OP is up-to-date, the title bars being white are an eye sore. If there's no way of getting dark title bars when using the dark theme, it's probably better to update Qt to 6.5 when available instead of going with this custom dark theme...

mbc07 avatar Mar 20 '23 14:03 mbc07

Assuming there are no minimum OS complications, updating to Qt 6.5+ to let Qt handle it on its own sounds great!

MayImilae avatar Mar 20 '23 14:03 MayImilae

Well Qt 6.5 isn't out yet, planned release at the end of this month. But yeah I agree that it's probably best to wait for that if it will handle it automatically for us.

AdmiralCurtiss avatar Mar 20 '23 14:03 AdmiralCurtiss

Just make sure the version bump is Windows-only, to avoid making things complicated for other older operating systems.

cobalt2727 avatar Mar 20 '23 16:03 cobalt2727

I was planning to update to Qt6.5 once it's released anyway, nice that there will (hopefully) be a noticeable improvement.

shuffle2 avatar Mar 20 '23 22:03 shuffle2

Feel free to use my style sheet https://github.com/EndangeredNayla/Dolphin-Dark-Mode

RainbowTabitha avatar Apr 16 '23 20:04 RainbowTabitha

I built dolphin with Qt 6.5.0 and changed QStyle to "fusion", here's x64 and arm64 binaries to test: https://drive.google.com/file/d/16jd4tzq5zjwBT5kVMzdrvg9tw4Q7uqcy/view?usp=sharing

qt config: https://github.com/dolphin-emu/qsc/commit/48c1704d12f65d9cebb810c4bf08eeffe36b8c46

I'd like to hold off actually updating the Qt binaries in ext-win-qt until msvc ships an update for that recent optimizer bug.

dolphin changes:

diff --git a/Externals/Qt b/Externals/Qt
--- a/Externals/Qt
+++ b/Externals/Qt
@@ -1 +1 @@
-Subproject commit 376baafde6cce2f8892c34c17ed397afa6c46d08
+Subproject commit 376baafde6cce2f8892c34c17ed397afa6c46d08-dirty
diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp
index 4b01bdcc27..03c05a1d6e 100644
--- a/Source/Core/DolphinQt/Main.cpp
+++ b/Source/Core/DolphinQt/Main.cpp
@@ -170,6 +170,8 @@ int main(int argc, char* argv[])
   QApplication app(argc, argv);
 #endif

+  QApplication::setStyle(QStringLiteral("fusion"));
+
 #ifdef _WIN32
   FreeConsole();
 #endif
diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp
index 07391cb65b..1ddac931b1 100644
--- a/Source/Core/DolphinQt/MenuBar.cpp
+++ b/Source/Core/DolphinQt/MenuBar.cpp
@@ -191,7 +191,7 @@ void MenuBar::OnDebugModeToggled(bool enabled)
 void MenuBar::AddFileMenu()
 {
   QMenu* file_menu = addMenu(tr("&File"));
-  m_open_action = file_menu->addAction(tr("&Open..."), this, &MenuBar::Open, QKeySequence::Open);
+  m_open_action = file_menu->addAction(tr("&Open..."), QKeySequence::Open, this, &MenuBar::Open);

   file_menu->addSeparator();

@@ -501,14 +501,14 @@ void MenuBar::AddViewMenu()
   connect(&Settings::Instance(), &Settings::GameListRefreshStarted, purge_action,
           [purge_action] { purge_action->setEnabled(true); });
   view_menu->addSeparator();
-  view_menu->addAction(tr("Search"), this, &MenuBar::ShowSearch, QKeySequence::Find);
+  view_menu->addAction(tr("Search"), QKeySequence::Find, this, &MenuBar::ShowSearch);
 }

 void MenuBar::AddOptionsMenu()
 {
   QMenu* options_menu = addMenu(tr("&Options"));
-  options_menu->addAction(tr("Co&nfiguration"), this, &MenuBar::Configure,
-                          QKeySequence::Preferences);
+  options_menu->addAction(tr("Co&nfiguration"), QKeySequence::Preferences, this,
+                          &MenuBar::Configure);
   options_menu->addSeparator();
   options_menu->addAction(tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
   options_menu->addAction(tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
diff --git a/Source/VSProps/QtCompile.props b/Source/VSProps/QtCompile.props
index c159b823e2..6c9f3b719d 100644
--- a/Source/VSProps/QtCompile.props
+++ b/Source/VSProps/QtCompile.props
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project>
   <PropertyGroup Label="UserMacros">
-    <ExternalsQtDir>$(ExternalsDir)Qt\Qt6.3.0\</ExternalsQtDir>
+    <ExternalsQtDir>$(ExternalsDir)Qt\Qt6.5.0\</ExternalsQtDir>
     <QtTargetDirDefault>$(ExternalsQtDir)$(Platform)\</QtTargetDirDefault>
     <QTDIR Condition="Exists('$(QtTargetDirDefault)') And ('$(QTDIR)'=='' Or !Exists('$(QTDIR)'))">$(QtTargetDirDefault)</QTDIR>
     <QTDIR Condition="Exists('$(QTDIR)') And !HasTrailingSlash('$(QTDIR)')">$(QTDIR)\</QTDIR>

shuffle2 avatar Apr 19 '23 07:04 shuffle2

I built dolphin with Qt 6.5.0 and changed QStyle to "fusion", here's x64 and arm64 binaries to test: https://drive.google.com/file/d/16jd4tzq5zjwBT5kVMzdrvg9tw4Q7uqcy/view?usp=sharing

Just tested it. The good news is that it works, the bad news is that it results in some weirdness (both on light and dark modes). For reference, I tested this on Windows 11 and my accent color is currently purple/pink-ish.

  • Light theme applies the accent color in some places (e.g. sliders and buttons) but not others (e.g. checkboxes). Tabs also look a bit off compared to master: light0 light1

  • Dark theme applies the accent color in more places, but also looks more off with our default "Clean" theme. Tabs also have a gray-ish look that is weird: dark0 dark1

  • If you change between light/dark mode on Windows or change the accent color while Dolphin is already open, parts of the GUI fail to update and get stuck in their previous state (screenshots shows the result of a light => dark transition, but the same happens the other way around): mismatch0 mismatch1

So yeah, it needs some work. While the idea of applying the Windows accent color is nice, perhaps we should disable it somehow, or default to a Dolphin-specific theme (blue?). I also didn't expect Dolphin to become aware of runtime theme changes out of the box with just a Qt version bump (you normally need to write code for that), but it did and seems to need some fixes...

mbc07 avatar Apr 19 '23 07:04 mbc07

  1. Yes, it is a different style so those differences are expected. It is no longer made to look like windows vista or any version of windows, rather is some qt creation (note any dark theme will have this problem).
  2. Personally I like the system-controlled accents and think it is more in line with the goal than having them controlled by the app. I don’t know if it’s changeable. Not sure if the difference in accented elements between light/dark is intended. It might be nice to embrace the accent even more and have it control the icon color automatically as well.
  3. I noticed the dynamic change bug as well. I assume this is just a bug in dolphin but haven’t looked into it.

shuffle2 avatar Apr 19 '23 08:04 shuffle2

What is the status on this? Stuck in eternal review hell? :p

FearlessTobi avatar May 31 '23 21:05 FearlessTobi

We recently updated to Qt 6.5, which has native support for a dark mode, but not with the Qt's Vista style (the default on Windows). There's another PR for changing the default style on Windows to Qt's Fusion, which has a dark mode, and this PR will likely get closed when that one gets merged.

If you don't want to wait for the PR, you can already launch Dolphin with the -style fusion CLI parameter to use the dark theme (it'll follow the system settings)...

mbc07 avatar May 31 '23 22:05 mbc07

link to the PR?

cobalt2727 avatar Jun 03 '23 19:06 cobalt2727

https://github.com/dolphin-emu/dolphin/pull/11789

It's not exactly 'review hell' and more of a general unsureness about what we should do here. I was originally under the impression that updating to Qt6.5 would just work with the existing style, but evidently that is not the case. I'm also not a fan of the fusion style either.

AdmiralCurtiss avatar Jun 06 '23 16:06 AdmiralCurtiss

Hm, i would call that review hell: the work is done and the feature works fine. I didn't realize it just wasn't being merged because you don't like the theme...

shuffle2 avatar Jun 06 '23 18:06 shuffle2

Only because a feature 'works fine' doesn't mean that we actually want it, especially if it's a change that is mainly aesthetics and affects about half of our userbase.

AdmiralCurtiss avatar Jun 06 '23 18:06 AdmiralCurtiss