-
Notifications
You must be signed in to change notification settings - Fork 117
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
VPN-6213 (part 6): Restructure files, add linter checks #10054
Conversation
90684ec
to
18eeab0
Compare
de38a21
to
e0f7735
Compare
e0f7735
to
eb8ce7a
Compare
src/theme.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really love the cleanup that you did with this.
WDYT: would it be possible to codify a theme now in c++? Like QObject -> BaseColor -> MainColor
and have the Theme.cpp simply expose the current color QObject as property?
Because with your nice cleanup i dont see anything the jsengine does the c++ preprocessor and a few consexpr could not do. And it's probably faster to expose a static QObject data vs concatting a string, evaling it in js and then exposing the static data.
Note not for now, this looks great but as followup task in our backlog. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I got into this, I found myself unsure why we were using a JS object to start with. (Because it's only QML actually using it?) I agree it's slower, though luckily it's only loaded at the boot of the app.
If it's possible to keep this structure (base colors that cannot be used in the app, theme colors that are used in app but only refer to base colors, derived theme colors that can be used in the app and refer to theme and base colors), I'm happy to move this into C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! This is awesome!
Description
This is the final PR for restructuring our colors to allow for additional theming. This builds on #10028, which built on #10019, which in turn built on #10015, which in turn built on #10014, which in turn built on #9983. All 5 have been merged into
main
.In this PR (roughly in order of commits):
colors.js
(identical for all themes),theme.js
(customized for each theme), andderived-theme.js
(identical for all themes)colors.js
and the bottom ofderived-theme.js
to allow us to merge all 3 color files into one before trying to read it as a JS object. This is well-commented. (Without this, I was having trouble lettingtheme.js
refer to colors named incolors.js
.)theme.cpp
is reworked to match the restructured filestheme.js
files andderived-theme.js
do not contain any hex color codes.theme.js
files use the exact same list of theme-defined colors.MZTheme.colors.x
colors in all QML files come from eithertheme.js
ortheme-derived.js
(to make sure we don't use anything likeMZTheme.colors.red
in a QML file).To see the secondary theme, use the developer debug menu's theme selection menu.
Reference
VPN-6213
Checklist