Skip to content

Commit

Permalink
Bugfix/14updated (#67)
Browse files Browse the repository at this point in the history
* Added number of merchantnodes to info tab

* Removed redundant code
  • Loading branch information
AndriiDiachuk authored and durkmurder committed May 8, 2018
1 parent d189a3d commit 655bcb3
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 127 deletions.
25 changes: 24 additions & 1 deletion src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "util.h"

#include "masternodeman.h"
#include "tpos/merchantnodeman.h"
#include "masternode-sync.h"
#include "privatesend.h"

Expand All @@ -39,6 +40,7 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
optionsModel(optionsModel),
peerTableModel(0),
cachedMasternodeCountString(""),
cachedMerchantnodeCountString(""),
banTableModel(0),
pollTimer(0)
{
Expand Down Expand Up @@ -88,7 +90,19 @@ QString ClientModel::getMasternodeCountString() const
.arg(QString::number((int)mnodeman.CountEnabled()));
// .arg(QString::number((int)mnodeman.CountByIP(NET_IPV4)))
// .arg(QString::number((int)mnodeman.CountByIP(NET_IPV6)))
// .arg(QString::number((int)mnodeman.CountByIP(NET_TOR)));
// .arg(QString::number((int)mnodeman.CountByIP(NET_TOR)));
}

QString ClientModel::getMerchantnodeCountString() const
{
// return tr("Total: %1 (PS compatible: %2 / Enabled: %3) (IPv4: %4, IPv6: %5, TOR: %6)").arg(QString::number((int)merchantnodeman.size()))
return tr("Total: %1 (PS compatible: %2 / Enabled: %3)")
.arg(QString::number((int)merchantnodeman.size()))
.arg(QString::number((int)merchantnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION)))
.arg(QString::number((int)merchantnodeman.CountEnabled()));
// .arg(QString::number((int)merchantnodeman.CountByIP(NET_IPV4)))
// .arg(QString::number((int)merchantnodeman.CountByIP(NET_IPV6)))
// .arg(QString::number((int)merchantnodeman.CountByIP(NET_TOR)));
}

int ClientModel::getNumBlocks() const
Expand Down Expand Up @@ -179,13 +193,22 @@ void ClientModel::updateTimer()
void ClientModel::updateMnTimer()
{
QString newMasternodeCountString = getMasternodeCountString();
QString newMerchantnodeCountString = getMerchantnodeCountString();

if (cachedMasternodeCountString != newMasternodeCountString)
{
cachedMasternodeCountString = newMasternodeCountString;

Q_EMIT strMasternodesChanged(cachedMasternodeCountString);
}

if (cachedMerchantnodeCountString != newMerchantnodeCountString)
{
cachedMerchantnodeCountString = newMerchantnodeCountString;

Q_EMIT strMerchantnodesChanged(cachedMerchantnodeCountString);
}

}

void ClientModel::updateNumConnections(int numConnections)
Expand Down
3 changes: 3 additions & 0 deletions src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ClientModel : public QObject
//! Return number of connections, default is in- and outbound (total)
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
QString getMasternodeCountString() const;
QString getMerchantnodeCountString() const;
int getNumBlocks() const;
int getHeaderTipHeight() const;
int64_t getHeaderTipTime() const;
Expand Down Expand Up @@ -94,6 +95,7 @@ class ClientModel : public QObject
OptionsModel *optionsModel;
PeerTableModel *peerTableModel;
QString cachedMasternodeCountString;
QString cachedMerchantnodeCountString;
BanTableModel *banTableModel;

QTimer *pollTimer;
Expand All @@ -105,6 +107,7 @@ class ClientModel : public QObject
Q_SIGNALS:
void numConnectionsChanged(int count);
void strMasternodesChanged(const QString &strMasternodes);
void strMerchantnodesChanged(const QString &strMerchantnodes);
void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress, bool header);
void additionalDataSyncProgressChanged(double nSyncProgress);
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
Expand Down
Loading

0 comments on commit 655bcb3

Please sign in to comment.