[libcalamaresui] Add a sidebar flavor setting
This commit is contained in:
parent
9a63d63d5b
commit
80f49bed1d
@ -41,6 +41,12 @@ windowSize: 800px,520px
|
||||
# *windowExpanding* set to "fullscreen").
|
||||
windowPlacement: center
|
||||
|
||||
# Kind of sidebar (panel on the left, showing progress).
|
||||
# - "widget" or unset, use traditional sidebar (logo, items)
|
||||
# - "none", hide it entirely
|
||||
# - "qml", use sidebar.qml from branding folder
|
||||
sidebar: none
|
||||
|
||||
# These are strings shown to the user in the user interface.
|
||||
# There is no provision for translating them -- since they
|
||||
# are names, the string is included as-is.
|
||||
|
@ -89,6 +89,7 @@ const QStringList Branding::s_styleEntryStrings =
|
||||
// clang-format on
|
||||
// *INDENT-ON*
|
||||
|
||||
|
||||
const NamedEnumTable< Branding::WindowDimensionUnit >&
|
||||
Branding::WindowDimension::suffixes()
|
||||
{
|
||||
@ -407,14 +408,24 @@ getString( const YAML::Node& doc, const char* key )
|
||||
void
|
||||
Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
// clang-format off
|
||||
static const NamedEnumTable< WindowExpansion > expansionNames {
|
||||
{ QStringLiteral( "normal" ), WindowExpansion::Normal },
|
||||
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
|
||||
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
|
||||
};
|
||||
static const NamedEnumTable< WindowPlacement > placementNames {
|
||||
{ QStringLiteral( "free" ), WindowPlacement::Free }, { QStringLiteral( "center" ), WindowPlacement::Center }
|
||||
{ QStringLiteral( "free" ), WindowPlacement::Free },
|
||||
{ QStringLiteral( "center" ), WindowPlacement::Center }
|
||||
};
|
||||
static const NamedEnumTable< SidebarFlavor > sidebarFlavorNames {
|
||||
{ QStringLiteral( "widget" ), SidebarFlavor::Widget },
|
||||
{ QStringLiteral( "none" ), SidebarFlavor::None },
|
||||
{ QStringLiteral( "qml" ), SidebarFlavor::Qml }
|
||||
};
|
||||
// clang-format on
|
||||
// *INDENT-ON*
|
||||
bool ok = false;
|
||||
|
||||
m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false );
|
||||
@ -431,6 +442,12 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
cWarning() << "Branding module-setting *windowPlacement* interpreted as"
|
||||
<< placementNames.find( m_windowPlacement, ok );
|
||||
}
|
||||
m_sidebarFlavor = sidebarFlavorNames.find( getString( doc, "sidebar" ), ok );
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "Branding module-setting *sidebar* interpreted as"
|
||||
<< sidebarFlavorNames.find( m_sidebarFlavor, ok );
|
||||
}
|
||||
|
||||
QString windowSize = getString( doc, "windowSize" );
|
||||
if ( !windowSize.isEmpty() )
|
||||
|
@ -122,6 +122,15 @@ public:
|
||||
Center,
|
||||
Free
|
||||
};
|
||||
Q_ENUM( WindowPlacement )
|
||||
///@brief What kind of sidebar to use in the main window
|
||||
enum class SidebarFlavor
|
||||
{
|
||||
None,
|
||||
Widget,
|
||||
Qml
|
||||
};
|
||||
Q_ENUM( SidebarFlavor )
|
||||
|
||||
static Branding* instance();
|
||||
|
||||
@ -214,6 +223,8 @@ private:
|
||||
WindowExpansion m_windowExpansion;
|
||||
WindowDimension m_windowHeight, m_windowWidth;
|
||||
WindowPlacement m_windowPlacement;
|
||||
|
||||
SidebarFlavor m_sidebarFlavor = SidebarFlavor::Widget;
|
||||
};
|
||||
|
||||
template < typename U >
|
||||
|
Loading…
Reference in New Issue
Block a user