Skip to content

Conversation

@xdustinface
Copy link

@xdustinface xdustinface commented Jun 26, 2020

This PR ist part of a series of +-25 PRs related to UI redesigns. Its ancestor is #3571, its successor is #3573. I did not screenshot every single PR and its changes, instead i made "walk through all screen" videos with the result of this PR series and also with the 0.15 UI. If there are any concrete screenshots wanted, just let me know. To build with the full set of changes you can build from the branch xdustinface:pr-ui-redesign which always contains all changes.

-> Walk through 0.15
-> Walk through Redesign

I tried to give the commits enough text to make things obvious without a lot description for each PR. Also here, if you want more description for this specific PR, let me know.

About this PR

With this PR the client avoids loading the stylesheets every 200ms to check if there are changes by just looking at the last modified timestamp.

This allows setting a size policy for the toolbar buttons so that
they are stretched over the toolbar and resize on window size changes.
This also removes the blue logo because its not longer used.
@xdustinface xdustinface force-pushed the pr-ui-19-loadstylesheet branch from aa1b9b2 to 65f462d Compare June 26, 2020 19:14
Includes the following methods
 - GUIUtil::loadFonts to load the fonts into the application's font
database
 - GUIUtil::setApplicationFont to set the application font depending on
the active theme
 - GUIUtil::setFont to set a specific font variation for a vector of widgets (Montserrat for dash themes, system default for traditional theme).
 - GUIUtil::getFont to get a specific montserrat variation as QFont (Montserrat for dash themes, system default for traditional theme).
 - GUIUtil::getFontWeightNormal to get the font weight to be used for normal text
 - GUIUtil::getFontWeightBold to get the font weight to be used for
bolder text
 - GUIUtil::getFontNormal to get the default normal weighted QFont
 - GUIUtil::getFontBold to get the default bold weighted QFont

There is a Qt bug on macOS (at least with macOS 10.15.4 and Qt 5.7.1)
which leads to not mapping the font weights correctly to the different
font types so that they can be selected by the appropriate methods to
set the font weight. As result there is now way to properly select the
different font styles from stylesheet or with QFont::setWeight() for the
font Montserrat. There are only two different weights selectable over
the full range of possible weight values. One very bold one and the
"ExtraLight" version. As workaround its possible to select the fonts by
using the font style string (QFont::setStyleName) as the Montserrat font becomes loaded as one
family with one "font style" for each font file. The font wrapper added
by this commit are taking care of this behaviour for all operating
systems so there should be no other usage of QFont outside of GUIUtil and no more font changes in stylesheets.
This is because font related changes will from now on only be made either in c++ with `GUIUtil::setFont` for font weight/style changes or in css for size and color changes with `font-size` or `color`.
This is because of a qt bug, so font-weight related changes will from now on only be made in c++ with GUIUtil helpers.
The two parent commits did remove all some font-weight changes from css and ui files. This commit reverts them.
-font-weight-normal allows to set the weight of normal texts in the UI
-font-weight-bold allows to set the weight of bold texts in the UI
-font-scale allows to scale the application font size up/down
This is a preparation for later style changes where dash themes will get
custom hover effects.
This is in preparation for a later commit which allows setting a custom css directory and runtime theme updates.
This allows to load a custom directory as css directory.

The custom directory currently needs to have the files:

- general.css
- dark.css
- light.css
- traditional.css
- scrollbars.css
This allows enabling them again on theme changes
If this mode is enabled the content of the css files will become pushed to the UI every second. It also forces some UI elements to show up which are actually only shown under special conditions (e.g. watch balance labels). Its required to set a custom css directory with -custom-css-dir to enable this.
The stylesheet is inherited from the parent so its enough to set it for the main window and use this as parent for all other windows.

Except for the ShutdownDialog. This needs to have its own stylesheet set because we can't have the main window as parent of the ShutdownDialog.
This is required now as RPCConsole does not longer show as extra window with a parent set (For stylesheet inheritance).
This commit enables runtime theme changes. Means no more client
restart required if the theme gets changed in the options dialog.

The stylesheet update process of the ui debug mode gets also improved by this
changes. Prior the stylesheets were pushed to the UI every second no matter
if there was a change or not. This is changing to only pushing them to the
UI if there were any changes made to the stylesheets.
- Hide prompt icon for dash themes in rpc console.
- Clear rpc console on theme changes to make sure fonts/sizes are correct.
- Its done in the StyleChange event to make sure things are still correct after a runtime theme change
- Clearing the console is required to reload the font colors.
- Reload the entries in SendCoinsDialog to avoid size and focus rect issues.
- Add light line below the coincontrol frame
- Add light line above fee frame
- Increase header font size
- Remove button layout changes of CoinControl button
- Fix Layout/Alignment of balance labels
- Inheritance doesn't work here obviously because of QCompleter is parent of the popup
- QStyledItemDelegate delegate is required. Without its not possible to access `::item` selectors from css.
This also keeps track of changed font-sizes and updates them depending on the settings if GUIUtil::updateFonts() gets called.
Allows to scale the font in the same way like with -font-scale.
Allows to set the weight for normal and bold text
Allows to choose between system default font or montserrat
Make its data also accessible int, not only by QModelIndex.
- AmountSpinBox (QAbstractBox) is now called AmountLineEdit (QLineEdit)
- Replaced the AmountSpinBox and the QValueComboBox with just an AmountLineEdit
- Adjusted min-size hint calculation
- Increased maximum width
- Right-Align text
- Removed obsolete code
Make sure it does not get stretched above the in AmountLineEdit::minimumSizeHint() calculated size.
Its fixed now with the change to a normal line edit.
This commit leads to GUIUtil::loadStyleSheet treating css code between
<os="<os_list>"> and </os> different. It will only become added for
operating systems provided in the list of the sections start tag.

There may be multiple entries per section. Possible entries:

- macosx
- windows
- other

<os_list> must be a combination of the three options above separated by
comma like in "windows,macosx".

Its ok to have multiple <os="...">...</os> sections in a file with
arbitrary OS combinations. They will all become added to the end of the
file though. Means even putting an <os> section in the top of the file
would become appended to the end of the file during loading which should
be kept in mind when adding sections to avoid unexpected overwriting.

Example
------------------------------------------------------------------------

<os="macosx, windows, other">

/* Example section to add styles for all operating systems
   Remove any to exclude it.
*/

</os>
This disabled scrollbars.css loading and adds a "windows,other" section in general.css, dark.css and light.css where it adds customizations for scrollbars in each theme.
Avoid loading the stylesheets every 200ms to check if there are changes by just looking at the last modified timestamp.
@xdustinface xdustinface force-pushed the pr-ui-19-loadstylesheet branch from 65f462d to a79939d Compare June 27, 2020 20:24
@xdustinface
Copy link
Author

Rebased into #3559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant