mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
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),
|
prevBlocks(0),
|
||||||
spinnerFrame(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(":/css/drkblue");
|
||||||
QFile qFile("drkblue.css"); // for development only
|
QFile qFile(theme); // for development only
|
||||||
if (qFile.open(QFile::ReadOnly)) {
|
if (qFile.open(QFile::ReadOnly)) {
|
||||||
QString styleSheet = QLatin1String(qFile.readAll());
|
QString styleSheet = QLatin1String(qFile.readAll());
|
||||||
this->setStyleSheet(styleSheet);
|
this->setStyleSheet(styleSheet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
|
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 <QDialogButtonBox>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QSettings>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
@ -38,12 +39,17 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
|||||||
model(0)
|
model(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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(":/css/drkblue");
|
||||||
QFile qFile("drkblue.css"); // for development only
|
QFile qFile(theme); // for development only
|
||||||
if (qFile.open(QFile::ReadOnly)) {
|
if (qFile.open(QFile::ReadOnly)) {
|
||||||
QString styleSheet = QLatin1String(qFile.readAll());
|
QString styleSheet = QLatin1String(qFile.readAll());
|
||||||
this->setStyleSheet(styleSheet);
|
this->setStyleSheet(styleSheet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// context menu actions
|
// 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>
|
<string>&Display</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_Display">
|
<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>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1_Display">
|
<layout class="QHBoxLayout" name="horizontalLayout_1_Display">
|
||||||
<item>
|
<item>
|
||||||
@ -531,7 +545,7 @@ https://www.transifex.com/projects/p/darkcoin/</string>
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -601,7 +615,7 @@ https://www.transifex.com/projects/p/darkcoin/</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_Display">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</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
|
#endif
|
||||||
|
|
||||||
/* Display elements init */
|
/* 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");
|
QDir translations(":translations");
|
||||||
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
|
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
|
||||||
foreach(const QString &langStr, translations.entryList())
|
foreach(const QString &langStr, translations.entryList())
|
||||||
@ -154,6 +160,7 @@ void OptionsDialog::setModel(OptionsModel *model)
|
|||||||
/* Network */
|
/* Network */
|
||||||
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
|
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
|
||||||
/* Display */
|
/* Display */
|
||||||
|
connect(ui->theme, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||||
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
|
||||||
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
|
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
|
||||||
}
|
}
|
||||||
@ -185,6 +192,7 @@ void OptionsDialog::setMapper()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Display */
|
/* Display */
|
||||||
|
mapper->addMapping(ui->theme, OptionsModel::Theme);
|
||||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||||
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
||||||
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
|
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");
|
addOverriddenOption("-socks");
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
|
if (!settings.contains("theme"))
|
||||||
|
settings.setValue("theme", "");
|
||||||
if (!settings.contains("language"))
|
if (!settings.contains("language"))
|
||||||
settings.setValue("language", "");
|
settings.setValue("language", "");
|
||||||
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
|
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
|
||||||
@ -224,6 +226,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
|||||||
return bDisplayAddresses;
|
return bDisplayAddresses;
|
||||||
case ThirdPartyTxUrls:
|
case ThirdPartyTxUrls:
|
||||||
return strThirdPartyTxUrls;
|
return strThirdPartyTxUrls;
|
||||||
|
case Theme:
|
||||||
|
return settings.value("theme");
|
||||||
case Language:
|
case Language:
|
||||||
return settings.value("language");
|
return settings.value("language");
|
||||||
case CoinControlFeatures:
|
case CoinControlFeatures:
|
||||||
@ -336,6 +340,12 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
|||||||
setRestartRequired(true);
|
setRestartRequired(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Theme:
|
||||||
|
if (settings.value("theme") != value) {
|
||||||
|
settings.setValue("theme", value);
|
||||||
|
setRestartRequired(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Language:
|
case Language:
|
||||||
if (settings.value("language") != value) {
|
if (settings.value("language") != value) {
|
||||||
settings.setValue("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
|
DisplayUnit, // BitcoinUnits::Unit
|
||||||
DisplayAddresses, // bool
|
DisplayAddresses, // bool
|
||||||
ThirdPartyTxUrls, // QString
|
ThirdPartyTxUrls, // QString
|
||||||
|
Theme, // QString
|
||||||
Language, // QString
|
Language, // QString
|
||||||
CoinControlFeatures, // bool
|
CoinControlFeatures, // bool
|
||||||
ThreadsScriptVerif, // int
|
ThreadsScriptVerif, // int
|
||||||
|
Loading…
Reference in New Issue
Block a user