diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 7fcbec666..69c2f0884 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -80,9 +80,9 @@ handle_args( QCoreApplication& a ) if ( parser.isSet( debugLevelOption ) ) { bool ok = true; - int l = parser.value( debugLevelOption ).toInt( &ok ); + unsigned int l = parser.value( debugLevelOption ).toUInt( &ok ); unsigned int dlevel = 0; - if ( !ok || ( l < 0 ) ) + if ( !ok ) dlevel = Logger::LOGVERBOSE; else dlevel = l; @@ -94,20 +94,20 @@ handle_args( QCoreApplication& a ) { cError() << "Missing path.\n"; parser.showHelp(); - return ModuleConfig(); // NOTREACHED } - if ( args.size() > 2 ) + else if ( args.size() > 2 ) { cError() << "More than one path.\n"; parser.showHelp(); - return ModuleConfig(); // NOTREACHED } + else + { + QString jobSettings( parser.value( jobOption ) ); + if ( jobSettings.isEmpty() && ( args.size() == 2 ) ) + jobSettings = args.at(1); - QString jobSettings( parser.value( jobOption ) ); - if ( jobSettings.isEmpty() && ( args.size() == 2 ) ) - jobSettings = args.at(1); - - return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) }; + return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) }; + } } @@ -207,7 +207,7 @@ main( int argc, char* argv[] ) return 1; } - using TR = Logger::DebugRow; + using TR = Logger::DebugRow; cDebug() << "Module metadata" << TR( "name", m->name() ) @@ -223,7 +223,6 @@ main( int argc, char* argv[] ) Calamares::JobResult r = p->exec(); if ( !r ) { - using TR = Logger::DebugRow; cDebug() << count << ".. failed" << TR( "summary", r.message() ) << TR( "details", r.details() ); diff --git a/src/libcalamares/kdsingleapplicationguard/kdsingleapplicationguard.h b/src/libcalamares/kdsingleapplicationguard/kdsingleapplicationguard.h index 7b744e110..3bd1e644d 100644 --- a/src/libcalamares/kdsingleapplicationguard/kdsingleapplicationguard.h +++ b/src/libcalamares/kdsingleapplicationguard/kdsingleapplicationguard.h @@ -1,5 +1,5 @@ -#ifndef __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ -#define __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ +#ifndef KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H +#define KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H #include @@ -31,9 +31,9 @@ public: AutoKillOtherInstances = 1 }; - explicit KDSingleApplicationGuard( QObject * parent=0 ); - explicit KDSingleApplicationGuard( Policy policy, QObject * parent=0 ); - explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=0 ); + explicit KDSingleApplicationGuard( QObject * parent=nullptr ); + explicit KDSingleApplicationGuard( Policy policy, QObject * parent=nullptr ); + explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=nullptr ); explicit KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent=0 ); ~KDSingleApplicationGuard(); @@ -138,4 +138,4 @@ QT_END_NAMESPACE #endif // QT_NO_SHAREDMEMORY -#endif /* __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ */ +#endif /* KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H */ diff --git a/src/libcalamares/kdsingleapplicationguard/kdtoolsglobal.h b/src/libcalamares/kdsingleapplicationguard/kdtoolsglobal.h index a0f004589..e23b78965 100644 --- a/src/libcalamares/kdsingleapplicationguard/kdtoolsglobal.h +++ b/src/libcalamares/kdsingleapplicationguard/kdtoolsglobal.h @@ -1,5 +1,5 @@ -#ifndef __KDTOOLS_KDTOOLSGLOBAL_H__ -#define __KDTOOLS_KDTOOLSGLOBAL_H__ +#ifndef KDTOOLS_KDTOOLSGLOBAL_H +#define KDTOOLS_KDTOOLSGLOBAL_H #include @@ -110,5 +110,5 @@ private: \ void init(bool) -#endif /* __KDTOOLS_KDTOOLSGLOBAL_H__ */ +#endif /* KDTOOLS_KDTOOLSGLOBAL_H */ diff --git a/src/libcalamares/kdsingleapplicationguard/pimpl_ptr.h b/src/libcalamares/kdsingleapplicationguard/pimpl_ptr.h index 7b7f36839..6f01cd64c 100644 --- a/src/libcalamares/kdsingleapplicationguard/pimpl_ptr.h +++ b/src/libcalamares/kdsingleapplicationguard/pimpl_ptr.h @@ -1,5 +1,5 @@ -#ifndef __KDTOOLSCORE__PIMPL_PTR_H__ -#define __KDTOOLSCORE__PIMPL_PTR_H__ +#ifndef KDTOOLSCORE__PIMPL_PTR_H +#define KDTOOLSCORE__PIMPL_PTR_H #include "kdtoolsglobal.h" @@ -14,7 +14,7 @@ namespace kdtools { public: pimpl_ptr() : d( new T ) {} explicit pimpl_ptr( T * t ) : d( t ) {} - ~pimpl_ptr() { delete d; d = 0; } + ~pimpl_ptr() { delete d; d = nullptr; } T * get() { return d; } const T * get() const { return d; } @@ -40,5 +40,5 @@ namespace kdtools { } // namespace kdtools #endif -#endif /* __KDTOOLSCORE__PIMPL_PTR_H__ */ +#endif /* KDTOOLSCORE__PIMPL_PTR_H */ diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/CalamaresUtils.cpp index 4a8b1f528..8441218d2 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/CalamaresUtils.cpp @@ -62,7 +62,7 @@ isWritableDir( const QDir& dir ) { if ( !dir.mkpath( "." ) ) { - cerr << "warning: failed to create " << qPrintable( path ) << endl; + cerr << "warning: failed to create " << qPrintable( path ) << '\n'; return false; } return true; diff --git a/src/libcalamares/utils/CommandList.cpp b/src/libcalamares/utils/CommandList.cpp index 8e332a066..6a9d68bef 100644 --- a/src/libcalamares/utils/CommandList.cpp +++ b/src/libcalamares/utils/CommandList.cpp @@ -45,21 +45,21 @@ static CommandLine get_variant_object( const QVariantMap& m ) static CommandList_t get_variant_stringlist( const QVariantList& l ) { CommandList_t retl; - unsigned int c = 0; + unsigned int count = 0; for ( const auto& v : l ) { if ( v.type() == QVariant::String ) retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet ) ); else if ( v.type() == QVariant::Map ) { - auto c( get_variant_object( v.toMap() ) ); - if ( c.isValid() ) - retl.append( c ); + auto command( get_variant_object( v.toMap() ) ); + if ( command.isValid() ) + retl.append( command ); // Otherwise warning is already given } else - cWarning() << "Bad CommandList element" << c << v.type() << v; - ++c; + cWarning() << "Bad CommandList element" << count << v.type() << v; + ++count; } return retl; } diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index 31dd44978..3061e0a5e 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -193,28 +193,28 @@ static const char continuation[] = "\n "; static const char subentry[] = " .. "; QDebug& -operator<<( QDebug& s, Continuation c ) +operator<<( QDebug& s, Continuation ) { s << continuation; return s; } QDebug& -operator<<( QDebug& s, SubEntry l ) +operator<<( QDebug& s, SubEntry ) { s << subentry; return s; } CDebug& -operator<<( CDebug&& s, Continuation c ) +operator<<( CDebug&& s, Continuation ) { s << continuation; return s; } CDebug& -operator<<( CDebug&& s, SubEntry l ) +operator<<( CDebug&& s, SubEntry ) { s << subentry; return s; diff --git a/src/libcalamares/utils/NamedEnum.h b/src/libcalamares/utils/NamedEnum.h index 047ae6f19..b4c7dcd56 100644 --- a/src/libcalamares/utils/NamedEnum.h +++ b/src/libcalamares/utils/NamedEnum.h @@ -66,7 +66,7 @@ struct NamedEnumTable { ok = false; - for ( const auto p : table ) + for ( const auto& p : table ) if ( 0 == QString::compare( s, p.first, Qt::CaseInsensitive ) ) { ok = true; @@ -87,7 +87,7 @@ struct NamedEnumTable { ok = false; - for ( const auto p : table ) + for ( const auto &p : table ) if ( s == p.second) { ok = true; diff --git a/src/libcalamares/utils/NamedSuffix.h b/src/libcalamares/utils/NamedSuffix.h index 97568d1da..d4a0ed4b7 100644 --- a/src/libcalamares/utils/NamedSuffix.h +++ b/src/libcalamares/utils/NamedSuffix.h @@ -72,7 +72,7 @@ public: NamedSuffix( const NamedEnumTable& table, const QString& s ) : NamedSuffix() { - for( const auto suffix : table.table ) + for( const auto& suffix : table.table ) if ( s.endsWith( suffix.first ) ) { m_value = s.left( s.length() - suffix.first.length() ).toInt(); diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 15c1c6125..e31130520 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -78,8 +78,8 @@ const QStringList Branding::s_styleEntryStrings = "sidebarTextHighlight" }; -static const NamedEnumTable& -windowDimensions() +const NamedEnumTable& +Branding::WindowDimension::suffixes() { using Unit = Branding::WindowDimensionUnit; static const NamedEnumTable names{ @@ -323,11 +323,6 @@ Branding::initSimpleSettings( const YAML::Node& doc ) { QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen }, { QStringLiteral( "noexpand" ), WindowExpansion::Fixed } }; - static const NamedEnumTable< WindowDimensionUnit > dimensionNames{ - { QStringLiteral( "px" ), WindowDimensionUnit::Pixies }, - { QStringLiteral( "em" ), WindowDimensionUnit::Fonties } - }; - bool ok = false; m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false ); @@ -342,8 +337,8 @@ Branding::initSimpleSettings( const YAML::Node& doc ) auto l = windowSize.split( ',' ); if ( l.count() == 2 ) { - m_windowWidth = WindowDimension( dimensionNames, l[0] ); - m_windowHeight = WindowDimension( dimensionNames, l[1] ); + m_windowWidth = WindowDimension( l[0] ); + m_windowHeight = WindowDimension( l[1] ); } } if ( !m_windowWidth.isValid() ) @@ -353,7 +348,7 @@ Branding::initSimpleSettings( const YAML::Node& doc ) } -void +[[noreturn]] void Branding::bail( const QString& message ) { cError() << "FATAL in" diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index d97e0595a..197cb8ee2 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -89,8 +89,11 @@ public: class WindowDimension : public NamedSuffix { public: - using NamedSuffix::NamedSuffix; + static const NamedEnumTable< WindowDimensionUnit >& suffixes(); bool isValid() const; + + using NamedSuffix::NamedSuffix; + WindowDimension( const QString& s ) : NamedSuffix( suffixes(), s ) {} } ; static Branding* instance(); @@ -132,7 +135,7 @@ private: static const QStringList s_imageEntryStrings; static const QStringList s_styleEntryStrings; - void bail( const QString& message ); + [[noreturn]] void bail( const QString& message ); QString m_descriptorPath; QString m_componentName; diff --git a/src/libcalamaresui/modulesystem/RequirementsChecker.cpp b/src/libcalamaresui/modulesystem/RequirementsChecker.cpp index c7f4625eb..1e98a3968 100644 --- a/src/libcalamaresui/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamaresui/modulesystem/RequirementsChecker.cpp @@ -143,8 +143,9 @@ RequirementsChecker::reportProgress() auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && !w->isFinished(); } ); if ( remaining > 0 ) { + unsigned int posInterval = ( m_progressTimer->interval() < 0 ) ? 1000 : uint( m_progressTimer->interval() ); QString waiting = tr( "Waiting for %n module(s).", "", remaining ); - QString elapsed = tr( "(%n second(s))", "", m_progressTimeouts * m_progressTimer->interval() / 1000 ); + QString elapsed = tr( "(%n second(s))", "", m_progressTimeouts * posInterval / 1000 ); emit requirementsProgress( waiting + QString( " " ) + elapsed ); } else diff --git a/src/libcalamaresui/utils/qjsonitem.h b/src/libcalamaresui/utils/qjsonitem.h index 5a8b2134f..113c9da97 100644 --- a/src/libcalamaresui/utils/qjsonitem.h +++ b/src/libcalamaresui/utils/qjsonitem.h @@ -13,7 +13,7 @@ class QJsonTreeItem { public: - QJsonTreeItem(QJsonTreeItem * parent = 0); + QJsonTreeItem(QJsonTreeItem * parent = nullptr); ~QJsonTreeItem(); void appendChild(QJsonTreeItem * item); QJsonTreeItem *child(int row); @@ -28,7 +28,7 @@ public: QJsonValue::Type type() const; - static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = 0); + static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = nullptr); protected: diff --git a/src/libcalamaresui/utils/qjsonmodel.h b/src/libcalamaresui/utils/qjsonmodel.h index 0d1b3232d..fc2c4abe1 100644 --- a/src/libcalamaresui/utils/qjsonmodel.h +++ b/src/libcalamaresui/utils/qjsonmodel.h @@ -16,7 +16,7 @@ class QJsonModel : public QAbstractItemModel { Q_OBJECT public: - explicit QJsonModel(QObject *parent = 0); + explicit QJsonModel(QObject *parent = nullptr); ~QJsonModel(); bool load(const QString& fileName); bool load(QIODevice * device); diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index 0ed8e69d3..d71976ef8 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -37,7 +37,7 @@ class WaitingSpinnerWidget : public QWidget { public: /*! Constructor for "standard" widget behaviour - use this * constructor if you wish to, e.g. embed your widget in another. */ - WaitingSpinnerWidget(QWidget *parent = 0, + WaitingSpinnerWidget(QWidget *parent = nullptr, bool centerOnParent = true, bool disableParentWhenSpinning = true); @@ -47,7 +47,7 @@ public: * QtWaitingSpinner automatically centres itself on it, if not, * "centreOnParent" is ignored. */ WaitingSpinnerWidget(Qt::WindowModality modality, - QWidget *parent = 0, + QWidget *parent = nullptr, bool centerOnParent = true, bool disableParentWhenSpinning = true); diff --git a/src/modules/locale/test_geoip.cpp b/src/modules/locale/test_geoip.cpp index 5ba43f72e..89c1b6030 100644 --- a/src/modules/locale/test_geoip.cpp +++ b/src/modules/locale/test_geoip.cpp @@ -54,8 +54,8 @@ int main(int argc, char** argv) QByteArray ba; while( !std::cin.eof() ) { char arr[1024]; - std::cin.read(arr,sizeof(arr)); - int s = std::cin.gcount(); + std::cin.read(arr, sizeof(arr)); + int s = static_cast( std::cin.gcount() ); ba.append(arr, s); } diff --git a/src/modules/shellprocess/Tests.cpp b/src/modules/shellprocess/Tests.cpp index 068aefda5..4928e28dd 100644 --- a/src/modules/shellprocess/Tests.cpp +++ b/src/modules/shellprocess/Tests.cpp @@ -176,9 +176,9 @@ script: )" ) ).toMap().value( "script" ); if ( !Calamares::JobQueue::instance() ) - (void *)new Calamares::JobQueue( nullptr ); + (void)new Calamares::JobQueue( nullptr ); if ( !Calamares::Settings::instance() ) - (void *)new Calamares::Settings( QString(), true ); + (void)new Calamares::Settings( QString(), true ); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); QVERIFY( gs != nullptr ); diff --git a/src/modules/users/CheckPWQuality.cpp b/src/modules/users/CheckPWQuality.cpp index a78edd754..e44729168 100644 --- a/src/modules/users/CheckPWQuality.cpp +++ b/src/modules/users/CheckPWQuality.cpp @@ -93,6 +93,25 @@ DEFINE_CHECK_FUNC( maxLength ) } #ifdef HAVE_LIBPWQUALITY +/* NOTE: + * + * The munge*() functions are here because libpwquality uses void* to + * represent user-data in callbacks and as a general "pass some parameter" + * type. These need to be munged to the right C++ type. + */ + +/// @brief Handle libpwquality using void* to represent a long +static inline long mungeLong( void* p ) +{ + return static_cast( reinterpret_cast( p ) ); +} + +/// @brief Handle libpwquality using void* to represent a char* +static inline const char* mungeString( void* p ) +{ + return reinterpret_cast( p ); +} + /** * Class that acts as a RAII placeholder for pwquality_settings_t pointers. * Gets a new pointer and ensures it is deleted only once; provides @@ -111,7 +130,6 @@ public: ~PWSettingsHolder() { - cDebug() << "Freeing PWQ@" << ( void* )m_settings; pwquality_free_settings( m_settings ); } @@ -155,7 +173,7 @@ public: case PWQ_ERROR_MEM_ALLOC: if ( auxerror ) { - QString s = QCoreApplication::translate( "PWQ", "Memory allocation error when setting '%1'" ).arg( ( const char* )auxerror ); + QString s = QCoreApplication::translate( "PWQ", "Memory allocation error when setting '%1'" ).arg( mungeString( auxerror ) ); free( auxerror ); return s; } @@ -176,41 +194,41 @@ public: return QCoreApplication::translate( "PWQ", "The password contains forbidden words in some form" ); case PWQ_ERROR_MIN_DIGITS: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains less than %1 digits" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains less than %1 digits" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too few digits" ); case PWQ_ERROR_MIN_UPPERS: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains less than %1 uppercase letters" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains less than %1 uppercase letters" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too few uppercase letters" ); case PWQ_ERROR_MIN_LOWERS: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains less than %1 lowercase letters" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains less than %1 lowercase letters" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too few lowercase letters" ); case PWQ_ERROR_MIN_OTHERS: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains less than %1 non-alphanumeric characters" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains less than %1 non-alphanumeric characters" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too few non-alphanumeric characters" ); case PWQ_ERROR_MIN_LENGTH: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password is shorter than %1 characters" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password is shorter than %1 characters" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password is too short" ); case PWQ_ERROR_ROTATED: return QCoreApplication::translate( "PWQ", "The password is just rotated old one" ); case PWQ_ERROR_MIN_CLASSES: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains less than %1 character classes" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains less than %1 character classes" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password does not contain enough character classes" ); case PWQ_ERROR_MAX_CONSECUTIVE: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains more than %1 same characters consecutively" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains more than %1 same characters consecutively" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too many same characters consecutively" ); case PWQ_ERROR_MAX_CLASS_REPEAT: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains more than %1 characters of the same class consecutively" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains more than %1 characters of the same class consecutively" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too many characters of the same class consecutively" ); case PWQ_ERROR_MAX_SEQUENCE: if ( auxerror ) - return QCoreApplication::translate( "PWQ", "The password contains monotonic sequence longer than %1 characters" ).arg( ( long )auxerror ); + return QCoreApplication::translate( "PWQ", "The password contains monotonic sequence longer than %1 characters" ).arg( mungeLong( auxerror ) ); return QCoreApplication::translate( "PWQ", "The password contains too long of a monotonic character sequence" ); case PWQ_ERROR_EMPTY_PASSWORD: return QCoreApplication::translate( "PWQ", "No password supplied" ); @@ -222,13 +240,13 @@ public: if ( auxerror ) { /* Here the string comes from cracklib, don't free? */ - return QCoreApplication::translate( "PWQ", "The password fails the dictionary check - %1" ).arg( ( const char* )auxerror ); + return QCoreApplication::translate( "PWQ", "The password fails the dictionary check - %1" ).arg( mungeString( auxerror ) ); } return QCoreApplication::translate( "PWQ", "The password fails the dictionary check" ); case PWQ_ERROR_UNKNOWN_SETTING: if ( auxerror ) { - QString s = QCoreApplication::translate( "PWQ", "Unknown setting - %1" ).arg( ( const char* )auxerror ); + QString s = QCoreApplication::translate( "PWQ", "Unknown setting - %1" ).arg( mungeString( auxerror ) ); free( auxerror ); return s; } @@ -236,7 +254,7 @@ public: case PWQ_ERROR_INTEGER: if ( auxerror ) { - QString s = QCoreApplication::translate( "PWQ", "Bad integer value of setting - %1" ).arg( ( const char* )auxerror ); + QString s = QCoreApplication::translate( "PWQ", "Bad integer value of setting - %1" ).arg( mungeString( auxerror ) ); free( auxerror ); return s; } @@ -244,7 +262,7 @@ public: case PWQ_ERROR_NON_INT_SETTING: if ( auxerror ) { - QString s = QCoreApplication::translate( "PWQ", "Setting %1 is not of integer type" ).arg( ( const char* )auxerror ); + QString s = QCoreApplication::translate( "PWQ", "Setting %1 is not of integer type" ).arg( mungeString( auxerror ) ); free( auxerror ); return s; } @@ -252,7 +270,7 @@ public: case PWQ_ERROR_NON_STR_SETTING: if ( auxerror ) { - QString s = QCoreApplication::translate( "PWQ", "Setting %1 is not of string type" ).arg( ( const char* )auxerror ); + QString s = QCoreApplication::translate( "PWQ", "Setting %1 is not of string type" ).arg( mungeString( auxerror ) ); free( auxerror ); return s; } diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index dd43baafd..067105b28 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -105,44 +105,40 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements() if ( entry == "storage" ) checkEntries.append( { entry, - [this]{ return tr( "has at least %1 GB available drive space" ) - .arg( m_requiredStorageGB ); }, - [this]{ return tr( "There is not enough drive space. At least %1 GB is required." ) - .arg( m_requiredStorageGB ); }, + [req=m_requiredStorageGB]{ return tr( "has at least %1 GB available drive space" ).arg( req ); }, + [req=m_requiredStorageGB]{ return tr( "There is not enough drive space. At least %1 GB is required." ).arg( req ); }, enoughStorage, m_entriesToRequire.contains( entry ) } ); else if ( entry == "ram" ) checkEntries.append( { entry, - [this]{ return tr( "has at least %1 GB working memory" ) - .arg( m_requiredRamGB ); }, - [this]{ return tr( "The system does not have enough working memory. At least %1 GB is required." ) - .arg( m_requiredRamGB ); }, + [req=m_requiredRamGB]{ return tr( "has at least %1 GB working memory" ).arg( req ); }, + [req=m_requiredRamGB]{ return tr( "The system does not have enough working memory. At least %1 GB is required." ).arg( req ); }, enoughRam, m_entriesToRequire.contains( entry ) } ); else if ( entry == "power" ) checkEntries.append( { entry, - [this]{ return tr( "is plugged in to a power source" ); }, - [this]{ return tr( "The system is not plugged in to a power source." ); }, + []{ return tr( "is plugged in to a power source" ); }, + []{ return tr( "The system is not plugged in to a power source." ); }, hasPower, m_entriesToRequire.contains( entry ) } ); else if ( entry == "internet" ) checkEntries.append( { entry, - [this]{ return tr( "is connected to the Internet" ); }, - [this]{ return tr( "The system is not connected to the Internet." ); }, + []{ return tr( "is connected to the Internet" ); }, + []{ return tr( "The system is not connected to the Internet." ); }, hasInternet, m_entriesToRequire.contains( entry ) } ); else if ( entry == "root" ) checkEntries.append( { entry, - [this]{ return QString(); }, //we hide it - [this]{ return Calamares::Settings::instance()->isSetupMode() + []{ return QString(); }, //we hide it + []{ return Calamares::Settings::instance()->isSetupMode() ? tr( "The setup program is not running with administrator rights." ) : tr( "The installer is not running with administrator rights." ); }, isRoot, @@ -151,8 +147,8 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements() else if ( entry == "screen" ) checkEntries.append( { entry, - [this]{ return QString(); }, // we hide it - [this]{ return Calamares::Settings::instance()->isSetupMode() + []{ return QString(); }, // we hide it + []{ return Calamares::Settings::instance()->isSetupMode() ? tr( "The screen is too small to display the setup program." ) : tr( "The screen is too small to display the installer." ); }, enoughScreen,