Changeset View
Changeset View
Standalone View
Standalone View
src/qt/overviewpage.cpp
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) | ||||
ui->labelWalletStatus->setIcon(icon); | ui->labelWalletStatus->setIcon(icon); | ||||
// Recent transactions | // Recent transactions | ||||
ui->listTransactions->setItemDelegate(txdelegate); | ui->listTransactions->setItemDelegate(txdelegate); | ||||
ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE)); | ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE)); | ||||
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); | ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); | ||||
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); | ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); | ||||
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, | connect(ui->listTransactions, &QListView::clicked, this, | ||||
SLOT(handleTransactionClicked(QModelIndex))); | &OverviewPage::handleTransactionClicked); | ||||
// start with displaying the "out of sync" warnings | // start with displaying the "out of sync" warnings | ||||
showOutOfSyncWarning(true); | showOutOfSyncWarning(true); | ||||
connect(ui->labelWalletStatus, SIGNAL(clicked()), this, | connect(ui->labelWalletStatus, &QPushButton::clicked, this, | ||||
SLOT(handleOutOfSyncWarningClicks())); | &OverviewPage::handleOutOfSyncWarningClicks); | ||||
connect(ui->labelTransactionsStatus, SIGNAL(clicked()), this, | connect(ui->labelTransactionsStatus, &QPushButton::clicked, this, | ||||
SLOT(handleOutOfSyncWarningClicks())); | &OverviewPage::handleOutOfSyncWarningClicks); | ||||
} | } | ||||
void OverviewPage::handleTransactionClicked(const QModelIndex &index) { | void OverviewPage::handleTransactionClicked(const QModelIndex &index) { | ||||
if (filter) Q_EMIT transactionClicked(filter->mapToSource(index)); | if (filter) Q_EMIT transactionClicked(filter->mapToSource(index)); | ||||
} | } | ||||
void OverviewPage::handleOutOfSyncWarningClicks() { | void OverviewPage::handleOutOfSyncWarningClicks() { | ||||
Q_EMIT outOfSyncWarningClicked(); | Q_EMIT outOfSyncWarningClicked(); | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if (!showWatchOnly) { | ||||
ui->labelWatchImmature->hide(); | ui->labelWatchImmature->hide(); | ||||
} | } | ||||
} | } | ||||
void OverviewPage::setClientModel(ClientModel *model) { | void OverviewPage::setClientModel(ClientModel *model) { | ||||
this->clientModel = model; | this->clientModel = model; | ||||
if (model) { | if (model) { | ||||
// Show warning if this is a prerelease version | // Show warning if this is a prerelease version | ||||
connect(model, SIGNAL(alertsChanged(QString)), this, | connect(model, &ClientModel::alertsChanged, this, | ||||
SLOT(updateAlerts(QString))); | &OverviewPage::updateAlerts); | ||||
updateAlerts(model->getStatusBarWarnings()); | updateAlerts(model->getStatusBarWarnings()); | ||||
} | } | ||||
} | } | ||||
void OverviewPage::setWalletModel(WalletModel *model) { | void OverviewPage::setWalletModel(WalletModel *model) { | ||||
this->walletModel = model; | this->walletModel = model; | ||||
if (model && model->getOptionsModel()) { | if (model && model->getOptionsModel()) { | ||||
// Set up transaction list | // Set up transaction list | ||||
filter.reset(new TransactionFilterProxy()); | filter.reset(new TransactionFilterProxy()); | ||||
filter->setSourceModel(model->getTransactionTableModel()); | filter->setSourceModel(model->getTransactionTableModel()); | ||||
filter->setLimit(NUM_ITEMS); | filter->setLimit(NUM_ITEMS); | ||||
filter->setDynamicSortFilter(true); | filter->setDynamicSortFilter(true); | ||||
filter->setSortRole(Qt::EditRole); | filter->setSortRole(Qt::EditRole); | ||||
filter->setShowInactive(false); | filter->setShowInactive(false); | ||||
filter->sort(TransactionTableModel::Date, Qt::DescendingOrder); | filter->sort(TransactionTableModel::Date, Qt::DescendingOrder); | ||||
ui->listTransactions->setModel(filter.get()); | ui->listTransactions->setModel(filter.get()); | ||||
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); | ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); | ||||
// Keep up to date with wallet | // Keep up to date with wallet | ||||
interfaces::Wallet &wallet = model->wallet(); | interfaces::Wallet &wallet = model->wallet(); | ||||
interfaces::WalletBalances balances = wallet.getBalances(); | interfaces::WalletBalances balances = wallet.getBalances(); | ||||
setBalance(balances); | setBalance(balances); | ||||
connect(model, SIGNAL(balanceChanged(interfaces::WalletBalances)), this, | connect(model, &WalletModel::balanceChanged, this, | ||||
SLOT(setBalance(interfaces::WalletBalances))); | &OverviewPage::setBalance); | ||||
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, | connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, | ||||
SLOT(updateDisplayUnit())); | this, &OverviewPage::updateDisplayUnit); | ||||
updateWatchOnlyLabels(wallet.haveWatchOnly()); | updateWatchOnlyLabels(wallet.haveWatchOnly()); | ||||
connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, | connect(model, &WalletModel::notifyWatchonlyChanged, this, | ||||
SLOT(updateWatchOnlyLabels(bool))); | &OverviewPage::updateWatchOnlyLabels); | ||||
} | } | ||||
// update the display unit, to not use the default ("BCH") | // update the display unit, to not use the default ("BCH") | ||||
updateDisplayUnit(); | updateDisplayUnit(); | ||||
} | } | ||||
void OverviewPage::updateDisplayUnit() { | void OverviewPage::updateDisplayUnit() { | ||||
if (walletModel && walletModel->getOptionsModel()) { | if (walletModel && walletModel->getOptionsModel()) { | ||||
Show All 20 Lines |