Added new dark grey theme (#471)

This commit is contained in:
fcasal 2018-05-02 07:02:24 +01:00 committed by xarkes
parent c0a3ec4481
commit df251dd514
5 changed files with 50 additions and 16 deletions

View File

@ -35,7 +35,7 @@ void GeneralOptionsWidget::updateThemeFromConfig()
// Disconnect currentIndexChanged because clearing the comboxBox and refiling it causes its index to change. // Disconnect currentIndexChanged because clearing the comboxBox and refiling it causes its index to change.
disconnect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this, disconnect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this,
SLOT(on_colorComboBox_currentIndexChanged(int))); SLOT(on_colorComboBox_currentIndexChanged(int)));
ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme() ? 1 : 0); ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme());
QList<QString> themes = Core()->getColorThemes(); QList<QString> themes = Core()->getColorThemes();
ui->colorComboBox->clear(); ui->colorComboBox->clear();
@ -71,7 +71,7 @@ void GeneralOptionsWidget::on_fontSelectionButton_clicked()
void GeneralOptionsWidget::on_themeComboBox_currentIndexChanged(int index) void GeneralOptionsWidget::on_themeComboBox_currentIndexChanged(int index)
{ {
//disconnect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig())); //disconnect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
Config()->setDarkTheme(index == 1); Config()->setDarkTheme(index);
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig())); //connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
} }

View File

@ -81,6 +81,11 @@
<string>Dark</string> <string>Dark</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Dark Grey</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">

View File

@ -105,6 +105,7 @@ void Configuration::loadDefaultTheme()
setColor("highlight", QColor(210, 210, 255)); setColor("highlight", QColor(210, 210, 255));
// Windows background // Windows background
setColor("gui.background", QColor(255, 255, 255)); setColor("gui.background", QColor(255, 255, 255));
setColor("gui.disass_selected", QColor(255, 255, 255));
// Disassembly nodes background // Disassembly nodes background
setColor("gui.alt_background", QColor(245, 250, 255)); setColor("gui.alt_background", QColor(245, 250, 255));
// Custom // Custom
@ -117,7 +118,7 @@ void Configuration::loadDefaultTheme()
setColor("gui.navbar.empty", QColor(100, 100, 100)); setColor("gui.navbar.empty", QColor(100, 100, 100));
} }
void Configuration::loadDarkTheme() void Configuration::loadBaseDark()
{ {
/* Load Qt Theme */ /* Load Qt Theme */
QFile f(":qdarkstyle/style.qss"); QFile f(":qdarkstyle/style.qss");
@ -147,11 +148,6 @@ void Configuration::loadDarkTheme()
setColor("gui.cflow", QColor(255, 255, 255)); setColor("gui.cflow", QColor(255, 255, 255));
setColor("gui.dataoffset", QColor(255, 255, 255)); setColor("gui.dataoffset", QColor(255, 255, 255));
setColor("gui.border", QColor(255, 255, 255)); setColor("gui.border", QColor(255, 255, 255));
setColor("highlight", QColor(64, 115, 115));
// Windows background
setColor("gui.background", QColor(36, 66, 79));
// Disassembly nodes background
setColor("gui.alt_background", QColor(58, 100, 128));
// Custom // Custom
setColor("gui.imports", QColor(50, 140, 255)); setColor("gui.imports", QColor(50, 140, 255));
setColor("gui.main", QColor(0, 128, 0)); setColor("gui.main", QColor(0, 128, 0));
@ -162,6 +158,32 @@ void Configuration::loadDarkTheme()
setColor("gui.navbar.empty", QColor(100, 100, 100)); setColor("gui.navbar.empty", QColor(100, 100, 100));
} }
void Configuration::loadDarkTheme()
{
loadBaseDark();
// Windows background
setColor("gui.background", QColor(36, 66, 79));
// Disassembly nodes background
setColor("gui.alt_background", QColor(58, 100, 128));
// Disassembly nodes background when selected
setColor("gui.disass_selected", QColor(36, 66, 79));
// Disassembly line selected
setColor("highlight", QColor(64, 115, 115));
}
void Configuration::loadDarkGreyTheme()
{
loadBaseDark();
// Windows background
setColor("gui.background", QColor(37, 40, 43));
// Disassembly nodes background
setColor("gui.alt_background", QColor(28, 31, 36));
// Disassembly nodes background when selected
setColor("gui.disass_selected", QColor(44, 53, 54));
// Disassembly line selected
setColor("highlight", QColor(21, 29, 29));
}
const QFont Configuration::getFont() const const QFont Configuration::getFont() const
{ {
QFont font = s.value("font", QFont("Inconsolata", 12)).value<QFont>(); QFont font = s.value("font", QFont("Inconsolata", 12)).value<QFont>();
@ -174,12 +196,17 @@ void Configuration::setFont(const QFont &font)
emit fontsUpdated(); emit fontsUpdated();
} }
void Configuration::setDarkTheme(bool set) void Configuration::setDarkTheme(int theme)
{ {
s.setValue("dark", set); s.setValue("dark", theme);
if (set) { switch(theme){
case 1:
loadDarkTheme(); loadDarkTheme();
} else { break;
case 2:
loadDarkGreyTheme();
break;
default:
loadDefaultTheme(); loadDefaultTheme();
} }
emit colorsUpdated(); emit colorsUpdated();

View File

@ -18,8 +18,10 @@ private:
void loadInitial(); void loadInitial();
// Colors // Colors
void loadBaseDark();
void loadDefaultTheme(); void loadDefaultTheme();
void loadDarkTheme(); void loadDarkTheme();
void loadDarkGreyTheme();
void setColor(const QString &name, const QColor &color); void setColor(const QString &name, const QColor &color);
// Images // Images
@ -41,10 +43,10 @@ public:
// Colors // Colors
const QColor getColor(const QString &name) const; const QColor getColor(const QString &name) const;
void setDarkTheme(bool set); void setDarkTheme(int theme);
bool getDarkTheme() int getDarkTheme()
{ {
return s.value("dark").toBool(); return s.value("dark").toInt();
} }
QString getDirProjects(); QString getDirProjects();

View File

@ -448,7 +448,7 @@ DisassemblerGraphView::Instr *DisassemblerGraphView::getInstrForMouseEvent(
void DisassemblerGraphView::colorsUpdatedSlot() void DisassemblerGraphView::colorsUpdatedSlot()
{ {
disassemblyBackgroundColor = ConfigColor("gui.alt_background"); disassemblyBackgroundColor = ConfigColor("gui.alt_background");
disassemblySelectedBackgroundColor = ConfigColor("gui.background"); disassemblySelectedBackgroundColor = ConfigColor("gui.disass_selected");
mDisabledBreakpointColor = disassemblyBackgroundColor; mDisabledBreakpointColor = disassemblyBackgroundColor;
graphNodeColor = ConfigColor("gui.border"); graphNodeColor = ConfigColor("gui.border");
backgroundColor = ConfigColor("gui.background"); backgroundColor = ConfigColor("gui.background");