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(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this,
SLOT(on_colorComboBox_currentIndexChanged(int)));
ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme() ? 1 : 0);
ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme());
QList<QString> themes = Core()->getColorThemes();
ui->colorComboBox->clear();
@ -71,7 +71,7 @@ void GeneralOptionsWidget::on_fontSelectionButton_clicked()
void GeneralOptionsWidget::on_themeComboBox_currentIndexChanged(int index)
{
//disconnect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
Config()->setDarkTheme(index == 1);
Config()->setDarkTheme(index);
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
}

View File

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

View File

@ -105,6 +105,7 @@ void Configuration::loadDefaultTheme()
setColor("highlight", QColor(210, 210, 255));
// Windows background
setColor("gui.background", QColor(255, 255, 255));
setColor("gui.disass_selected", QColor(255, 255, 255));
// Disassembly nodes background
setColor("gui.alt_background", QColor(245, 250, 255));
// Custom
@ -117,7 +118,7 @@ void Configuration::loadDefaultTheme()
setColor("gui.navbar.empty", QColor(100, 100, 100));
}
void Configuration::loadDarkTheme()
void Configuration::loadBaseDark()
{
/* Load Qt Theme */
QFile f(":qdarkstyle/style.qss");
@ -147,11 +148,6 @@ void Configuration::loadDarkTheme()
setColor("gui.cflow", QColor(255, 255, 255));
setColor("gui.dataoffset", 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
setColor("gui.imports", QColor(50, 140, 255));
setColor("gui.main", QColor(0, 128, 0));
@ -162,6 +158,32 @@ void Configuration::loadDarkTheme()
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
{
QFont font = s.value("font", QFont("Inconsolata", 12)).value<QFont>();
@ -174,12 +196,17 @@ void Configuration::setFont(const QFont &font)
emit fontsUpdated();
}
void Configuration::setDarkTheme(bool set)
void Configuration::setDarkTheme(int theme)
{
s.setValue("dark", set);
if (set) {
s.setValue("dark", theme);
switch(theme){
case 1:
loadDarkTheme();
} else {
break;
case 2:
loadDarkGreyTheme();
break;
default:
loadDefaultTheme();
}
emit colorsUpdated();

View File

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

View File

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