From: svost Date: Mon, 30 Jan 2017 14:27:56 +0000 (+0300) Subject: Remove 'estimated total blocks' field from gui X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=934815c8638689111eb4ce75c58aea6add66318f Remove 'estimated total blocks' field from gui --- diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 5abc0c0..148720d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -443,8 +443,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) setNumConnections(clientModel->getNumConnections()); connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers()); - connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); + setNumBlocks(clientModel->getNumBlocks()); + connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateMining())); @@ -575,7 +575,7 @@ void BitcoinGUI::setNumConnections(int count) labelConnectionsIcon->setToolTip(tr("%n active connection(s) to NovaCoin network", "", count)); } -void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) +void BitcoinGUI::setNumBlocks(int count) { // don't show / hide progress bar and its label if we have no connection to the network if (!clientModel || clientModel->getNumConnections() == 0) @@ -589,31 +589,11 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) QString strStatusBarWarnings = clientModel->getStatusBarWarnings(); QString tooltip; - if(count < nTotalBlocks) - { - int nRemainingBlocks = nTotalBlocks - count; - float nPercentageDone = count / (nTotalBlocks * 0.01f); - - if (strStatusBarWarnings.isEmpty()) - { - progressBarLabel->setText(tr("Synchronizing with network...")); - progressBarLabel->setVisible(true); - progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks)); - progressBar->setMaximum(nTotalBlocks); - progressBar->setValue(count); - progressBar->setVisible(true); - } - - tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2); - } - else - { - if (strStatusBarWarnings.isEmpty()) - progressBarLabel->setVisible(false); + if (strStatusBarWarnings.isEmpty()) + progressBarLabel->setVisible(false); - progressBar->setVisible(false); - tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count); - } + progressBar->setVisible(false); + tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count); // Override progressBarLabel text and hide progress bar, when we have warnings to display if (!strStatusBarWarnings.isEmpty()) @@ -653,7 +633,7 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) } // Set icon state: spinning if catching up, tick otherwise - if(secs < 90*60 && count >= nTotalBlocks) + if(secs < 90*60) { tooltip = tr("Up to date") + QString(".
") + tooltip; labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); @@ -702,7 +682,7 @@ void BitcoinGUI::updateMining() return; } - if (clientModel->inInitialBlockDownload() || clientModel->getNumBlocksOfPeers() > clientModel->getNumBlocks()) + if (clientModel->inInitialBlockDownload()) { labelMiningIcon->setToolTip(tr("Blockchain download is in progress")); return; diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 20eb7ca..c60a068 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -131,7 +131,7 @@ public slots: /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ - void setNumBlocks(int count, int nTotalBlocks); + void setNumBlocks(int count); /** Set stake miner status in the UI */ void updateMining(); /** Set the encryption status as shown in the UI. diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index f98e476..01a8320 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -17,8 +17,7 @@ extern double GetDifficulty(const CBlockIndex* blockindex); static const int64_t nClientStartupTime = GetTime(); ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : - QObject(parent), optionsModel(optionsModel), - cachedNumBlocks(0), cachedNumBlocksOfPeers(0), pollTimer(0) + QObject(parent), optionsModel(optionsModel), cachedNumBlocks(0), pollTimer(0) { numBlocksAtStartup = -1; @@ -96,14 +95,11 @@ void ClientModel::updateTimer() // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); - int newNumBlocksOfPeers = getNumBlocksOfPeers(); - if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers) + if(cachedNumBlocks != newNumBlocks) { cachedNumBlocks = newNumBlocks; - cachedNumBlocksOfPeers = newNumBlocksOfPeers; - - emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers); + emit numBlocksChanged(newNumBlocks); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); @@ -130,7 +126,7 @@ void ClientModel::updateAlert(const QString &hash, int status) // Emit a numBlocksChanged when the status message changes, // so that the view recomputes and updates the status bar. - emit numBlocksChanged(getNumBlocks(), getNumBlocksOfPeers()); + emit numBlocksChanged(getNumBlocks()); } bool ClientModel::isTestNet() const @@ -143,11 +139,6 @@ bool ClientModel::inInitialBlockDownload() const return IsInitialBlockDownload(); } -int ClientModel::getNumBlocksOfPeers() const -{ - return GetNumBlocksOfPeers(); -} - QString ClientModel::getStatusBarWarnings() const { return QString::fromStdString(GetWarnings("statusbar")); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index cf3e30e..c08caeb 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -49,8 +49,6 @@ public: bool isTestNet() const; //! Return true if core is doing initial block download bool inInitialBlockDownload() const; - //! Return conservative estimate of total number of blocks, or 0 if unknown - int getNumBlocksOfPeers() const; //! Return warnings to be displayed in status bar QString getStatusBarWarnings() const; @@ -73,7 +71,7 @@ private: void unsubscribeFromCoreSignals(); signals: void numConnectionsChanged(int count); - void numBlocksChanged(int count, int countOfPeers); + void numBlocksChanged(int count); void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); //! Asynchronous error notification diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index f5b50f6..6ff4bdd 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -250,29 +250,6 @@ - - - - Estimated total blocks - - - - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index c793bf9..8be6397 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -268,7 +268,7 @@ void RPCConsole::setClientModel(ClientModel *model) { // Subscribe to information, replies, messages, errors connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); + connect(model, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); @@ -281,7 +281,7 @@ void RPCConsole::setClientModel(ClientModel *model) setNumConnections(model->getNumConnections()); ui->isTestNet->setChecked(model->isTestNet()); - setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers()); + setNumBlocks(model->getNumBlocks()); } } @@ -357,14 +357,12 @@ void RPCConsole::setNumConnections(int count) ui->numberOfConnections->setText(connections); } -void RPCConsole::setNumBlocks(int count, int countOfPeers) +void RPCConsole::setNumBlocks(int count) { ui->numberOfBlocks->setText(QString::number(count)); - ui->totalBlocks->setText(QString::number(countOfPeers)); if(clientModel) { // If there is no current number available display N/A instead of 0, which can't ever be true - ui->totalBlocks->setText(clientModel->getNumBlocksOfPeers() == 0 ? tr("N/A") : QString::number(clientModel->getNumBlocksOfPeers())); ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString()); } } diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index aa8c8f3..06487b2 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -54,7 +54,7 @@ public slots: /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ - void setNumBlocks(int count, int countOfPeers); + void setNumBlocks(int count); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */