rovsuite / monterey

Monterey is the computer GUI for rov-suite, an open source ROV control system.
21 stars 14 forks source link

Configurable/Customizable Themes #43

Open QuantumCD opened 11 years ago

QuantumCD commented 11 years ago

This probably wouldn't be too hard of a thing to implement, as I've done it in the past. However, the hard part would be switching the palettes of the QML elements. The graphs at the top aren't that big of a deal, but the LED Indicators could be easily modified to use a global palette. Any thoughts on the other QML elements?

I think it's sort of an important feature, as the dark theme doesn't always look right. We could either go with a default theme, or I could look into a theme editor sort of like Qt Creator's text editor configuration. Thoughts on this?

image

The above is what the current state of the UI is if we just leave the Fusion theme to its default palette. Note that I also changed the background of the LEDIndicator's to reflect the window color just now.

chriskonstad commented 11 years ago

I like it! It would be fairly easy to implement! Probably the best way of handling it would be to add it as a function in the QML "widget's" C++ class (i.e. DepthTape or Compass) that takes the QPalette of MainWindow and extracts the proper colors for the proper spots. It would also let us add a "night" mode (red on black), which I know is a requested feature for OpenROV's control application.

QuantumCD commented 11 years ago

Yeah, I could definitely experiment with some different palettes. Perhaps you could work on setting up the QML widgets to read the palette colors, and I'll see about another palette which uses red instead of blues for the contrasting color?

QuantumCD commented 11 years ago

I might just experiment with using an INI file for color palettes. That'd probably be the best way to allow users to make/share custom palettes. XML would be a viable option too, but INI wouldn't require the QtXML module. I'll test some things out later in a different project and see how that would work.

QuantumCD commented 11 years ago

Okay, here's some pictures of my preliminary red on black theme. Give me some feedback if you have any criticisms!

image Above is the button text + new tooltip which is similar to the blue one in my original dark theme.

image A slider.

image A focused slider.

image A focused button.

image New menu items.

image Highlighted text + context menu in a QTextEdit.

That's about it for now. I left the base/window colors the same, since you said red on black. Here's a picture of the entire thing with the above palette:

image

chriskonstad commented 11 years ago

I love that focused slider and the button looks pretty slick! And I like your idea of reading it from an INI file so that it's easy to copy and share. That's why the settings are put into an INI file instead of the default QSettings location for each OS. And yes, I'll get on setting up the QML widgets to accept new QPalettes. Great feature idea, by the way! Just curious, but how do you set the palette up in this example? By each widget type or for the entire qApp? I'm just curious because the QCustomPlots, QLabels, and QLCDNumbers should have accepted that QPalette just fine.

chriskonstad commented 11 years ago

Also, just from a UX perspective, maybe the ROVSettings window should have a QComboBox that reads a "styles.ini" (or similarly named) file and populates a list of selectable QPalettes. That way, the user can just copy and paste a theme into their INI file, alongside their other themes, and then simply chose it from the settings window. Any thoughts?

QuantumCD commented 11 years ago

I was using the application in main. It should be accepting--you're right. Also, a simple file browser for an INI file would be perfect, I think. How does that sound? Something like "Choose Theme" maybe.

chriskonstad commented 11 years ago

Dang. That'll be a bug to work on. :-/ That sounds perfect! I can't wait for Monterey 3.1... ;)

QuantumCD commented 11 years ago

Good luck with that bug. Look at the obvious things first, unlike me. :P I'm going to work on the customizable theme tool for now. Hopefully it can be integrated soon.

chriskonstad commented 11 years ago

Haha! Thanks. XD Should the theme selector be launched from the View menu bar item or the settings window?

QuantumCD commented 11 years ago

Hmm... that's a good question. In other news, I figured out how to serialize the palettes to INI and read them back in! The only problem (which is really just an annoyance) is that QColor's are saved as QVariant byte arrays, meaning it will be nearly impossible to edit the INI files by hand. That means I'll need to build a color editor in itself, so perhaps it'd be better if it was its own dialog entirely. Once I'm done with all of it, I'll see about integrating it with Monterey.

chriskonstad commented 11 years ago

Oh nice! Alright. That sounds like a plan. I'll work on getting those QML widgets ready for QPalettes today. I was at Qt Insights yesterday. :)

chriskonstad commented 11 years ago

I just laid some ground work for QML widget themes. It just uses the current Dark Fusion palette right now, but by changing Monterey's palette and then calling refreshPalette() on all of the QML widgets, the palette's colors will propagate. If need be, we can change which colors get applied where.