[packagechooser] Load translated strings from config
- Apply the *labels* from the configuration file to the visible strings (only the ViewStep name).
This commit is contained in:
parent
0eae72e10f
commit
019d1c36c6
@ -32,6 +32,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "locale/TranslatableConfiguration.h"
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
@ -46,6 +47,7 @@ PackageChooserViewStep::PackageChooserViewStep( QObject* parent )
|
||||
, m_widget( nullptr )
|
||||
, m_model( nullptr )
|
||||
, m_mode( PackageChooserMode::Required )
|
||||
, m_stepName( nullptr )
|
||||
{
|
||||
emit nextStatusChanged( false );
|
||||
}
|
||||
@ -58,13 +60,14 @@ PackageChooserViewStep::~PackageChooserViewStep()
|
||||
m_widget->deleteLater();
|
||||
}
|
||||
delete m_model;
|
||||
delete m_stepName;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
PackageChooserViewStep::prettyName() const
|
||||
{
|
||||
return tr( "Packages" );
|
||||
return m_stepName ? m_stepName->get() : tr( "Packages" );
|
||||
}
|
||||
|
||||
|
||||
@ -167,12 +170,12 @@ void
|
||||
PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
QString mode = CalamaresUtils::getString( configurationMap, "mode" );
|
||||
bool ok = false;
|
||||
bool mode_ok = false;
|
||||
if ( !mode.isEmpty() )
|
||||
{
|
||||
m_mode = roleNames().find( mode, ok );
|
||||
m_mode = roleNames().find( mode, mode_ok );
|
||||
}
|
||||
if ( !ok )
|
||||
if ( !mode_ok )
|
||||
{
|
||||
m_mode = PackageChooserMode::Required;
|
||||
}
|
||||
@ -185,6 +188,16 @@ PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap
|
||||
m_id = moduleInstanceKey().split( '@' ).last();
|
||||
}
|
||||
|
||||
bool labels_ok = false;
|
||||
auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok );
|
||||
if ( labels_ok )
|
||||
{
|
||||
if ( labels.contains( "step" ) )
|
||||
{
|
||||
m_stepName = new CalamaresUtils::Locale::TranslatedString( labels, "step" );
|
||||
}
|
||||
}
|
||||
|
||||
bool first_time = !m_model;
|
||||
if ( configurationMap.contains( "items" ) )
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define PACKAGECHOOSERVIEWSTEP_H
|
||||
|
||||
#include "PluginDllMacro.h"
|
||||
#include "locale/TranslatableConfiguration.h"
|
||||
#include "utils/PluginFactory.h"
|
||||
#include "viewpages/ViewStep.h"
|
||||
|
||||
@ -65,6 +66,7 @@ private:
|
||||
// Configuration
|
||||
PackageChooserMode m_mode;
|
||||
QString m_id;
|
||||
CalamaresUtils::Locale::TranslatedString *m_stepName; // As it appears in the sidebar
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PackageChooserViewStepFactory )
|
||||
|
Loading…
Reference in New Issue
Block a user