GUI: working style selection
3
.gitignore
vendored
@ -24,7 +24,6 @@ CppDependOut/
|
||||
*.bmarks
|
||||
*.chw
|
||||
*.cbTemp
|
||||
*.ini
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
@ -73,9 +72,11 @@ src/build-*/
|
||||
!/hooks/AStyleHelper.exe
|
||||
!/hooks/AStyle.dll
|
||||
!/bin/x64dbg_shell_remove.reg
|
||||
!/bin/themes/
|
||||
!*.lib
|
||||
.scannerwork/
|
||||
bw-output/
|
||||
build-wrapper*
|
||||
My Amplifier Results - */
|
||||
My Inspector Results - */
|
||||
/bin/x96dbg.ini
|
||||
|
BIN
bin/themes/Dark/rc/Hmovetoolbar.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
bin/themes/Dark/rc/Hsepartoolbar.png
Normal file
After Width: | Height: | Size: 172 B |
BIN
bin/themes/Dark/rc/Vmovetoolbar.png
Normal file
After Width: | Height: | Size: 228 B |
BIN
bin/themes/Dark/rc/Vsepartoolbar.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
bin/themes/Dark/rc/branch_closed-on.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
bin/themes/Dark/rc/branch_closed.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
bin/themes/Dark/rc/branch_open-on.png
Normal file
After Width: | Height: | Size: 150 B |
BIN
bin/themes/Dark/rc/branch_open.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
bin/themes/Dark/rc/checkbox_checked.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
bin/themes/Dark/rc/checkbox_checked_disabled.png
Normal file
After Width: | Height: | Size: 491 B |
BIN
bin/themes/Dark/rc/checkbox_checked_focus.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
bin/themes/Dark/rc/checkbox_indeterminate.png
Normal file
After Width: | Height: | Size: 493 B |
BIN
bin/themes/Dark/rc/checkbox_indeterminate_disabled.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
bin/themes/Dark/rc/checkbox_indeterminate_focus.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
bin/themes/Dark/rc/checkbox_unchecked.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
bin/themes/Dark/rc/checkbox_unchecked_disabled.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
bin/themes/Dark/rc/checkbox_unchecked_focus.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
bin/themes/Dark/rc/close-hover.png
Normal file
After Width: | Height: | Size: 598 B |
BIN
bin/themes/Dark/rc/close-pressed.png
Normal file
After Width: | Height: | Size: 598 B |
BIN
bin/themes/Dark/rc/close.png
Normal file
After Width: | Height: | Size: 586 B |
BIN
bin/themes/Dark/rc/down_arrow.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
bin/themes/Dark/rc/down_arrow_disabled.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
bin/themes/Dark/rc/left_arrow.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
bin/themes/Dark/rc/left_arrow_disabled.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
bin/themes/Dark/rc/radio_checked.png
Normal file
After Width: | Height: | Size: 940 B |
BIN
bin/themes/Dark/rc/radio_checked_disabled.png
Normal file
After Width: | Height: | Size: 972 B |
BIN
bin/themes/Dark/rc/radio_checked_focus.png
Normal file
After Width: | Height: | Size: 846 B |
BIN
bin/themes/Dark/rc/radio_unchecked.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
bin/themes/Dark/rc/radio_unchecked_disabled.png
Normal file
After Width: | Height: | Size: 760 B |
BIN
bin/themes/Dark/rc/radio_unchecked_focus.png
Normal file
After Width: | Height: | Size: 646 B |
BIN
bin/themes/Dark/rc/right_arrow.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
bin/themes/Dark/rc/right_arrow_disabled.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
bin/themes/Dark/rc/sizegrip.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
bin/themes/Dark/rc/stylesheet-branch-end.png
Normal file
After Width: | Height: | Size: 224 B |
BIN
bin/themes/Dark/rc/stylesheet-branch-more.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
bin/themes/Dark/rc/stylesheet-vline.png
Normal file
After Width: | Height: | Size: 239 B |
BIN
bin/themes/Dark/rc/transparent.png
Normal file
After Width: | Height: | Size: 195 B |
BIN
bin/themes/Dark/rc/undock.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
bin/themes/Dark/rc/up_arrow.png
Normal file
After Width: | Height: | Size: 158 B |
BIN
bin/themes/Dark/rc/up_arrow_disabled.png
Normal file
After Width: | Height: | Size: 159 B |
1050
bin/themes/Dark/style.css
Normal file
246
bin/themes/Dark/style.ini
Normal file
@ -0,0 +1,246 @@
|
||||
[Color]
|
||||
CustomColor0=#EEFF99
|
||||
CustomColor1=#55AAFF
|
||||
CustomColor10=#FFFFFF
|
||||
CustomColor11=#FFFFFF
|
||||
CustomColor12=#FFFFFF
|
||||
CustomColor13=#FFFFFF
|
||||
CustomColor14=#FFFFFF
|
||||
CustomColor15=#FFFFFF
|
||||
CustomColor2=#55FFFF
|
||||
CustomColor3=#00AAFF
|
||||
CustomColor4=#FF55FF
|
||||
CustomColor5=#C8FF4F
|
||||
CustomColor6=#FFFFFF
|
||||
CustomColor7=#FFFFFF
|
||||
CustomColor8=#FFFFFF
|
||||
CustomColor9=#FFFFFF
|
||||
CustomColorCount=10
|
||||
|
||||
[Colors]
|
||||
AbstractTableViewBackgroundColor=#212121
|
||||
AbstractTableViewHeaderTextColor=#E0E0E0
|
||||
AbstractTableViewSelectionColor=#414141
|
||||
AbstractTableViewSeparatorColor=#717171
|
||||
AbstractTableViewTextColor=#E0E0E0
|
||||
BreakpointSummaryKeywordColor=#89A2F6
|
||||
BreakpointSummaryParenColor=#E0E0E0
|
||||
BreakpointSummaryStringColor=#B794F6
|
||||
DisassemblyAddressBackgroundColor=#XXXXXX
|
||||
DisassemblyAddressColor=#A0A0A0
|
||||
DisassemblyAutoCommentBackgroundColor=#XXXXXX
|
||||
DisassemblyAutoCommentColor=#A0A0A0
|
||||
DisassemblyBackgroundColor=#212121
|
||||
DisassemblyBookmarkBackgroundColor=#E6E976
|
||||
DisassemblyBookmarkColor=#212121
|
||||
DisassemblyBreakpointBackgroundColor=#EF5350
|
||||
DisassemblyBreakpointColor=#000000
|
||||
DisassemblyByte00BackgroundColor=#XXXXXX
|
||||
DisassemblyByte00Color=#E0E0E0
|
||||
DisassemblyByte7FBackgroundColor=#XXXXXX
|
||||
DisassemblyByte7FColor=#E0E0E0
|
||||
DisassemblyByteFFBackgroundColor=#XXXXXX
|
||||
DisassemblyByteFFColor=#E0E0E0
|
||||
DisassemblyByteIsPrintBackgroundColor=#XXXXXX
|
||||
DisassemblyByteIsPrintColor=#E0E0E0
|
||||
DisassemblyBytesBackgroundColor=#XXXXXX
|
||||
DisassemblyBytesColor=#E0E0E0
|
||||
DisassemblyCipBackgroundColor=#93EE62
|
||||
DisassemblyCipColor=#000000
|
||||
DisassemblyCommentBackgroundColor=#XXXXXX
|
||||
DisassemblyCommentColor=#E0E0E0
|
||||
DisassemblyConditionalJumpLineFalseColor=#808080
|
||||
DisassemblyConditionalJumpLineTrueColor=#AA0000
|
||||
DisassemblyFunctionColor=#F88478
|
||||
DisassemblyHardwareBreakpointBackgroundColor=#XXXXXX
|
||||
DisassemblyHardwareBreakpointColor=#E6E976
|
||||
DisassemblyLabelBackgroundColor=#XXXXXX
|
||||
DisassemblyLabelColor=#B794F6
|
||||
DisassemblyLoopColor=#F88478
|
||||
DisassemblyMnemonicBriefBackgroundColor=#XXXXXX
|
||||
DisassemblyMnemonicBriefColor=#A0A0A0
|
||||
DisassemblyModifiedBytesBackgroundColor=#XXXXXX
|
||||
DisassemblyModifiedBytesColor=#EF5350
|
||||
DisassemblyRelocationUnderlineColor=#EF5350
|
||||
DisassemblyRestoredBytesBackgroundColor=#XXXXXX
|
||||
DisassemblyRestoredBytesColor=#B3F575
|
||||
DisassemblySelectedAddressBackgroundColor=#XXXXXX
|
||||
DisassemblySelectedAddressColor=#E0E0E0
|
||||
DisassemblySelectionColor=#414141
|
||||
DisassemblyTracedBackgroundColor=#2C2C38
|
||||
DisassemblyUnconditionalJumpLineColor=#A0A0A0
|
||||
GraphBackgroundColor=#212121
|
||||
GraphBreakpointColor=#EF5350
|
||||
GraphBrfalseColor=#EF5350
|
||||
GraphBrtrueColor=#B3F575
|
||||
GraphCipColor=#A6F93E
|
||||
GraphCurrentShadowColor=#414141
|
||||
GraphDisabledBreakpointColor=#C54441
|
||||
GraphIndirectcallShadowColor=#F55F86
|
||||
GraphJmpColor=#A0A0A0
|
||||
GraphNodeBackgroundColor=#XXXXXX
|
||||
GraphNodeColor=#111111
|
||||
GraphRetShadowColor=#F88478
|
||||
HexDumpAddressBackgroundColor=#XXXXXX
|
||||
HexDumpAddressColor=#A0A0A0
|
||||
HexDumpBackgroundColor=#212121
|
||||
HexDumpByte00BackgroundColor=#XXXXXX
|
||||
HexDumpByte00Color=#E0E0E0
|
||||
HexDumpByte7FBackgroundColor=#XXXXXX
|
||||
HexDumpByte7FColor=#E0E0E0
|
||||
HexDumpByteFFBackgroundColor=#XXXXXX
|
||||
HexDumpByteFFColor=#E0E0E0
|
||||
HexDumpByteIsPrintBackgroundColor=#XXXXXX
|
||||
HexDumpByteIsPrintColor=#E0E0E0
|
||||
HexDumpLabelBackgroundColor=#XXXXXX
|
||||
HexDumpLabelColor=#B794F6
|
||||
HexDumpModifiedBytesBackgroundColor=#XXXXXX
|
||||
HexDumpModifiedBytesColor=#EF5350
|
||||
HexDumpRestoredBytesBackgroundColor=#XXXXXX
|
||||
HexDumpRestoredBytesColor=#A6F93E
|
||||
HexDumpSelectionColor=#414141
|
||||
HexDumpSystemModuleCodePointerHighlightColor=#EF5350
|
||||
HexDumpSystemModuleDataPointerHighlightColor=#B794F6
|
||||
HexDumpTextColor=#E0E0E0
|
||||
HexDumpUnknownCodePointerHighlightColor=#0000FF
|
||||
HexDumpUnknownDataPointerHighlightColor=#89A2F6
|
||||
HexDumpUserModuleCodePointerHighlightColor=#00FF00
|
||||
HexDumpUserModuleDataPointerHighlightColor=#008000
|
||||
HexEditBackgroundColor=#212121
|
||||
HexEditSelectionColor=#414141
|
||||
HexEditTextColor=#E0E0E0
|
||||
HexEditWildcardColor=#C60000
|
||||
InstructionAddressBackgroundColor=#XXXXXX
|
||||
InstructionAddressColor=#F88478
|
||||
InstructionCallBackgroundColor=#XXXXXX
|
||||
InstructionCallColor=#F55F86
|
||||
InstructionCommaBackgroundColor=#XXXXXX
|
||||
InstructionCommaColor=#E0E0E0
|
||||
InstructionConditionalJumpBackgroundColor=#XXXXXX
|
||||
InstructionConditionalJumpColor=#F55F86
|
||||
InstructionFarBackgroundColor=#XXXXXX
|
||||
InstructionFarColor=#F55F86
|
||||
InstructionFpuRegisterBackgroundColor=#XXXXXX
|
||||
InstructionFpuRegisterColor=#B794F6
|
||||
InstructionGeneralRegisterBackgroundColor=#XXXXXX
|
||||
InstructionGeneralRegisterColor=#B794F6
|
||||
InstructionHighlightBackgroundColor=#969600
|
||||
InstructionHighlightColor=#000000
|
||||
InstructionInt3BackgroundColor=#XXXXXX
|
||||
InstructionInt3Color=#5F5F5F
|
||||
InstructionMemoryBaseRegisterBackgroundColor=#XXXXXX
|
||||
InstructionMemoryBaseRegisterColor=#B794F6
|
||||
InstructionMemoryBracketsBackgroundColor=#XXXXXX
|
||||
InstructionMemoryBracketsColor=#E0E0E0
|
||||
InstructionMemoryIndexRegisterBackgroundColor=#XXXXXX
|
||||
InstructionMemoryIndexRegisterColor=#B794F6
|
||||
InstructionMemoryOperatorBackgroundColor=#XXXXXX
|
||||
InstructionMemoryOperatorColor=#E0E0E0
|
||||
InstructionMemoryScaleBackgroundColor=#XXXXXX
|
||||
InstructionMemoryScaleColor=#F88478
|
||||
InstructionMemorySegmentBackgroundColor=#XXXXXX
|
||||
InstructionMemorySegmentColor=#B794F6
|
||||
InstructionMemorySizeBackgroundColor=#XXXXXX
|
||||
InstructionMemorySizeColor=#E0E0E0
|
||||
InstructionMemoryStackBracketsBackgroundColor=#XXXXXX
|
||||
InstructionMemoryStackBracketsColor=#E0E0E0
|
||||
InstructionMmxRegisterBackgroundColor=#XXXXXX
|
||||
InstructionMmxRegisterColor=#B794F6
|
||||
InstructionMnemonicBackgroundColor=#XXXXXX
|
||||
InstructionMnemonicColor=#89A2F6
|
||||
InstructionNopBackgroundColor=#XXXXXX
|
||||
InstructionNopColor=#A8A8A8
|
||||
InstructionPrefixBackgroundColor=#XXXXXX
|
||||
InstructionPrefixColor=#89A2F6
|
||||
InstructionPushPopBackgroundColor=#XXXXXX
|
||||
InstructionPushPopColor=#89A2F6
|
||||
InstructionRetBackgroundColor=#XXXXXX
|
||||
InstructionRetColor=#F55F86
|
||||
InstructionSseRegisterBackgroundColor=#XXXXXX
|
||||
InstructionSseRegisterColor=#000080
|
||||
InstructionUncategorizedBackgroundColor=#XXXXXX
|
||||
InstructionUncategorizedColor=#E0E0E0
|
||||
InstructionUnconditionalJumpBackgroundColor=#XXXXXX
|
||||
InstructionUnconditionalJumpColor=#F55F86
|
||||
InstructionUnusualBackgroundColor=#FF0000
|
||||
InstructionUnusualColor=#000000
|
||||
InstructionValueBackgroundColor=#XXXXXX
|
||||
InstructionValueColor=#F88478
|
||||
InstructionXmmRegisterBackgroundColor=#XXXXXX
|
||||
InstructionXmmRegisterColor=#B794F6
|
||||
InstructionYmmRegisterBackgroundColor=#XXXXXX
|
||||
InstructionYmmRegisterColor=#B794F6
|
||||
InstructionZmmRegisterBackgroundColor=#XXXXXX
|
||||
InstructionZmmRegisterColor=#B794F6
|
||||
LogLinkBackgroundColor=#XXXXXX
|
||||
LogLinkColor=#89A2F6
|
||||
MemoryMapBreakpointBackgroundColor=#EF5350
|
||||
MemoryMapBreakpointColor=#212121
|
||||
MemoryMapCipBackgroundColor=#212121
|
||||
MemoryMapCipColor=#A6F93E
|
||||
MemoryMapSectionTextColor=#89A2F6
|
||||
PatchRelocatedByteHighlightColor=#EF5350
|
||||
RegistersArgumentLabelColor=#89A2F6
|
||||
RegistersBackgroundColor=#212121
|
||||
RegistersColor=#E0E0E0
|
||||
RegistersExtraInfoColor=#F55F86
|
||||
RegistersHighlightReadColor=#A6F93E
|
||||
RegistersHighlightReadWriteColor=#EF5350
|
||||
RegistersHighlightWriteColor=#E1EA76
|
||||
RegistersLabelColor=#B794F6
|
||||
RegistersModifiedColor=#F88478
|
||||
RegistersSelectionColor=#414141
|
||||
SearchListViewHighlightBackgroundColor=#XXXXXX
|
||||
SearchListViewHighlightColor=#C60000
|
||||
SideBarBackgroundColor=#212121
|
||||
SideBarBulletBookmarkColor=#E1EA76
|
||||
SideBarBulletBreakpointColor=#EF5350
|
||||
SideBarBulletColor=#414141
|
||||
SideBarBulletDisabledBreakpointColor=#AA3A38
|
||||
SideBarCheckBoxBackColor=#414141
|
||||
SideBarCheckBoxForeColor=#E0E0E0
|
||||
SideBarCipLabelBackgroundColor=#414141
|
||||
SideBarCipLabelColor=#93EE62
|
||||
SideBarConditionalJumpLineFalseBackwardsColor=#808080
|
||||
SideBarConditionalJumpLineFalseColor=#808080
|
||||
SideBarConditionalJumpLineTrueBackwardsColor=#A0A0A0
|
||||
SideBarConditionalJumpLineTrueColor=#A0A0A0
|
||||
SideBarUnconditionalJumpLineFalseBackwardsColor=#808080
|
||||
SideBarUnconditionalJumpLineFalseColor=#808080
|
||||
SideBarUnconditionalJumpLineTrueBackwardsColor=#A0A0A0
|
||||
SideBarUnconditionalJumpLineTrueColor=#A0A0A0
|
||||
StackAddressBackgroundColor=#XXXXXX
|
||||
StackAddressColor=#A0A0A0
|
||||
StackBackgroundColor=#212121
|
||||
StackCspBackgroundColor=#XXXXXX
|
||||
StackCspColor=#A6F93E
|
||||
StackFrameColor=#F88478
|
||||
StackFrameSystemColor=#F88478
|
||||
StackInactiveTextColor=#A0A0A0
|
||||
StackLabelBackgroundColor=#XXXXXX
|
||||
StackLabelColor=#B794F6
|
||||
StackReturnToColor=#F55F86
|
||||
StackSEHChainColor=#F55F86
|
||||
StackSelectedAddressBackgroundColor=#XXXXXX
|
||||
StackSelectedAddressColor=#E0E0E0
|
||||
StackSelectionColor=#414141
|
||||
StackTextColor=#E0E0E0
|
||||
StructAlternateBackgroundColor=#313131
|
||||
StructBackgroundColor=#212121
|
||||
SymbolLoadedTextColor=#E0E0E0
|
||||
SymbolLoadingTextColor=#E1EA76
|
||||
SymbolUnloadedTextColor=#A0A0A0
|
||||
ThreadCurrentBackgroundColor=#C24000
|
||||
ThreadCurrentColor=#FFFFFF
|
||||
WatchTriggeredBackgroundColor=#XXXXXX
|
||||
WatchTriggeredColor=#EF5350
|
||||
|
||||
[Fonts]
|
||||
AbstractTableView=Lucida Console,8,-1,5,50,0,0,0,0,0
|
||||
Application=MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0
|
||||
Disassembly=Lucida Console,8,-1,5,50,0,0,0,0,0
|
||||
HexDump=Lucida Console,8,-1,5,50,0,0,0,0,0
|
||||
HexEdit=Lucida Console,8,-1,5,50,0,0,0,0,0
|
||||
Log=Courier New,8,-1,5,50,0,0,0,0,0
|
||||
Registers=Lucida Console,8,-1,5,50,0,0,0,0,0
|
||||
Stack=Lucida Console,8,-1,5,50,0,0,0,0,0
|
@ -350,12 +350,10 @@ MainWindow::MainWindow(QWidget* parent)
|
||||
connect(mTabWidget, SIGNAL(tabMovedTabWidget(int, int)), this, SLOT(tabMovedSlot(int, int)));
|
||||
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcuts()));
|
||||
|
||||
// Setup favourite tools menu
|
||||
// Menu stuff
|
||||
updateFavouriteTools();
|
||||
|
||||
// Setup language menu
|
||||
setupLanguagesMenu();
|
||||
|
||||
setupThemesMenu();
|
||||
setupMenuCustomization();
|
||||
|
||||
// Set default setttings (when not set)
|
||||
@ -429,6 +427,107 @@ void MainWindow::setupLanguagesMenu()
|
||||
ui->menuOptions->addMenu(languageMenu);
|
||||
}
|
||||
|
||||
#include "../src/bridge/Utf8Ini.h"
|
||||
|
||||
static void importSettings(const QString & filename)
|
||||
{
|
||||
QFile f(QDir::toNativeSeparators(filename));
|
||||
if(f.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream in(&f);
|
||||
auto style = in.readAll();
|
||||
f.close();
|
||||
Utf8Ini ini;
|
||||
int errorLine;
|
||||
if(ini.Deserialize(style.toStdString(), errorLine))
|
||||
{
|
||||
auto sections = ini.Sections();
|
||||
for(const auto & section : sections)
|
||||
{
|
||||
auto keys = ini.Keys(section);
|
||||
for(const auto & key : keys)
|
||||
BridgeSettingSet(section.c_str(), key.c_str(), ini.GetValue(section, key).c_str());
|
||||
}
|
||||
Config()->load();
|
||||
DbgSettingsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
emit Config()->guiOptionsUpdated();
|
||||
emit Config()->shortcutsUpdated();
|
||||
emit Config()->tokenizerConfigUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::loadSelectedStyle(bool reloadStyleCss)
|
||||
{
|
||||
char selectedTheme[MAX_SETTING_SIZE] = "";
|
||||
QString stylePath(":/css/default.css");
|
||||
QString styleSettings;
|
||||
if(BridgeSettingGet("Theme", "Selected", selectedTheme) && *selectedTheme)
|
||||
{
|
||||
QString themePath = QString("%1/../themes/%2/style.css").arg(QCoreApplication::applicationDirPath()).arg(selectedTheme);
|
||||
if(QFile(themePath).exists())
|
||||
stylePath = themePath;
|
||||
QString settingsPath = QString("%1/../themes/%2/style.ini").arg(QCoreApplication::applicationDirPath()).arg(selectedTheme);
|
||||
if(QFile(themePath).exists())
|
||||
styleSettings = settingsPath;
|
||||
}
|
||||
QFile f(stylePath);
|
||||
if(f.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream in(&f);
|
||||
auto style = in.readAll();
|
||||
f.close();
|
||||
auto nameIdx = stylePath.lastIndexOf('/');
|
||||
auto dir = stylePath.mid(nameIdx - 1);
|
||||
auto current = QDir::current().absolutePath();
|
||||
QDir::setCurrent(dir);
|
||||
qApp->setStyleSheet(style);
|
||||
QDir::setCurrent(current);
|
||||
}
|
||||
if(!reloadStyleCss && !styleSettings.isEmpty())
|
||||
importSettings(styleSettings);
|
||||
}
|
||||
|
||||
void MainWindow::themeTriggeredSlot()
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(sender());
|
||||
if(action == nullptr)
|
||||
return;
|
||||
QString dir = action->data().toString();
|
||||
int nameIdx = dir.lastIndexOf('/');
|
||||
QString name = dir.mid(nameIdx + 1);
|
||||
QString styleCss = QString("%1/style.css").arg(dir);
|
||||
QString styleIni = QString("%1/style.ini").arg(dir);
|
||||
GuiAddLogMessage(QString("%1:%2").arg(styleCss).arg(styleIni).toUtf8().constData());
|
||||
|
||||
BridgeSettingSet("Theme", "Selected", name.toUtf8().constData());
|
||||
loadSelectedStyle();
|
||||
}
|
||||
|
||||
void MainWindow::setupThemesMenu()
|
||||
{
|
||||
auto exists = [](const QString & str)
|
||||
{
|
||||
return QFile(str).exists();
|
||||
};
|
||||
QDirIterator it(QString("%1/../themes").arg(QCoreApplication::applicationDirPath()), QDir::NoDotAndDotDot | QDir::Dirs);
|
||||
while(it.hasNext())
|
||||
{
|
||||
auto dir = it.next();
|
||||
auto nameIdx = dir.lastIndexOf('/');
|
||||
auto name = dir.mid(nameIdx + 1);
|
||||
auto action = ui->menuTheme->addAction(name);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(themeTriggeredSlot()));
|
||||
action->setText(name);
|
||||
action->setData(dir);
|
||||
GuiAddLogMessage(dir.toUtf8().constData());
|
||||
GuiAddLogMessage("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setupLanguagesMenu2()
|
||||
{
|
||||
QMenu* languageMenu = dynamic_cast<QMenu*>(sender()); //The only sender is languageMenu
|
||||
@ -1716,16 +1815,7 @@ void MainWindow::on_actionFaq_triggered()
|
||||
|
||||
void MainWindow::on_actionReloadStylesheet_triggered()
|
||||
{
|
||||
QFile f(QString("%1/style.css").arg(QCoreApplication::applicationDirPath()));
|
||||
if(f.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream in(&f);
|
||||
auto style = in.readAll();
|
||||
f.close();
|
||||
qApp->setStyleSheet(style);
|
||||
}
|
||||
else
|
||||
qApp->setStyleSheet("");
|
||||
loadSelectedStyle(true);
|
||||
ensurePolished();
|
||||
update();
|
||||
}
|
||||
@ -2053,40 +2143,12 @@ void MainWindow::customizeMenu()
|
||||
onMenuCustomized();
|
||||
}
|
||||
|
||||
#include "../src/bridge/Utf8Ini.h"
|
||||
|
||||
void MainWindow::on_actionImportSettings_triggered()
|
||||
{
|
||||
auto filename = QFileDialog::getOpenFileName(this, tr("Open file"), QCoreApplication::applicationDirPath(), tr("Settings (*.ini);;All files (*.*)"));
|
||||
if(!filename.length())
|
||||
return;
|
||||
QFile f(QDir::toNativeSeparators(filename));
|
||||
if(f.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream in(&f);
|
||||
auto style = in.readAll();
|
||||
f.close();
|
||||
Utf8Ini ini;
|
||||
int errorLine;
|
||||
if(ini.Deserialize(style.toStdString(), errorLine))
|
||||
{
|
||||
auto sections = ini.Sections();
|
||||
for(const auto & section : sections)
|
||||
{
|
||||
auto keys = ini.Keys(section);
|
||||
for(const auto & key : keys)
|
||||
BridgeSettingSet(section.c_str(), key.c_str(), ini.GetValue(section, key).c_str());
|
||||
}
|
||||
Config()->load();
|
||||
DbgSettingsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
emit Config()->guiOptionsUpdated();
|
||||
emit Config()->shortcutsUpdated();
|
||||
emit Config()->tokenizerConfigUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
importSettings(filename);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionImportdatabase_triggered()
|
||||
@ -2204,3 +2266,19 @@ void MainWindow::on_actionCheckUpdates_triggered()
|
||||
{
|
||||
mUpdateChecker->checkForUpdates();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDefaultTheme_triggered()
|
||||
{
|
||||
// Delete [Theme] Selected
|
||||
BridgeSettingSet("Theme", "Selected", nullptr);
|
||||
// Load style
|
||||
loadSelectedStyle();
|
||||
// Reset [Colors] to default
|
||||
Config()->Colors = Config()->defaultColors;
|
||||
Config()->writeColors();
|
||||
// Reset [Fonts] to default
|
||||
Config()->Fonts = Config()->defaultFonts;
|
||||
Config()->writeFonts();
|
||||
// delete [Color] section
|
||||
BridgeSettingSet("Color", nullptr, nullptr);
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
void loadTabSavedOrder();
|
||||
void clearTabWidget();
|
||||
|
||||
static void loadSelectedStyle(bool reloadStyleCss = false);
|
||||
|
||||
public slots:
|
||||
void saveWindowSettings();
|
||||
void loadWindowSettings();
|
||||
@ -156,6 +158,7 @@ public slots:
|
||||
void customizeMenu();
|
||||
void addFavouriteItem(int type, const QString & name, const QString & description);
|
||||
void setFavouriteItemShortcut(int type, const QString & name, const QString & shortcut);
|
||||
void themeTriggeredSlot();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui;
|
||||
@ -195,6 +198,7 @@ private:
|
||||
|
||||
void updateMRUMenu();
|
||||
void setupLanguagesMenu();
|
||||
void setupThemesMenu();
|
||||
void onMenuCustomized();
|
||||
void setupMenuCustomization();
|
||||
QAction* makeCommandAction(QAction* action, const QString & command);
|
||||
@ -280,6 +284,7 @@ private slots:
|
||||
void on_actionRestartAdmin_triggered();
|
||||
void on_actionPlugins_triggered();
|
||||
void on_actionCheckUpdates_triggered();
|
||||
void on_actionDefaultTheme_triggered();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -23,7 +23,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>868</width>
|
||||
<height>23</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@ -157,6 +157,12 @@
|
||||
<property name="title">
|
||||
<string>&Options</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuTheme">
|
||||
<property name="title">
|
||||
<string>&Theme</string>
|
||||
</property>
|
||||
<addaction name="actionDefaultTheme"/>
|
||||
</widget>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionAppearance"/>
|
||||
<addaction name="actionShortcuts"/>
|
||||
@ -165,6 +171,7 @@
|
||||
<addaction name="actionReloadStylesheet"/>
|
||||
<addaction name="actionSetInitializationScript"/>
|
||||
<addaction name="actionImportSettings"/>
|
||||
<addaction name="menuTheme"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFavourites">
|
||||
<property name="title">
|
||||
@ -1191,6 +1198,16 @@
|
||||
<string>Modules</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Theme">
|
||||
<property name="text">
|
||||
<string>&Theme</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDefaultTheme">
|
||||
<property name="text">
|
||||
<string>&Default</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
@ -70,14 +70,7 @@ int main(int argc, char* argv[])
|
||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
MyApplication application(argc, argv);
|
||||
QFile f(QString("%1/style.css").arg(QCoreApplication::applicationDirPath()));
|
||||
if(f.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream in(&f);
|
||||
auto style = in.readAll();
|
||||
f.close();
|
||||
application.setStyleSheet(style);
|
||||
}
|
||||
MainWindow::loadSelectedStyle(true);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
QAbstractEventDispatcher::instance(application.thread())->setEventFilter(MyApplication::globalEventFilter);
|
||||
#else
|
||||
|
@ -315,4 +315,7 @@
|
||||
<file>images/crash_dump.png</file>
|
||||
<file>images/exclamation.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/css">
|
||||
<file>default.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|