Added dark theme

This commit is contained in:
xarkes 2018-01-09 12:03:07 +01:00
parent 266402095f
commit d878e5055e
53 changed files with 1375 additions and 90 deletions

View File

@ -137,11 +137,11 @@ void MainWindow::initUI()
spacer4->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
spacer4->setMinimumSize(10, 10);
ui->mainToolBar->insertWidget(ui->actionForward, spacer4);
ui->actionForward->setIcon(QIcon(new SvgIconEngine(QString(":/img/icons/arrow_right.svg"), palette().buttonText().color())));
ui->actionForward->setIcon(QIcon(new SvgIconEngine(QString(":/img/icons/arrow_right.svg"))));
// Popup menu on theme toolbar button
QToolButton *backButton = new QToolButton(this);
backButton->setIcon(QIcon(new SvgIconEngine(QString(":/img/icons/arrow_left.svg"), palette().buttonText().color())));
backButton->setIcon(QIcon(new SvgIconEngine(QString(":/img/icons/arrow_left.svg"))));
//backButton->setPopupMode(QToolButton::DelayedPopup);
ui->mainToolBar->insertWidget(ui->actionForward, backButton);
connect(backButton, SIGNAL(clicked()), this, SLOT(backButton_clicked()));
@ -371,18 +371,6 @@ bool MainWindow::saveProjectAs(bool quit)
}
void MainWindow::toggleTheme()
{
if (QSettings().value("dark").toBool())
{
setDefaultTheme();
}
else
{
setDarkTheme();
}
}
void MainWindow::refreshOmniBar(const QStringList &flags)
{
omnibar->refresh(flags);
@ -487,17 +475,6 @@ void MainWindow::setTabLocation()
}
}
void MainWindow::setDarkTheme()
{
Config()->setDarkTheme(true);
}
void MainWindow::setDefaultTheme()
{
Config()->setDarkTheme(false);
}
void MainWindow::refreshAll()
{
Core()->triggerRefreshAll();
@ -769,16 +746,6 @@ void MainWindow::on_actionRun_Script_triggered()
this->core->cmd(". " + fileName);
}
void MainWindow::on_actionDark_Theme_triggered()
{
this->setDarkTheme();
}
void MainWindow::on_actionWhite_Theme_triggered()
{
this->setDefaultTheme();
}
void MainWindow::on_actionLoad_triggered()
{
QProcess process(this);

View File

@ -81,7 +81,6 @@ public:
void addOutput(const QString &msg);
void addDebugOutput(const QString &msg);
void sendToNotepad(const QString &txt);
void toggleTheme();
void refreshOmniBar(const QStringList &flags);
public slots:
@ -91,9 +90,6 @@ public slots:
void setPanelLock();
void setTabLocation();
void setDarkTheme();
void setDefaultTheme();
void on_actionLock_triggered();
void on_actionLockUnlock_triggered();
@ -102,8 +98,6 @@ public slots:
void lockUnlock_Docks(bool what);
void on_actionDark_Theme_triggered();
void on_actionRun_Script_triggered();
void toggleResponsive(bool maybe);
@ -129,8 +123,6 @@ private slots:
void on_actionUndoSeek_triggered();
void on_actionRedoSeek_triggered();
void on_actionWhite_Theme_triggered();
void on_actionLoad_triggered();
void on_actionForward_triggered();

View File

@ -181,7 +181,9 @@ FORMS += \
widgets/ClassesWidget.ui
RESOURCES += \
resources.qrc
resources.qrc \
themes/qdarkstyle/style.qrc
DISTFILES += cutter.astylerc

1
src/themes/qdarkstyle/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*.pyc

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View File

@ -0,0 +1,46 @@
<RCC>
<qresource prefix="qss_icons">
<file>rc/up_arrow_disabled.png</file>
<file>rc/Hmovetoolbar.png</file>
<file>rc/stylesheet-branch-end.png</file>
<file>rc/branch_closed-on.png</file>
<file>rc/stylesheet-vline.png</file>
<file>rc/branch_closed.png</file>
<file>rc/branch_open-on.png</file>
<file>rc/transparent.png</file>
<file>rc/right_arrow_disabled.png</file>
<file>rc/sizegrip.png</file>
<file>rc/close.png</file>
<file>rc/close-hover.png</file>
<file>rc/close-pressed.png</file>
<file>rc/down_arrow.png</file>
<file>rc/Vmovetoolbar.png</file>
<file>rc/left_arrow.png</file>
<file>rc/stylesheet-branch-more.png</file>
<file>rc/up_arrow.png</file>
<file>rc/right_arrow.png</file>
<file>rc/left_arrow_disabled.png</file>
<file>rc/Hsepartoolbar.png</file>
<file>rc/branch_open.png</file>
<file>rc/Vsepartoolbar.png</file>
<file>rc/down_arrow_disabled.png</file>
<file>rc/undock.png</file>
<file>rc/checkbox_checked_disabled.png</file>
<file>rc/checkbox_checked_focus.png</file>
<file>rc/checkbox_checked.png</file>
<file>rc/checkbox_indeterminate.png</file>
<file>rc/checkbox_indeterminate_focus.png</file>
<file>rc/checkbox_unchecked_disabled.png</file>
<file>rc/checkbox_unchecked_focus.png</file>
<file>rc/checkbox_unchecked.png</file>
<file>rc/radio_checked_disabled.png</file>
<file>rc/radio_checked_focus.png</file>
<file>rc/radio_checked.png</file>
<file>rc/radio_unchecked_disabled.png</file>
<file>rc/radio_unchecked_focus.png</file>
<file>rc/radio_unchecked.png</file>
</qresource>
<qresource prefix="qdarkstyle">
<file>style.qss</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QFontDatabase>
#include <QFile>
#include <QApplication>
Configuration* Configuration::mPtr = nullptr;
@ -118,6 +120,8 @@ void Configuration::loadDefaultTheme()
// Custom
setColor("gui.imports", colorA);
/* Load Qt Theme */
qApp->setStyleSheet("");
}
void Configuration::loadDarkTheme()
@ -204,6 +208,20 @@ void Configuration::loadDarkTheme()
setColor("gui.alt_background", QColor(58, 100, 128));
// Custom
setColor("gui.imports", colorA);
/* Load Qt Theme */
QFile f(":qdarkstyle/style.qss");
if (!f.exists())
{
qWarning() << "Can't find dark theme stylesheet.";
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
}
}
const QFont Configuration::getFont() const

View File

@ -81,7 +81,7 @@ void Dashboard::updateContents()
else
{
this->ui->canaryEdit->setText("False");
this->ui->canaryEdit->setStyleSheet("color: rgb(255, 0, 0);");
//this->ui->canaryEdit->setStyleSheet("color: rgb(255, 0, 0);");
}
if (item2["crypto"].toBool() == true)
{
@ -98,7 +98,7 @@ void Dashboard::updateContents()
else
{
this->ui->nxEdit->setText("False");
this->ui->nxEdit->setStyleSheet("color: rgb(255, 0, 0);");
//this->ui->nxEdit->setStyleSheet("color: rgb(255, 0, 0);");
}
if (item2["pic"].toBool() == true)
{
@ -107,7 +107,7 @@ void Dashboard::updateContents()
else
{
this->ui->picEdit->setText("False");
this->ui->picEdit->setStyleSheet("color: rgb(255, 0, 0);");
//this->ui->picEdit->setStyleSheet("color: rgb(255, 0, 0);");
}
if (item2["static"].toBool() == true)
{

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: palette(base);</string>
<string notr="true"></string>
</property>
<property name="windowTitle">
<string notr="true">Dashboard</string>

View File

@ -167,7 +167,7 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
case Qt::ForegroundRole:
if (functionIsImport(function.offset))
return QVariant(ConfigColor("gui.imports"));
return QVariant(QColor(Qt::black));
return QVariant(this->property("color"));
case FunctionDescriptionRole:
return QVariant::fromValue(function);

View File

@ -57,19 +57,13 @@
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QTreeView::item
<string notr="true">
QTreeView::item
{
padding-top: 1px;
padding-bottom: 1px;
}
QToolTip
{
background-color: #444;
border: 3px solid #444;
color: rgb(232, 232, 232);
font: 11pt &quot;Monaco&quot;;
}</string>
</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>

View File

@ -23,14 +23,6 @@ SideBar::SideBar(MainWindow *main) :
{
ui->respButton->setChecked(false);
}
if (settings.value("dark").toBool())
{
ui->themesButton->setChecked(true);
}
else
{
ui->themesButton->setChecked(false);
}
}
SideBar::~SideBar() {}
@ -54,25 +46,6 @@ void SideBar::on_lockButton_clicked()
}
}
void SideBar::themesButtonToggle()
{
ui->themesButton->click();
}
void SideBar::on_themesButton_clicked()
{
if (ui->themesButton->isChecked())
{
// Dark theme
this->main->setDarkTheme();
}
else
{
// Clear theme
this->main->setDefaultTheme();
}
}
void SideBar::on_calcInput_textChanged(const QString &arg1)
{
ui->calcOutput->setText(QString::number(CutterCore::getInstance()->math(arg1)));

View File

@ -19,17 +19,12 @@ public:
explicit SideBar(MainWindow *main);
~SideBar();
public slots:
void themesButtonToggle();
private slots:
void on_tabsButton_clicked();
void on_lockButton_clicked();
void on_themesButton_clicked();
void on_calcInput_textChanged(const QString &arg1);
void on_asm2hex_clicked();