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: Resize Header Column with Additional Text #2683

Merged

Conversation

PrestackI
Copy link
Contributor

@PrestackI PrestackI commented Apr 26, 2023

Problem:
The column for "Avg. Credit" in the Researcher Configuration under the Projects Tab is not wide enough to accommodate 1 million+ average credit amounts without showing them in scientific notation. The column is not resizable.

Observations:
It appears that the column width is dictated by the longest field text string or header text length within the column. There are 2 exceptions:

  • The integer "Avg. Credit" column that is showing a scientific notation instead of resizing to be shown in the standard form.
  • The text "CPID" column that automatically resizes when you increase/decrease the width of the overall window.

Solution:
My solution is to add the text "Recent " to the text for the "Avg. Credit" header to accommodate larger numbers in their standard form. This should be sufficient to accommodate the largest RAC in the standard form.

Justification:
I believe this to the easiest and safest way to increase the field length to show larger numbers in their standard form without refactoring the table. It will also bring congruence between the terminology used by BOINC and the Gridcoin Wallet.

Leaving this as a draft to receive feedback before marking Ready for review.

Problem:
The column for "Avg. Credit" in the Researcher Configuration under the Projects Tab is not wide enough to accommodate 1 million+ average credit amounts without showing them in scientific notation. The column is not resizable.

Observations:
It appears that the column width is dictated by the longest field text string or header text length within the column. 
There are 2 exceptions:
- The integer "Avg. Credit" column that is showing a scientific notation instead of resizing to be shown in the standard form.
- The text "CPID" column that automatically resizes when you increase/decrease the width of the overall window.

Solution:
My solution is to add the text "Recent " to the text for the "Avg. Credit" header to accommodate larger numbers in their standard form. This should be sufficient to accommodate the largest RAC in the standard form.

Justification:
I believe this to the easiest and safest way to increase the field length to show larger numbers in their standard form without refactoring the table. 
It will also bring congruence between the terminology used by BOINC and the Gridcoin Wallet.
@jamescowens
Copy link
Member

Might work. Have you tested it to see how it looks?

@jamescowens jamescowens self-requested a review April 27, 2023 01:03
@jamescowens jamescowens linked an issue Apr 27, 2023 that may be closed by this pull request
@jamescowens jamescowens added this to the Miss Piggy milestone Apr 27, 2023
@PrestackI
Copy link
Contributor Author

PrestackI commented Apr 27, 2023

I have not yet. Not exactly sure how to test it for Windows from scratch.

The instructions provided below appear to mention that it needs to be included in the testnet branch?
https://gridcoin.us/wiki/testnet.html

Any other suggestions?

@jamescowens
Copy link
Member

jamescowens commented Apr 27, 2023 via email

@jamescowens
Copy link
Member

I tested this. You also need to change the projecttablemodel.cpp:

QVariant ProjectTableModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid()) {
        return QVariant();
    }

    const ProjectRow* row = static_cast<const ProjectRow*>(index.internalPointer());

    switch (role) {
        case Qt::DisplayRole:
            switch (index.column()) {
                case Name:
                    return row->m_name;
                case Eligible:
                    if (!row->m_error.isEmpty()) {
                        return row->m_error;
                    }
                    break;
                case GDPRControls:
                    if (row->m_gdpr_controls) {
                        return *row->m_gdpr_controls;
                    }
                    break;
                case Cpid:
                    return row->m_cpid;
                case Magnitude:
                    return row->m_magnitude;
                case RecentAverageCredit:
                    return QString::number(row->m_rac, 'f', 0);
            }
            break;

In particular in the case RecentAverageCredit, you need to change return row-m_rac to be QString::number(row->m_rac, 'f', 0).

Copy link
Member

@jamescowens jamescowens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my earlier comment.

@PrestackI
Copy link
Contributor Author

PrestackI commented Apr 27, 2023

Added.

Do I need to #include <QString>? Or is it taken care of with #include <QIcon>?

@jamescowens
Copy link
Member

You don't

@PrestackI PrestackI marked this pull request as ready for review April 28, 2023 01:02
Copy link
Member

@jamescowens jamescowens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@jamescowens jamescowens merged commit e6f8863 into gridcoin-community:development Apr 28, 2023
@jamescowens jamescowens changed the title Resize Header Column with Additional Text gui: Resize Header Column with Additional Text Apr 28, 2023
@PrestackI PrestackI deleted the PrestackI-patch-1.1 branch April 28, 2023 01:52
jamescowens added a commit to jamescowens/Gridcoin-Research that referenced this pull request Mar 2, 2024
Added
 - contrib: add nix file for compilation environment gridcoin-community#2660 (@div72)
 - gui: Make main Gridcoin window geometry save unique to datadir location gridcoin-community#2661 (@jamescowens)
 - build: Initial CMake support gridcoin-community#2676 (@CyberTailor)
 - util: Add `-shutdownnotify` and `startupnotify` options from upstream gridcoin-community#2688 (@barton2526)
 - gui, staking: Implement facilities for mandatory sidestakes and sidestake GUI gridcoin-community#2704 (@jamescowens)
 - gui, voting: Implement poll result caching and poll stale indicator gridcoin-community#2709 (@jamescowens)
 - gui, projects: Implement greylist state for projects in GUI projects table gridcoin-community#2715 (@jamescowens)
 - gui, poll: Implement poll expiration reminders gridcoin-community#2716 (@jamescowens)
 - serialize: allow variants to be serialized gridcoin-community#2729 (@div72)
 - gui: Implement poll field length limiters in GUI forms gridcoin-community#2742 (@jamescowens)

Changed
 - consensus, contract, scraper, protocol, project, beacon, rpc: Replace remaining appcache sections with native structures gridcoin-community#2639 (@jamescowens)
 - build: update libsecp256k1 to v0.3.0 gridcoin-community#2655 (@div72)
 - build: Replace $(AT) with .SILENT gridcoin-community#2674 (@barton2526)
 - build: allow system bdb gridcoin-community#2675 (@div72)
 - Resize Header Column with Additional Text gridcoin-community#2683 (@PrestackI)
 - rpc: use RPCErrorCode everywhere gridcoin-community#2687 (@Pythonix)
 - wallet: SecureString to allow null characters gridcoin-community#2690 (@barton2526)
 - random: port some upstream changes gridcoin-community#2696 (@div72)
 - depends: Bump dependencies gridcoin-community#2692 (@barton2526)
 - doc: Update link to Discord server gridcoin-community#2693 (@adriaanjoubert)
 - rpc: Change capitalization, remove whitespace of rpc keys gridcoin-community#2711 (@Pythonix)
 - ci: bump MacOS version to 12 gridcoin-community#2713 (@div72)
 - depends: no-longer nuke libc++abi.so* in native_clang package gridcoin-community#2719 (@div72)
 - doc: update windows `-fstack-clash-protection` doc gridcoin-community#2720 (@div72)
 - Silence `-Wcast-function-type` warning gridcoin-community#2721 (@div72)
 - build: Use newest `config.{guess,sub}` available gridcoin-community#2722 (@div72)
 - refactor: use the try_lock result in TryEnter gridcoin-community#2723 (@div72)
 - Updates for file src/qt/locale/bitcoin_en.ts in pt_PT gridcoin-community#2726 (@gridcoin-community)
 - ci: do not silently fail gridcoin-community#2727 (@div72)
 - Properly include Boost Array header gridcoin-community#2730 (@theMarix)
 - build: Update depends zlib to 1.3.1 gridcoin-community#2734 (@jamescowens)
 - util: Enhance Fraction class overflow resistance gridcoin-community#2735 (@jamescowens)
 - refactor: Fix compilation warnings gridcoin-community#2737 (@jamescowens)
 - gui, util: Improve upgrade dialog gridcoin-community#2738 (@jamescowens)
 - util: Improve allocation class gridcoin-community#2740 (@jamescowens)
 - translations: translation updates for Miss Piggy release gridcoin-community#2745 (@jamescowens)

Removed
 - gui: Disable snapshot GUI action gridcoin-community#2700 (@jamescowens)
 - build, crypto, script: remove most of OpenSSL usage gridcoin-community#2705 (@div72)
 - util: remove WSL 1 workaround in fs gridcoin-community#2717 (@div72)

Fixed
 - diagnostics: fix missing arg in ETTS warning gridcoin-community#2684 (@div72)
 - misc: fix include guard in netaddress.h gridcoin-community#2695 (@div72)
 - gui: Fix expired pending beacon display gridcoin-community#2698 (@jamescowens)
 - consensus: Fix 20230904 testnet forking issue gridcoin-community#2703 (@jamescowens)
 - gui: Fix filter by type in Transaction View gridcoin-community#2708 (@jamescowens)
 - depends: make fontconfig build under clang-16 gridcoin-community#2718 (@div72)
 - diag: fix researcher mode check gridcoin-community#2725 (@div72)
 - gui: Add missing switch cases for ALREADY_IN_MEMPOOL gridcoin-community#2728 (@jamescowens)
 - beacon, registry: Fix beacon history stall gridcoin-community#2731 (@jamescowens)
 - build: Implement comp_double comparison function in certain tests gridcoin-community#2741 (@jamescowens)
 - ci: change Qt path in CMake CI gridcoin-community#2743 (@div72)
 - net: Correct -tor argument handling gridcoin-community#2744 (@jamescowens)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GUI: How to present larger values for average credits
2 participants