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:
Wladimir J. van der Laan
2015-07-28 15:20:14 +02:00
parent 1369d699b6
commit eec7757445
37 changed files with 462 additions and 318 deletions

View File

@@ -8,7 +8,7 @@
#include "guiconstants.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "scicon.h"
#include "platformstyle.h"
#include "transactiondesc.h"
#include "transactionrecord.h"
#include "walletmodel.h"
@@ -222,12 +222,13 @@ public:
}
};
TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *parent):
TransactionTableModel::TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent):
QAbstractTableModel(parent),
wallet(wallet),
walletModel(parent),
priv(new TransactionTablePriv(wallet, this)),
fProcessingQueuedTransactions(false)
fProcessingQueuedTransactions(false),
platformStyle(platformStyle)
{
columns << QString() << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
@@ -521,7 +522,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
{
QIcon icon = qvariant_cast<QIcon>(index.data(RawDecorationRole));
return TextColorIcon(icon);
return platformStyle->TextColorIcon(icon);
}
case Qt::DisplayRole:
switch(index.column())