Skip to content

Commit

Permalink
Add the signal for an Omni state change to the client model
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed Mar 31, 2015
1 parent a72250f commit a762905
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ void ClientModel::updateNumConnections(int numConnections)
emit numConnectionsChanged(numConnections);
}

void ClientModel::updateOmniState()
{
emit refreshOmniState();
}

void ClientModel::updateAlert(const QString &hash, int status)
{
// Show error message notification for new alert
Expand Down Expand Up @@ -202,6 +207,12 @@ QString ClientModel::formatClientStartupTime() const
}

// Handlers for core signals
static void OmniStateChanged(ClientModel *clientmodel)
{
// This will be triggered for each block that contains Omni layer transactions
QMetaObject::invokeMethod(clientmodel, "updateOmniState", Qt::QueuedConnection);
}

static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
{
// emits signal "showProgress"
Expand Down Expand Up @@ -231,6 +242,7 @@ void ClientModel::subscribeToCoreSignals()
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.OmniStateChanged.connect(boost::bind(OmniStateChanged, this));
}

void ClientModel::unsubscribeFromCoreSignals()
Expand All @@ -239,4 +251,5 @@ void ClientModel::unsubscribeFromCoreSignals()
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.OmniStateChanged.disconnect(boost::bind(OmniStateChanged, this));
}
2 changes: 2 additions & 0 deletions src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ClientModel : public QObject
void numBlocksChanged(int count);
void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
void refreshOmniState();

//! Fired when a message should be reported to the user
void message(const QString &title, const QString &message, unsigned int style);
Expand All @@ -100,6 +101,7 @@ public slots:
void updateTimer();
void updateNumConnections(int numConnections);
void updateAlert(const QString &hash, int status);
void updateOmniState();
};

#endif // BITCOIN_QT_CLIENTMODEL_H

0 comments on commit a762905

Please sign in to comment.