Serial Studio 1.1.6
A dashboard software for your embedded projects
Misc::ThemeManager Class Reference

The ThemeManager class. More...

#include <ThemeManager.h>

Inheritance diagram for Misc::ThemeManager:
Inheritance graph
Collaboration diagram for Misc::ThemeManager:
Collaboration graph

Public Slots

void setTheme (const int id)
 
void setCustomWindowDecorations (const bool enabled)
 

Signals

void themeChanged ()
 
void availableThemesChanged ()
 
void customWindowDecorationsChanged ()
 

Public Member Functions

int themeId () const
 
bool customWindowDecorations () const
 
bool titlebarSeparator () const
 
QColor base () const
 
QColor link () const
 
QColor button () const
 
QColor window () const
 
QColor text () const
 
QColor border () const
 
QColor midlight () const
 
QColor highlight () const
 
QColor brightText () const
 
QColor buttonText () const
 
QColor windowText () const
 
QColor tooltipText () const
 
QColor tooltipBase () const
 
QColor highlightedText () const
 
QColor highlightedTextAlternative () const
 
QColor placeholderText () const
 
QColor toolbarGradient1 () const
 
QColor toolbarGradient2 () const
 
QColor menubarText () const
 
QColor dialogBackground () const
 
QColor consoleText () const
 
QColor consoleBase () const
 
QColor consoleButton () const
 
QColor consoleWindow () const
 
QColor consoleHighlight () const
 
QColor consoleHighlightedText () const
 
QColor consolePlaceholderText () const
 
QColor windowBackground () const
 
QColor windowGradient1 () const
 
QColor windowGradient2 () const
 
QColor alternativeHighlight () const
 
QColor setupPanelBackground () const
 
QColor widgetTextPrimary () const
 
QColor widgetTextSecondary () const
 
QColor widgetWindowBackground () const
 
QColor widgetWindowBorder () const
 
QColor paneWindowBackground () const
 
QColor ledEnabled () const
 
QColor ledDisabled () const
 
QColor csvCheckbox () const
 
QColor widgetForegroundPrimary () const
 
QColor widgetForegroundSecondary () const
 
QColor widgetIndicator () const
 
QColor widgetControlBackground () const
 
QColor connectButtonChecked () const
 
QColor connectButtonUnchecked () const
 
QColor mqttButton () const
 
StringList widgetColors () const
 
StringList availableThemes () const
 

Static Public Member Functions

static ThemeManagerinstance ()
 

Properties

int themeId
 
bool titlebarSeparator
 
QColor base
 
QColor link
 
QColor button
 
QColor window
 
QColor text
 
QColor border
 
QColor midlight
 
QColor highlight
 
QColor brightText
 
QColor buttonText
 
QColor windowText
 
QColor tooltipText
 
QColor tooltipBase
 
QColor highlightedText
 
QColor highlightedTextAlternative
 
QColor placeholderText
 
QColor toolbarGradient1
 
QColor toolbarGradient2
 
QColor consoleText
 
QColor consoleBase
 
QColor consoleButton
 
QColor consoleWindow
 
QColor consoleHighlight
 
QColor consoleHighlightedText
 
QColor consolePlaceholderText
 
QColor windowBackground
 
QColor windowGradient1
 
QColor windowGradient2
 
QColor menubarText
 
QColor dialogBackground
 
QColor alternativeHighlight
 
QColor setupPanelBackground
 
QColor widgetTextPrimary
 
QColor widgetTextSecondary
 
QColor widgetWindowBackground
 
QColor widgetWindowBorder
 
QColor paneWindowBackground
 
QColor ledEnabled
 
QColor ledDisabled
 
QColor csvCheckbox
 
QColor widgetForegroundPrimary
 
QColor widgetForegroundSecondary
 
QColor widgetIndicator
 
QColor widgetControlBackground
 
QColor connectButtonChecked
 
QColor connectButtonUnchecked
 
QColor mqttButton
 
StringList widgetColors
 
StringList availableThemes
 
bool customWindowDecorations
 

Private Slots

void populateThemes ()
 
void loadTheme (const int id)
 

Private Member Functions

 ThemeManager ()
 
 ThemeManager (ThemeManager &&)=delete
 
 ThemeManager (const ThemeManager &)=delete
 
ThemeManageroperator= (ThemeManager &&)=delete
 
ThemeManageroperator= (const ThemeManager &)=delete
 

Private Attributes

int m_themeId
 
bool m_customWindowDecorations
 
QSettings m_settings
 
bool m_titlebarSeparator
 
StringList m_availableThemes
 
StringList m_availableThemesPaths
 
QColor m_base
 
QColor m_link
 
QColor m_button
 
QColor m_window
 
QColor m_text
 
QColor m_border
 
QColor m_midlight
 
QColor m_highlight
 
QColor m_brightText
 
QColor m_buttonText
 
QColor m_windowText
 
QColor m_tooltipText
 
QColor m_tooltipBase
 
QColor m_highlightedText
 
QColor m_highlightedTextAlternative
 
QColor m_placeholderText
 
QColor m_toolbarGradient1
 
QColor m_toolbarGradient2
 
QColor m_menubarText
 
QColor m_dialogBackground
 
QColor m_consoleText
 
QColor m_consoleBase
 
QColor m_consoleButton
 
QColor m_consoleWindow
 
QColor m_consoleHighlight
 
QColor m_consoleHighlightedText
 
QColor m_consolePlaceholderText
 
QColor m_windowBackground
 
QColor m_windowGradient1
 
QColor m_windowGradient2
 
QColor m_alternativeHighlight
 
QColor m_setupPanelBackground
 
QColor m_widgetTextPrimary
 
QColor m_widgetTextSecondary
 
QColor m_widgetWindowBackground
 
QColor m_widgetWindowBorder
 
QColor m_paneWindowBackground
 
QColor m_ledEnabled
 
QColor m_ledDisabled
 
QColor m_csvCheckbox
 
QColor m_widgetForegroundPrimary
 
QColor m_widgetForegroundSecondary
 
QColor m_widgetIndicator
 
QColor m_widgetControlBackground
 
QColor m_connectButtonChecked
 
QColor m_connectButtonUnchecked
 
QColor m_mqttButton
 
StringList m_widgetColors
 

Detailed Description

The ThemeManager class.

The ThemeManager class reads all the colors that are required to build a Serial Studio theme and makes them available to the rest of the application.

Themes are stored as JSON files in the "assets/themes" folder. The class automatically builds a model with the available themes. The only requirement to create your own themes is to create a JSON theme file and add it to the application resources file.

Constructor & Destructor Documentation

◆ ThemeManager() [1/3]

Misc::ThemeManager::ThemeManager ( )
explicitprivate

Constructor function, searches for available themes & loads the theme variant selected by the user.

◆ ThemeManager() [2/3]

Misc::ThemeManager::ThemeManager ( ThemeManager &&  )
privatedelete

◆ ThemeManager() [3/3]

Misc::ThemeManager::ThemeManager ( const ThemeManager )
privatedelete

Member Function Documentation

◆ alternativeHighlight()

QColor Misc::ThemeManager::alternativeHighlight ( ) const

◆ availableThemes()

StringList Misc::ThemeManager::availableThemes ( ) const

◆ availableThemesChanged

void Misc::ThemeManager::availableThemesChanged ( )
signal

◆ base()

QColor Misc::ThemeManager::base ( ) const

◆ border()

QColor Misc::ThemeManager::border ( ) const

◆ brightText()

QColor Misc::ThemeManager::brightText ( ) const

◆ button()

QColor Misc::ThemeManager::button ( ) const

◆ buttonText()

QColor Misc::ThemeManager::buttonText ( ) const

◆ connectButtonChecked()

QColor Misc::ThemeManager::connectButtonChecked ( ) const

◆ connectButtonUnchecked()

QColor Misc::ThemeManager::connectButtonUnchecked ( ) const

◆ consoleBase()

QColor Misc::ThemeManager::consoleBase ( ) const

◆ consoleButton()

QColor Misc::ThemeManager::consoleButton ( ) const

◆ consoleHighlight()

QColor Misc::ThemeManager::consoleHighlight ( ) const

◆ consoleHighlightedText()

QColor Misc::ThemeManager::consoleHighlightedText ( ) const

◆ consolePlaceholderText()

QColor Misc::ThemeManager::consolePlaceholderText ( ) const

◆ consoleText()

QColor Misc::ThemeManager::consoleText ( ) const

◆ consoleWindow()

QColor Misc::ThemeManager::consoleWindow ( ) const

◆ csvCheckbox()

QColor Misc::ThemeManager::csvCheckbox ( ) const

◆ customWindowDecorations()

bool Misc::ThemeManager::customWindowDecorations ( ) const

Returns true if the application should draw the window decorations & controls by itself. This feature makes it look cooler, but it can lead to some trouble on not-so-common desktop environments, such as CDE.

◆ customWindowDecorationsChanged

void Misc::ThemeManager::customWindowDecorationsChanged ( )
signal

◆ dialogBackground()

QColor Misc::ThemeManager::dialogBackground ( ) const

◆ highlight()

QColor Misc::ThemeManager::highlight ( ) const

◆ highlightedText()

QColor Misc::ThemeManager::highlightedText ( ) const

◆ highlightedTextAlternative()

QColor Misc::ThemeManager::highlightedTextAlternative ( ) const

◆ instance()

Misc::ThemeManager & Misc::ThemeManager::instance ( )
static

Returns a pointer to the only instance of this class

◆ ledDisabled()

QColor Misc::ThemeManager::ledDisabled ( ) const

◆ ledEnabled()

QColor Misc::ThemeManager::ledEnabled ( ) const

◆ link()

QColor Misc::ThemeManager::link ( ) const

◆ loadTheme

void Misc::ThemeManager::loadTheme ( const int  id)
privateslot

Parses the JSON theme definition file for the given theme ID. The colors are then "extracted" from the JSON file & loaded into the class, which is later used to set the colors of the QML user interface.

◆ menubarText()

QColor Misc::ThemeManager::menubarText ( ) const

◆ midlight()

QColor Misc::ThemeManager::midlight ( ) const

◆ mqttButton()

QColor Misc::ThemeManager::mqttButton ( ) const

◆ operator=() [1/2]

ThemeManager & Misc::ThemeManager::operator= ( const ThemeManager )
privatedelete

◆ operator=() [2/2]

ThemeManager & Misc::ThemeManager::operator= ( ThemeManager &&  )
privatedelete

◆ paneWindowBackground()

QColor Misc::ThemeManager::paneWindowBackground ( ) const

◆ placeholderText()

QColor Misc::ThemeManager::placeholderText ( ) const

◆ populateThemes

void Misc::ThemeManager::populateThemes ( )
privateslot

Reads all the available theme files from the application resources folder.

Note
theme definitions are bundled during the compilatopn process.

◆ setCustomWindowDecorations

void Misc::ThemeManager::setCustomWindowDecorations ( const bool  enabled)
slot

Enables/disables the custom window feature. See the customWindowDecorations() function for more information.

◆ setTheme

void Misc::ThemeManager::setTheme ( const int  id)
slot

Updates the theme ID to be used & saves the changes to the application settings.

Finally, this function prompts the user to restart the application in order to apply changes.

Unfortunately, an app restart is required because the application palette must be set before the GUI is initialized.

◆ setupPanelBackground()

QColor Misc::ThemeManager::setupPanelBackground ( ) const

◆ text()

QColor Misc::ThemeManager::text ( ) const

◆ themeChanged

void Misc::ThemeManager::themeChanged ( )
signal

◆ themeId()

int Misc::ThemeManager::themeId ( ) const

Returns the ID of the theme that the user has selected.

◆ titlebarSeparator()

bool Misc::ThemeManager::titlebarSeparator ( ) const

◆ toolbarGradient1()

QColor Misc::ThemeManager::toolbarGradient1 ( ) const

◆ toolbarGradient2()

QColor Misc::ThemeManager::toolbarGradient2 ( ) const

◆ tooltipBase()

QColor Misc::ThemeManager::tooltipBase ( ) const

◆ tooltipText()

QColor Misc::ThemeManager::tooltipText ( ) const

◆ widgetColors()

StringList Misc::ThemeManager::widgetColors ( ) const

◆ widgetControlBackground()

QColor Misc::ThemeManager::widgetControlBackground ( ) const

◆ widgetForegroundPrimary()

QColor Misc::ThemeManager::widgetForegroundPrimary ( ) const

◆ widgetForegroundSecondary()

QColor Misc::ThemeManager::widgetForegroundSecondary ( ) const

◆ widgetIndicator()

QColor Misc::ThemeManager::widgetIndicator ( ) const

◆ widgetTextPrimary()

QColor Misc::ThemeManager::widgetTextPrimary ( ) const

◆ widgetTextSecondary()

QColor Misc::ThemeManager::widgetTextSecondary ( ) const

◆ widgetWindowBackground()

QColor Misc::ThemeManager::widgetWindowBackground ( ) const

◆ widgetWindowBorder()

QColor Misc::ThemeManager::widgetWindowBorder ( ) const

◆ window()

QColor Misc::ThemeManager::window ( ) const

◆ windowBackground()

QColor Misc::ThemeManager::windowBackground ( ) const

◆ windowGradient1()

QColor Misc::ThemeManager::windowGradient1 ( ) const

◆ windowGradient2()

QColor Misc::ThemeManager::windowGradient2 ( ) const

◆ windowText()

QColor Misc::ThemeManager::windowText ( ) const

Member Data Documentation

◆ m_alternativeHighlight

QColor Misc::ThemeManager::m_alternativeHighlight
private

◆ m_availableThemes

StringList Misc::ThemeManager::m_availableThemes
private

◆ m_availableThemesPaths

StringList Misc::ThemeManager::m_availableThemesPaths
private

◆ m_base

QColor Misc::ThemeManager::m_base
private

◆ m_border

QColor Misc::ThemeManager::m_border
private

◆ m_brightText

QColor Misc::ThemeManager::m_brightText
private

◆ m_button

QColor Misc::ThemeManager::m_button
private

◆ m_buttonText

QColor Misc::ThemeManager::m_buttonText
private

◆ m_connectButtonChecked

QColor Misc::ThemeManager::m_connectButtonChecked
private

◆ m_connectButtonUnchecked

QColor Misc::ThemeManager::m_connectButtonUnchecked
private

◆ m_consoleBase

QColor Misc::ThemeManager::m_consoleBase
private

◆ m_consoleButton

QColor Misc::ThemeManager::m_consoleButton
private

◆ m_consoleHighlight

QColor Misc::ThemeManager::m_consoleHighlight
private

◆ m_consoleHighlightedText

QColor Misc::ThemeManager::m_consoleHighlightedText
private

◆ m_consolePlaceholderText

QColor Misc::ThemeManager::m_consolePlaceholderText
private

◆ m_consoleText

QColor Misc::ThemeManager::m_consoleText
private

◆ m_consoleWindow

QColor Misc::ThemeManager::m_consoleWindow
private

◆ m_csvCheckbox

QColor Misc::ThemeManager::m_csvCheckbox
private

◆ m_customWindowDecorations

bool Misc::ThemeManager::m_customWindowDecorations
private

◆ m_dialogBackground

QColor Misc::ThemeManager::m_dialogBackground
private

◆ m_highlight

QColor Misc::ThemeManager::m_highlight
private

◆ m_highlightedText

QColor Misc::ThemeManager::m_highlightedText
private

◆ m_highlightedTextAlternative

QColor Misc::ThemeManager::m_highlightedTextAlternative
private

◆ m_ledDisabled

QColor Misc::ThemeManager::m_ledDisabled
private

◆ m_ledEnabled

QColor Misc::ThemeManager::m_ledEnabled
private

◆ m_link

QColor Misc::ThemeManager::m_link
private

◆ m_menubarText

QColor Misc::ThemeManager::m_menubarText
private

◆ m_midlight

QColor Misc::ThemeManager::m_midlight
private

◆ m_mqttButton

QColor Misc::ThemeManager::m_mqttButton
private

◆ m_paneWindowBackground

QColor Misc::ThemeManager::m_paneWindowBackground
private

◆ m_placeholderText

QColor Misc::ThemeManager::m_placeholderText
private

◆ m_settings

QSettings Misc::ThemeManager::m_settings
private

◆ m_setupPanelBackground

QColor Misc::ThemeManager::m_setupPanelBackground
private

◆ m_text

QColor Misc::ThemeManager::m_text
private

◆ m_themeId

int Misc::ThemeManager::m_themeId
private

◆ m_titlebarSeparator

bool Misc::ThemeManager::m_titlebarSeparator
private

◆ m_toolbarGradient1

QColor Misc::ThemeManager::m_toolbarGradient1
private

◆ m_toolbarGradient2

QColor Misc::ThemeManager::m_toolbarGradient2
private

◆ m_tooltipBase

QColor Misc::ThemeManager::m_tooltipBase
private

◆ m_tooltipText

QColor Misc::ThemeManager::m_tooltipText
private

◆ m_widgetColors

StringList Misc::ThemeManager::m_widgetColors
private

◆ m_widgetControlBackground

QColor Misc::ThemeManager::m_widgetControlBackground
private

◆ m_widgetForegroundPrimary

QColor Misc::ThemeManager::m_widgetForegroundPrimary
private

◆ m_widgetForegroundSecondary

QColor Misc::ThemeManager::m_widgetForegroundSecondary
private

◆ m_widgetIndicator

QColor Misc::ThemeManager::m_widgetIndicator
private

◆ m_widgetTextPrimary

QColor Misc::ThemeManager::m_widgetTextPrimary
private

◆ m_widgetTextSecondary

QColor Misc::ThemeManager::m_widgetTextSecondary
private

◆ m_widgetWindowBackground

QColor Misc::ThemeManager::m_widgetWindowBackground
private

◆ m_widgetWindowBorder

QColor Misc::ThemeManager::m_widgetWindowBorder
private

◆ m_window

QColor Misc::ThemeManager::m_window
private

◆ m_windowBackground

QColor Misc::ThemeManager::m_windowBackground
private

◆ m_windowGradient1

QColor Misc::ThemeManager::m_windowGradient1
private

◆ m_windowGradient2

QColor Misc::ThemeManager::m_windowGradient2
private

◆ m_windowText

QColor Misc::ThemeManager::m_windowText
private

Property Documentation

◆ alternativeHighlight

QColor Misc::ThemeManager::alternativeHighlight
read

◆ availableThemes

StringList Misc::ThemeManager::availableThemes
read

◆ base

QColor Misc::ThemeManager::base
read

◆ border

QColor Misc::ThemeManager::border
read

◆ brightText

QColor Misc::ThemeManager::brightText
read

◆ button

QColor Misc::ThemeManager::button
read

◆ buttonText

QColor Misc::ThemeManager::buttonText
read

◆ connectButtonChecked

QColor Misc::ThemeManager::connectButtonChecked
read

◆ connectButtonUnchecked

QColor Misc::ThemeManager::connectButtonUnchecked
read

◆ consoleBase

QColor Misc::ThemeManager::consoleBase
read

◆ consoleButton

QColor Misc::ThemeManager::consoleButton
read

◆ consoleHighlight

QColor Misc::ThemeManager::consoleHighlight
read

◆ consoleHighlightedText

QColor Misc::ThemeManager::consoleHighlightedText
read

◆ consolePlaceholderText

QColor Misc::ThemeManager::consolePlaceholderText
read

◆ consoleText

QColor Misc::ThemeManager::consoleText
read

◆ consoleWindow

QColor Misc::ThemeManager::consoleWindow
read

◆ csvCheckbox

QColor Misc::ThemeManager::csvCheckbox
read

◆ customWindowDecorations

bool Misc::ThemeManager::customWindowDecorations
readwrite

◆ dialogBackground

QColor Misc::ThemeManager::dialogBackground
read

◆ highlight

QColor Misc::ThemeManager::highlight
read

◆ highlightedText

QColor Misc::ThemeManager::highlightedText
read

◆ highlightedTextAlternative

QColor Misc::ThemeManager::highlightedTextAlternative
read

◆ ledDisabled

QColor Misc::ThemeManager::ledDisabled
read

◆ ledEnabled

QColor Misc::ThemeManager::ledEnabled
read

◆ link

QColor Misc::ThemeManager::link
read

◆ menubarText

QColor Misc::ThemeManager::menubarText
read

◆ midlight

QColor Misc::ThemeManager::midlight
read

◆ mqttButton

QColor Misc::ThemeManager::mqttButton
read

◆ paneWindowBackground

QColor Misc::ThemeManager::paneWindowBackground
read

◆ placeholderText

QColor Misc::ThemeManager::placeholderText
read

◆ setupPanelBackground

QColor Misc::ThemeManager::setupPanelBackground
read

◆ text

QColor Misc::ThemeManager::text
read

◆ themeId

int Misc::ThemeManager::themeId
read

◆ titlebarSeparator

bool Misc::ThemeManager::titlebarSeparator
read

◆ toolbarGradient1

QColor Misc::ThemeManager::toolbarGradient1
read

◆ toolbarGradient2

QColor Misc::ThemeManager::toolbarGradient2
read

◆ tooltipBase

QColor Misc::ThemeManager::tooltipBase
read

◆ tooltipText

QColor Misc::ThemeManager::tooltipText
read

◆ widgetColors

StringList Misc::ThemeManager::widgetColors
read

◆ widgetControlBackground

QColor Misc::ThemeManager::widgetControlBackground
read

◆ widgetForegroundPrimary

QColor Misc::ThemeManager::widgetForegroundPrimary
read

◆ widgetForegroundSecondary

QColor Misc::ThemeManager::widgetForegroundSecondary
read

◆ widgetIndicator

QColor Misc::ThemeManager::widgetIndicator
read

◆ widgetTextPrimary

QColor Misc::ThemeManager::widgetTextPrimary
read

◆ widgetTextSecondary

QColor Misc::ThemeManager::widgetTextSecondary
read

◆ widgetWindowBackground

QColor Misc::ThemeManager::widgetWindowBackground
read

◆ widgetWindowBorder

QColor Misc::ThemeManager::widgetWindowBorder
read

◆ window

QColor Misc::ThemeManager::window
read

◆ windowBackground

QColor Misc::ThemeManager::windowBackground
read

◆ windowGradient1

QColor Misc::ThemeManager::windowGradient1
read

◆ windowGradient2

QColor Misc::ThemeManager::windowGradient2
read

◆ windowText

QColor Misc::ThemeManager::windowText
read

The documentation for this class was generated from the following files: