Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log into the progress bar, when mints are synchronizing #1096

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hdmint/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "keystore.h"
#include <boost/optional.hpp>
#include "masternode-sync.h"
#include "ui_interface.h"

/**
* Constructor for CHDMintWallet object.
Expand Down Expand Up @@ -269,10 +270,10 @@ void CHDMintWallet::SyncWithChain(bool fGenerateMintPool, boost::optional<std::l
if (setChecked.count(pMint.first))
continue;
setChecked.insert(pMint.first);
uiInterface.UpdateProgressBarLabel("Synchronizing mints...");

if (ShutdownRequested())
return;

uint160& mintHashSeedMaster = std::get<0>(pMint.second);
int32_t& mintCount = std::get<2>(pMint.second);

Expand Down Expand Up @@ -435,6 +436,7 @@ void CHDMintWallet::SyncWithChain(bool fGenerateMintPool, boost::optional<std::l
}
}
}
uiInterface.UpdateProgressBarLabel("");
// Clear listMints to allow it to be repopulated by the mintPool on the next iteration
if(foundSigma || foundLela)
listMints = boost::none;
Expand Down
12 changes: 12 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
// Show progress dialog
connect(_clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));

// Update progress bar label textw
connect(_clientModel, SIGNAL(updateProgressBarLabel(QString)), this, SLOT(updateProgressBarLabel(QString)));

// Update Elysium pending status
connect(_clientModel, SIGNAL(refreshElysiumPending(bool)), this, SLOT(setElysiumPendingStatus(bool)));

Expand Down Expand Up @@ -1433,6 +1436,15 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress)
progressDialog->setValue(nProgress);
}

void BitcoinGUI::updateProgressBarLabel(const QString& text)
{
if (progressBarLabel)
{
progressBarLabel->setVisible(!text.isEmpty());
progressBarLabel->setText(text);
}
}

void BitcoinGUI::setTrayIconVisible(bool fHideTrayIcon)
{
if (trayIcon)
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ private Q_SLOTS:

/** Show progress dialog e.g. for verifychain */
void showProgress(const QString &title, int nProgress);

/** Update progress bar label text */
void updateProgressBarLabel(const QString& text);

/** When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly. */
void setTrayIconVisible(bool);
Expand Down
9 changes: 9 additions & 0 deletions src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ static void ShowProgress(ClientModel *clientmodel, const std::string &title, int
Q_ARG(int, nProgress));
}

static void UpdateProgressBarLabel(ClientModel *clientmodel, const std::string &title)
{
// emits signal "updateProgressBarLabel"
QMetaObject::invokeMethod(clientmodel, "updateProgressBarLabel", Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(title)));
}

static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
{
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
Expand Down Expand Up @@ -424,6 +431,7 @@ void ClientModel::subscribeToCoreSignals()
{
// Connect signals to client
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.UpdateProgressBarLabel.connect(boost::bind(UpdateProgressBarLabel, this, _1));
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyNetworkActiveChanged.connect(boost::bind(NotifyNetworkActiveChanged, this, _1));
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this));
Expand All @@ -444,6 +452,7 @@ void ClientModel::unsubscribeFromCoreSignals()
{
// Disconnect signals from client
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.UpdateProgressBarLabel.disconnect(boost::bind(UpdateProgressBarLabel, this, _1));
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyNetworkActiveChanged.disconnect(boost::bind(NotifyNetworkActiveChanged, this, _1));
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this));
Expand Down
3 changes: 3 additions & 0 deletions src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ class ClientModel : public QObject
// Show progress dialog e.g. for verifychain
void showProgress(const QString &title, int nProgress);

// Update progress bar label text
void updateProgressBarLabel(const QString &title);

public Q_SLOTS:
void updateTimer();
void updateNumConnections(int numConnections);
Expand Down
3 changes: 3 additions & 0 deletions src/ui_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class CClientUIInterface
/** Show progress e.g. for verifychain */
boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;

/** Update progress bar label text */
boost::signals2::signal<void (const std::string &title)> UpdateProgressBarLabel;

/** New block has been accepted */
boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyBlockTip;

Expand Down