@ -138,6 +138,32 @@ loadStrings( QMap< QString, QString >& map,
}
}
static Branding : : UploadServerInfo
uploadServerFromMap ( const QVariantMap & map )
{
using Type = Branding : : UploadServerType ;
// *INDENT-OFF*
// clang-format off
static const NamedEnumTable < Type > names {
{ " none " , Type : : None } ,
{ " fiche " , Type : : Fiche }
} ;
// clang-format on
// *INDENT-ON*
QString typestring = map [ " type " ] . toString ( ) ;
QString urlstring = map [ " url " ] . toString ( ) ;
if ( typestring . isEmpty ( ) | | urlstring . isEmpty ( ) )
{
return Branding : : UploadServerInfo ( Branding : : UploadServerType : : None , QUrl ( ) ) ;
}
bool bogus = false ; // we don't care about type-name lookup success here
return Branding : : UploadServerInfo ( names . find ( typestring , bogus ) ,
QUrl ( urlstring , QUrl : : ParsingMode : : StrictMode ) ) ;
}
/** @brief Load the @p map with strings from @p config
*
* If os - release is supported ( with KF5 CoreAddons > = 5.58 ) then
@ -227,11 +253,7 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent )
} ) ;
loadStrings ( m_style , doc , " style " , [ ] ( const QString & s ) - > QString { return s ; } ) ;
const QVariantMap temp = CalamaresUtils : : yamlMapToVariant ( doc [ " uploadServer " ] ) ;
for ( auto it = temp . constBegin ( ) ; it ! = temp . constEnd ( ) ; + + it )
{
m_uploadServer . insert ( it . key ( ) , it . value ( ) . toString ( ) ) ;
}
m_uploadServer = uploadServerFromMap ( CalamaresUtils : : yamlMapToVariant ( doc [ " uploadServer " ] ) ) ;
}
catch ( YAML : : Exception & e )
{
@ -292,12 +314,6 @@ Branding::imagePath( Branding::ImageEntry imageEntry ) const
return m_images . value ( s_imageEntryStrings . value ( imageEntry ) ) ;
}
QString
Branding : : uploadServer ( Branding : : UploadServerEntry uploadServerEntry ) const
{
return m_uploadServer . value ( s_uploadServerStrings . value ( uploadServerEntry ) ) ;
}
QPixmap
Branding : : image ( Branding : : ImageEntry imageEntry , const QSize & size ) const
{