Merge pull request #4667
bbad683
[Qt] simplify return code and return values in txtablemodel (Philip Kaufmann)21f1516
[Qt] add all used colors in txtablemodel to guiconstants (Philip Kaufmann)
This commit is contained in:
commit
7fd8813675
2 changed files with 16 additions and 19 deletions
|
@ -23,6 +23,12 @@ static const int STATUSBAR_ICONSIZE = 16;
|
||||||
#define COLOR_NEGATIVE QColor(255, 0, 0)
|
#define COLOR_NEGATIVE QColor(255, 0, 0)
|
||||||
/* Transaction list -- bare address (without label) */
|
/* Transaction list -- bare address (without label) */
|
||||||
#define COLOR_BAREADDRESS QColor(140, 140, 140)
|
#define COLOR_BAREADDRESS QColor(140, 140, 140)
|
||||||
|
/* Transaction list -- TX status decoration - open until date */
|
||||||
|
#define COLOR_TX_STATUS_OPENUNTILDATE QColor(64, 64, 255)
|
||||||
|
/* Transaction list -- TX status decoration - offline */
|
||||||
|
#define COLOR_TX_STATUS_OFFLINE QColor(192, 192, 192)
|
||||||
|
/* Transaction list -- TX status decoration - default color */
|
||||||
|
#define COLOR_BLACK QColor(0, 0, 0)
|
||||||
|
|
||||||
/* Tooltips longer than this (in characters) are converted into rich text,
|
/* Tooltips longer than this (in characters) are converted into rich text,
|
||||||
so that they can be word-wrapped.
|
so that they can be word-wrapped.
|
||||||
|
|
|
@ -209,10 +209,7 @@ public:
|
||||||
}
|
}
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
else
|
return 0;
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString describe(TransactionRecord *rec, int unit)
|
QString describe(TransactionRecord *rec, int unit)
|
||||||
|
@ -225,7 +222,7 @@ public:
|
||||||
return TransactionDesc::toHTML(wallet, mi->second, rec, unit);
|
return TransactionDesc::toHTML(wallet, mi->second, rec, unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QString("");
|
return QString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -330,10 +327,7 @@ QString TransactionTableModel::formatTxDate(const TransactionRecord *wtx) const
|
||||||
{
|
{
|
||||||
return GUIUtil::dateTimeStr(wtx->time);
|
return GUIUtil::dateTimeStr(wtx->time);
|
||||||
}
|
}
|
||||||
else
|
return QString();
|
||||||
{
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up address in address book, if found return label (address)
|
/* Look up address in address book, if found return label (address)
|
||||||
|
@ -345,11 +339,11 @@ QString TransactionTableModel::lookupAddress(const std::string &address, bool to
|
||||||
QString description;
|
QString description;
|
||||||
if(!label.isEmpty())
|
if(!label.isEmpty())
|
||||||
{
|
{
|
||||||
description += label + QString(" ");
|
description += label;
|
||||||
}
|
}
|
||||||
if(label.isEmpty() || tooltip)
|
if(label.isEmpty() || tooltip)
|
||||||
{
|
{
|
||||||
description += QString("(") + QString::fromStdString(address) + QString(")");
|
description += QString(" (") + QString::fromStdString(address) + QString(")");
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
@ -389,7 +383,6 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
|
||||||
default:
|
default:
|
||||||
return QIcon(":/icons/tx_inout");
|
return QIcon(":/icons/tx_inout");
|
||||||
}
|
}
|
||||||
return QVariant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
|
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
|
||||||
|
@ -456,9 +449,9 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||||
{
|
{
|
||||||
case TransactionStatus::OpenUntilBlock:
|
case TransactionStatus::OpenUntilBlock:
|
||||||
case TransactionStatus::OpenUntilDate:
|
case TransactionStatus::OpenUntilDate:
|
||||||
return QColor(64,64,255);
|
return COLOR_TX_STATUS_OPENUNTILDATE;
|
||||||
case TransactionStatus::Offline:
|
case TransactionStatus::Offline:
|
||||||
return QColor(192,192,192);
|
return COLOR_TX_STATUS_OFFLINE;
|
||||||
case TransactionStatus::Unconfirmed:
|
case TransactionStatus::Unconfirmed:
|
||||||
return QIcon(":/icons/transaction_0");
|
return QIcon(":/icons/transaction_0");
|
||||||
case TransactionStatus::Confirming:
|
case TransactionStatus::Confirming:
|
||||||
|
@ -482,8 +475,9 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||||
case TransactionStatus::MaturesWarning:
|
case TransactionStatus::MaturesWarning:
|
||||||
case TransactionStatus::NotAccepted:
|
case TransactionStatus::NotAccepted:
|
||||||
return QIcon(":/icons/transaction_0");
|
return QIcon(":/icons/transaction_0");
|
||||||
|
default:
|
||||||
|
return COLOR_BLACK;
|
||||||
}
|
}
|
||||||
return QColor(0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
|
QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
|
||||||
|
@ -646,10 +640,7 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
|
||||||
{
|
{
|
||||||
return createIndex(row, column, priv->index(row));
|
return createIndex(row, column, priv->index(row));
|
||||||
}
|
}
|
||||||
else
|
return QModelIndex();
|
||||||
{
|
|
||||||
return QModelIndex();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionTableModel::updateDisplayUnit()
|
void TransactionTableModel::updateDisplayUnit()
|
||||||
|
|
Loading…
Reference in a new issue