diff --git a/about.ui b/about.ui
index 50493c72..b2bdf105 100644
--- a/about.ui
+++ b/about.ui
@@ -231,6 +231,11 @@ p, li { white-space: pre-wrap; }
QListView::ListMode
+ -
+
+ Simple light and dark color theme option
+
+
-
Filename suggestion for Exports
diff --git a/bcsettings.cpp b/bcsettings.cpp
index 69012c55..bd497d91 100644
--- a/bcsettings.cpp
+++ b/bcsettings.cpp
@@ -19,7 +19,8 @@
#include
#include
#include
-
+#include
+#include
BCSettings *BCSettings::instance()
{
@@ -117,4 +118,35 @@ void BCSettings::restoreDefaultSettings()
settings->setValue(SETTINGS::SCALE, 1.00);
settings->setValue(SETTINGS::AUTOGROWTH, true);
settings->setValue(SETTINGS::USENATIVEDIALOGS, false);
+ settings->setValue(SETTINGS::COLORSCHEME, 0);
+}
+QPalette BCSettings::paletteForSetting()
+{
+ int index = settings->value(SETTINGS::COLORSCHEME).toInt();
+ QPalette newPalette;
+ if( index == 0)
+ newPalette = qApp->style()->standardPalette();
+ else {
+ newPalette.setColor(QPalette::Window, index == 1 ? darkWindow : lightWindow);
+ newPalette.setColor(QPalette::Base, index == 1 ? darkButton : lightButton);
+ newPalette.setColor(QPalette::Text, index == 1 ? darkText : lightText);
+ newPalette.setColor(QPalette::AlternateBase, index == 1 ? darkWindow : lightWindow);
+ newPalette.setColor(QPalette::WindowText, index == 1 ? darkText : lightText);
+ newPalette.setColor(QPalette::Button, index == 1 ? darkButton : lightButton);
+ newPalette.setColor(QPalette::ButtonText,index == 1 ? darkText : lightText);
+ newPalette.setColor(QPalette::PlaceholderText, index == 1 ? darkPlaceholderText : lightPlaceholderText);
+ newPalette.setColor(QPalette::Disabled, QPalette::Button, index == 1 ? darkDisableButton : lightDisableButton);
+ newPalette.setColor(QPalette::Disabled, QPalette::Window, index == 1 ? darkDisableButton : lightDisableButton);
+ newPalette.setColor(QPalette::Disabled, QPalette::WindowText, index == 1 ? darkInactiveText : lightInactiveText);
+ newPalette.setColor(QPalette::Disabled,QPalette::ButtonText, index == 1 ? darkInactiveText : lightInactiveText);
+ newPalette.setColor(QPalette::ToolTipBase, index == 1 ? darkText : lightText);
+ newPalette.setColor(QPalette::ToolTipText, index == 1 ? darkWindow : lightWindow);
+ newPalette.setColor(QPalette::Highlight,index == 1 ? darkHighlight : lightHighlight);
+ newPalette.setColor(QPalette::HighlightedText, index == 1 ? darkWindow : lightWindow);
+ newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, index == 1 ? darkButton : lightButton);
+ newPalette.setColor(QPalette::Active, QPalette::Text, index == 1 ? darkText : lightText);
+ newPalette.setColor(QPalette::Link, index == 1 ? darkLink : lightLink);
+ newPalette.setColor(QPalette::LinkVisited, index == 1 ? darkInactiveText : lightInactiveText);
+ }
+ return newPalette;
}
diff --git a/bcsettings.h b/bcsettings.h
index fcc6cf71..61960fad 100644
--- a/bcsettings.h
+++ b/bcsettings.h
@@ -14,6 +14,7 @@
// GNU General Public License for more details. //
/****************************************************************************/
#pragma once
+#include
#include
#include
#include
@@ -40,6 +41,7 @@ namespace SETTINGS {
inline const static QString WORLDMAPADVANCED = QStringLiteral("worldMapAdvanced");
inline const static QString USENATIVEDIALOGS = QStringLiteral("useNativeDialogs");
inline const static QString SIDEBARURLS = QStringLiteral("sidebarUrls");
+ inline const static QString COLORSCHEME = QStringLiteral("colorScheme");
}
class BCSettings : public QObject
@@ -50,6 +52,7 @@ class BCSettings : public QObject
void setValue(const QString &setting = QString(), const QVariant &value = QVariant());
QVariant value(const QString &setting = QString(), const QVariant &defaultValue = QVariant());
void restoreDefaultSettings();
+ QPalette paletteForSetting();
signals:
void settingsChanged();
private:
@@ -61,27 +64,47 @@ class BCSettings : public QObject
void cleanSettings();
QSettings *settings = nullptr;
inline static const QStringList validSettingsNames = {
- SETTINGS::MAINGEOMETRY,
- SETTINGS::AUTOGROWTH,
- SETTINGS::CHARADVANCED,
- SETTINGS::STATFOLDER,
- SETTINGS::CHOCOADVANCED,
- SETTINGS::DEFAULTSAVE,
- SETTINGS::EDITABLECOMBOS,
- SETTINGS::PROGRESSADVANCED,
- SETTINGS::LANG,
- SETTINGS::LANGPATH,
- SETTINGS::LOADPATH,
- SETTINGS::LOCVIEWADVANCED,
- SETTINGS::ALWAYSSHOWCONTROLLERMAP,
- SETTINGS::CUSTOMDEFAULTSAVE,
- SETTINGS::REGION,
- SETTINGS::EMUSAVEPATH,
- SETTINGS::PCSAVEPATH,
- SETTINGS::SCALE,
- SETTINGS::ENABLETEST,
- SETTINGS::WORLDMAPADVANCED,
- SETTINGS::USENATIVEDIALOGS,
- SETTINGS::SIDEBARURLS
- };
+ SETTINGS::MAINGEOMETRY,
+ SETTINGS::AUTOGROWTH,
+ SETTINGS::CHARADVANCED,
+ SETTINGS::STATFOLDER,
+ SETTINGS::CHOCOADVANCED,
+ SETTINGS::DEFAULTSAVE,
+ SETTINGS::EDITABLECOMBOS,
+ SETTINGS::PROGRESSADVANCED,
+ SETTINGS::LANG,
+ SETTINGS::LANGPATH,
+ SETTINGS::LOADPATH,
+ SETTINGS::LOCVIEWADVANCED,
+ SETTINGS::ALWAYSSHOWCONTROLLERMAP,
+ SETTINGS::CUSTOMDEFAULTSAVE,
+ SETTINGS::REGION,
+ SETTINGS::EMUSAVEPATH,
+ SETTINGS::PCSAVEPATH,
+ SETTINGS::SCALE,
+ SETTINGS::ENABLETEST,
+ SETTINGS::WORLDMAPADVANCED,
+ SETTINGS::USENATIVEDIALOGS,
+ SETTINGS::SIDEBARURLS,
+ SETTINGS::COLORSCHEME,
+ };
+ //Theme Colors
+ inline static const QColor lightWindow = QColor(252, 252, 252);
+ inline static const QColor lightDisableWindow = QColor(192, 192, 192);
+ inline static const QColor lightText = QColor(35, 38, 39);
+ inline static const QColor lightButton = QColor(239, 240, 241);
+ inline static const QColor lightDisableButton = QColor(180, 181, 182);
+ inline static const QColor lightHighlight = QColor(61,174,233);
+ inline static const QColor lightInactiveText = QColor(127,140,141);
+ inline static const QColor lightLink = QColor(41, 128, 185);
+ inline static const QColor lightPlaceholderText = QColor(96, 96, 96);
+ inline static const QColor darkWindow = QColor(35, 38, 41);
+ inline static const QColor darkDisableWindow = QColor(100, 100, 100);
+ inline static const QColor darkText = QColor(239, 240, 241);
+ inline static const QColor darkDisableButton = QColor(67, 74, 81);
+ inline static const QColor darkButton = QColor(49, 54, 59);
+ inline static const QColor darkHighlight = QColor(61,174,233);
+ inline static const QColor darkInactiveText = QColor(189, 195, 199);
+ inline static const QColor darkLink = QColor(41, 128, 185);
+ inline static const QColor darkPlaceholderText = QColor(196, 196, 196);
};
diff --git a/main.cpp b/main.cpp
index e2444b71..6ae5278b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -19,6 +19,7 @@
#include
#include
#include
+#include "bcsettings.h"
#include "mainwindow.h"
#if defined(STATIC) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
@@ -47,7 +48,8 @@ int main(int argc, char *argv[])
#ifndef Q_OS_LINUX
a.setStyle(QStyleFactory::create("Fusion"));
#endif
- a.setAttribute(Qt::AA_DontUseNativeDialogs);
+ a.setPalette(BCSettings::instance()->paletteForSetting());
+ a.setAttribute(Qt::AA_DontUseNativeDialogs, !BCSettings::instance()->value(SETTINGS::USENATIVEDIALOGS).toBool());
a.setApplicationName("Black Chocobo");
a.setApplicationVersion(version.toString());
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 14fadead..e5582fc8 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -428,17 +428,21 @@ MainWindow::~MainWindow()
void MainWindow::changeEvent(QEvent *e)
{
- if (e->type() != QEvent::LanguageChange)
- return;
-
- ui->retranslateUi(this);
- ui->tabWidget->setTabText(3, tr("Chocobo"));
- ui->tabWidget->setTabText(7, tr("Game Options"));
- populateCombos();
- materiaupdate();
- updateStolenMateria();
- if (ui->psxExtras->isVisible())
- update_hexEditor_PSXInfo();
+ if (e->type() == QEvent::PaletteChange) {
+ QPalette palette = BCSettings::instance()->paletteForSetting();
+ for (QWidget * widget : findChildren(QString(), Qt::FindChildrenRecursively))
+ widget->setPalette(palette);
+ hexEditor->setAddressAreaColor(palette.alternateBase().color());
+ } else if (e->type() == QEvent::LanguageChange) {
+ ui->retranslateUi(this);
+ ui->tabWidget->setTabText(3, tr("Chocobo"));
+ ui->tabWidget->setTabText(7, tr("Game Options"));
+ populateCombos();
+ materiaupdate();
+ updateStolenMateria();
+ if (ui->psxExtras->isVisible())
+ update_hexEditor_PSXInfo();
+ }
}
void MainWindow::dragEnterEvent(QDragEnterEvent *e)
{
diff --git a/options.cpp b/options.cpp
index 7c422fcf..3b7948f3 100644
--- a/options.cpp
+++ b/options.cpp
@@ -46,8 +46,8 @@ Options::Options(QWidget *parent) : QDialog(parent)
translator->load(translation, dir.absolutePath());
QString lang = translation.mid(7, 2);
ui->comboLanguage->addItem(translator->translate("MainWindow", "TRANSLATE TO YOUR LANGUAGE NAME"), lang);
- ui->comboLanguage->setCurrentIndex(ui->comboLanguage->findData(BCSettings::instance()->value(SETTINGS::LANG, QStringLiteral("en"))));
}
+ ui->comboLanguage->setCurrentIndex(ui->comboLanguage->findData(BCSettings::instance()->value(SETTINGS::LANG, QStringLiteral("en"))));
ui->comboLanguage->setVisible(ui->comboLanguage->count());
ui->lblLanguage->setVisible(ui->comboLanguage->count());
@@ -117,6 +117,7 @@ void Options::loadSettings()
ui->comboLanguage->setCurrentIndex(ui->comboLanguage->findData(BCSettings::instance()->value(SETTINGS::LANG)));
ui->cbNativeDialogs->setChecked(BCSettings::instance()->value(SETTINGS::USENATIVEDIALOGS).toBool());
ui->btnEditSideBarItems->setVisible(!ui->cbNativeDialogs->isChecked());
+ ui->comboColorScheme->setCurrentIndex(BCSettings::instance()->value(SETTINGS::COLORSCHEME).toInt());
}
void Options::saveSettings()
@@ -140,6 +141,7 @@ void Options::saveSettings()
BCSettings::instance()->setValue(SETTINGS::AUTOGROWTH, ui->cbAutoGrowth->isChecked());
BCSettings::instance()->setValue(SETTINGS::LANG, ui->comboLanguage->currentData());
BCSettings::instance()->setValue(SETTINGS::USENATIVEDIALOGS, ui->cbNativeDialogs->isChecked());
+ BCSettings::instance()->setValue(SETTINGS::COLORSCHEME, ui->comboColorScheme->currentIndex());
}
void Options::restoreDefaultSettings()
@@ -222,3 +224,9 @@ void Options::on_btnEditSideBarItems_clicked()
{
BCDialog::editSideBarPaths(this);
}
+
+void Options::on_comboColorScheme_currentIndexChanged(int index)
+{
+ BCSettings::instance()->setValue(SETTINGS::COLORSCHEME, index);
+ qApp->setPalette(BCSettings::instance()->paletteForSetting());
+}
diff --git a/options.h b/options.h
index 81c90c89..1a85bfbd 100644
--- a/options.h
+++ b/options.h
@@ -48,10 +48,11 @@ private slots:
void on_comboLanguage_currentIndexChanged(const QString &arg1);
void on_cbNativeDialogs_clicked(bool checked);
void on_btnEditSideBarItems_clicked();
+ void on_comboColorScheme_currentIndexChanged(int index);
+
private:
Ui::Options *ui;
void loadSettings();
void saveSettings();
void restoreDefaultSettings();
- void updateSettings();
};
diff --git a/options.ui b/options.ui
index 4b05cddf..678a71ac 100644
--- a/options.ui
+++ b/options.ui
@@ -10,7 +10,7 @@
0
0
820
- 610
+ 636
@@ -266,28 +266,99 @@
-
-
-
-
-
-
- Use Native File Dialogs
+
+
+ 6
+
+
-
+
+
+ 0
-
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 25
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ Application Language
+
+
+
+
- -
-
+
-
+
-
+
0
0
-
-
+
+ Use Native File Dialogs
- -
+
-
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 25
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ New Game Default Region
+
+
+
+
+
+ -
@@ -332,49 +403,70 @@
- -
-
-
- 0
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Edit the Places show in sidebar on file dialogs
+
+
+ Edit Places
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
-
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 25
- 20
-
-
-
+
+ System Theme
+
-
-
-
-
- 0
- 0
-
-
-
- New Game Default Region
-
-
+
+ Dark Theme
+
-
+ -
+
+ Light Theme
+
+
+
- -
-
+
-
+
0
-
-
+
Qt::Horizontal
@@ -390,7 +482,7 @@
-
-
+
0
@@ -401,28 +493,12 @@
- Application Language
+ Application Color Scheme
- -
-
-
-
- 0
- 0
-
-
-
- Edit the Places show in sidebar on file dialogs
-
-
- Edit Places
-
-
-