Rockbox Technical Forums

Support and General Use => Theming and Appearance Customization => Topic started by: Inclement Death on August 31, 2020, 02:38:52 PM

Title: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on August 31, 2020, 02:38:52 PM
So, I played around with the existing theme editor and took a look at the code...

It was written in VB6 utilizing Windows Forms. VB6 is a dead language and I want more from a theme editor. So...

I started writing a new one with a C#/WPF front end, CLI (Common Language Interface), and a (hopefully) cross-platform capable C++ back end. The back end will handle all the processing so Linux and Apple devs can attach their own UIs to it for other platforms.

A lot of the UI items will be drag and drop; images, buttons, sliders, etc.

Background image, cached images, and settings will be set in a separate tab.

Images will be resized and converted based on selected device and moved to an %u201CIn Progress%u201D folder. The original images will be held in a temp folder so the theme can be resized for other devices.

The WPS output will be editable and in its own tab or collapsible area (haven%u2019t decided yet).
The goal of this project is to have a theme creator/editor that can package the entire theme and install it to the media player.

I could use some assistance with my screen size JSON file. Need to add all supported devices and their screen sizes. Using JSON because it%u2019s lightweight, easy to understand, and is supported across multiple languages.

I attached the JSON screen size file, but had to change the extension from .json to .txt since they are not in the allowed list.

EDIT: Updated screen size file. Forgot to add color depth.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on August 31, 2020, 03:53:31 PM
You're aware that the Rockbox Theme Editor we have in our git is written in C++, using the Qt framework?
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on August 31, 2020, 07:32:53 PM
I only saw the one on the "Useful Tools" wiki page... https://www.rockbox.org/wiki/EZWPS (https://www.rockbox.org/wiki/EZWPS)

Damn, I thought that was it and wasted a ton of time I could have spent working on something else.

Ok... I'll take a better look in the git repo.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: cereal_killer on September 01, 2020, 11:01:47 AM
Here is a link to a .exe of the Theme editor, if it is of and help: https://www.reddit.com/r/rockbox/comments/fh001f/build_theme_editor/
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on September 01, 2020, 04:15:49 PM
I could use some assistance with my screen size JSON file. Need to add all supported devices and their screen sizes. Using JSON because it%u2019s lightweight, easy to understand, and is supported across multiple languages.

Not a json file but that's what the existing editor is using. Also likely to be somewhat outdated, but well ...
https://git.rockbox.org/cgit/rockbox.git/tree/utils/themeeditor/resources/targetdb
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on September 02, 2020, 04:48:22 PM
I'm installing QT now. Going to familiarize myself with the code.

Where is the bug list for the Theme Editor? Only found one bug from 2010 and no feature requests in the tracker.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on September 03, 2020, 01:19:06 PM
Where is the bug list for the Theme Editor? Only found one bug from 2010 and no feature requests in the tracker.

There is no bug list. There hasn't been much interest in it, so no real bug reports here.

There are also no feature requests. At some point we closed all feature requests, since they simply ended up clogging the tracker.

I'm not planning to maintain it, but since I looked at it I just fixed some build issues of the Theme Editor with Qt5. If you want to do serious work on it I suggest you show around on IRC, since that is where developers hang.

While at it I also created an updated Windows binary. You can find it here: https://drive.google.com/drive/folders/0B8pPsvGJ3RdKfnhyTDAwTWstMlhNR3NDanZURHFzOEI4ZHhoQUJ5OXUzN1NDRlp0U0hZNzQ?usp=sharing
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on September 04, 2020, 03:05:00 AM
Damn, I fixed most of the build issues with Qt5, but I will revert my changes and grab yours; may solve my linker issue with zlib. Although, it could be an issue with my WSL installation.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on September 04, 2020, 10:17:13 AM
Most issues are simply search and replace (like QString::toAscii() is now toLatin1()). You shouldn't need to use WSL. You only need MinGW, though there is an issue left -- we used msys too in the past. This has been changed long ago, but not for the theme editor. I'm going to address that later today.

After that you should be able to go the qmake; mingw32-make limbo from a cmd window (obviously you need MinGW and Qt in the path, but Qt brings a shortcut for this, or use Qt creator with a MinGW kit)

Edit: Done that. Easiest to build is likely by opening the pro file with Qt Creator and configuring it with a MinGW kit. Works fine for me. No need for WSL or anything extra.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on September 04, 2020, 01:51:17 PM
WSL makes it easier to use Visual Studio 2019 with the QT extension. I have it set up to open devenv.exe through the terminal window so editing the files won’t screw up the Linux permissions. Most of my Linux experience is using Ubuntu to cross-compile code for IoT devices.

Still have the zlib linker issue; even tried the zlib NuGet package. I’ll figure it out, probably installed the wrong zlib package from apt or it’s a path issue. Downside of C and C++, linker headaches; which is one of the reasons I usually stick to C# frontends and C++ backends with a C++/CLI wrapper.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on September 04, 2020, 03:36:55 PM
I don't understand what you're trying to do. The Theme Editor compiles fine as native Windows application. You don't need anything WSL, and no Linux permissions involved.

The only "problem" right now is that there's a Makefile involved, so you need to use MinGW to build, you can't use VS right now (should be easy to fix, but nobody did that so far; you can use it as editor of course, and the Qt extension for VS also doesn't need anything but a Qt installation). Qt comes with MinGW support (and even the environment), so all you need is to install Qt for MinGW, Qt's MinGW tools, and (optionally, if you want an IDE) Qt Creator. Then either use the MinGW shell (Qt installs a shortcut) to run qmake and mingw32-make or open the pro file in Qt Creator. Build. Done.

Don't install random things with NuGet or apt. You don't need that. Qt brings everything that is needed. There are no linker headaches when doing it properly ...
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: Inclement Death on September 04, 2020, 04:55:15 PM
I‘m setting up my dev environment to add features and fix bugs, not just build the latest. My VS install has a cross-compiler with CMake support and the Qt5 extension adds QMake support. Just working on getting the cross-compiler set up properly.

I want to add support for drag drop, image resizing, font conversion, and packaging themes for multiple screen sizes. Basically, I want to make it an easy to use, all-in-one theme editor. I have experience with cross-platform C++ written in Visual Studio for IoT devices running different flavors of Linux.

I don’t code professionally anymore due to a connective tissue disorder that took away most of the fine motor control in my hands and causes my joints to dislocate. I went from typing ~120 words per minute to ~30, on a good day. I’m mostly bedridden, bored as hell, and trying to help out as best I can with the tools I have.
Title: Re: New WYSIWYG Theme Editor and other utilities in one app!
Post by: bluebrother on September 04, 2020, 05:15:55 PM
If you're working on Windows why are you trying to cross compile? If you want to work on the code there's no benefit in not working natively since there is no need to do otherwise. It only complicates things, and if you're writing portable code there's no problem in building for another OS later. I also don't see how you want to effectively debug a GUI application remotely. Sure it's possible but why go through all those extra hoops for what? Are you running those c# frontends you mentioned on a different (cross) platform for development as well?

And btw, the Theme Editor is not a pure qmake project. Having qmake support in VS will not be enough, at least for native builds (and I don't see why that should be different for remote builds)

And setting up a dev environment usually starts with getting the current code to compile 🤔