[libcalamaresui] Add panel flavor
- rename enum to more general PanelFlavor - introduce branding settings for navigation (e.g. for switching the navigation buttons off, or using QML)
This commit is contained in:
parent
d4083c9bbb
commit
57e6864902
@ -44,9 +44,15 @@ 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
|
||||
# - "qml", use calamares-sidebar.qml from branding folder
|
||||
sidebar: widget
|
||||
|
||||
# Kind of navigation (button panel on the bottom).
|
||||
# - "widget" or unset, use traditional navigation
|
||||
# - "none", hide it entirely
|
||||
# - "qml", use calamares-navigation.qml from branding folder
|
||||
navigation: widget
|
||||
|
||||
# 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.
|
||||
|
@ -191,15 +191,15 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
QWidget* sideBox = nullptr;
|
||||
switch ( branding->sidebarFlavor() )
|
||||
{
|
||||
case Calamares::Branding::SidebarFlavor::Widget:
|
||||
case Calamares::Branding::PanelFlavor::Widget:
|
||||
sideBox = getWidgetSidebar(
|
||||
qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
|
||||
break;
|
||||
case Calamares::Branding::SidebarFlavor::Qml:
|
||||
case Calamares::Branding::PanelFlavor::Qml:
|
||||
sideBox = getQmlSidebar(
|
||||
qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
|
||||
break;
|
||||
case Calamares::Branding::SidebarFlavor::None:
|
||||
case Calamares::Branding::PanelFlavor::None:
|
||||
sideBox = nullptr;
|
||||
}
|
||||
if ( sideBox )
|
||||
|
@ -419,11 +419,11 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
{ QStringLiteral( "free" ), WindowPlacement::Free },
|
||||
{ QStringLiteral( "center" ), WindowPlacement::Center }
|
||||
};
|
||||
static const NamedEnumTable< SidebarFlavor > sidebarFlavorNames {
|
||||
{ QStringLiteral( "widget" ), SidebarFlavor::Widget },
|
||||
{ QStringLiteral( "none" ), SidebarFlavor::None },
|
||||
{ QStringLiteral( "hidden" ), SidebarFlavor::None },
|
||||
{ QStringLiteral( "qml" ), SidebarFlavor::Qml }
|
||||
static const NamedEnumTable< PanelFlavor > sidebarFlavorNames {
|
||||
{ QStringLiteral( "widget" ), PanelFlavor::Widget },
|
||||
{ QStringLiteral( "none" ), PanelFlavor::None },
|
||||
{ QStringLiteral( "hidden" ), PanelFlavor::None },
|
||||
{ QStringLiteral( "qml" ), PanelFlavor::Qml }
|
||||
};
|
||||
// clang-format on
|
||||
// *INDENT-ON*
|
||||
@ -449,6 +449,12 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
cWarning() << "Branding module-setting *sidebar* interpreted as"
|
||||
<< sidebarFlavorNames.find( m_sidebarFlavor, ok );
|
||||
}
|
||||
m_navigationFlavor = sidebarFlavorNames.find( getString( doc, "navigation" ), ok);
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "Branding module-setting *navigation* interpreted as"
|
||||
<< sidebarFlavorNames.find( m_navigationFlavor, ok );
|
||||
}
|
||||
|
||||
QString windowSize = getString( doc, "windowSize" );
|
||||
if ( !windowSize.isEmpty() )
|
||||
|
@ -124,13 +124,13 @@ public:
|
||||
};
|
||||
Q_ENUM( WindowPlacement )
|
||||
///@brief What kind of sidebar to use in the main window
|
||||
enum class SidebarFlavor
|
||||
enum class PanelFlavor
|
||||
{
|
||||
None,
|
||||
Widget,
|
||||
Qml
|
||||
};
|
||||
Q_ENUM( SidebarFlavor )
|
||||
Q_ENUM( PanelFlavor )
|
||||
|
||||
static Branding* instance();
|
||||
|
||||
@ -185,7 +185,9 @@ public:
|
||||
bool windowPlacementCentered() const { return m_windowPlacement == WindowPlacement::Center; }
|
||||
|
||||
///@brief Which sidebar flavor is configured
|
||||
SidebarFlavor sidebarFlavor() const { return m_sidebarFlavor; }
|
||||
PanelFlavor sidebarFlavor() const { return m_sidebarFlavor; }
|
||||
///@brief Which navigation flavor is configured
|
||||
PanelFlavor navigationFlavor() const { return m_navigationFlavor; }
|
||||
|
||||
/**
|
||||
* Creates a map called "branding" in the global storage, and inserts an
|
||||
@ -227,7 +229,8 @@ private:
|
||||
WindowDimension m_windowHeight, m_windowWidth;
|
||||
WindowPlacement m_windowPlacement;
|
||||
|
||||
SidebarFlavor m_sidebarFlavor = SidebarFlavor::Widget;
|
||||
PanelFlavor m_sidebarFlavor = PanelFlavor::Widget;
|
||||
PanelFlavor m_navigationFlavor = PanelFlavor::Widget;
|
||||
};
|
||||
|
||||
template < typename U >
|
||||
|
Loading…
Reference in New Issue
Block a user