[shellprocess] Allow customizing the name of the job

main
Adriaan de Groot 4 years ago
parent 21598ef4b3
commit 6221c6497a

@ -34,6 +34,10 @@ ShellProcessJob::~ShellProcessJob() {}
QString
ShellProcessJob::prettyName() const
{
if ( m_name )
{
return m_name->get();
}
return tr( "Shell Processes Job" );
}
@ -75,6 +79,16 @@ ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
{
cWarning() << "No script given for ShellProcessJob" << moduleInstanceKey();
}
bool labels_ok = false;
auto labels = CalamaresUtils::getSubMap( configurationMap, "i18n", labels_ok );
if ( labels_ok )
{
if ( labels.contains( "name" ) )
{
m_name = std::make_unique< CalamaresUtils::Locale::TranslatedString >( labels, "name" );
}
}
}
CALAMARES_PLUGIN_FACTORY_DEFINITION( ShellProcessJobFactory, registerPlugin< ShellProcessJob >(); )

@ -13,6 +13,7 @@
#include "CppJob.h"
#include "DllMacro.h"
#include "locale/TranslatableConfiguration.h"
#include "utils/CommandList.h"
#include "utils/PluginFactory.h"
@ -37,6 +38,7 @@ public:
private:
std::unique_ptr< CalamaresUtils::CommandList > m_commands;
std::unique_ptr< CalamaresUtils::Locale::TranslatedString > m_name;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( ShellProcessJobFactory )

@ -37,6 +37,8 @@
# be obtained with a single string and a global timeout, but when
# there are multiple commands to execute, one of them might have
# a different timeout than the others.
#
# To change the description of the job, set the *name* entries in *i18n*.
---
dontChroot: false
timeout: 10
@ -63,3 +65,15 @@ script:
- "/usr/bin/true"
- command: "/usr/local/bin/slowloris"
timeout: 3600
# You can change the description of the job (as it is displayed in the
# progress bar during installation) by defining an *i18n* key, which
# has a *name* field and optionally, translations as *name[lang]*.
#
# Without a translation here, the default name from the source code
# is used, "Shell Processes Job".
#
# i18n:
# name: "Shell process"
# name[nl]: "Schelpenpad"
# name[en_GB]: "Just a moment"

Loading…
Cancel
Save