Skip to content

Commit

Permalink
Better dark styling than previous.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavpandeyvpz committed Apr 25, 2019
1 parent a5536af commit 5420dc0
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "QDarkStyleSheet"]
path = QDarkStyleSheet
url = https://github.com/ColinDuquesnoy/QDarkStyleSheet
[submodule "Qt-Frameless-Window-DarkStyle"]
path = Qt-Frameless-Window-DarkStyle
url = https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle
1 change: 0 additions & 1 deletion QDarkStyleSheet
Submodule QDarkStyleSheet deleted from 29bb06
1 change: 1 addition & 0 deletions Qt-Frameless-Window-DarkStyle
4 changes: 3 additions & 1 deletion apkstudio.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ TEMPLATE = app
CONFIG += c++11

HEADERS += \
Qt-Frameless-Window-DarkStyle/DarkStyle.h \
sources/adbinstallworker.h \
sources/apkdecompiledialog.h \
sources/apkdecompileworker.h \
Expand All @@ -24,6 +25,7 @@ HEADERS += \
sources/versionresolveworker.h

SOURCES += \
Qt-Frameless-Window-DarkStyle/DarkStyle.cpp \
sources/main.cpp \
sources/adbinstallworker.cpp \
sources/apkdecompiledialog.cpp \
Expand All @@ -43,7 +45,7 @@ SOURCES += \
sources/versionresolveworker.cpp

RESOURCES += \
QDarkStyleSheet/qdarkstyle/style.qrc \
Qt-Frameless-Window-DarkStyle/darkstyle.qrc \
build/linux.sh \
build/osx.sh \
build/windows.bat \
Expand Down
4 changes: 4 additions & 0 deletions resources/all.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
<file>fugue/gear.png</file>
<file>fugue/color.png</file>
</qresource>
<qresource prefix="/styles">
<file>dark.qss</file>
<file>light.qss</file>
</qresource>
</RCC>
13 changes: 13 additions & 0 deletions resources/dark.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SourceCodeEdit {
background-color: #222;
color: #ccc;
selection-background-color: #000;
selection-color: #fff;
}

SourceCodeSidebarWidget {
background-color: #000;
color: #aaa;
selection-background-color: #222;
selection-color: #ccc;
}
16 changes: 16 additions & 0 deletions resources/light.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SourceCodeEdit {
alternate-background-color: #ced7df;
background-color: #fff;
color: #222;
font-family: Courier;
font-size: 10pt;
selection-background-color: #c4dff6;
selection-color: #205081;
}

SourceCodeSidebarWidget {
background-color: #eff3f6;
color: #59626a;
selection-background-color: #ced7df;
selection-color: #323b43;
}
12 changes: 3 additions & 9 deletions sources/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "splashwindow.h"
#include <QApplication>
#include <QFile>
#include <QSettings>
#include <QTextStream>
#include "splashwindow.h"
#include "../Qt-Frameless-Window-DarkStyle/DarkStyle.h"

int main(int argc, char *argv[])
{
Expand All @@ -14,12 +13,7 @@ int main(int argc, char *argv[])
QSettings settings;
const bool dark = settings.value("dark_theme", false).toBool();
if (dark) {
QFile qss(":/qdarkstyle/style.qss");
if (qss.exists() && qss.open(QFile::ReadOnly | QFile::Text)) {
QTextStream styles(&qss);
app.setStyleSheet(styles.readAll());
qss.close();
}
app.setStyle(new DarkStyle);
}
SplashWindow window;
window.show();
Expand Down
6 changes: 6 additions & 0 deletions sources/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ MainWindow::MainWindow(QWidget *parent)
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &MainWindow::handleClipboardDataChanged);
thread->start();
QSettings settings;
const bool dark = settings.value("dark_theme", false).toBool();
QFile qss(QString(":/styles/%1.qss").arg(dark ? "dark" : "light"));
qss.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream contents(&qss);
setStyleSheet(contents.readAll());
qss.close();
if (settings.value("app_maximized").toBool()) {
showMaximized();
} else {
Expand Down

0 comments on commit 5420dc0

Please sign in to comment.