Skip to content

Conversation

@micieslak
Copy link
Member

What does the PR do

Reimplements Theme from stateful singleton to attached property, dynamically propagated through the components tree.

[TODO[

Affected areas

Architecture compliance

Screencapture of the functionality

Impact on end user

How to test

Risk

@micieslak micieslak requested review from a team, alexjba, caybro and noeliaSD as code owners November 20, 2025 10:27
@micieslak micieslak marked this pull request as draft November 20, 2025 10:27
@micieslak micieslak force-pushed the feat/theme-attached-type branch from 71355b5 to d6a2153 Compare November 20, 2025 10:34
@status-im-auto
Copy link
Member

status-im-auto commented Nov 20, 2025

Jenkins Builds

Click to see older builds (67)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d6a2153 #2 2025-11-20 10:42:15 ~7 min tests/nim 📄log
✔️ d6a2153 #2 2025-11-20 10:44:30 ~9 min android/arm64 🤖apk 📲
✔️ d6a2153 #2 2025-11-20 10:49:24 ~14 min tests/ui 📄log
✔️ d6a2153 #2 2025-11-20 10:50:05 ~15 min ios/aarch64 📱ipa
✔️ d6a2153 #2 2025-11-20 10:50:22 ~15 min macos/aarch64 🍎dmg
✔️ d6a2153 #2 2025-11-20 10:52:47 ~17 min linux/x86_64 📦tgz
✔️ d6a2153 #2 2025-11-20 10:53:42 ~18 min macos/aarch64-nwaku 🍎dmg
✔️ d6a2153 #2 2025-11-20 10:57:35 ~22 min linux/x86_64-nwaku 📦tgz
✔️ d6a2153 pr19316 2025-11-20 11:08:48 ~15 min tests/e2e 📊rpt
✔️ d6a2153 #2 2025-11-20 11:10:34 ~35 min windows/x86_64 💿exe
✖️ d6a2153 PR19316 2025-11-20 11:38:10 ~27 min tests/e2e-windows 📊rpt
39086dbb #3 2025-11-20 17:22:25 ~7 min android/arm64 📄log
a21474e #4 2025-11-21 11:18:31 ~6 min android/arm64 📄log
✔️ a21474e #3 2025-11-21 11:19:16 ~6 min tests/nim 📄log
a21474e #3 2025-11-21 11:21:22 ~9 min linux/x86_64-nwaku 📄log
a21474e #3 2025-11-21 11:25:12 ~12 min macos/aarch64-nwaku 📄log
✔️ a21474e #3 2025-11-21 11:26:01 ~13 min macos/aarch64 🍎dmg
✔️ a21474e #3 2025-11-21 11:26:21 ~13 min tests/ui 📄log
✔️ a21474e #3 2025-11-21 11:28:35 ~16 min linux/x86_64 📦tgz
✔️ a21474e #3 2025-11-21 11:38:31 ~26 min ios/aarch64 📱ipa
✔️ a21474e #3 2025-11-21 11:39:09 ~26 min windows/x86_64 💿exe
✔️ a21474e pr19316 2025-11-21 11:44:30 ~15 min tests/e2e 📊rpt
✖️ a21474e PR19316 2025-11-21 12:06:45 ~27 min tests/e2e-windows 📊rpt
✔️ 35c8758d #5 2025-11-21 15:58:00 ~9 min android/arm64 🤖apk 📲
✔️ 42ca45b #4 2025-11-21 16:04:34 ~15 min tests/nim 📄log
✔️ 42ca45b #4 2025-11-21 16:04:40 ~15 min ios/aarch64 📱ipa
✔️ 42ca45b #4 2025-11-21 16:04:40 ~15 min macos/aarch64-nwaku 🍎dmg
✔️ 42ca45b #4 2025-11-21 16:09:50 ~20 min linux/x86_64 📦tgz
✔️ 42ca45b #4 2025-11-21 16:11:05 ~22 min linux/x86_64-nwaku 📦tgz
✔️ 42ca45b #4 2025-11-21 16:11:42 ~22 min tests/ui 📄log
✔️ 42ca45b #4 2025-11-21 16:12:12 ~23 min windows/x86_64 💿exe
✔️ 42ca45b pr19316 2025-11-21 16:27:34 ~17 min tests/e2e 📊rpt
✖️ 42ca45b PR19316 2025-11-21 16:42:24 ~30 min tests/e2e-windows 📊rpt
✔️ 1c5773db #6 2025-11-21 17:26:40 ~10 min android/arm64 🤖apk 📲
✔️ 9f3195d8 #7 2025-11-22 17:27:58 ~12 min android/arm64 🤖apk 📲
✔️ b11fba6b #8 2025-11-24 17:30:49 ~15 min android/arm64 🤖apk 📲
✔️ ad13304e #9 2025-11-25 11:43:08 ~10 min android/arm64 🤖apk 📲
c1b54b0 #5 2025-11-25 11:44:19 ~11 min macos/aarch64-nwaku 📄log
c1b54b0 #5 2025-11-25 11:44:33 ~11 min linux/x86_64-nwaku 📄log
✔️ c1b54b0 #5 2025-11-25 11:46:30 ~13 min tests/nim 📄log
✔️ c1b54b0 #5 2025-11-25 11:48:56 ~16 min macos/aarch64 🍎dmg
c1b54b0 #5 2025-11-25 11:55:45 ~22 min tests/ui 📄log
✔️ c1b54b0 #5 2025-11-25 11:55:55 ~23 min linux/x86_64 📦tgz
✔️ c1b54b0 #5 2025-11-25 12:01:14 ~28 min windows/x86_64 💿exe
✔️ c1b54b0 pr19316 2025-11-25 12:11:55 ~15 min tests/e2e 📊rpt
✖️ c1b54b0 PR19316 2025-11-25 12:20:06 ~18 min tests/e2e-windows 📊rpt
6cf7b25 #6 2025-11-25 12:09:44 ~6 min macos/aarch64-nwaku 📄log
✔️ 6cf7b25 #6 2025-11-25 12:11:18 ~8 min tests/nim 📄log
✔️ 6cf7b25 #6 2025-11-25 12:15:12 ~12 min macos/aarch64 🍎dmg
✖️ 6cf7b25 #6 2025-11-25 12:15:12 ~12 min ios/aarch64 📱ipa
6cf7b25 #6 2025-11-25 12:17:54 ~14 min tests/ui 📄log
✔️ 6cf7b25 #6 2025-11-25 12:18:42 ~15 min linux/x86_64 📦tgz
✔️ 6cf7b25 #6 2025-11-25 12:23:58 ~20 min windows/x86_64 💿exe
✔️ 6cf7b25 #6 2025-11-25 12:24:58 ~22 min linux/x86_64-nwaku 📦tgz
✔️ 6cf7b25 pr19316 2025-11-25 12:36:19 ~17 min tests/e2e 📊rpt
✖️ 6cf7b25 PR19316 2025-11-25 12:52:53 ~28 min tests/e2e-windows 📊rpt
✔️ 6137e074 #10 2025-11-25 12:11:33 ~8 min android/arm64 🤖apk 📲
cf4e110 #7 2025-11-25 15:40:53 ~5 min macos/aarch64-nwaku 📄log
✔️ cf4e110 #7 2025-11-25 15:41:45 ~6 min tests/nim 📄log
✖️ cf4e110 #7 2025-11-25 15:44:29 ~9 min ios/aarch64 📱ipa
✔️ cf4e110 #7 2025-11-25 15:46:16 ~11 min macos/aarch64 🍎dmg
✔️ cf4e110 #7 2025-11-25 15:50:15 ~15 min linux/x86_64 📦tgz
cf4e110 #7 2025-11-25 15:50:28 ~15 min tests/ui 📄log
✔️ cf4e110 #7 2025-11-25 15:51:37 ~16 min linux/x86_64-nwaku 📦tgz
✔️ cf4e110 #7 2025-11-25 16:00:32 ~25 min windows/x86_64 💿exe
✖️ cf4e110 pr19316 2025-11-25 16:08:06 ~17 min tests/e2e 📊rpt
✖️ cf4e110 PR19316 2025-11-25 16:26:41 ~26 min tests/e2e-windows 📊rpt
Commit #️⃣ Finished (UTC) Duration Platform Result
5309fdb #8 2025-11-25 20:14:50 ~6 min macos/aarch64-nwaku 📄log
✔️ 5309fdb #8 2025-11-25 20:15:07 ~6 min tests/nim 📄log
✔️ 5309fdb #8 2025-11-25 20:22:03 ~13 min ios/aarch64 📱ipa
✔️ 5309fdb #8 2025-11-25 20:23:10 ~14 min macos/aarch64 🍎dmg
✔️ 5309fdb #8 2025-11-25 20:24:13 ~15 min linux/x86_64 📦tgz
✔️ 5309fdb #8 2025-11-25 20:24:32 ~15 min tests/ui 📄log
✔️ 5309fdb #8 2025-11-25 20:25:43 ~17 min linux/x86_64-nwaku 📦tgz
✔️ 5309fdb #8 2025-11-25 20:31:59 ~23 min windows/x86_64 💿exe
✔️ 5309fdb pr19316 2025-11-25 20:41:09 ~16 min tests/e2e 📊rpt
✔️ 85e5f55 #9 2025-11-26 14:28:14 ~6 min tests/nim 📄log
85e5f55 #9 2025-11-26 14:28:18 ~6 min macos/aarch64-nwaku 📄log
✔️ 85e5f55 #9 2025-11-26 14:35:27 ~13 min tests/ui 📄log
✔️ 85e5f55 #9 2025-11-26 14:36:02 ~14 min ios/aarch64 📱ipa
✔️ 85e5f55 #9 2025-11-26 14:36:24 ~14 min macos/aarch64 🍎dmg
✔️ 85e5f55 #9 2025-11-26 14:37:15 ~15 min linux/x86_64-nwaku 📦tgz
✔️ 85e5f55 #9 2025-11-26 14:38:29 ~16 min linux/x86_64 📦tgz
✔️ 85e5f55 #9 2025-11-26 14:46:05 ~24 min windows/x86_64 💿exe
✔️ 85e5f55 pr19316 2025-11-26 14:54:36 ~16 min tests/e2e 📊rpt
✖️ 85e5f55 PR19316 2025-11-26 15:15:15 ~29 min tests/e2e-windows 📊rpt

@micieslak micieslak force-pushed the feat/theme-attached-type branch 3 times, most recently from c1b54b0 to 6cf7b25 Compare November 25, 2025 12:02
Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

Awesome work! I love it :beers
Let's get it merged quickly now that we have the release branch. It's probably a burden to maintain.

return s_asideTextFontBaseSize + m_fontSizeOffset;
}

QJSValue Theme::fontSize() const
Copy link
Contributor

Choose a reason for hiding this comment

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

Beautiful! Never crossed my mind to try this approach!

Copy link
Contributor

Choose a reason for hiding this comment

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

it's probably a good approach to use on all the hardcoded dimensions we have in the app and ultimately to replace the scaling.

Copy link
Member

Choose a reason for hiding this comment

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

Hehe that's my idea! 😆

@micieslak micieslak force-pushed the feat/theme-attached-type branch 2 times, most recently from cf4e110 to 5309fdb Compare November 25, 2025 20:08
Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

Awesome work! Just some suggestions and minor things

{
QColor c = color;
if (alpha > 0.0 && alpha <= 1.0)
c.setAlphaF(alpha);
Copy link
Member

Choose a reason for hiding this comment

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

Not sure this is going to work as expected... you usually want to switch to a HSL/HSV color space first

Copy link
Member

Choose a reason for hiding this comment

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

Old code:

    function setColorAlpha(color, alpha) {
        return Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, alpha)
    }

Copy link
Member Author

@micieslak micieslak Nov 26, 2025

Choose a reason for hiding this comment

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

This code is replacement for:

    function alphaColor(color, alpha) {
        let actualColor = Qt.darker(color, 1)
        actualColor.a = alpha
        return actualColor
    }

where the first line let actualColor = Qt.darker(color, 1) is just tricky conversion in case e.g. "red" color literal is provided. The version you quoted is from Utils, and it's not related with this code.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah but that's why it does the darker first, it probably converts to HSL behind the scene


Q_PROPERTY(Style style READ style WRITE setStyle RESET resetStyle
NOTIFY styleChanged)
Q_PROPERTY(const ThemePalette* palette READ palette
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could also expose other old properties (like fonts) in order to minimize the QML diff, wdyt?

Copy link
Member Author

@micieslak micieslak Nov 26, 2025

Choose a reason for hiding this comment

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

I found it cleaner to keep things like Fonts as a separate, dedicated component responsible only for fonts. Especially that there is that FontLoader loading logic inside.

It creates bigger diff indeed, but it's just fully automatic replacement.

Copy link
Member

Choose a reason for hiding this comment

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

Yup, bigger diff but also... it will be very hard to backport fixes now, e.g. to 2.36 branch but I agree that's just a temporary problem

readonly property alias monoFont: monoFont.font
readonly property alias codeFont: codeFont.font

FontLoader {
Copy link
Member

Choose a reason for hiding this comment

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

We could (pre)load all these fonts from C++ too, and it would be faster imo :) And just expose the three baseFont/monoFont/codeFont properties

Copy link
Member

Choose a reason for hiding this comment

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

I meant https://doc.qt.io/qt-6/qfontdatabase.html#addApplicationFont

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to keep the attached type as small/simple as possible. Ideally only stuff that can benefit from propagation should be there. I found it more modular when keeping things like that separated.

Copy link
Member

Choose a reason for hiding this comment

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

Yup, this wouldn't be part of the propagation, just initialized and setup somewhere else, not in QML

@micieslak micieslak force-pushed the feat/theme-attached-type branch from 5309fdb to 85e5f55 Compare November 26, 2025 14:21
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.

4 participants