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

gui: Add one minute QTimer to update beacon age/expiration in tooltip #2671

Conversation

jamescowens
Copy link
Member

This adds a trivial QTimer with a frequency of once per minute to update the beacon status in the GUI, and ensure the tooltip accurately reflects beacon age and time remaining until expiration.

@barton2526
Copy link
Member

Is one minute really what we want? It seems a little too frequent IMO.

@jamescowens
Copy link
Member Author

jamescowens commented Mar 30, 2023

It is a trivial update, and since we display the expiration times down to the second, even a minute is arguably not frequent enough. I think one minute is a good compromise.

The function being called does very little work...

void BitcoinGUI::updateBeaconIcon()
{
    LogPrint(BCLog::MISC, "BitcoinGUI::updateBeaconIcon()");

    if (researcherModel->configuredForInvestorMode()
        || researcherModel->detectedPoolMode())
    {
        labelBeaconIcon->hide();
        return;
    }

    labelBeaconIcon->show();
    labelBeaconIcon->setPixmap(GRC::ScaleStatusIcon(this, researcherModel->getBeaconStatusIcon()));

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

@barton2526
Copy link
Member

Why do we display down to the second in the first place? Maybe we should just display down to the minute and update every minute.

@jamescowens
Copy link
Member Author

I agree with you but that is a more extensive change that I would rather do against the dev branch. This is against hotfix and is going to be put into a point release with the other hotfixes merged since the 5.4.2.0 release.

@barton2526
Copy link
Member

utACK

@jamescowens jamescowens merged commit 2121748 into gridcoin-community:hotfix Mar 31, 2023
jamescowens added a commit to jamescowens/Gridcoin-Research that referenced this pull request Apr 5, 2023
Added
 - install: Enhance windows installer - detect running gridcoinresearch(d).exe and ask to close before continuing gridcoin-community#2672 (@jamescowens)
 - gui: Add one minute QTimer to update beacon age/expiration in tooltip gridcoin-community#2671 (@jamescowens)

Changed
none

Removed
none

Fixed
 - util: Implement workaround for backupwallet to deal with Boost 1.74 regression on copy_file gridcoin-community#2669 (@jamescowens)
 - banman: use GetPerformanceCounter instead of GetRandBytes gridcoin-community#2668 (@div72)
@jamescowens jamescowens deleted the fix_beacon_status_update_frequency branch July 21, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants