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()));
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)
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())
}
// 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(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
return;
}
- if (clientModel->inInitialBlockDownload() || clientModel->getNumBlocksOfPeers() > clientModel->getNumBlocks())
+ if (clientModel->inInitialBlockDownload())
{
labelMiningIcon->setToolTip(tr("Blockchain download is in progress"));
return;
/** 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.
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;
// 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());
// 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
return IsInitialBlockDownload();
}
-int ClientModel::getNumBlocksOfPeers() const
-{
- return GetNumBlocksOfPeers();
-}
-
QString ClientModel::getStatusBarWarnings() const
{
return QString::fromStdString(GetWarnings("statusbar"));
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;
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
</property>
</widget>
</item>
- <item row="12" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Estimated total blocks</string>
- </property>
- </widget>
- </item>
- <item row="12" column="2">
- <widget class="QLabel" name="totalBlocks">
- <property name="cursor">
- <cursorShape>IBeamCursor</cursorShape>
- </property>
- <property name="text">
- <string>N/A</string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
<item row="2" column="2">
<widget class="QLabel" name="clientVersion">
<property name="cursor">
{
// 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)));
setNumConnections(model->getNumConnections());
ui->isTestNet->setChecked(model->isTestNet());
- setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers());
+ setNumBlocks(model->getNumBlocks());
}
}
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());
}
}
/** 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 */