mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-23 13:24:18 +00:00
The synchronization progress bar now compares the amount of total blocks to amount of blocks downloaded at application start-up. Could be probably implemented better.
This commit is contained in:
parent
9b9e2f1748
commit
78b3bf56f7
@ -345,6 +345,7 @@ void BitcoinGUI::setNumConnections(int count)
|
|||||||
|
|
||||||
void BitcoinGUI::setNumBlocks(int count)
|
void BitcoinGUI::setNumBlocks(int count)
|
||||||
{
|
{
|
||||||
|
int initTotal = clientModel->getNumBlocksAtStartup();
|
||||||
int total = clientModel->getTotalBlocksEstimate();
|
int total = clientModel->getTotalBlocksEstimate();
|
||||||
QString tooltip;
|
QString tooltip;
|
||||||
|
|
||||||
@ -352,8 +353,8 @@ void BitcoinGUI::setNumBlocks(int count)
|
|||||||
{
|
{
|
||||||
progressBarLabel->setVisible(true);
|
progressBarLabel->setVisible(true);
|
||||||
progressBar->setVisible(true);
|
progressBar->setVisible(true);
|
||||||
progressBar->setMaximum(total);
|
progressBar->setMaximum(total - initTotal);
|
||||||
progressBar->setValue(count);
|
progressBar->setValue(count - initTotal);
|
||||||
tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total);
|
tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -18,6 +18,8 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
|||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
timer->start(MODEL_UPDATE_DELAY);
|
timer->start(MODEL_UPDATE_DELAY);
|
||||||
|
|
||||||
|
numBlocksAtStartup = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientModel::getNumConnections() const
|
int ClientModel::getNumConnections() const
|
||||||
@ -30,6 +32,12 @@ int ClientModel::getNumBlocks() const
|
|||||||
return nBestHeight;
|
return nBestHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientModel::getNumBlocksAtStartup()
|
||||||
|
{
|
||||||
|
if (numBlocksAtStartup == -1) numBlocksAtStartup = getNumBlocks();
|
||||||
|
return numBlocksAtStartup;
|
||||||
|
}
|
||||||
|
|
||||||
QDateTime ClientModel::getLastBlockDate() const
|
QDateTime ClientModel::getLastBlockDate() const
|
||||||
{
|
{
|
||||||
return QDateTime::fromTime_t(pindexBest->GetBlockTime());
|
return QDateTime::fromTime_t(pindexBest->GetBlockTime());
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
|
|
||||||
int getNumConnections() const;
|
int getNumConnections() const;
|
||||||
int getNumBlocks() const;
|
int getNumBlocks() const;
|
||||||
|
int getNumBlocksAtStartup();
|
||||||
|
|
||||||
QDateTime getLastBlockDate() const;
|
QDateTime getLastBlockDate() const;
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ private:
|
|||||||
int cachedNumConnections;
|
int cachedNumConnections;
|
||||||
int cachedNumBlocks;
|
int cachedNumBlocks;
|
||||||
|
|
||||||
|
int numBlocksAtStartup;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void numConnectionsChanged(int count);
|
void numConnectionsChanged(int count);
|
||||||
void numBlocksChanged(int count);
|
void numBlocksChanged(int count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user