[libcalamares] Use the enum names as keys
- this uses the Qt internals to map enum values to names, making the separate translation table unnecessary. Adjust default branding to use the new names. This makes code (using enum identifiers) and configuration (using string keys) consistent in naming.
This commit is contained in:
parent
e6d72cb23b
commit
7356961f52
@ -170,20 +170,20 @@ images:
|
||||
|
||||
# Colors for text and background components.
|
||||
#
|
||||
# - sidebarBackground is the background of the sidebar
|
||||
# - sidebarText is the (foreground) text color
|
||||
# - sidebarTextHighlight sets the background of the selected (current) step.
|
||||
# - SidebarBackground is the background of the sidebar
|
||||
# - SidebarText is the (foreground) text color
|
||||
# - SidebarBackgroundCurrent sets the background of the current step.
|
||||
# Optional, and defaults to the application palette.
|
||||
# - sidebarSelect is the text color of the selected step.
|
||||
# - SidebarTextCurrent is the text color of the current step.
|
||||
#
|
||||
# These colors can **also** be set through the stylesheet, if the
|
||||
# branding component also ships a stylesheet.qss. Then they are
|
||||
# the corresponding CSS attributes of #sidebarApp.
|
||||
style:
|
||||
sidebarBackground: "#292F34"
|
||||
sidebarText: "#FFFFFF"
|
||||
sidebarTextSelect: "#292F34"
|
||||
sidebarTextHighlight: "#D35400"
|
||||
SidebarBackground: "#292F34"
|
||||
SidebarText: "#FFFFFF"
|
||||
SidebarTextCurrent: "#292F34"
|
||||
SidebarBackgroundCurrent: "#D35400"
|
||||
|
||||
### SLIDESHOW
|
||||
#
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QMetaEnum>
|
||||
#include <QPixmap>
|
||||
#include <QVariantMap>
|
||||
|
||||
@ -85,19 +86,6 @@ const QStringList Branding::s_imageEntryStrings =
|
||||
"productWelcome"
|
||||
};
|
||||
|
||||
/** @brief Mapping of enum values to key names
|
||||
*
|
||||
* The key names can be found in `branding.desc` and need to match
|
||||
* that (and the branding schema).
|
||||
*/
|
||||
static const QStringList s_styleEntryStrings =
|
||||
{
|
||||
"sidebarBackground",
|
||||
"sidebarText",
|
||||
"sidebarTextSelect", // enum value TextCurrent
|
||||
"sidebarTextHighlight", // enum value BackgroundCurrent
|
||||
};
|
||||
|
||||
const QStringList Branding::s_uploadServerStrings =
|
||||
{
|
||||
"type",
|
||||
@ -322,7 +310,8 @@ Branding::string( Branding::StringEntry stringEntry ) const
|
||||
QString
|
||||
Branding::styleString( Branding::StyleEntry styleEntry ) const
|
||||
{
|
||||
return m_style.value( s_styleEntryStrings.value( styleEntry ) );
|
||||
const auto meta = QMetaEnum::fromType<Branding::StyleEntry>();
|
||||
return meta.valueToKey(styleEntry);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user