Skip to content

Commit

Permalink
merged with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Jun 9, 2016
2 parents b76304e + de64f11 commit d8f8709
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 33 deletions.
83 changes: 50 additions & 33 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define ICON_OFFSET 16
#define DECORATION_SIZE 54
#define NUM_ITEMS 5
#define NUM_ITEMS_ADV 7

class TxViewDelegate : public QAbstractItemDelegate
{
Expand Down Expand Up @@ -93,7 +94,7 @@ class TxViewDelegate : public QAbstractItemDelegate
foreground = option.palette.color(QPalette::Text);
}
painter->setPen(foreground);
QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true, BitcoinUnits::separatorAlways);
QString amountText = BitcoinUnits::floorWithUnit(unit, amount, true, BitcoinUnits::separatorAlways);
if(!confirmed)
{
amountText = QString("[") + amountText + QString("]");
Expand Down Expand Up @@ -137,7 +138,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
// Recent transactions
ui->listTransactions->setItemDelegate(txdelegate);
ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE));
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
// Note: minimum height of listTransactions will be set later in updateAdvancedPSUI() to reflect actual settings
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);

connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
Expand All @@ -147,29 +148,32 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
ui->labelPrivateSendSyncStatus->setText("(" + tr("out of sync") + ")");
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");

if(fLiteMode){
ui->framePrivateSend->setVisible(false);
// hide PS frame (helps to preserve saved size)
// we'll setup and make it visible in updateAdvancedPSUI() later if we are not in litemode
ui->framePrivateSend->setVisible(false);

// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);

// that's it for litemode
if(fLiteMode) return;

// disable any PS UI for masternode
if(fMasterNode){
ui->togglePrivateSend->setText("(" + tr("Disabled") + ")");
ui->privateSendAuto->setText("(" + tr("Disabled") + ")");
ui->privateSendReset->setText("(" + tr("Disabled") + ")");
ui->framePrivateSend->setEnabled(false);
} else {
updateAdvancedPSUI(false);
if(fMasterNode){
ui->togglePrivateSend->setText("(" + tr("Disabled") + ")");
ui->privateSendAuto->setText("(" + tr("Disabled") + ")");
ui->privateSendReset->setText("(" + tr("Disabled") + ")");
ui->framePrivateSend->setEnabled(false);
if(!fEnablePrivateSend){
ui->togglePrivateSend->setText(tr("Start Mixing"));
} else {
if(!fEnablePrivateSend){
ui->togglePrivateSend->setText(tr("Start Mixing"));
} else {
ui->togglePrivateSend->setText(tr("Stop Mixing"));
}
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(privateSendStatus()));
timer->start(1000);
ui->togglePrivateSend->setText(tr("Stop Mixing"));
}
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(privateSendStatus()));
timer->start(1000);
}

// start with displaying the "out of sync" warnings
showOutOfSyncWarning(true);
}

void OverviewPage::handleTransactionClicked(const QModelIndex &index)
Expand Down Expand Up @@ -260,18 +264,6 @@ void OverviewPage::setWalletModel(WalletModel *model)
this->walletModel = model;
if(model && model->getOptionsModel())
{
// Set up transaction list
filter = new TransactionFilterProxy();
filter->setSourceModel(model->getTransactionTableModel());
filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
filter->setShowInactive(false);
filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);

ui->listTransactions->setModel(filter);
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);

// Keep up to date with wallet
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance(), model->getAnonymizedBalance(),
model->getWatchBalance(), model->getWatchUnconfirmedBalance(), model->getWatchImmatureBalance());
Expand All @@ -281,6 +273,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
connect(model->getOptionsModel(), SIGNAL(privateSendRoundsChanged()), this, SLOT(updatePrivateSendProgress()));
connect(model->getOptionsModel(), SIGNAL(anonymizeDashAmountChanged()), this, SLOT(updatePrivateSendProgress()));
connect(model->getOptionsModel(), SIGNAL(advancedPSUIChanged(bool)), this, SLOT(updateAdvancedPSUI(bool)));
// explicitly update PS frame and transaction list to reflect actual settings
updateAdvancedPSUI(model->getOptionsModel()->getShowAdvancedPSUI());

connect(ui->privateSendAuto, SIGNAL(clicked()), this, SLOT(privateSendAuto()));
Expand Down Expand Up @@ -431,6 +424,12 @@ void OverviewPage::updatePrivateSendProgress()
}

void OverviewPage::updateAdvancedPSUI(bool fShowAdvancedPSUI) {
int nNumItems = (fLiteMode || !fShowAdvancedPSUI) ? NUM_ITEMS : NUM_ITEMS_ADV;
SetupTransactionList(nNumItems);

if (fLiteMode) return;

ui->framePrivateSend->setVisible(true);
ui->labelCompletitionText->setVisible(fShowAdvancedPSUI);
ui->privateSendProgress->setVisible(fShowAdvancedPSUI);
ui->labelSubmittedDenomText->setVisible(fShowAdvancedPSUI);
Expand Down Expand Up @@ -565,3 +564,21 @@ void OverviewPage::togglePrivateSend(){

}
}

void OverviewPage::SetupTransactionList(int nNumItems) {
ui->listTransactions->setMinimumHeight(nNumItems * (DECORATION_SIZE + 2));

if(walletModel && walletModel->getOptionsModel()) {
// Set up transaction list
filter = new TransactionFilterProxy();
filter->setSourceModel(walletModel->getTransactionTableModel());
filter->setLimit(nNumItems);
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
filter->setShowInactive(false);
filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);

ui->listTransactions->setModel(filter);
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
}
}
2 changes: 2 additions & 0 deletions src/qt/overviewpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public Q_SLOTS:
TxViewDelegate *txdelegate;
TransactionFilterProxy *filter;

void SetupTransactionList(int nNumItems);

private Q_SLOTS:
void togglePrivateSend();
void privateSendAuto();
Expand Down
Binary file modified src/qt/res/icons/crownium/masternodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,18 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
case TransactionRecord::Darksent:
case TransactionRecord::RecvWithDarksend:
{
QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address));
if(label.isEmpty())
return COLOR_BAREADDRESS;
} break;
case TransactionRecord::SendToSelf:
case TransactionRecord::DarksendCreateDenominations:
case TransactionRecord::DarksendDenominate:
case TransactionRecord::DarksendMakeCollaterals:
case TransactionRecord::DarksendCollateralPayment:
return COLOR_BAREADDRESS;
default:
break;
Expand Down

0 comments on commit d8f8709

Please sign in to comment.