i18n: drop superfluous QObject* parent

These additional pointers were introduced for translations,
and needed their own tricks to get lupdate to recognize the
strings. Using QCoreApplication::translate() removes the
need to a QObject to provide context. Drop the now-unneeded
parameters.
This commit is contained in:
Adriaan de Groot 2018-02-07 17:12:49 +01:00
parent c71385e93f
commit d27675d660
10 changed files with 19 additions and 20 deletions

View File

@ -82,7 +82,7 @@ ProcessJob::exec()
QString(), QString(),
m_timeoutSec ); m_timeoutSec );
return CalamaresUtils::ProcessResult::explainProcess( this, ec, m_command, output, m_timeoutSec ); return CalamaresUtils::ProcessResult::explainProcess( ec, m_command, output, m_timeoutSec );
} }

View File

@ -252,7 +252,7 @@ System::doChroot() const
} }
Calamares::JobResult Calamares::JobResult
ProcessResult::explainProcess( const QObject* parent, int ec, const QString& command, const QString& output, int timeout ) ProcessResult::explainProcess( int ec, const QString& command, const QString& output, int timeout )
{ {
using Calamares::JobResult; using Calamares::JobResult;

View File

@ -41,7 +41,6 @@ public:
/** @brief Explain a typical external process failure. /** @brief Explain a typical external process failure.
* *
* @param parent Used as context for translation calls.
* @param errorCode Return code from runCommand() or similar * @param errorCode Return code from runCommand() or similar
* (negative values get special explanation). The member * (negative values get special explanation). The member
* function uses the exit code stored in the ProcessResult * function uses the exit code stored in the ProcessResult
@ -53,18 +52,18 @@ public:
* @param timeout Timeout passed to the process runner, for explaining * @param timeout Timeout passed to the process runner, for explaining
* error code -4 (timeout). * error code -4 (timeout).
*/ */
static Calamares::JobResult explainProcess( const QObject* parent, int errorCode, const QString& command, const QString& output, int timeout ); static Calamares::JobResult explainProcess( int errorCode, const QString& command, const QString& output, int timeout );
/// @brief Convenience wrapper for explainProcess() /// @brief Convenience wrapper for explainProcess()
inline Calamares::JobResult explainProcess( const QObject* parent, const QString& command, int timeout ) const inline Calamares::JobResult explainProcess( const QString& command, int timeout ) const
{ {
return explainProcess( parent, getExitCode(), command, getOutput(), timeout ); return explainProcess( getExitCode(), command, getOutput(), timeout );
} }
/// @brief Convenience wrapper for explainProcess() /// @brief Convenience wrapper for explainProcess()
inline Calamares::JobResult explainProcess( const QObject* parent, const QStringList& command, int timeout ) const inline Calamares::JobResult explainProcess( const QStringList& command, int timeout ) const
{ {
return explainProcess( parent, getExitCode(), command.join( ' ' ), getOutput(), timeout ); return explainProcess( getExitCode(), command.join( ' ' ), getOutput(), timeout );
} }
} ; } ;

View File

@ -98,7 +98,7 @@ CommandList::~CommandList()
{ {
} }
Calamares::JobResult CommandList::run( const QObject* parent ) Calamares::JobResult CommandList::run()
{ {
System::RunLocation location = m_doChroot ? System::RunLocation::RunInTarget : System::RunLocation::RunInHost; System::RunLocation location = m_doChroot ? System::RunLocation::RunInTarget : System::RunLocation::RunInHost;
@ -139,7 +139,7 @@ Calamares::JobResult CommandList::run( const QObject* parent )
if ( suppress_result ) if ( suppress_result )
cDebug() << "Error code" << r.getExitCode() << "ignored by CommandList configuration."; cDebug() << "Error code" << r.getExitCode() << "ignored by CommandList configuration.";
else else
return r.explainProcess( parent, processed_cmd, timeout ); return r.explainProcess( processed_cmd, timeout );
} }
} }

View File

@ -88,7 +88,7 @@ public:
return m_doChroot; return m_doChroot;
} }
Calamares::JobResult run( const QObject* parent ); Calamares::JobResult run();
using CommandList_t::isEmpty; using CommandList_t::isEmpty;
using CommandList_t::count; using CommandList_t::count;

View File

@ -85,7 +85,7 @@ ContextualProcessJob::exec()
{ {
if ( gs->contains( binding->variable ) && ( gs->value( binding->variable ).toString() == binding->value ) ) if ( gs->contains( binding->variable ) && ( gs->value( binding->variable ).toString() == binding->value ) )
{ {
Calamares::JobResult r = binding->commands->run( this ); Calamares::JobResult r = binding->commands->run();
if ( !r ) if ( !r )
return r; return r;
} }

View File

@ -62,7 +62,7 @@ ShellProcessJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
return m_commands->run( this ); return m_commands->run();
} }

View File

@ -144,7 +144,7 @@ public:
* It is used under the terms of the GNU GPL v3 or later, as * It is used under the terms of the GNU GPL v3 or later, as
* allowed by the libpwquality license (LICENSES/GPLv2+-libpwquality) * allowed by the libpwquality license (LICENSES/GPLv2+-libpwquality)
*/ */
QString explanation( QWidget* parent ) QString explanation()
{ {
void* auxerror = m_auxerror; void* auxerror = m_auxerror;
m_auxerror = nullptr; m_auxerror = nullptr;
@ -312,9 +312,9 @@ DEFINE_CHECK_FUNC( libpwquality )
{ {
checks.push_back( checks.push_back(
PasswordCheck( PasswordCheck(
[parent,settings]() [settings]()
{ {
return settings->explanation( parent ); return settings->explanation();
}, },
[settings]( const QString& s ) [settings]( const QString& s )
{ {

View File

@ -69,7 +69,7 @@ using PasswordCheckList = QVector<PasswordCheck>;
* an error, though). * an error, though).
*/ */
#define _xDEFINE_CHECK_FUNC(x) \ #define _xDEFINE_CHECK_FUNC(x) \
add_check_##x( QWidget* parent, PasswordCheckList& checks, const QVariant& value ) add_check_##x( PasswordCheckList& checks, const QVariant& value )
#define DEFINE_CHECK_FUNC(x) void _xDEFINE_CHECK_FUNC(x) #define DEFINE_CHECK_FUNC(x) void _xDEFINE_CHECK_FUNC(x)
#define DECLARE_CHECK_FUNC(x) void _xDEFINE_CHECK_FUNC(x); #define DECLARE_CHECK_FUNC(x) void _xDEFINE_CHECK_FUNC(x);

View File

@ -462,16 +462,16 @@ UsersPage::addPasswordCheck( const QString& key, const QVariant& value )
{ {
if ( key == "minLength" ) if ( key == "minLength" )
{ {
add_check_minLength( this, m_passwordChecks, value ); add_check_minLength( m_passwordChecks, value );
} }
else if ( key == "maxLength" ) else if ( key == "maxLength" )
{ {
add_check_maxLength( this, m_passwordChecks, value ); add_check_maxLength( m_passwordChecks, value );
} }
#ifdef CHECK_PWQUALITY #ifdef CHECK_PWQUALITY
else if ( key == "libpwquality" ) else if ( key == "libpwquality" )
{ {
add_check_libpwquality( this, m_passwordChecks, value ); add_check_libpwquality( m_passwordChecks, value );
} }
#endif #endif
else else