Merge pull request #12080 from AdmiralCurtiss/windark

Add custom dark theme for Windows.
This commit is contained in:
Admiral H. Curtiss
2023-08-12 20:04:03 +02:00
committed by GitHub
86 changed files with 1696 additions and 131 deletions
+10
View File
@@ -12,6 +12,7 @@ if (MSVC)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg)
message(STATUS "Found Qt version ${Qt6_VERSION}")
@@ -293,6 +294,8 @@ add_executable(dolphin-emu
QtUtils/ParallelProgressDialog.h
QtUtils/PartiallyClosableTabWidget.cpp
QtUtils/PartiallyClosableTabWidget.h
QtUtils/SetWindowDecorations.cpp
QtUtils/SetWindowDecorations.h
QtUtils/SignalBlocking.h
QtUtils/UTF8CodePointCountValidator.cpp
QtUtils/UTF8CodePointCountValidator.h
@@ -362,6 +365,12 @@ add_executable(dolphin-emu
WiiUpdate.h
)
if (WIN32)
target_sources(dolphin-emu PRIVATE
Styles/Dark/dark.qrc
)
endif()
if (NOT WIN32)
target_sources(dolphin-emu PRIVATE
QtUtils/SignalDaemon.cpp
@@ -396,6 +405,7 @@ if (WIN32)
PRIVATE
gdi32.lib
shell32.lib
dwmapi.lib # Needed to set window decorations for dark theme
)
endif()
@@ -22,6 +22,7 @@
#include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "UICommon/GameFile.h"
@@ -230,6 +231,7 @@ void ARCodeWidget::OnCodeAddClicked()
CheatCodeEditor ed(this);
ed.SetARCode(&ar);
SetQWidgetWindowDecorations(&ed);
if (ed.exec() == QDialog::Rejected)
return;
@@ -253,6 +255,7 @@ void ARCodeWidget::OnCodeEditClicked()
{
ed.SetARCode(&current_ar);
SetQWidgetWindowDecorations(&ed);
if (ed.exec() == QDialog::Rejected)
return;
}
@@ -261,6 +264,7 @@ void ARCodeWidget::OnCodeEditClicked()
ActionReplay::ARCode ar = current_ar;
ed.SetARCode(&ar);
SetQWidgetWindowDecorations(&ed);
if (ed.exec() == QDialog::Rejected)
return;
@@ -13,6 +13,7 @@
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h"
@@ -59,6 +60,7 @@ void CommonControllersWidget::OnControllerInterfaceConfigure()
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
}
@@ -14,6 +14,7 @@
#include "Common/Config/Config.h"
#include "DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.h"
DualShockUDPClientWidget::DualShockUDPClientWidget()
@@ -111,6 +112,7 @@ void DualShockUDPClientWidget::OnServerAdded()
DualShockUDPClientAddServerDialog add_server_dialog(this);
connect(&add_server_dialog, &DualShockUDPClientAddServerDialog::accepted, this,
&DualShockUDPClientWidget::RefreshServerList);
SetQWidgetWindowDecorations(&add_server_dialog);
add_server_dialog.exec();
}
@@ -25,6 +25,7 @@
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Resources.h"
#include "UICommon/UICommon.h"
@@ -364,6 +365,7 @@ void FilesystemWidget::ExtractDirectory(const DiscIO::Partition& partition, cons
dialog.Reset();
});
SetQWidgetWindowDecorations(dialog.GetRaw());
dialog.GetRaw()->exec();
future.get();
}
@@ -17,6 +17,7 @@
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Settings.h"
FreeLookWidget::FreeLookWidget(QWidget* parent) : QWidget(parent)
@@ -97,6 +98,7 @@ void FreeLookWidget::OnFreeLookControllerConfigured()
MappingWindow* window = new MappingWindow(this, MappingWindow::Type::MAPPING_FREELOOK, index);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
}
@@ -3,6 +3,11 @@
#include "DolphinQt/Config/GameConfigHighlighter.h"
#include <QBrush>
#include <QColor>
#include "DolphinQt/Settings.h"
struct HighlightingRule
{
QRegularExpression pattern;
@@ -13,22 +18,36 @@ GameConfigHighlighter::~GameConfigHighlighter() = default;
GameConfigHighlighter::GameConfigHighlighter(QTextDocument* parent) : QSyntaxHighlighter(parent)
{
const bool is_dark_theme = Settings::Instance().IsThemeDark();
QTextCharFormat equal_format;
equal_format.setForeground(Qt::red);
if (is_dark_theme)
equal_format.setForeground(QBrush{QColor(255, 96, 96)});
else
equal_format.setForeground(Qt::red);
QTextCharFormat section_format;
section_format.setFontWeight(QFont::Bold);
QTextCharFormat comment_format;
comment_format.setForeground(Qt::darkGreen);
if (is_dark_theme)
comment_format.setForeground(QBrush{QColor(0, 220, 0)});
else
comment_format.setForeground(Qt::darkGreen);
comment_format.setFontItalic(true);
QTextCharFormat const_format;
const_format.setFontWeight(QFont::Bold);
const_format.setForeground(Qt::blue);
if (is_dark_theme)
const_format.setForeground(QBrush{QColor(132, 132, 255)});
else
const_format.setForeground(Qt::blue);
QTextCharFormat num_format;
num_format.setForeground(Qt::darkBlue);
if (is_dark_theme)
num_format.setForeground(QBrush{QColor(66, 138, 255)});
else
num_format.setForeground(Qt::darkBlue);
m_rules.emplace_back(HighlightingRule{QRegularExpression(QStringLiteral("=")), equal_format});
m_rules.emplace_back(
@@ -24,6 +24,7 @@
#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h"
@@ -137,8 +138,12 @@ void GamecubeControllersWidget::OnGCPadConfigure(size_t index)
type = MappingWindow::Type::MAPPING_GCPAD;
break;
case SerialInterface::SIDEVICE_WIIU_ADAPTER:
GCPadWiiUConfigDialog(static_cast<int>(index), this).exec();
{
GCPadWiiUConfigDialog dialog(static_cast<int>(index), this);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
return;
}
case SerialInterface::SIDEVICE_GC_STEERING:
type = MappingWindow::Type::MAPPING_GC_STEERINGWHEEL;
break;
@@ -161,6 +166,7 @@ void GamecubeControllersWidget::OnGCPadConfigure(size_t index)
MappingWindow* window = new MappingWindow(this, type, static_cast<int>(index));
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
}
@@ -28,6 +28,7 @@
#include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "UICommon/GameFile.h"
@@ -201,6 +202,7 @@ void GeckoCodeWidget::AddCode()
CheatCodeEditor ed(this);
ed.SetGeckoCode(&code);
SetQWidgetWindowDecorations(&ed);
if (ed.exec() == QDialog::Rejected)
return;
@@ -219,6 +221,7 @@ void GeckoCodeWidget::EditCode()
CheatCodeEditor ed(this);
ed.SetGeckoCode(&m_gecko_codes[index]);
SetQWidgetWindowDecorations(&ed);
if (ed.exec() == QDialog::Rejected)
return;
@@ -22,6 +22,7 @@
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/Graphics/PostProcessingConfigWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Settings.h"
#include "VideoCommon/PostProcessing.h"
@@ -570,11 +571,15 @@ void EnhancementsWidget::AddDescriptions()
void EnhancementsWidget::ConfigureColorCorrection()
{
ColorCorrectionConfigWindow(this).exec();
ColorCorrectionConfigWindow dialog(this);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
}
void EnhancementsWidget::ConfigurePostProcessingShader()
{
const std::string shader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
PostProcessingConfigWindow(this, shader).exec();
PostProcessingConfigWindow dialog(this, shader);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
}
@@ -24,6 +24,7 @@
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Settings.h"
#include "VideoCommon/VideoBackendBase.h"
@@ -164,6 +165,7 @@ void GeneralWidget::SaveSettings()
confirm_sw.setWindowTitle(tr("Confirm backend change"));
confirm_sw.setText(tr(warningMessage->c_str()));
SetQWidgetWindowDecorations(&confirm_sw);
if (confirm_sw.exec() != QMessageBox::Yes)
{
m_backend_combo->setCurrentIndex(m_backend_combo->findData(
@@ -11,6 +11,7 @@
#include "Core/FreeLookManager.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/InputConfig.h"
FreeLookRotation::FreeLookRotation(MappingWindow* window) : MappingWidget(window)
@@ -33,6 +34,7 @@ void FreeLookRotation::CreateMainLayout()
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
});
m_main_layout->addLayout(alternate_input_layout, 0, 0, 1, -1);
@@ -6,6 +6,8 @@
#include <optional>
#include <thread>
#include <QBrush>
#include <QColor>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QHeaderView>
@@ -38,7 +40,6 @@
namespace
{
// TODO: Make sure these functions return colors that will be visible in the current theme.
QTextCharFormat GetSpecialCharFormat()
{
QTextCharFormat format;
@@ -49,7 +50,10 @@ QTextCharFormat GetSpecialCharFormat()
QTextCharFormat GetLiteralCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkMagenta});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(171, 132, 219)});
else
format.setForeground(QBrush{Qt::darkMagenta});
return format;
}
@@ -57,35 +61,50 @@ QTextCharFormat GetInvalidCharFormat()
{
QTextCharFormat format;
format.setUnderlineStyle(QTextCharFormat::WaveUnderline);
format.setUnderlineColor(Qt::darkRed);
if (Settings::Instance().IsThemeDark())
format.setUnderlineColor(QColor(255, 69, 0));
else
format.setUnderlineColor(Qt::darkRed);
return format;
}
QTextCharFormat GetControlCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkGreen});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(0, 220, 0)});
else
format.setForeground(QBrush{Qt::darkGreen});
return format;
}
QTextCharFormat GetVariableCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkYellow});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(226, 226, 0)});
else
format.setForeground(QBrush{Qt::darkYellow});
return format;
}
QTextCharFormat GetBarewordCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkBlue});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(66, 138, 255)});
else
format.setForeground(QBrush{Qt::darkBlue});
return format;
}
QTextCharFormat GetCommentCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkGray});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(176, 176, 176)});
else
format.setForeground(QBrush{Qt::darkGray});
return format;
}
} // namespace
@@ -12,6 +12,7 @@
#include "DolphinQt/Config/Mapping/MappingCommon.h"
#include "DolphinQt/Config/Mapping/MappingWidget.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/ControlReference/ControlReference.h"
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
@@ -97,6 +98,7 @@ void MappingButton::AdvancedPressed()
{
IOWindow io(m_parent, m_parent->GetController(), m_reference,
m_reference->IsInput() ? IOWindow::Type::Input : IOWindow::Type::Output);
SetQWidgetWindowDecorations(&io);
io.exec();
ConfigChanged();
@@ -16,6 +16,7 @@
#include "DolphinQt/Config/Mapping/MappingIndicator.h"
#include "DolphinQt/Config/Mapping/MappingNumeric.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/ControlReference/ControlReference.h"
#include "InputCommon/ControllerEmu/Control/Control.h"
@@ -248,6 +249,7 @@ void MappingWidget::ShowAdvancedControlGroupDialog(ControllerEmu::ControlGroup*
// Enable "Close" button functionality.
connect(button_box, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
}
@@ -303,6 +305,7 @@ MappingWidget::CreateSettingAdvancedMappingButton(ControllerEmu::NumericSettingB
setting.SetExpressionFromValue();
IOWindow io(this, GetController(), &setting.GetInputReference(), IOWindow::Type::Input);
SetQWidgetWindowDecorations(&io);
io.exec();
setting.SimplifyIfPossible();
@@ -49,6 +49,7 @@
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
#include "DolphinQt/Settings.h"
@@ -255,6 +256,7 @@ void MappingWindow::OnDeleteProfilePressed()
error.setIcon(QMessageBox::Critical);
error.setWindowTitle(tr("Error"));
error.setText(tr("The profile '%1' does not exist").arg(profile_name));
SetQWidgetWindowDecorations(&error);
error.exec();
return;
}
@@ -267,6 +269,7 @@ void MappingWindow::OnDeleteProfilePressed()
confirm.setInformativeText(tr("This cannot be undone!"));
confirm.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
SetQWidgetWindowDecorations(&confirm);
if (confirm.exec() != QMessageBox::Yes)
{
return;
@@ -294,6 +297,7 @@ void MappingWindow::OnLoadProfilePressed()
error.setIcon(QMessageBox::Critical);
error.setWindowTitle(tr("Error"));
error.setText(tr("The profile '%1' does not exist").arg(m_profiles_combo->currentText()));
SetQWidgetWindowDecorations(&error);
error.exec();
return;
}
@@ -14,6 +14,7 @@
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/InputConfig.h"
@@ -42,6 +43,7 @@ void WiimoteEmuExtensionMotionInput::CreateNunchukLayout()
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
});
layout->addLayout(warning_layout, 0, 0, 1, -1);
@@ -15,6 +15,7 @@
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "InputCommon/InputConfig.h"
@@ -40,6 +41,7 @@ void WiimoteEmuMotionControlIMU::CreateMainLayout()
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
SetQWidgetWindowDecorations(window);
window->show();
});
+15 -2
View File
@@ -15,6 +15,7 @@
#include "Core/PatchEngine.h"
#include "DolphinQt/Config/NewPatchDialog.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "UICommon/GameFile.h"
@@ -74,7 +75,13 @@ void PatchesWidget::OnAdd()
PatchEngine::Patch patch;
patch.user_defined = true;
if (NewPatchDialog(this, patch).exec())
bool new_patch_confirmed = false;
{
NewPatchDialog dialog(this, patch);
SetQWidgetWindowDecorations(&dialog);
new_patch_confirmed = dialog.exec();
}
if (new_patch_confirmed)
{
m_patches.push_back(patch);
SavePatches();
@@ -98,7 +105,13 @@ void PatchesWidget::OnEdit()
patch.name = tr("%1 (Copy)").arg(QString::fromStdString(patch.name)).toStdString();
}
if (NewPatchDialog(this, patch).exec())
bool new_patch_confirmed = false;
{
NewPatchDialog dialog(this, patch);
SetQWidgetWindowDecorations(&dialog);
new_patch_confirmed = dialog.exec();
}
if (new_patch_confirmed)
{
if (patch.user_defined)
{
@@ -20,6 +20,7 @@
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeVerifier.h"
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
#include "DolphinQt/Settings.h"
VerifyWidget::VerifyWidget(std::shared_ptr<DiscIO::Volume> volume) : m_volume(std::move(volume))
@@ -180,6 +181,7 @@ void VerifyWidget::Verify()
return result;
});
SetQWidgetWindowDecorations(progress.GetRaw());
progress.GetRaw()->exec();
std::optional<DiscIO::VolumeVerifier::Result> result = future.get();

Some files were not shown because too many files have changed in this diff Show More