mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6514 Dark Theme : Move define to RiaDefines
This commit is contained in:
parent
87bc6acd65
commit
4841d19d02
@ -114,6 +114,16 @@ void caf::AppEnum<RiaDefines::GridCaseAxis>::setUp()
|
||||
|
||||
setDefault( RiaDefines::GridCaseAxis::AXIS_K );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::ThemeEnum>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::ThemeEnum::DEFAULT, "DEFAULT", "Default theme" );
|
||||
addItem( RiaDefines::ThemeEnum::DARK, "DARK", "Dark theme" );
|
||||
addItem( RiaDefines::ThemeEnum::LIGHT, "LIGHT", "Light theme" );
|
||||
setDefault( RiaDefines::ThemeEnum::DEFAULT );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -215,4 +215,11 @@ enum class GridCaseAxis
|
||||
UNDEFINED_AXIS
|
||||
};
|
||||
|
||||
enum class ThemeEnum
|
||||
{
|
||||
DEFAULT,
|
||||
DARK,
|
||||
LIGHT
|
||||
};
|
||||
|
||||
}; // namespace RiaDefines
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuDockWidgetTools.h"
|
||||
#include "RiuFileDialogTools.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainWindowTools.h"
|
||||
#include "RiuMdiMaximizeWindowGuard.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RifReaderSettings.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmSettings.h"
|
||||
@ -1002,7 +1003,7 @@ bool RiaPreferences::openExportedPdfInViewer() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuGuiTheme::ThemeEnum RiaPreferences::guiTheme() const
|
||||
RiaDefines::ThemeEnum RiaPreferences::guiTheme() const
|
||||
{
|
||||
return m_guiTheme();
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@ -113,7 +112,7 @@ public:
|
||||
bool showProgressBar() const;
|
||||
bool openExportedPdfInViewer() const;
|
||||
|
||||
RiuGuiTheme::ThemeEnum guiTheme() const;
|
||||
RiaDefines::ThemeEnum guiTheme() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
@ -215,7 +214,7 @@ private:
|
||||
caf::PdmField<bool> m_showProgressBar;
|
||||
caf::PdmField<QString> m_gtestFilter;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RiuGuiTheme::ThemeEnum>> m_guiTheme;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ThemeEnum>> m_guiTheme;
|
||||
|
||||
caf::PdmField<PageSizeEnum> m_pageSize;
|
||||
caf::PdmField<PageOrientationEnum> m_pageOrientation;
|
||||
|
@ -18,13 +18,15 @@
|
||||
|
||||
#include "RicThemeColorEditorFeature.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuQssSyntaxHighlighter.h"
|
||||
#include "RiuTextEditWithCompletion.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -51,7 +53,7 @@ bool RicThemeColorEditorFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiuGuiTheme::ThemeEnum theme = RiaGuiApplication::instance()->preferences()->guiTheme();
|
||||
RiaDefines::ThemeEnum theme = RiaGuiApplication::instance()->preferences()->guiTheme();
|
||||
|
||||
QDialog* dialog = new QDialog( RiuMainWindow::instance() );
|
||||
connect( dialog, &QDialog::close, [this, theme]() { RiuGuiTheme::updateGuiTheme( theme ); } );
|
||||
@ -63,11 +65,11 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
layout->addWidget( new QLabel( "GUI theme" ), 0, 0 );
|
||||
|
||||
QComboBox* themeSelector = new QComboBox();
|
||||
caf::AppEnum<RiuGuiTheme::ThemeEnum> themes;
|
||||
caf::AppEnum<RiaDefines::ThemeEnum> themes;
|
||||
for ( size_t index = 0; index < themes.size(); index++ )
|
||||
{
|
||||
themeSelector->addItem( themes.uiTextFromIndex( index ), QVariant::fromValue( index ) );
|
||||
if ( static_cast<RiuGuiTheme::ThemeEnum>( index ) == theme )
|
||||
if ( static_cast<RiaDefines::ThemeEnum>( index ) == theme )
|
||||
{
|
||||
themeSelector->setCurrentIndex( static_cast<int>( index ) );
|
||||
}
|
||||
@ -104,7 +106,7 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
QGridLayout* innerLayout = new QGridLayout();
|
||||
int row = 0;
|
||||
int column = 0;
|
||||
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
QMap<QString, QString> variableValueMap = RiuGuiTheme::getVariableValueMap( theme );
|
||||
QMap<QString, QString> variableGuiTextMap = RiuGuiTheme::getVariableGuiTextMap( theme );
|
||||
for ( const QString variableName : variableValueMap.keys() )
|
||||
@ -139,8 +141,8 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
// connect( themeSelector, qOverload<int>( &QComboBox::currentIndexChanged ), [=]() {
|
||||
connect( themeSelector, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [=]() {
|
||||
generateColorFields();
|
||||
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiuGuiTheme::updateGuiTheme( static_cast<RiuGuiTheme::ThemeEnum>( theme ) );
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiuGuiTheme::updateGuiTheme( static_cast<RiaDefines::ThemeEnum>( theme ) );
|
||||
editor->setPlainText( RiuGuiTheme::loadStyleSheet( theme ) );
|
||||
} );
|
||||
|
||||
@ -157,7 +159,7 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
|
||||
QPushButton* button = new QPushButton( "Apply style sheet changes" );
|
||||
layout->addWidget( button, 6, 1 );
|
||||
connect( button, &QPushButton::clicked, [this, themeSelector, editor, generateColorFields]() {
|
||||
RiuGuiTheme::ThemeEnum theme = static_cast<RiuGuiTheme::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
|
||||
RiuGuiTheme::writeStyleSheetToFile( theme, editor->toPlainText() );
|
||||
generateColorFields();
|
||||
} );
|
||||
|
@ -45,25 +45,11 @@
|
||||
#include "qwt_plot_marker.h"
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RiuGuiTheme::ThemeEnum>::setUp()
|
||||
{
|
||||
addItem( RiuGuiTheme::ThemeEnum::DEFAULT, "DEFAULT", "Default theme" );
|
||||
addItem( RiuGuiTheme::ThemeEnum::DARK, "DARK", "Dark theme" );
|
||||
addItem( RiuGuiTheme::ThemeEnum::LIGHT, "LIGHT", "Light theme" );
|
||||
setDefault( RiuGuiTheme::ThemeEnum::DEFAULT );
|
||||
}
|
||||
|
||||
} // End namespace caf
|
||||
|
||||
QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableValueMap = {};
|
||||
QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableGuiTextMap = {};
|
||||
QMap<RiaDefines::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableValueMap = {};
|
||||
QMap<RiaDefines::ThemeEnum, QMap<QString, QString>> RiuGuiTheme::s_variableGuiTextMap = {};
|
||||
QMap<QString, QMap<QString, QMap<QString, QMap<QString, QString>>>> RiuGuiTheme::s_qwtPlotItemPropertiesMap = {};
|
||||
QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme::s_customStyleSheetApplicators =
|
||||
{ { QString(
|
||||
"QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::curve\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
|
||||
{{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::curve\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((line-color|symbol-color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match ) {
|
||||
@ -104,8 +90,7 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
if ( QwtPlotCurve* curve = dynamic_cast<QwtPlotCurve*>( item ) )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
|
||||
match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = curve->pen();
|
||||
pen.setColor( QColor( lineColor ) );
|
||||
@ -126,8 +111,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} },
|
||||
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::grid\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
|
||||
}},
|
||||
{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::grid\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match ) {
|
||||
@ -156,8 +141,7 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
{
|
||||
if ( QwtPlotGrid* grid = dynamic_cast<QwtPlotGrid*>( item ) )
|
||||
{
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) ||
|
||||
match.captured( "itemName" ) == "*" )
|
||||
if ( itemNameRegExp.exactMatch( item->title().text() ) || match.captured( "itemName" ) == "*" )
|
||||
{
|
||||
QPen pen = grid->majorPen();
|
||||
pen.setColor( QColor( color ) );
|
||||
@ -169,8 +153,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} },
|
||||
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::legend\\s*\\{("
|
||||
}},
|
||||
{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::legend\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((text-color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
[]( QRegularExpressionMatch& match ) {
|
||||
@ -206,8 +190,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} },
|
||||
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::lineMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
|
||||
}},
|
||||
{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::lineMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
|
||||
"\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((color|text-color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
@ -265,8 +249,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} },
|
||||
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::pointMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
|
||||
}},
|
||||
{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::pointMarker\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]"
|
||||
"\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((color|text-color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
@ -326,8 +310,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} },
|
||||
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::picker"
|
||||
}},
|
||||
{QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::picker"
|
||||
"\\s*\\{("
|
||||
"?<properties>([\\n\\r]*\\s*((text-color):"
|
||||
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
|
||||
@ -364,12 +348,12 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
|
||||
plotWidget->replot();
|
||||
}
|
||||
}
|
||||
} } };
|
||||
}}};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGuiTheme::updateGuiTheme( ThemeEnum theme )
|
||||
void RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
s_qwtPlotItemPropertiesMap.clear();
|
||||
applyStyleSheet( theme );
|
||||
@ -384,7 +368,7 @@ void RiuGuiTheme::updateGuiTheme( ThemeEnum theme )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuGuiTheme::applyStyleSheet( ThemeEnum theme )
|
||||
bool RiuGuiTheme::applyStyleSheet( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
QString styleSheetPath = getStyleSheetPath( theme );
|
||||
QFile styleSheetFile( styleSheetPath );
|
||||
@ -406,7 +390,7 @@ bool RiuGuiTheme::applyStyleSheet( ThemeEnum theme )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGuiTheme::changeVariableValue( RiuGuiTheme::ThemeEnum theme, const QString& variableName, const QString& newValue )
|
||||
void RiuGuiTheme::changeVariableValue( RiaDefines::ThemeEnum theme, const QString& variableName, const QString& newValue )
|
||||
{
|
||||
if ( !s_variableValueMap.keys().contains( theme ) )
|
||||
{
|
||||
@ -422,7 +406,7 @@ void RiuGuiTheme::changeVariableValue( RiuGuiTheme::ThemeEnum theme, const QStri
|
||||
}
|
||||
}
|
||||
|
||||
QMap<QString, QString> RiuGuiTheme::getVariableValueMap( RiuGuiTheme::ThemeEnum theme )
|
||||
QMap<QString, QString> RiuGuiTheme::getVariableValueMap( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
if ( !s_variableValueMap.keys().contains( theme ) )
|
||||
{
|
||||
@ -448,7 +432,7 @@ QMap<QString, QString> RiuGuiTheme::getVariableValueMap( RiuGuiTheme::ThemeEnum
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QMap<QString, QString> RiuGuiTheme::getVariableGuiTextMap( RiuGuiTheme::ThemeEnum theme )
|
||||
QMap<QString, QString> RiuGuiTheme::getVariableGuiTextMap( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
if ( !s_variableGuiTextMap.keys().contains( theme ) )
|
||||
{
|
||||
@ -474,7 +458,7 @@ QMap<QString, QString> RiuGuiTheme::getVariableGuiTextMap( RiuGuiTheme::ThemeEnu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuGuiTheme::applyVariableValueMapToStyleSheet( RiuGuiTheme::ThemeEnum theme )
|
||||
QString RiuGuiTheme::applyVariableValueMapToStyleSheet( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
QFileInfo info( getStyleSheetPath( theme ) );
|
||||
QString absoluteStyleSheetPath = QString( "%0/%1" ).arg( GUI_THEMES_DIR ).arg( info.fileName() );
|
||||
@ -512,7 +496,7 @@ QString RiuGuiTheme::applyVariableValueMapToStyleSheet( RiuGuiTheme::ThemeEnum t
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuGuiTheme::writeStyleSheetToFile( RiuGuiTheme::ThemeEnum theme, const QString& styleSheet )
|
||||
bool RiuGuiTheme::writeStyleSheetToFile( RiaDefines::ThemeEnum theme, const QString& styleSheet )
|
||||
{
|
||||
QFileInfo info( getStyleSheetPath( theme ) );
|
||||
QString absoluteStyleSheetPath = QString( "%0/%1" ).arg( GUI_THEMES_DIR ).arg( info.fileName() );
|
||||
@ -542,7 +526,7 @@ bool RiuGuiTheme::writeStyleSheetToFile( RiuGuiTheme::ThemeEnum theme, const QSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuGuiTheme::loadStyleSheet( RiuGuiTheme::ThemeEnum theme )
|
||||
QString RiuGuiTheme::loadStyleSheet( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
QFile styleSheetFile( getStyleSheetPath( theme ) );
|
||||
QString styleSheet;
|
||||
@ -580,10 +564,10 @@ QAbstractItemModel* RiuGuiTheme::getQssCompletionModel( QCompleter* completer )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiuGuiTheme::getColorByVariableName( const QString& variable, int theme /*= -1 */ )
|
||||
{
|
||||
RiuGuiTheme::ThemeEnum eTheme = RiaGuiApplication::instance()->preferences()->guiTheme();
|
||||
if ( theme >= 0 && theme < static_cast<int>( caf::AppEnum<RiuGuiTheme::ThemeEnum>().size() ) )
|
||||
RiaDefines::ThemeEnum eTheme = RiaGuiApplication::instance()->preferences()->guiTheme();
|
||||
if ( theme >= 0 && theme < static_cast<int>( caf::AppEnum<RiaDefines::ThemeEnum>().size() ) )
|
||||
{
|
||||
eTheme = static_cast<RiuGuiTheme::ThemeEnum>( theme );
|
||||
eTheme = static_cast<RiaDefines::ThemeEnum>( theme );
|
||||
}
|
||||
|
||||
if ( s_variableValueMap.keys().contains( eTheme ) && s_variableValueMap[eTheme].keys().contains( "$" + variable ) )
|
||||
@ -759,7 +743,7 @@ void RiuGuiTheme::styleQwtItem( QwtPicker* item )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGuiTheme::preparseStyleSheet( RiuGuiTheme::ThemeEnum theme, QString& styleSheet )
|
||||
void RiuGuiTheme::preparseStyleSheet( RiaDefines::ThemeEnum theme, QString& styleSheet )
|
||||
{
|
||||
QRegularExpression variableRegExp(
|
||||
"[ \\t]*(?<name>\\$[a-zA-z0-9_]+)[ \\t]*:[ \\t]*(?<value>[a-zA-Z-_0-9#]+);[ \\t]*(\\/\\/[ "
|
||||
@ -811,9 +795,9 @@ void RiuGuiTheme::preparseStyleSheet( RiuGuiTheme::ThemeEnum theme, QString& sty
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuGuiTheme::getStyleSheetPath( ThemeEnum theme )
|
||||
QString RiuGuiTheme::getStyleSheetPath( RiaDefines::ThemeEnum theme )
|
||||
{
|
||||
return QString( ":/themes/%0.qss" ).arg( caf::AppEnum<RiuGuiTheme::ThemeEnum>( theme ).text().toLower() );
|
||||
return QString( ":/themes/%0.qss" ).arg( caf::AppEnum<RiaDefines::ThemeEnum>( theme ).text().toLower() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <QMap>
|
||||
@ -34,27 +36,21 @@ class QwtSymbol;
|
||||
class QwtPlotMarker;
|
||||
class QwtPlotCurve;
|
||||
class QwtPicker;
|
||||
class QwtText;
|
||||
|
||||
typedef std::function<void( QRegularExpressionMatch& )> CustomStyleSheetApplicator;
|
||||
|
||||
class RiuGuiTheme
|
||||
{
|
||||
public:
|
||||
enum class ThemeEnum
|
||||
{
|
||||
DEFAULT,
|
||||
DARK,
|
||||
LIGHT
|
||||
};
|
||||
|
||||
static void updateGuiTheme( ThemeEnum theme );
|
||||
static bool applyStyleSheet( ThemeEnum theme );
|
||||
static void changeVariableValue( RiuGuiTheme::ThemeEnum theme, const QString& variableName, const QString& newValue );
|
||||
static QMap<QString, QString> getVariableValueMap( RiuGuiTheme::ThemeEnum theme );
|
||||
static QMap<QString, QString> getVariableGuiTextMap( RiuGuiTheme::ThemeEnum theme );
|
||||
static QString applyVariableValueMapToStyleSheet( RiuGuiTheme::ThemeEnum theme );
|
||||
static bool writeStyleSheetToFile( RiuGuiTheme::ThemeEnum theme, const QString& styleSheet );
|
||||
static QString loadStyleSheet( RiuGuiTheme::ThemeEnum theme );
|
||||
static void updateGuiTheme( RiaDefines::ThemeEnum theme );
|
||||
static bool applyStyleSheet( RiaDefines::ThemeEnum theme );
|
||||
static void changeVariableValue( RiaDefines::ThemeEnum theme, const QString& variableName, const QString& newValue );
|
||||
static QMap<QString, QString> getVariableValueMap( RiaDefines::ThemeEnum theme );
|
||||
static QMap<QString, QString> getVariableGuiTextMap( RiaDefines::ThemeEnum theme );
|
||||
static QString applyVariableValueMapToStyleSheet( RiaDefines::ThemeEnum theme );
|
||||
static bool writeStyleSheetToFile( RiaDefines::ThemeEnum theme, const QString& styleSheet );
|
||||
static QString loadStyleSheet( RiaDefines::ThemeEnum theme );
|
||||
static QAbstractItemModel* getQssCompletionModel( QCompleter* completer );
|
||||
static QColor getColorByVariableName( const QString& variable, int theme = -1 );
|
||||
static QString
|
||||
@ -63,8 +59,8 @@ public:
|
||||
static void styleQwtItem( QwtPicker* item );
|
||||
|
||||
private:
|
||||
static void preparseStyleSheet( RiuGuiTheme::ThemeEnum theme, QString& styleSheet );
|
||||
static QString getStyleSheetPath( RiuGuiTheme::ThemeEnum theme );
|
||||
static void preparseStyleSheet( RiaDefines::ThemeEnum theme, QString& styleSheet );
|
||||
static QString getStyleSheetPath( RiaDefines::ThemeEnum theme );
|
||||
static void storeQwtStyleSheetProperty( const QString& plotName,
|
||||
const QString& itemType,
|
||||
const QString& itemName,
|
||||
@ -75,8 +71,8 @@ private:
|
||||
static QwtSymbol* cloneCurveSymbol( QwtPlotCurve* curve );
|
||||
|
||||
private:
|
||||
static QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> s_variableValueMap;
|
||||
static QMap<RiuGuiTheme::ThemeEnum, QMap<QString, QString>> s_variableGuiTextMap;
|
||||
static QMap<RiaDefines::ThemeEnum, QMap<QString, QString>> s_variableValueMap;
|
||||
static QMap<RiaDefines::ThemeEnum, QMap<QString, QString>> s_variableGuiTextMap;
|
||||
static QMap<QString, QMap<QString, QMap<QString, QMap<QString, QString>>>> s_qwtPlotItemPropertiesMap;
|
||||
static QMap<QString, CustomStyleSheetApplicator> s_customStyleSheetApplicators;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user