Skip to content

Commit 02eb781

Browse files
committed
GUI: settings information, do not update block num and block hash if the screen is not visible.
1 parent cbc5021 commit 02eb781

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/qt/pivx/settings/settingsinformationwidget.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <QDir>
1616

17-
#define REQUEST_UPDATE_MN_COUNT 0
17+
#define REQUEST_UPDATE_COUNTS 0
1818

1919
SettingsInformationWidget::SettingsInformationWidget(PIVXGUI* _window,QWidget *parent) :
2020
PWidget(_window,parent),
@@ -141,6 +141,7 @@ void SettingsInformationWidget::setNumConnections(int count)
141141

142142
void SettingsInformationWidget::setNumBlocks(int count)
143143
{
144+
if (!isVisible()) return;
144145
ui->labelInfoBlockNumber->setText(QString::number(count));
145146
if (clientModel) {
146147
ui->labelInfoBlockTime->setText(clientModel->getLastBlockDate().toString());
@@ -168,7 +169,7 @@ void SettingsInformationWidget::showEvent(QShowEvent *event)
168169
if (clientModel) {
169170
clientModel->startMasternodesTimer();
170171
// Initial masternodes count value, running in a worker thread to not lock mnmanager mutex in the main thread.
171-
execute(REQUEST_UPDATE_MN_COUNT);
172+
execute(REQUEST_UPDATE_COUNTS);
172173
}
173174
}
174175

@@ -181,15 +182,17 @@ void SettingsInformationWidget::hideEvent(QHideEvent *event) {
181182

182183
void SettingsInformationWidget::run(int type)
183184
{
184-
if (type == REQUEST_UPDATE_MN_COUNT) {
185+
if (type == REQUEST_UPDATE_COUNTS) {
185186
QMetaObject::invokeMethod(this, "setMasternodeCount",
186187
Qt::QueuedConnection, Q_ARG(QString, clientModel->getMasternodesCount()));
188+
QMetaObject::invokeMethod(this, "setNumBlocks",
189+
Qt::QueuedConnection, Q_ARG(int, clientModel->getLastBlockProcessedHeight()));
187190
}
188191
}
189192

190193
void SettingsInformationWidget::onError(QString error, int type)
191194
{
192-
if (type == REQUEST_UPDATE_MN_COUNT) {
195+
if (type == REQUEST_UPDATE_COUNTS) {
193196
setMasternodeCount(tr("No available data"));
194197
}
195198
}

0 commit comments

Comments
 (0)