Theme selector added to options-page
This commit is contained in:
parent
25ccc86acd
commit
6d58449987
@ -72,12 +72,16 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
|
||||
prevBlocks(0),
|
||||
spinnerFrame(0)
|
||||
{
|
||||
/* Open default CSS */
|
||||
/* Open CSS when configured */
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile("drkblue.css"); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
|
||||
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
|
||||
|
16
src/qt/coincontroldialog.cpp
Normal file → Executable file
16
src/qt/coincontroldialog.cpp
Normal file → Executable file
@ -24,6 +24,7 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFlags>
|
||||
#include <QIcon>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
@ -38,12 +39,17 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
||||
model(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
/* Open default CSS */
|
||||
|
||||
/* Open CSS when configured */
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile("drkblue.css"); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
|
||||
// context menu actions
|
||||
|
18
src/qt/forms/optionsdialog.ui
Normal file → Executable file
18
src/qt/forms/optionsdialog.ui
Normal file → Executable file
@ -482,6 +482,20 @@
|
||||
<string>&Display</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_Display">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4_Display" stretch="0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="themeLabel">
|
||||
<property name="text">
|
||||
<string>User Interface Theme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QValueComboBox" name="theme"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1_Display">
|
||||
<item>
|
||||
@ -531,7 +545,7 @@ https://www.transifex.com/projects/p/darkcoin/</string>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -601,7 +615,7 @@ https://www.transifex.com/projects/p/darkcoin/</string>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_Display">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
8
src/qt/optionsdialog.cpp
Normal file → Executable file
8
src/qt/optionsdialog.cpp
Normal file → Executable file
@ -69,6 +69,12 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
#endif
|
||||
|
||||
/* Display elements init */
|
||||
|
||||
/* Theme selector */
|
||||
ui->theme->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
|
||||
ui->theme->addItem(QString("DRK-blue"), QVariant("drkblue.css")); // ToDo: remove .css when we finally use resources
|
||||
|
||||
/* Language selector */
|
||||
QDir translations(":translations");
|
||||
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
|
||||
foreach(const QString &langStr, translations.entryList())
|
||||
@ -154,6 +160,7 @@ void OptionsDialog::setModel(OptionsModel *model)
|
||||
/* Network */
|
||||
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
|
||||
/* Display */
|
||||
connect(ui->theme, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
|
||||
}
|
||||
@ -185,6 +192,7 @@ void OptionsDialog::setMapper()
|
||||
#endif
|
||||
|
||||
/* Display */
|
||||
mapper->addMapping(ui->theme, OptionsModel::Theme);
|
||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
||||
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
|
||||
|
10
src/qt/optionsmodel.cpp
Normal file → Executable file
10
src/qt/optionsmodel.cpp
Normal file → Executable file
@ -138,6 +138,8 @@ void OptionsModel::Init()
|
||||
addOverriddenOption("-socks");
|
||||
|
||||
// Display
|
||||
if (!settings.contains("theme"))
|
||||
settings.setValue("theme", "");
|
||||
if (!settings.contains("language"))
|
||||
settings.setValue("language", "");
|
||||
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
|
||||
@ -224,6 +226,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
return bDisplayAddresses;
|
||||
case ThirdPartyTxUrls:
|
||||
return strThirdPartyTxUrls;
|
||||
case Theme:
|
||||
return settings.value("theme");
|
||||
case Language:
|
||||
return settings.value("language");
|
||||
case CoinControlFeatures:
|
||||
@ -336,6 +340,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
setRestartRequired(true);
|
||||
}
|
||||
break;
|
||||
case Theme:
|
||||
if (settings.value("theme") != value) {
|
||||
settings.setValue("theme", value);
|
||||
setRestartRequired(true);
|
||||
}
|
||||
break;
|
||||
case Language:
|
||||
if (settings.value("language") != value) {
|
||||
settings.setValue("language", value);
|
||||
|
1
src/qt/optionsmodel.h
Normal file → Executable file
1
src/qt/optionsmodel.h
Normal file → Executable file
@ -37,6 +37,7 @@ public:
|
||||
DisplayUnit, // BitcoinUnits::Unit
|
||||
DisplayAddresses, // bool
|
||||
ThirdPartyTxUrls, // QString
|
||||
Theme, // QString
|
||||
Language, // QString
|
||||
CoinControlFeatures, // bool
|
||||
ThreadsScriptVerif, // int
|
||||
|
Loading…
Reference in New Issue
Block a user