[libcalamaresui] Improve WindowDimensions class
- Make sure the class knows its own suffixes
This commit is contained in:
parent
6560c194ad
commit
5a95bf507f
@ -78,8 +78,8 @@ const QStringList Branding::s_styleEntryStrings =
|
||||
"sidebarTextHighlight"
|
||||
};
|
||||
|
||||
static const NamedEnumTable<Branding::WindowDimensionUnit>&
|
||||
windowDimensions()
|
||||
const NamedEnumTable<Branding::WindowDimensionUnit>&
|
||||
Branding::WindowDimension::suffixes()
|
||||
{
|
||||
using Unit = Branding::WindowDimensionUnit;
|
||||
static const NamedEnumTable<Unit> names{
|
||||
@ -323,11 +323,6 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
|
||||
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
|
||||
};
|
||||
static const NamedEnumTable< WindowDimensionUnit > dimensionNames{
|
||||
{ QStringLiteral( "px" ), WindowDimensionUnit::Pixies },
|
||||
{ QStringLiteral( "em" ), WindowDimensionUnit::Fonties }
|
||||
};
|
||||
|
||||
bool ok = false;
|
||||
|
||||
m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false );
|
||||
@ -342,8 +337,8 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
auto l = windowSize.split( ',' );
|
||||
if ( l.count() == 2 )
|
||||
{
|
||||
m_windowWidth = WindowDimension( dimensionNames, l[0] );
|
||||
m_windowHeight = WindowDimension( dimensionNames, l[1] );
|
||||
m_windowWidth = WindowDimension( l[0] );
|
||||
m_windowHeight = WindowDimension( l[1] );
|
||||
}
|
||||
}
|
||||
if ( !m_windowWidth.isValid() )
|
||||
|
@ -89,8 +89,11 @@ public:
|
||||
class WindowDimension : public NamedSuffix<WindowDimensionUnit, WindowDimensionUnit::None>
|
||||
{
|
||||
public:
|
||||
using NamedSuffix::NamedSuffix;
|
||||
static const NamedEnumTable< WindowDimensionUnit >& suffixes();
|
||||
bool isValid() const;
|
||||
|
||||
using NamedSuffix::NamedSuffix;
|
||||
WindowDimension( const QString& s ) : NamedSuffix( suffixes(), s ) {}
|
||||
} ;
|
||||
|
||||
static Branding* instance();
|
||||
|
Loading…
Reference in New Issue
Block a user