mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
qt: Introduce PlatformStyle
Introduce a PlatformStyle to handle platform-specific customization of the UI. This replaces 'scicon', as well as #ifdefs to determine whether to place icons on buttons. The selected PlatformStyle defaults to the platform that the application was compiled on, but can be overridden from the command line with `-uiplatform=<x>`. Also fixes the warning from #6328.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "coincontroldialog.h"
|
||||
#include "guiutil.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "scicon.h"
|
||||
#include "platformstyle.h"
|
||||
#include "sendcoinsentry.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
@@ -27,25 +27,26 @@
|
||||
#include <QSettings>
|
||||
#include <QTextDocument>
|
||||
|
||||
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
|
||||
SendCoinsDialog::SendCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SendCoinsDialog),
|
||||
clientModel(0),
|
||||
model(0),
|
||||
fNewRecipientAllowed(true),
|
||||
fFeeMinimized(true)
|
||||
fFeeMinimized(true),
|
||||
platformStyle(platformStyle)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
|
||||
ui->addButton->setIcon(QIcon());
|
||||
ui->clearButton->setIcon(QIcon());
|
||||
ui->sendButton->setIcon(QIcon());
|
||||
#else
|
||||
ui->addButton->setIcon(SingleColorIcon(":/icons/add"));
|
||||
ui->clearButton->setIcon(SingleColorIcon(":/icons/remove"));
|
||||
ui->sendButton->setIcon(SingleColorIcon(":/icons/send"));
|
||||
#endif
|
||||
if (!platformStyle->getImagesOnButtons()) {
|
||||
ui->addButton->setIcon(QIcon());
|
||||
ui->clearButton->setIcon(QIcon());
|
||||
ui->sendButton->setIcon(QIcon());
|
||||
} else {
|
||||
ui->addButton->setIcon(platformStyle->SingleColorIcon(":/icons/add"));
|
||||
ui->clearButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove"));
|
||||
ui->sendButton->setIcon(platformStyle->SingleColorIcon(":/icons/send"));
|
||||
}
|
||||
|
||||
GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this);
|
||||
|
||||
@@ -364,7 +365,7 @@ void SendCoinsDialog::accept()
|
||||
|
||||
SendCoinsEntry *SendCoinsDialog::addEntry()
|
||||
{
|
||||
SendCoinsEntry *entry = new SendCoinsEntry(this);
|
||||
SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this);
|
||||
entry->setModel(model);
|
||||
ui->entries->addWidget(entry);
|
||||
connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*)));
|
||||
@@ -711,7 +712,7 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
|
||||
// Coin Control: button inputs -> show actual coin control dialog
|
||||
void SendCoinsDialog::coinControlButtonClicked()
|
||||
{
|
||||
CoinControlDialog dlg;
|
||||
CoinControlDialog dlg(platformStyle);
|
||||
dlg.setModel(model);
|
||||
dlg.exec();
|
||||
coinControlUpdateLabels();
|
||||
|
||||
Reference in New Issue
Block a user