add light and dark themes
This commit is contained in:
parent
ec98312340
commit
376cfbf9c3
7 changed files with 247 additions and 2 deletions
|
@ -1281,7 +1281,7 @@
|
|||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Transparency</string>
|
||||
<string>Opacity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2827,6 +2827,8 @@
|
|||
<addaction name="actionCursor_Tile_Outline"/>
|
||||
<addaction name="actionPlayer_View_Rectangle"/>
|
||||
<addaction name="actionBetter_Cursors"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionThemes"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTools">
|
||||
<property name="title">
|
||||
|
@ -3083,6 +3085,11 @@
|
|||
<string>Ctrl+Shift+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionThemes">
|
||||
<property name="text">
|
||||
<string>Themes...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -141,6 +141,7 @@ private slots:
|
|||
void on_toolButton_ExpandAll_clicked();
|
||||
void on_toolButton_CollapseAll_clicked();
|
||||
void on_actionAbout_Porymap_triggered();
|
||||
void on_actionThemes_triggered();
|
||||
void on_pushButton_AddCustomHeaderField_clicked();
|
||||
void on_pushButton_DeleteCustomHeaderField_clicked();
|
||||
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
|
||||
|
|
|
@ -144,7 +144,8 @@ FORMS += forms/mainwindow.ui \
|
|||
forms/mapimageexporter.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources/images.qrc
|
||||
resources/images.qrc \
|
||||
resources/themes.qrc
|
||||
|
||||
INCLUDEPATH += include
|
||||
INCLUDEPATH += include/core
|
||||
|
|
6
resources/themes.qrc
Normal file
6
resources/themes.qrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>themes/dark.qss</file>
|
||||
<file>themes/light.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
95
resources/themes/dark.qss
Normal file
95
resources/themes/dark.qss
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* DARK theme for porymap */
|
||||
|
||||
/* General Widgets */
|
||||
|
||||
QWidget {
|
||||
background: #31332b;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
QWidget::item:selected {
|
||||
background: #49483E;
|
||||
}
|
||||
|
||||
QWidget::item:focus {
|
||||
background: #49483E;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Combo Boxes */
|
||||
|
||||
QComboBox {
|
||||
background: #272822;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView {
|
||||
background: #31332b;
|
||||
color: #75715E;
|
||||
selection-background-color: #49483E;
|
||||
}
|
||||
|
||||
/* Spin Boxes */
|
||||
|
||||
QSpinBox {
|
||||
background: #272822;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
/* Line Edits */
|
||||
|
||||
QLineEdit {
|
||||
background: #272822;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
/* Frames, Labels */
|
||||
|
||||
#label_spritePixmap {
|
||||
background: #272822;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
/* Checkboxes */
|
||||
|
||||
QCheckBox, QRadioButton {
|
||||
border: none;
|
||||
}
|
||||
|
||||
QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked {
|
||||
border: 1px solid #49483E;
|
||||
background: none;
|
||||
}
|
||||
|
||||
QRadioButton::indicator:unchecked:hover, QCheckBox::indicator:unchecked:hover {
|
||||
border: 1px solid #F8F8F2;
|
||||
}
|
||||
|
||||
QRadioButton::indicator::checked, QCheckBox::indicator::checked {
|
||||
border: 1px solid #49483E;
|
||||
background: #49483E;
|
||||
}
|
||||
|
||||
QRadioButton::indicator:checked:hover, QCheckBox::indicator:checked:hover {
|
||||
border: 1px solid #F8F8F2;
|
||||
background: #F8F8F2;
|
||||
}
|
||||
|
||||
/* Map List View */
|
||||
|
||||
QTreeView {
|
||||
background: #272822;
|
||||
}
|
||||
|
||||
QTreeView::item:hover {
|
||||
background: #49483E;
|
||||
}
|
||||
|
||||
QTreeView::item:selected {
|
||||
background: #49483E;
|
||||
color: #F8F8F2;
|
||||
}
|
||||
|
||||
QTreeView::branch {
|
||||
background: #272822;
|
||||
}
|
95
resources/themes/light.qss
Normal file
95
resources/themes/light.qss
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* LIGHT theme for porymap */
|
||||
|
||||
/* General Widgets */
|
||||
|
||||
QWidget {
|
||||
background: #F5F5F5;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
QWidget::item:selected {
|
||||
background: #CACACA;
|
||||
}
|
||||
|
||||
QWidget::item:focus {
|
||||
background: #CACACA;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Combo Boxes */
|
||||
|
||||
QComboBox {
|
||||
background: #F5F5F5;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView {
|
||||
background: #F5F5F5;
|
||||
color: #898989;
|
||||
selection-background-color: #707070;
|
||||
}
|
||||
|
||||
/* Spin Boxes */
|
||||
|
||||
QSpinBox {
|
||||
background: #F5F5F5;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
/* Line Edits */
|
||||
|
||||
QLineEdit {
|
||||
background: #F5F5F5;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
/* Frames, Labels */
|
||||
|
||||
#label_spritePixmap {
|
||||
background: #F5F5F5;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
/* Checkboxes */
|
||||
|
||||
QCheckBox, QRadioButton {
|
||||
border: none;
|
||||
}
|
||||
|
||||
QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked {
|
||||
border: 1px solid #CACACA;
|
||||
background: none;
|
||||
}
|
||||
|
||||
QRadioButton::indicator:unchecked:hover, QCheckBox::indicator:unchecked:hover {
|
||||
border: 1px solid #3C3C3C;
|
||||
}
|
||||
|
||||
QRadioButton::indicator::checked, QCheckBox::indicator::checked {
|
||||
border: 1px solid #CACACA;
|
||||
background: #CACACA;
|
||||
}
|
||||
|
||||
QRadioButton::indicator:checked:hover, QCheckBox::indicator:checked:hover {
|
||||
border: 1px solid #3C3C3C;
|
||||
background: #3C3C3C;
|
||||
}
|
||||
|
||||
/* Map List View */
|
||||
|
||||
QTreeView {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
QTreeView::item:hover {
|
||||
background: #CACACA;
|
||||
}
|
||||
|
||||
QTreeView::item:selected {
|
||||
background: #CACACA;
|
||||
color: #3C3C3C;
|
||||
}
|
||||
|
||||
QTreeView::branch {
|
||||
background: #F5F5F5;
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
#include "customattributestable.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDirIterator>
|
||||
#include <QStandardItemModel>
|
||||
#include <QShortcut>
|
||||
#include <QSpinBox>
|
||||
|
@ -2119,6 +2120,45 @@ void MainWindow::on_actionAbout_Porymap_triggered()
|
|||
window->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionThemes_triggered()
|
||||
{
|
||||
QStringList themes;
|
||||
QRegularExpression re(":/themes/([A-z0-9_]+).qss");
|
||||
themes.append("default");
|
||||
QDirIterator it(":/themes", QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QString themeName = re.match(it.next()).captured(1);
|
||||
themes.append(themeName);
|
||||
}
|
||||
|
||||
QDialog themeSelectorWindow(this);
|
||||
QFormLayout form(&themeSelectorWindow);
|
||||
|
||||
NoScrollComboBox *themeSelector = new NoScrollComboBox();
|
||||
themeSelector->addItems(themes);
|
||||
form.addRow(new QLabel("Themes"), themeSelector);
|
||||
|
||||
QDialogButtonBox buttonBox(QDialogButtonBox::Apply | QDialogButtonBox::Close, Qt::Horizontal, &themeSelectorWindow);
|
||||
form.addRow(&buttonBox);
|
||||
connect(&buttonBox, &QDialogButtonBox::clicked, [&themeSelectorWindow, &buttonBox, themeSelector, this](QAbstractButton *button){
|
||||
if (button == buttonBox.button(QDialogButtonBox::Apply)) {
|
||||
QString theme = themeSelector->currentText();
|
||||
if (theme == "default") {
|
||||
setStyleSheet("");
|
||||
return;
|
||||
}
|
||||
|
||||
QFile File(QString(":/themes/%1.qss").arg(theme));
|
||||
File.open(QFile::ReadOnly);
|
||||
QString stylesheet = QLatin1String(File.readAll());
|
||||
setStyleSheet(stylesheet);
|
||||
}
|
||||
});
|
||||
connect(&buttonBox, SIGNAL(rejected()), &themeSelectorWindow, SLOT(reject()));
|
||||
|
||||
themeSelectorWindow.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_AddCustomHeaderField_clicked()
|
||||
{
|
||||
int rowIndex = this->ui->tableWidget_CustomHeaderFields->rowCount();
|
||||
|
|
Loading…
Reference in a new issue