PowerTuneDigital / PowerTuneDigitalOfficial

Official PowerTune Digital Repo
GNU General Public License v3.0
18 stars 7 forks source link

Implement Constants and reusable combobox widget #107

Closed pgrandin closed 1 year ago

pgrandin commented 1 year ago

This pull request aims to achieve 2 things: 1) currently all the themeing is hardcoded. This leads to some discrepancies in the usage of font sizes, component placements, and even sometimes background colors (for example, the "Warn / Gear" settings page has a hardcoded black background, where everything else has gray : https://github.com/PowerTuneDigital/PowerTuneDigitalOfficial/blob/90e4bc5d200ee1f5fdc9a2cef695b4e1afe60162/Settings/warn_gear.qml#L9

By introducing Constants, we can ensure consistency and we can also make it easier to adapt the theme or colors (we then only need to change the values in one place).

2) The code for the comboboxes used in the settings main page does a lot of duplication. This reduces code readability and introduces the risk of error of behavior discrepancies. (for example, highligthing the pressure unit in the combo box does not work because of a naming issue between the component https://github.com/PowerTuneDigital/PowerTuneDigitalOfficial/blob/90e4bc5d200ee1f5fdc9a2cef695b4e1afe60162/Settings/main.qml#L236 and the relevant check https://github.com/PowerTuneDigital/PowerTuneDigitalOfficial/blob/90e4bc5d200ee1f5fdc9a2cef695b4e1afe60162/Settings/main.qml#L252

By adding the StyledComboBox.qml custom widget we make it easy to ensure that all Comboboxes will look and behave identically.

This pull request yields no visual changes (aside from fixing the highlighting for the pressure combobox) and does not introduce behavioral changes.