Skip to content

Commit

Permalink
Merge pull request #2498 from jamescowens/fix_negative_beacon_time_to…
Browse files Browse the repository at this point in the history
…_expire

gui: Add beaconExpired() to researchermodel
  • Loading branch information
jamescowens authored Apr 24, 2022
2 parents ec11d12 + b239d51 commit 06b4cba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1841,15 +1841,24 @@ void BitcoinGUI::updateBeaconIcon()
labelBeaconIcon->show();
labelBeaconIcon->setPixmap(GRC::ScaleStatusIcon(this, researcherModel->getBeaconStatusIcon()));

labelBeaconIcon->setToolTip(tr(
"CPID: %1\n"
"Beacon age: %2\n"
"Expires: %3\n"
"%4")
.arg(researcherModel->formatCpid())
.arg(researcherModel->formatBeaconAge())
.arg(researcherModel->formatTimeToBeaconExpiration())
.arg(researcherModel->formatBeaconStatus()));
if (researcherModel->beaconExpired()) {
labelBeaconIcon->setToolTip(tr("CPID: %1\n"
"Beacon age: %2\n"
"Current beacon expired!\n"
"%3")
.arg(researcherModel->formatCpid())
.arg(researcherModel->formatBeaconAge())
.arg(researcherModel->formatBeaconStatus()));
} else {
labelBeaconIcon->setToolTip(tr("CPID: %1\n"
"Beacon age: %2\n"
"Expires: %3\n"
"%4")
.arg(researcherModel->formatCpid())
.arg(researcherModel->formatBeaconAge())
.arg(researcherModel->formatTimeToBeaconExpiration())
.arg(researcherModel->formatBeaconStatus()));
}
}

void BitcoinGUI::handleNewPoll()
Expand Down
5 changes: 5 additions & 0 deletions src/qt/researcher/researchermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ bool ResearcherModel::hasRenewableBeacon() const
return m_beacon && m_beacon->Renewable(GetAdjustedTime());
}

bool ResearcherModel::beaconExpired() const
{
return m_beacon->Expired(GetAdjustedTime());
}

bool ResearcherModel::hasMagnitude() const
{
return m_researcher->Magnitude() != 0;
Expand Down
1 change: 1 addition & 0 deletions src/qt/researcher/researchermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ResearcherModel : public QObject
bool hasActiveBeacon() const;
bool hasPendingBeacon() const;
bool hasRenewableBeacon() const;
bool beaconExpired() const;
bool hasMagnitude() const;
bool hasRAC() const;
bool hasSplitCpid() const;
Expand Down

0 comments on commit 06b4cba

Please sign in to comment.