Allow prompt icon to be colorized #330

pull jarolrod wants to merge 1 commits into bitcoin-core:master from jarolrod:prompt-icon-colorized changing 1 files +2 −0
  1. jarolrod commented at 4:09 am on May 15, 2021: member

    Opening the console on macOS, while in dark mode, the console prompt icon will not be colorized white like other icons. This applies the platformStyle to the icon so that It can be colorized white.

    While here, refactor the promptIcon widget from a QPushButton to QLabel; which is more appropriate, per Qt Docs:

    QLabel is used for displaying text or an image. No user interaction functionality is provided.

    Master PR
    Screen Shot 2021-05-14 at 11 46 33 PM Screen Shot 2021-05-14 at 11 45 41 PM
  2. hebasto added the label UI on May 15, 2021
  3. hebasto commented at 10:30 am on May 15, 2021: member
    ~Just stating a fact: this PR and #270 (comment) are competing.~
  4. jarolrod commented at 12:30 pm on May 15, 2021: member

    @hebasto This and #270 are independent.

    Using a new prompt icon is independent from making sure it’s colorized white in dark mode.

  5. hebasto commented at 12:36 pm on May 15, 2021: member

    @hebasto This and #270 are independent.

    Using a new prompt icon is independent from making sure it’s colorized white in dark mode.

    Not a new icon, but text:

    If you want to have a symbol to indicate user input vs. console output, why not keep it text-based, like in the example below? It uses the “>” character to indicate user input, to match the icon next to the input field.

  6. jarolrod commented at 1:06 pm on May 15, 2021: member

    @hebasto

    That’s in regards to how we should change the console input vs output icons. Not about the prompt icon.

  7. hebasto commented at 1:11 pm on May 15, 2021: member

    @hebasto

    That’s in regards to how we should change the console input vs output icons. Not about the prompt icon.

    You’re right. Sorry for noise.

  8. in src/qt/forms/debugwindow.ui:611 in 2162b3e251 outdated
    607-            <string/>
    608-           </property>
    609-           <property name="icon">
    610-            <iconset resource="../bitcoin.qrc">
    611-             <normaloff>:/icons/prompticon</normaloff>
    612-             <disabledoff>:/icons/prompticon</disabledoff>:/icons/prompticon</iconset>
    


    hebasto commented at 2:48 pm on May 15, 2021:
    I’d keep setting an icon in the UI file to provide it in the Qt Designer tool.

    jarolrod commented at 8:31 pm on June 2, 2021:
    addressed in 82d430d
  9. hebasto commented at 2:49 pm on May 15, 2021: member
    Approach ACK 2162b3e25148037ed3478e31402b2de15c90a53a.
  10. hebasto added the label macOS on May 15, 2021
  11. DrahtBot added the label Needs rebase on May 20, 2021
  12. jarolrod force-pushed on May 21, 2021
  13. jarolrod commented at 9:37 pm on May 21, 2021: member

    updated from 2162b3e -> f5e5511 (pr330.01 -> pr330.02, diff)

    Changes:

    • rebase on master to solve conflict with #281
    • address comment @hebasto in regard to your comment There is no icon property for a QLabel. To address this, I instead also set the pixmap in the *.ui file. Here, I also set the scaled property so that the pixmap will actually show in a designer tool. Because of this, I change the dimension from 16 x 24 to 14 x 14. Here’s why:

    If I keep the original dimensions, the pixmap will look warped in the designer tool: Screen Shot 2021-05-21 at 4 33 49 PM

    It is ok to set the dimensions of the QLabel to the exact dimensions we set for the pixmap itself. Doing so means the pixmap will look normal in the designer tool:

    0ui->promptIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/prompticon").pixmap(14, 14));
    

    Screen Shot 2021-05-21 at 4 33 26 PM

    There is no change in the size of this pixmap(previously icon) comparing master, pr330.01, or pr330.02:

    Master PR330.01 PR330.02 (this)
    original old-pr new-pr
  14. jarolrod force-pushed on May 21, 2021
  15. jarolrod commented at 9:54 pm on May 21, 2021: member

    updated from f5e5511 -> be85c7f (pr330.02 -> pr330.03, diff)

    Changes:

    • Address whitespace linter failure
      • The linter does not like a chunk that only adds whitespace, this chunk came to be after rebasing over master. Previously, the same chunk where I added the whitespace added our promptIcon. To fix this, I now set promptIcon below clearButton instead of below fontSmallerButton
  16. DrahtBot removed the label Needs rebase on May 21, 2021
  17. hebasto commented at 6:38 pm on May 28, 2021: member

    Opening the console on macOS, while in dark mode, the console prompt icon will not be colorized white like other icons. This applies the platformStyle to the icon so that It can be colorized white.

    While here, refactor the promptIcon widget from a QPushButton to QLabel; which is more appropriate, per Qt Docs:

    QLabel is used for displaying text or an image. No user interaction functionality is provided.

    Master PR Screen Shot 2021-05-14 at 11 46 33 PM Screen Shot 2021-05-14 at 11 45 41 PM

    Does this line (from #275) https://github.com/bitcoin-core/gui/blob/123b401e0acf3b26f149711bdf06d7f6eced1968/src/qt/rpcconsole.cpp#L853 change anything?

  18. jarolrod commented at 8:28 pm on May 28, 2021: member

    @hebasto It seems that we’ve uncovered the first “bug” since the merge of 275. If you start off with dark mode on the current master, which includes 275, the promptIcon is colored black. It will become colorized if you switch to light mode then back to dark mode. Below are screenshots showing this behavior

    Start with Dark Mode on Master Switch to Light then Back to Dark

    Another thing to notice is that because this is currently a disabled QPushButton, the promptIcon is colored gray instead of white.

    Applying this PR on top of master (which requires changes to do), fixes this “bug”, makes the promptIcon class appropriate, and lets it be colorized white.

    There’s currently a silent merge conflict with #275 and will be pushing changes to fix this.

  19. jarolrod force-pushed on Jun 2, 2021
  20. jarolrod commented at 8:23 pm on June 2, 2021: member

    updated from be85c7f -> 82d430d (pr330.03 -> pr330.04)

    Changes:

    • address silent merge conflict with #275
  21. in src/qt/forms/debugwindow.ui:595 in 82d430d3d1 outdated
    591@@ -592,34 +592,17 @@
    592           <number>3</number>
    593          </property>
    594          <item>
    595-          <widget class="QPushButton" name="promptIcon">
    596-           <property name="enabled">
    597-            <bool>false</bool>
    598-           </property>
    599+          <widget class="QLabel" name="promptIcon">
    


    hebasto commented at 9:30 pm on June 2, 2021:
    GUIUtil::ThemedLabel?

    jarolrod commented at 4:57 pm on June 5, 2021:

    See, a rough implementation of this suggestion here: https://github.com/jarolrod/gui/commit/4bc138e647cd6d5c7b2671d070c8c15623d1c37f

    I think the current approach is simpler


    jarolrod commented at 8:27 pm on June 30, 2021:
    not applicable anymore since 2f23ad2
  22. hebasto removed the label macOS on Jun 2, 2021
  23. hebasto commented at 5:48 pm on June 5, 2021: member

    I think the current approach is simpler

    What about a minimal change:

     0--- a/src/qt/rpcconsole.cpp
     1+++ b/src/qt/rpcconsole.cpp
     2@@ -525,6 +525,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
     3     //: Secondary shortcut to decrease the RPC console font size.
     4     GUIUtil::AddButtonShortcut(ui->fontSmallerButton, tr("Ctrl+_"));
     5 
     6+    ui->promptIcon->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/prompticon")));
     7+
     8     // Install event filter for up and down arrow
     9     ui->lineEdit->installEventFilter(this);
    10     ui->lineEdit->setMaxLength(16 * 1024 * 1024);
    

    ?

  24. jarolrod force-pushed on Jun 7, 2021
  25. jarolrod commented at 8:02 am on June 7, 2021: member

    updated from 82d430d -> 8095c81 (pr330.04 -> pr330.05)

    Changed:

    • Based on #358 so that we can use GUIUtil::ThemedLabel.
  26. in src/qt/forms/debugwindow.ui:595 in 8095c81ea7 outdated
    591@@ -592,34 +592,17 @@
    592           <number>3</number>
    593          </property>
    594          <item>
    595-          <widget class="QPushButton" name="promptIcon">
    596-           <property name="enabled">
    597-            <bool>false</bool>
    598-           </property>
    599+          <widget class="GUIUtil::ThemedLabel" name="promptIcon">
    


    hebasto commented at 2:47 am on June 13, 2021:
    It appears that Qt Designer (at least version 5.12.8) does not behave well if a class name is prepended by a namespace – it shows that the widget has a layout, that is obviously wrong.

    jarolrod commented at 8:27 pm on June 30, 2021:
    not applicable anymore since 2f23ad2
  27. in src/qt/forms/debugwindow.ui:1648 in 8095c81ea7 outdated
    1640@@ -1658,6 +1641,12 @@
    1641     <slot>clear()</slot>
    1642    </slots>
    1643   </customwidget>
    1644+  <customwidget>
    1645+    <class>GUIUtil::ThemedLabel</class>
    1646+    <extends>QLabel</extends>
    1647+    <header>qt/guiutil.h</header>
    1648+    <container>2</container>
    


    hebasto commented at 2:59 am on June 13, 2021:
    Why this line?

    jarolrod commented at 8:26 pm on June 30, 2021:
    not applicable anymore since 2f23ad2
  28. luke-jr commented at 6:55 pm on June 25, 2021: member

    Prefer to fix with b942216a1a72cfa049c951ac573e047794a5b8f1 or such.

    It’d be nice to magically make theming work everywhere, but this approach doesn’t seem worth it.

  29. hebasto added this to the milestone 22.0 on Jun 29, 2021
  30. qt: allow prompt icon to be colorized 2f23ad2c40
  31. jarolrod force-pushed on Jun 30, 2021
  32. jarolrod commented at 8:26 pm on June 30, 2021: member

    Updated from 8095c81 -> 2f23ad2 (pr330.05 -> pr330.06)

    Changes:

    • Use minimal diff solution to accomplish the goal of this PR, as mentioned here and here

    Tested on macOS 11.3, macOS 10.15.7, and macOS 10.14.6. Below are screenshots showing the prompt icon properly re-colorized on the mentioned platforms:

    macOS 11.3

    Start: Dark Mode Switch: Light Mode
    Start: Light Mode Switch: Dark Mode

    macOS 10.15.7

    Start: Dark Mode Switch: Light Mode
    Start: Light Mode Switch: Dark Mode

    macOS 10.14.6

    Start: Dark Mode Switch: Light Mode
    Screen Shot 2021-06-30 at 2 24 58 PM Screen Shot 2021-06-30 at 2 25 22 PM
    Start: Light Mode Switch: Dark Mode
    Screen Shot 2021-06-30 at 2 26 35 PM Screen Shot 2021-06-30 at 2 27 06 PM
  33. hebasto approved
  34. hebasto commented at 6:11 am on July 1, 2021: member
    ACK 2f23ad2c4031c43c6820ead6af7ae7cc6d4275ad
  35. hebasto merged this on Jul 1, 2021
  36. hebasto closed this on Jul 1, 2021

  37. sidhujag referenced this in commit a6db827ae0 on Jul 1, 2021
  38. gwillen referenced this in commit dce5ea8d1d on Jun 1, 2022
  39. bitcoin-core locked this on Aug 16, 2022


jarolrod hebasto luke-jr

Labels
UI

Milestone
22.0


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-23 00:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me