mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
CSS-loader refactored for ease of maintenance
This commit is contained in:
parent
a8b42a0dd4
commit
34c0bd3c1b
@ -33,7 +33,6 @@
|
||||
#include <QDateTime>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
#include <QListWidget>
|
||||
@ -73,16 +72,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
|
||||
spinnerFrame(0)
|
||||
{
|
||||
/* Open CSS when configured */
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
this->setStyleSheet(GUIUtil::loadStyleSheet());
|
||||
|
||||
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <QCheckBox>
|
||||
#include <QCursor>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFile>
|
||||
#include <QFlags>
|
||||
#include <QIcon>
|
||||
#include <QSettings>
|
||||
@ -42,16 +41,7 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
/* Open CSS when configured */
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
this->setStyleSheet(GUIUtil::loadStyleSheet());
|
||||
|
||||
// context menu actions
|
||||
QAction *copyAddressAction = new QAction(tr("Copy address"), this);
|
||||
|
17
src/qt/guiutil.cpp
Normal file → Executable file
17
src/qt/guiutil.cpp
Normal file → Executable file
@ -763,6 +763,23 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize,
|
||||
parent->move(pos);
|
||||
}
|
||||
|
||||
// Open CSS when configured
|
||||
QString loadStyleSheet()
|
||||
{
|
||||
QString styleSheet;
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
styleSheet = QLatin1String(qFile.readAll());
|
||||
}
|
||||
}
|
||||
return styleSheet;
|
||||
}
|
||||
|
||||
void setClipboard(const QString& str)
|
||||
{
|
||||
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
|
||||
|
3
src/qt/guiutil.h
Normal file → Executable file
3
src/qt/guiutil.h
Normal file → Executable file
@ -176,6 +176,9 @@ namespace GUIUtil
|
||||
/** Restore window size and position */
|
||||
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);
|
||||
|
||||
/** Load global CSS theme */
|
||||
QString loadStyleSheet();
|
||||
|
||||
/* Convert QString to OS specific boost path through UTF-8 */
|
||||
boost::filesystem::path qstringToBoostPath(const QString &path);
|
||||
|
||||
|
13
src/qt/transactiondescdialog.cpp
Normal file → Executable file
13
src/qt/transactiondescdialog.cpp
Normal file → Executable file
@ -2,13 +2,13 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "guiutil.h"
|
||||
#include "transactiondescdialog.h"
|
||||
#include "ui_transactiondescdialog.h"
|
||||
|
||||
#include "transactiontablemodel.h"
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
|
||||
@ -19,16 +19,7 @@ TransactionDescDialog::TransactionDescDialog(const QModelIndex &idx, QWidget *pa
|
||||
ui->setupUi(this);
|
||||
|
||||
/* Open CSS when configured */
|
||||
QSettings settings;
|
||||
QString theme = settings.value("theme", "").toString();
|
||||
if(!theme.isEmpty()){
|
||||
// QFile qFile(":/css/drkblue");
|
||||
QFile qFile(theme); // for development only
|
||||
if (qFile.open(QFile::ReadOnly)) {
|
||||
QString styleSheet = QLatin1String(qFile.readAll());
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
this->setStyleSheet(GUIUtil::loadStyleSheet());
|
||||
|
||||
QString desc = idx.data(TransactionTableModel::LongDescriptionRole).toString();
|
||||
ui->detailText->setHtml(desc);
|
||||
|
Loading…
Reference in New Issue
Block a user