Add Icon to themes + Dark TitleBar (#2611)
* Add Icon to themes * Fix formatting * Dark Titlebar Test * Fix Formatting * Hopefully fixed errors * Test Dark-Mode * Potentially fix issue * Try linking library * Test Dark-Mode (Round 2) * Fix Formatting * Test Dark-Mode (Round 3) * Working Dark Titlebar * Fixed Icon on toolbar * Exclude .vscode/ Directory * Dark Mode Config: Bool -> Int * Made error not sound backwards * Some updates to dark title bar * Fix crash in 32-bit * Get Windows 10 NtBuildNumber from KUSER_SHARED_DATA instead * Add hack that fixed the redrawing issue Co-authored-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>
This commit is contained in:
parent
4feff86822
commit
19069dcff8
|
@ -15,6 +15,7 @@ COV/
|
|||
minidump/
|
||||
CppDependOut/
|
||||
.vs/
|
||||
.vscode/
|
||||
|
||||
# Global filetypes to ignore
|
||||
*.depend
|
||||
|
|
|
@ -236,3 +236,4 @@ ThreadCurrentColor=#FFFFFF
|
|||
WatchTriggeredBackgroundColor=#XXXXXX
|
||||
WatchTriggeredColor=#EF5350
|
||||
LinkColor=#89A2F6
|
||||
DarkTitleBar=1
|
||||
|
|
|
@ -394,6 +394,8 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
mCpuWidget->setDisasmFocus();
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(loadWindowSettings()));
|
||||
|
||||
updateDarkTitleBar();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -518,6 +520,7 @@ void MainWindow::themeTriggeredSlot()
|
|||
QString name = dir.mid(nameIdx + 1);
|
||||
BridgeSettingSet("Theme", "Selected", name.toUtf8().constData());
|
||||
loadSelectedStyle();
|
||||
updateDarkTitleBar();
|
||||
}
|
||||
|
||||
void MainWindow::setupThemesMenu()
|
||||
|
@ -1090,6 +1093,34 @@ void MainWindow::updateWindowTitleSlot(QString filename)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateDarkTitleBar()
|
||||
{
|
||||
// https://www.vergiliusproject.com/kernels/x64/Windows%2010%20%7C%202016/2009%2020H2%20(October%202020%20Update)/_KUSER_SHARED_DATA
|
||||
uint32_t NtBuildNumber = *(uint32_t*)(0x7FFE0000 + 0x260);
|
||||
|
||||
if(NtBuildNumber == 0 /* pre Windows-10 */ || NtBuildNumber < 17763)
|
||||
return;
|
||||
|
||||
duint darkTitleBar = 0;
|
||||
BridgeSettingGetUint("Colors", "DarkTitleBar", &darkTitleBar);
|
||||
|
||||
static auto hdwmapi = LoadLibraryW(L"dwmapi.dll");
|
||||
if(hdwmapi)
|
||||
{
|
||||
typedef int(WINAPI * DWMSETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
static auto DwmSetWindowAttribute = (DWMSETWINDOWATTRIBUTE)GetProcAddress(hdwmapi, "DwmSetWindowAttribute");
|
||||
auto hwnd = (HWND)this->winId();
|
||||
DwmSetWindowAttribute(hwnd, (NtBuildNumber >= 18985) ? 20 : 19, &darkTitleBar, sizeof(uint32_t));
|
||||
|
||||
// HACK: Create a 1x1 pixel frameless window on top of the title bar to force Windows to redraw it
|
||||
auto w = new QWidget(nullptr, Qt::FramelessWindowHint);
|
||||
w->resize(1, 1);
|
||||
w->move(this->pos());
|
||||
w->show();
|
||||
delete w;
|
||||
}
|
||||
}
|
||||
|
||||
// Used by View->CPU
|
||||
void MainWindow::displayCpuWidgetShowCpu()
|
||||
{
|
||||
|
@ -1594,7 +1625,7 @@ void MainWindow::patchWindow()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
{
|
||||
SimpleErrorBox(this, tr("Error!"), tr("Patches cannot be shown when not debugging..."));
|
||||
SimpleErrorBox(this, tr("Error!"), tr("Patches can only be shown while debugging..."));
|
||||
return;
|
||||
}
|
||||
GuiUpdatePatches();
|
||||
|
@ -2330,11 +2361,13 @@ void MainWindow::on_actionDefaultTheme_triggered()
|
|||
// Reset [Colors] to default
|
||||
Config()->Colors = Config()->defaultColors;
|
||||
Config()->writeColors();
|
||||
BridgeSettingSetUint("Colors", "DarkTitleBar", 0);
|
||||
// Reset [Fonts] to default
|
||||
//Config()->Fonts = Config()->defaultFonts;
|
||||
//Config()->writeFonts();
|
||||
// Remove custom colors
|
||||
BridgeSettingSet("Colors", "CustomColorCount", nullptr);
|
||||
updateDarkTitleBar();
|
||||
}
|
||||
|
||||
void MainWindow::updateStyle()
|
||||
|
|
|
@ -196,6 +196,7 @@ private:
|
|||
|
||||
QAction* actionManageFavourites;
|
||||
|
||||
void updateDarkTitleBar();
|
||||
void updateMRUMenu();
|
||||
void setupLanguagesMenu();
|
||||
void setupThemesMenu();
|
||||
|
|
|
@ -176,6 +176,10 @@
|
|||
<property name="title">
|
||||
<string>&Theme</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resource.qrc">
|
||||
<normaloff>:/icons/images/themes.png</normaloff>:/icons/images/themes.png</iconset>
|
||||
</property>
|
||||
<addaction name="actionDefaultTheme"/>
|
||||
</widget>
|
||||
<addaction name="actionSettings"/>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 759 B |
|
@ -265,6 +265,7 @@
|
|||
<file>images/breakpoint_exception_add.png</file>
|
||||
<file>images/breakpoint_module_add.png</file>
|
||||
<file>images/importsettings.png</file>
|
||||
<file>images/themes.png</file>
|
||||
<file>images/initscript.png</file>
|
||||
<file>images/struct.png</file>
|
||||
<file>images/removestruct.png</file>
|
||||
|
|
Loading…
Reference in New Issue