![]() |
NDEVR
API Documentation
|
Responsible for setting up the core style of the application including size of various widgets and colors. More...
Public Member Functions | |
| NDEVRProxyStyle () | |
| Constructs the proxy style with default settings. | |
| NDEVRProxyStyle (const File &ini_file) | |
| Constructs the proxy style and loads settings from an INI file. | |
| NDEVRProxyStyle (QStyle *style) | |
| Constructs the proxy style wrapping an existing QStyle. | |
| fltp08 | baseTextScale () const |
| Returns the base text scaling factor. | |
| fltp08 | desktopFontScale () |
| Returns the desktop font scaling factor. | |
| RGBColor | disabledColor (NDEVRLightingTheme theme) const |
| Returns the disabled-state color for a given theme. | |
| void | drawArrow (Qt::ArrowType type, QPainter *painter, const QStyleOption *option, const QRect &rect, const QColor &color) const |
| Draws an arrow indicator in the given direction. | |
| void | drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget=nullptr) const override |
| Draws a complex control such as a scroll bar or slider. | |
| void | drawControl (ControlElement element, const QStyleOption *opt, QPainter *painter, const QWidget *widget) const override |
| Draws a control element such as a button or label. | |
| virtual void | drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const override |
| Draws a pixmap within a styled context. | |
| void | drawItemText (QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const override |
| Draws text within a styled context. | |
| virtual void | drawPrimitive (PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override |
| Draws a primitive style element with custom NDEVR rendering. | |
| TimeSpan | fadeInAnimationTime () const |
| Returns the duration of fade-in animations. | |
| TimeSpan | fadeOutAnimationTime () const |
| Returns the duration of fade-out animations. | |
| virtual void | getINI (INIFactory &factory) override |
| Serializes or deserializes theme settings through an INI factory. | |
| QPalette | interpolatedThemePalette (NDEVRLightingTheme start, NDEVRLightingTheme end, fltp04 percent) const |
| Returns a palette that interpolates between two themes. | |
| bool | isGlobalStyle () const |
| Checks whether this instance is the global singleton style. | |
| QRect | itemPixmapRect (const QRect &r, int flags, const QPixmap &pixmap) const override |
| Returns the bounding rectangle for an item pixmap. | |
| QRect | itemTextRect (const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const override |
| Returns the bounding rectangle for item text. | |
| void | lightingThemeChangedSignal (NDEVRLightingTheme theme) |
| Emitted when the lighting theme changes. | |
| NDEVRLightingTheme | oldTheme () const |
| Returns the theme that was active before the most recent theme change. | |
| TimeSpan | paletteAnimationTime () const |
| Returns the duration of palette transition animations. | |
| int | pixelMetric (PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override |
| Returns a pixel metric value scaled for the current UI settings. | |
| void | polish (QWidget *widget) override |
| Polishes a widget by applying NDEVR-specific style adjustments. | |
| TimeSpan | resizeAnimationTime () const |
| Returns the duration of widget resize animations. | |
| void | setLightingTheme (NDEVRLightingTheme theme, bool force_update=false, bool save_settings=true) |
| Sets the active lighting theme immediately. | |
| void | setLightingThemeAnimated (NDEVRLightingTheme start, NDEVRLightingTheme end, fltp04 percent) |
| Sets the lighting theme with an animated transition at a specific percentage. | |
| void | setLightingThemeAnimated (NDEVRLightingTheme theme) |
| Sets the lighting theme with an animated transition from the current theme. | |
| void | setToDefaultColors () |
| Resets all theme colors to their default values. | |
| void | setToDefaultSizes () |
| Resets all UI size metrics to their default values. | |
| void | setUseRoundedButtons (bool use_rounded_buttons) |
| Enables or disables rounded button rendering. | |
| QSize | sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override |
| Computes the size for a widget given its contents type. | |
| QIcon | standardIcon (StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override |
| Returns the standard icon for a given pixmap type. | |
| virtual QPalette | standardPalette () const override |
| Returns the standard palette for the current theme. | |
| int | styleHint (StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override |
| Returns a style hint value for the given hint type. | |
| QRect | subControlRect (ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override |
| Returns the sub-control rectangle for a complex control. | |
| QRect | subElementRect (SubElement element, const QStyleOption *option, const QWidget *widget) const override |
| Returns the sub-element rectangle for a given element type. | |
| NDEVRLightingTheme | theme () const |
| Returns the currently active lighting theme. | |
| QPalette | themePalette (NDEVRLightingTheme theme) const |
| Returns the palette for a specific lighting theme. | |
| fltp04 | themeTransitionPercent () |
| Returns the current theme transition animation percentage. | |
| void | updateIconOverrideTheme () |
| Updates the icon theme override to match the current lighting theme. | |
| void | updateResolutionPixelMetric () |
| Recalculates the resolution-dependent pixel metric based on the current display. | |
| void | updateUIFromStyle () |
| Refreshes the entire UI to reflect current style settings. | |
| bool | usingRoundedButtons () const |
| Checks whether rounded buttons are currently enabled. | |
| Public Member Functions inherited from INIInterface | |
| INIInterface () | |
| Constructs an INIInterface with no default INI file. | |
| INIInterface (const File &default_ini) | |
| Constructs an INIInterface with the specified default INI file. | |
| virtual | ~INIInterface () |
| Virtual destructor for safe polymorphic cleanup. | |
| virtual void | finishReadingINI (INIFactory &) |
| Called after reading an INI file. | |
| virtual void | prepareForINI (INIFactory &) |
| Called before reading or writing an INI file. | |
| virtual bool | readINIOptions () |
| Reads INI options from the default INI file. | |
| virtual bool | readINIOptions (File &ini_file) |
| Reads INI options from the specified INI file. | |
| virtual bool | saveINIOptions (bool multithead=false) |
| Saves INI options to the default INI file. | |
| virtual bool | saveINIOptions (File &ini_file, bool multithead=false) |
| Saves INI options to the specified INI file. | |
| void | setDefaultINIFile (const File &file) |
| Sets the default INI file path used for reading and writing options. | |
| virtual void | writeToLog (const StringView &title, LogPtr log, uint01 log_level=2U) |
| Writes the current INI options to the specified log with a title. | |
| virtual void | writeToLog (LogPtr log, uint01 log_level=2U) |
| Writes the current INI options to the specified log. | |
Static Public Member Functions | |
| static StringView | ColorThemeIcon (NDEVRLightingTheme theme) |
| Returns the icon name associated with a given lighting theme. | |
| static NDEVRProxyStyle * | GlobalStyle () |
| Returns the singleton global style instance. | |
| static QFont | OriginalFont () |
| Returns the original application font before any scaling is applied. | |
Protected Member Functions | |
| fltp08 | baseUIScale () const |
| Returns the base UI scaling factor. | |
| void | drawRoundedButtonBackground (const QStyleOption *opt, QPainter *p, int radius=Constant< int >::Max) const |
| Draws a rounded button background. | |
| void | init () |
| Initializes the proxy style with default values and system metrics. | |
| void | saveSettings () |
| Persists the current style settings to storage. | |
| void | updateFontScale () |
| Recalculates the font scale based on current settings. | |
Protected Attributes | |
| fltp08 | m_desktop_text_scale |
| Text scale factor for desktop mode. | |
| fltp08 | m_desktop_ui_scale |
| UI scale factor for desktop mode. | |
| QStyle * | m_native_theme |
| The platform native style used as a fallback. | |
| NDEVRLightingTheme | m_old_theme |
| The previously active theme before the last change. | |
| fltp08 | m_resolution_pixel_metric |
| A DPI-aware pixel metric for the current display. | |
| NDEVRLightingTheme | m_theme |
| The currently active lighting theme. | |
| fltp04 | m_theme_transition_percent |
| Current animation progress during theme transitions. | |
| fltp08 | m_touch_text_scale_horz |
| Horizontal text scale factor for touch mode. | |
| fltp08 | m_touch_text_scale_vert |
| Vertical text scale factor for touch mode. | |
| fltp08 | m_touch_ui_scale_horz |
| Horizontal UI scale factor for touch mode. | |
| fltp08 | m_touch_ui_scale_vert |
| Vertical UI scale factor for touch mode. | |
| bool | m_touch_use_rounded_buttons |
| Whether rounded button rendering is enabled in touch mode. | |
| RGBColor | theme_colors [NDEVRLightingTheme::e_num_of_themes][QPalette::NColorRoles] |
| Per-theme color table indexed by theme and palette role. | |
| Protected Attributes inherited from INIInterface | |
| File | m_default_ini |
| The default file path used for reading and writing INI options. | |
Static Protected Attributes | |
| static NDEVRProxyStyle * | s_global_style |
| The singleton global style instance. | |
Responsible for setting up the core style of the application including size of various widgets and colors.
Some themes are inherited from the OS, some from Qt's fusion style, and some are defined and drawn directly.
Definition at line 94 of file NDEVRTheme.h.
| NDEVRProxyStyle::NDEVRProxyStyle | ( | const File & | ini_file | ) |
Constructs the proxy style and loads settings from an INI file.
| [in] | ini_file | The INI file containing theme settings. |
| NDEVRProxyStyle::NDEVRProxyStyle | ( | QStyle * | style | ) |
Constructs the proxy style wrapping an existing QStyle.
| [in] | style | The base QStyle to proxy. |
References NDEVRProxyStyle().
| fltp08 NDEVRProxyStyle::baseTextScale | ( | ) | const |
Returns the base text scaling factor.
|
protected |
Returns the base UI scaling factor.
|
static |
Returns the icon name associated with a given lighting theme.
| [in] | theme | The lighting theme. |
References theme().
| fltp08 NDEVRProxyStyle::desktopFontScale | ( | ) |
Returns the desktop font scaling factor.
| RGBColor NDEVRProxyStyle::disabledColor | ( | NDEVRLightingTheme | theme | ) | const |
| void NDEVRProxyStyle::drawArrow | ( | Qt::ArrowType | type, |
| QPainter * | painter, | ||
| const QStyleOption * | option, | ||
| const QRect & | rect, | ||
| const QColor & | color ) const |
Draws an arrow indicator in the given direction.
| [in] | type | The arrow direction. |
| [in] | painter | The painter to draw with. |
| [in] | option | The style options. |
| [in] | rect | The bounding rectangle for the arrow. |
| [in] | color | The color of the arrow. |
|
override |
Draws a complex control such as a scroll bar or slider.
| [in] | control | The complex control type. |
| [in] | option | The style options for the complex control. |
| [in] | painter | The painter to draw with. |
| [in] | widget | Optional widget context. |
|
override |
Draws a control element such as a button or label.
| [in] | element | The control element type. |
| [in] | opt | The style options. |
| [in] | painter | The painter to draw with. |
| [in] | widget | Optional widget context. |
|
overridevirtual |
Draws a pixmap within a styled context.
| [in] | painter | The painter to draw with. |
| [in] | rect | The bounding rectangle. |
| [in] | alignment | The alignment flags for the pixmap. |
| [in] | pixmap | The pixmap to draw. |
|
override |
Draws text within a styled context.
| [in] | painter | The painter to draw with. |
| [in] | rect | The bounding rectangle for the text. |
| [in] | flags | Text alignment and formatting flags. |
| [in] | pal | The palette to use for text colors. |
| [in] | enabled | Whether the text should appear enabled. |
| [in] | text | The text string to draw. |
| [in] | textRole | The palette color role for the text. |
|
overridevirtual |
Draws a primitive style element with custom NDEVR rendering.
| [in] | pe | The primitive element to draw. |
| [in] | opt | The style options for the element. |
| [in] | p | The painter to draw with. |
| [in] | w | Optional widget context. |
|
protected |
Draws a rounded button background.
| [in] | opt | The style options for the button. |
| [in] | p | The painter to draw with. |
| [in] | radius | The corner radius, defaults to maximum for fully rounded. |
| TimeSpan NDEVRProxyStyle::fadeInAnimationTime | ( | ) | const |
Returns the duration of fade-in animations.
| TimeSpan NDEVRProxyStyle::fadeOutAnimationTime | ( | ) | const |
Returns the duration of fade-out animations.
|
overridevirtual |
Serializes or deserializes theme settings through an INI factory.
| [in] | factory | The INI factory for reading or writing settings. |
Implements INIInterface.
|
static |
Returns the singleton global style instance.
References NDEVRProxyStyle().
| QPalette NDEVRProxyStyle::interpolatedThemePalette | ( | NDEVRLightingTheme | start, |
| NDEVRLightingTheme | end, | ||
| fltp04 | percent ) const |
Returns a palette that interpolates between two themes.
| [in] | start | The starting theme. |
| [in] | end | The ending theme. |
| [in] | percent | The interpolation percentage from 0.0 to 1.0. |
| bool NDEVRProxyStyle::isGlobalStyle | ( | ) | const |
Checks whether this instance is the global singleton style.
|
override |
Returns the bounding rectangle for an item pixmap.
| [in] | r | The reference rectangle. |
| [in] | flags | Alignment flags. |
| [in] | pixmap | The pixmap to position. |
|
override |
Returns the bounding rectangle for item text.
| [in] | fm | The font metrics to use. |
| [in] | r | The reference rectangle. |
| [in] | flags | Text alignment and formatting flags. |
| [in] | enabled | Whether the item is enabled. |
| [in] | text | The text to measure. |
| void NDEVRProxyStyle::lightingThemeChangedSignal | ( | NDEVRLightingTheme | theme | ) |
| NDEVRLightingTheme NDEVRProxyStyle::oldTheme | ( | ) | const |
Returns the theme that was active before the most recent theme change.
|
static |
Returns the original application font before any scaling is applied.
| TimeSpan NDEVRProxyStyle::paletteAnimationTime | ( | ) | const |
Returns the duration of palette transition animations.
|
override |
Returns a pixel metric value scaled for the current UI settings.
| [in] | metric | The pixel metric to query. |
| [in] | option | Optional style option context. |
| [in] | widget | Optional widget context. |
|
override |
Polishes a widget by applying NDEVR-specific style adjustments.
| [in] | widget | The widget to polish. |
| TimeSpan NDEVRProxyStyle::resizeAnimationTime | ( | ) | const |
Returns the duration of widget resize animations.
| void NDEVRProxyStyle::setLightingTheme | ( | NDEVRLightingTheme | theme, |
| bool | force_update = false, | ||
| bool | save_settings = true ) |
| void NDEVRProxyStyle::setLightingThemeAnimated | ( | NDEVRLightingTheme | start, |
| NDEVRLightingTheme | end, | ||
| fltp04 | percent ) |
Sets the lighting theme with an animated transition at a specific percentage.
| [in] | start | The starting theme. |
| [in] | end | The ending theme. |
| [in] | percent | The interpolation percentage from 0.0 to 1.0. |
| void NDEVRProxyStyle::setLightingThemeAnimated | ( | NDEVRLightingTheme | theme | ) |
| void NDEVRProxyStyle::setUseRoundedButtons | ( | bool | use_rounded_buttons | ) |
Enables or disables rounded button rendering.
| [in] | use_rounded_buttons | True to use rounded buttons, false for rectangular. |
|
override |
Computes the size for a widget given its contents type.
| [in] | type | The contents type. |
| [in] | option | The style options. |
| [in] | size | The proposed content size. |
| [in] | widget | Optional widget context. |
|
override |
Returns the standard icon for a given pixmap type.
| [in] | standardIcon | The standard pixmap identifier. |
| [in] | option | Optional style options. |
| [in] | widget | Optional widget context. |
References standardIcon().
Referenced by standardIcon().
|
overridevirtual |
Returns the standard palette for the current theme.
|
override |
Returns a style hint value for the given hint type.
| [in] | stylehint | The style hint to query. |
| [in] | opt | Optional style options. |
| [in] | widget | Optional widget context. |
| [in] | returnData | Optional return data for complex hints. |
|
override |
Returns the sub-control rectangle for a complex control.
| [in] | cc | The complex control type. |
| [in] | opt | The style options for the complex control. |
| [in] | sc | The sub-control to query. |
| [in] | widget | Optional widget context. |
|
override |
Returns the sub-element rectangle for a given element type.
| [in] | element | The sub-element type. |
| [in] | option | The style options. |
| [in] | widget | Optional widget context. |
|
inline |
Returns the currently active lighting theme.
Definition at line 330 of file NDEVRTheme.h.
References m_theme.
Referenced by ColorThemeIcon(), disabledColor(), lightingThemeChangedSignal(), setLightingTheme(), setLightingThemeAnimated(), and themePalette().
| QPalette NDEVRProxyStyle::themePalette | ( | NDEVRLightingTheme | theme | ) | const |
| fltp04 NDEVRProxyStyle::themeTransitionPercent | ( | ) |
Returns the current theme transition animation percentage.
| bool NDEVRProxyStyle::usingRoundedButtons | ( | ) | const |
Checks whether rounded buttons are currently enabled.