GSoC: Libreoffice Theme (week - 1 update)

Sahil Gautam printfdebugging at gmail.com
Fri May 24 11:00:25 UTC 2024


Hi,the WIP prototype patch is linked in the sources below.
I created an extension and found that we can overwrite the expert configuration from
the extension. Then I searched on the web for what options do these toolkits provide in
terms of styling. For gtk, the only option that I found was to go via the CSS route, meaning
that one has to create either a CSS file, or a CSS string, load it into a GtkCssProvider(StyleProvider),
and add the provider to the GdkScreen. For QT/kf5 I am supposed to create a derived class of QStyle
and change the drawing behaviour for the widgets there. The youtube tutorial explains it well, but I
am yet to test it properly (my lsp was having some issues).

I added an entry under tools > options > application colors for changing the menubar color, and it works
in gtk. But it works only when one goes to tools > options > applic... and changes it on the spot.
On startup, the colors are washed away for some reason.

The various vclplugins communicate with the configuration via `AllSettings` which are passed to
the various `updateSettings(...)` functions. I tried using  `Color aColor = svtools::ColorConfig::GetDefaultColor(svtools::MENUBARBACKGROUND);`
but got linking errors. Meaning that the only way  of exchaning information with the toolkits is `AllSettings.StyleSettings().get....color()`,
Please share if you know of any other ways to access the expert config colors in VCLs. I have been searching for the central AllSettings/
StyleSettings object, but didn't find it yet.

The `ColorConfig` class seems to be the central structure for accessing/modifying the tools > options > App Colors, but I found
not a single instance of it in the VCL. Also there are some questions that I am  trying to find the answer to first, like

- how is the central StyleSettings object (part of AllSettings) is communicating with expert configuration.
- why is my  lsp suddenly broken in qt source files :)


----- A little frustrated ------

Woring in VCL and colorcfg with a 4 core i5 laptop is a bad idea. And this was the major setback that I faced.
I couldn't just change something like add a new function and test it quickly. Compiling it took an hour or more,
and by then my brain's cache was cleared. So within this week, I am building a computer with 7950x.
I have ccache --max-size= 200G, still 4 cores!!

I had some college exams this month + the slow PC. I tried working on something else while the program compiles,
but that doesn't help as it takes 30 minutes to sink into the codebase and the constant context switching makes
it worst. Summer holidays for this year are starting day after tomorrow, and I hope the next week I can get more work done.

Sahil Gautam
still debugging with printf

Sources:
https://gerrit.libreoffice.org/c/core/+/168016  [PROTOTYPE PATCH]
https://wiki.documentfoundation.org/images/b/b0/LibreOffice_config_extension_writing.pdf
https://www.youtube.com/watch?v=Qn4HHbDxG0M  [A nice tutorial on Styling in QT/kf5]
https://discourse.gnome.org/t/setting-css-attributes-on-individual-widget-instances/13836  [Styling in GTK]

On 5/14/24 2:03 PM, Printf Debugging wrote:
> Hi, I am Printf from India, and I will be working on the "Libreoffice 
> Theme" project this summer. First of all, many many thanks to Heiko 
> and Rafael for mentoring the project, and to the community for being 
> so welcoming! This week, I have been wrapping up some patches that I 
> had assigned myself, along with some hunting and exploration in the 
> VCL. I found that there are functions like `bool 
> GtkSalGraphics::updateSettings(AllSettings& rSettings)` which extract 
> the colors from the widget systems and save those in a local copy via 
> the `Set.....Color()` functions. The transaction seemed to be one way 
> though, meaning that I didn't see any calls putting the updated colors 
> back into the widget system, to modify the UI. For the colors like 
> accent-color etc, I think all the getting/setting happens on the local 
> copy after extraction. So I have been trying to understand how GTK 
> does colors. Found that styling in GTK is built around 
> `GtkStyleContext` to which we add StyleProviders, which have the 
> styling information. There are a lot of GtkStyleContext pointers in 
> `gtkgdi.hxx` for each major component. These are created at startup... 
> (survey in progress) I will come up with a prototype patch to change 
> the menubar colors probably in this week (counting the start of week 1 
> from today) or at max next week. The idea is to get a thumbs up from 
> the mentors, community and the devs on the approach/roadmap for the 
> project, like shall we create a separate dialog for themes, or shall 
> we repurpose the `Tools > Options > Application Colors/Personas` area. 
> If we go the dialog route, then what should be the layout, considering 
> that this project might extend beyond just plain colors during or even 
> after the GSoC project. Is my styling approach scalable, meaning 
> should I create a separate class etc etc. This is my first project 
> where I am working under time constraint. So there might be some 
> hiccups here and there, but I will converse the situation(s)/updates 
> on time, and I hope we can find the solutions together. Again, thanks 
> for being such a warm and community. Always Debugging on Terminal Printf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20240524/011d2bb0/attachment-0001.htm>


More information about the LibreOffice mailing list