Merge branch 'warnings-reduction'

This commit is contained in:
Adriaan de Groot 2019-04-11 15:20:17 +02:00
commit 05bf1e5226
19 changed files with 105 additions and 93 deletions

View File

@ -80,9 +80,9 @@ handle_args( QCoreApplication& a )
if ( parser.isSet( debugLevelOption ) ) if ( parser.isSet( debugLevelOption ) )
{ {
bool ok = true; bool ok = true;
int l = parser.value( debugLevelOption ).toInt( &ok ); unsigned int l = parser.value( debugLevelOption ).toUInt( &ok );
unsigned int dlevel = 0; unsigned int dlevel = 0;
if ( !ok || ( l < 0 ) ) if ( !ok )
dlevel = Logger::LOGVERBOSE; dlevel = Logger::LOGVERBOSE;
else else
dlevel = l; dlevel = l;
@ -94,20 +94,20 @@ handle_args( QCoreApplication& a )
{ {
cError() << "Missing <module> path.\n"; cError() << "Missing <module> path.\n";
parser.showHelp(); parser.showHelp();
return ModuleConfig(); // NOTREACHED
} }
if ( args.size() > 2 ) else if ( args.size() > 2 )
{ {
cError() << "More than one <module> path.\n"; cError() << "More than one <module> path.\n";
parser.showHelp(); 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 ) ); return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) };
if ( jobSettings.isEmpty() && ( args.size() == 2 ) ) }
jobSettings = args.at(1);
return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) };
} }
@ -207,7 +207,7 @@ main( int argc, char* argv[] )
return 1; return 1;
} }
using TR = Logger::DebugRow<const char*, const QString&>; using TR = Logger::DebugRow<const char*, const QString>;
cDebug() << "Module metadata" cDebug() << "Module metadata"
<< TR( "name", m->name() ) << TR( "name", m->name() )
@ -223,7 +223,6 @@ main( int argc, char* argv[] )
Calamares::JobResult r = p->exec(); Calamares::JobResult r = p->exec();
if ( !r ) if ( !r )
{ {
using TR = Logger::DebugRow<QString, QString>;
cDebug() << count << ".. failed" cDebug() << count << ".. failed"
<< TR( "summary", r.message() ) << TR( "summary", r.message() )
<< TR( "details", r.details() ); << TR( "details", r.details() );

View File

@ -1,5 +1,5 @@
#ifndef __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ #ifndef KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H
#define __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ #define KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H
#include <QtCore/QObject> #include <QtCore/QObject>
@ -31,9 +31,9 @@ public:
AutoKillOtherInstances = 1 AutoKillOtherInstances = 1
}; };
explicit KDSingleApplicationGuard( QObject * parent=0 ); explicit KDSingleApplicationGuard( QObject * parent=nullptr );
explicit KDSingleApplicationGuard( Policy policy, QObject * parent=0 ); explicit KDSingleApplicationGuard( Policy policy, QObject * parent=nullptr );
explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=0 ); explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=nullptr );
explicit KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent=0 ); explicit KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent=0 );
~KDSingleApplicationGuard(); ~KDSingleApplicationGuard();
@ -138,4 +138,4 @@ QT_END_NAMESPACE
#endif // QT_NO_SHAREDMEMORY #endif // QT_NO_SHAREDMEMORY
#endif /* __KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H__ */ #endif /* KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H */

View File

@ -1,5 +1,5 @@
#ifndef __KDTOOLS_KDTOOLSGLOBAL_H__ #ifndef KDTOOLS_KDTOOLSGLOBAL_H
#define __KDTOOLS_KDTOOLSGLOBAL_H__ #define KDTOOLS_KDTOOLSGLOBAL_H
#include <QtCore/QtGlobal> #include <QtCore/QtGlobal>
@ -110,5 +110,5 @@ private: \
void init(bool) void init(bool)
#endif /* __KDTOOLS_KDTOOLSGLOBAL_H__ */ #endif /* KDTOOLS_KDTOOLSGLOBAL_H */

View File

@ -1,5 +1,5 @@
#ifndef __KDTOOLSCORE__PIMPL_PTR_H__ #ifndef KDTOOLSCORE__PIMPL_PTR_H
#define __KDTOOLSCORE__PIMPL_PTR_H__ #define KDTOOLSCORE__PIMPL_PTR_H
#include "kdtoolsglobal.h" #include "kdtoolsglobal.h"
@ -14,7 +14,7 @@ namespace kdtools {
public: public:
pimpl_ptr() : d( new T ) {} pimpl_ptr() : d( new T ) {}
explicit pimpl_ptr( T * t ) : d( t ) {} explicit pimpl_ptr( T * t ) : d( t ) {}
~pimpl_ptr() { delete d; d = 0; } ~pimpl_ptr() { delete d; d = nullptr; }
T * get() { return d; } T * get() { return d; }
const T * get() const { return d; } const T * get() const { return d; }
@ -40,5 +40,5 @@ namespace kdtools {
} // namespace kdtools } // namespace kdtools
#endif #endif
#endif /* __KDTOOLSCORE__PIMPL_PTR_H__ */ #endif /* KDTOOLSCORE__PIMPL_PTR_H */

View File

@ -62,7 +62,7 @@ isWritableDir( const QDir& dir )
{ {
if ( !dir.mkpath( "." ) ) if ( !dir.mkpath( "." ) )
{ {
cerr << "warning: failed to create " << qPrintable( path ) << endl; cerr << "warning: failed to create " << qPrintable( path ) << '\n';
return false; return false;
} }
return true; return true;

View File

@ -45,21 +45,21 @@ static CommandLine get_variant_object( const QVariantMap& m )
static CommandList_t get_variant_stringlist( const QVariantList& l ) static CommandList_t get_variant_stringlist( const QVariantList& l )
{ {
CommandList_t retl; CommandList_t retl;
unsigned int c = 0; unsigned int count = 0;
for ( const auto& v : l ) for ( const auto& v : l )
{ {
if ( v.type() == QVariant::String ) if ( v.type() == QVariant::String )
retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet ) ); retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet ) );
else if ( v.type() == QVariant::Map ) else if ( v.type() == QVariant::Map )
{ {
auto c( get_variant_object( v.toMap() ) ); auto command( get_variant_object( v.toMap() ) );
if ( c.isValid() ) if ( command.isValid() )
retl.append( c ); retl.append( command );
// Otherwise warning is already given // Otherwise warning is already given
} }
else else
cWarning() << "Bad CommandList element" << c << v.type() << v; cWarning() << "Bad CommandList element" << count << v.type() << v;
++c; ++count;
} }
return retl; return retl;
} }

View File

@ -193,28 +193,28 @@ static const char continuation[] = "\n ";
static const char subentry[] = " .. "; static const char subentry[] = " .. ";
QDebug& QDebug&
operator<<( QDebug& s, Continuation c ) operator<<( QDebug& s, Continuation )
{ {
s << continuation; s << continuation;
return s; return s;
} }
QDebug& QDebug&
operator<<( QDebug& s, SubEntry l ) operator<<( QDebug& s, SubEntry )
{ {
s << subentry; s << subentry;
return s; return s;
} }
CDebug& CDebug&
operator<<( CDebug&& s, Continuation c ) operator<<( CDebug&& s, Continuation )
{ {
s << continuation; s << continuation;
return s; return s;
} }
CDebug& CDebug&
operator<<( CDebug&& s, SubEntry l ) operator<<( CDebug&& s, SubEntry )
{ {
s << subentry; s << subentry;
return s; return s;

View File

@ -66,7 +66,7 @@ struct NamedEnumTable
{ {
ok = false; ok = false;
for ( const auto p : table ) for ( const auto& p : table )
if ( 0 == QString::compare( s, p.first, Qt::CaseInsensitive ) ) if ( 0 == QString::compare( s, p.first, Qt::CaseInsensitive ) )
{ {
ok = true; ok = true;
@ -87,7 +87,7 @@ struct NamedEnumTable
{ {
ok = false; ok = false;
for ( const auto p : table ) for ( const auto &p : table )
if ( s == p.second) if ( s == p.second)
{ {
ok = true; ok = true;

View File

@ -72,7 +72,7 @@ public:
NamedSuffix( const NamedEnumTable<T>& table, const QString& s ) NamedSuffix( const NamedEnumTable<T>& table, const QString& s )
: NamedSuffix() : NamedSuffix()
{ {
for( const auto suffix : table.table ) for( const auto& suffix : table.table )
if ( s.endsWith( suffix.first ) ) if ( s.endsWith( suffix.first ) )
{ {
m_value = s.left( s.length() - suffix.first.length() ).toInt(); m_value = s.left( s.length() - suffix.first.length() ).toInt();

View File

@ -78,8 +78,8 @@ const QStringList Branding::s_styleEntryStrings =
"sidebarTextHighlight" "sidebarTextHighlight"
}; };
static const NamedEnumTable<Branding::WindowDimensionUnit>& const NamedEnumTable<Branding::WindowDimensionUnit>&
windowDimensions() Branding::WindowDimension::suffixes()
{ {
using Unit = Branding::WindowDimensionUnit; using Unit = Branding::WindowDimensionUnit;
static const NamedEnumTable<Unit> names{ static const NamedEnumTable<Unit> names{
@ -323,11 +323,6 @@ Branding::initSimpleSettings( const YAML::Node& doc )
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen }, { QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed } { QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
}; };
static const NamedEnumTable< WindowDimensionUnit > dimensionNames{
{ QStringLiteral( "px" ), WindowDimensionUnit::Pixies },
{ QStringLiteral( "em" ), WindowDimensionUnit::Fonties }
};
bool ok = false; bool ok = false;
m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false ); m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false );
@ -342,8 +337,8 @@ Branding::initSimpleSettings( const YAML::Node& doc )
auto l = windowSize.split( ',' ); auto l = windowSize.split( ',' );
if ( l.count() == 2 ) if ( l.count() == 2 )
{ {
m_windowWidth = WindowDimension( dimensionNames, l[0] ); m_windowWidth = WindowDimension( l[0] );
m_windowHeight = WindowDimension( dimensionNames, l[1] ); m_windowHeight = WindowDimension( l[1] );
} }
} }
if ( !m_windowWidth.isValid() ) if ( !m_windowWidth.isValid() )
@ -353,7 +348,7 @@ Branding::initSimpleSettings( const YAML::Node& doc )
} }
void [[noreturn]] void
Branding::bail( const QString& message ) Branding::bail( const QString& message )
{ {
cError() << "FATAL in" cError() << "FATAL in"

View File

@ -89,8 +89,11 @@ public:
class WindowDimension : public NamedSuffix<WindowDimensionUnit, WindowDimensionUnit::None> class WindowDimension : public NamedSuffix<WindowDimensionUnit, WindowDimensionUnit::None>
{ {
public: public:
using NamedSuffix::NamedSuffix; static const NamedEnumTable< WindowDimensionUnit >& suffixes();
bool isValid() const; bool isValid() const;
using NamedSuffix::NamedSuffix;
WindowDimension( const QString& s ) : NamedSuffix( suffixes(), s ) {}
} ; } ;
static Branding* instance(); static Branding* instance();
@ -132,7 +135,7 @@ private:
static const QStringList s_imageEntryStrings; static const QStringList s_imageEntryStrings;
static const QStringList s_styleEntryStrings; static const QStringList s_styleEntryStrings;
void bail( const QString& message ); [[noreturn]] void bail( const QString& message );
QString m_descriptorPath; QString m_descriptorPath;
QString m_componentName; QString m_componentName;

View File

@ -143,8 +143,9 @@ RequirementsChecker::reportProgress()
auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && !w->isFinished(); } ); auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && !w->isFinished(); } );
if ( remaining > 0 ) 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 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 ); emit requirementsProgress( waiting + QString( " " ) + elapsed );
} }
else else

View File

@ -13,7 +13,7 @@
class QJsonTreeItem class QJsonTreeItem
{ {
public: public:
QJsonTreeItem(QJsonTreeItem * parent = 0); QJsonTreeItem(QJsonTreeItem * parent = nullptr);
~QJsonTreeItem(); ~QJsonTreeItem();
void appendChild(QJsonTreeItem * item); void appendChild(QJsonTreeItem * item);
QJsonTreeItem *child(int row); QJsonTreeItem *child(int row);
@ -28,7 +28,7 @@ public:
QJsonValue::Type type() const; QJsonValue::Type type() const;
static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = 0); static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = nullptr);
protected: protected:

View File

@ -16,7 +16,7 @@ class QJsonModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QJsonModel(QObject *parent = 0); explicit QJsonModel(QObject *parent = nullptr);
~QJsonModel(); ~QJsonModel();
bool load(const QString& fileName); bool load(const QString& fileName);
bool load(QIODevice * device); bool load(QIODevice * device);

View File

@ -37,7 +37,7 @@ class WaitingSpinnerWidget : public QWidget {
public: public:
/*! Constructor for "standard" widget behaviour - use this /*! Constructor for "standard" widget behaviour - use this
* constructor if you wish to, e.g. embed your widget in another. */ * constructor if you wish to, e.g. embed your widget in another. */
WaitingSpinnerWidget(QWidget *parent = 0, WaitingSpinnerWidget(QWidget *parent = nullptr,
bool centerOnParent = true, bool centerOnParent = true,
bool disableParentWhenSpinning = true); bool disableParentWhenSpinning = true);
@ -47,7 +47,7 @@ public:
* QtWaitingSpinner automatically centres itself on it, if not, * QtWaitingSpinner automatically centres itself on it, if not,
* "centreOnParent" is ignored. */ * "centreOnParent" is ignored. */
WaitingSpinnerWidget(Qt::WindowModality modality, WaitingSpinnerWidget(Qt::WindowModality modality,
QWidget *parent = 0, QWidget *parent = nullptr,
bool centerOnParent = true, bool centerOnParent = true,
bool disableParentWhenSpinning = true); bool disableParentWhenSpinning = true);

View File

@ -54,8 +54,8 @@ int main(int argc, char** argv)
QByteArray ba; QByteArray ba;
while( !std::cin.eof() ) { while( !std::cin.eof() ) {
char arr[1024]; char arr[1024];
std::cin.read(arr,sizeof(arr)); std::cin.read(arr, sizeof(arr));
int s = std::cin.gcount(); int s = static_cast<int>( std::cin.gcount() );
ba.append(arr, s); ba.append(arr, s);
} }

View File

@ -176,9 +176,9 @@ script:
)" ) ).toMap().value( "script" ); )" ) ).toMap().value( "script" );
if ( !Calamares::JobQueue::instance() ) if ( !Calamares::JobQueue::instance() )
(void *)new Calamares::JobQueue( nullptr ); (void)new Calamares::JobQueue( nullptr );
if ( !Calamares::Settings::instance() ) if ( !Calamares::Settings::instance() )
(void *)new Calamares::Settings( QString(), true ); (void)new Calamares::Settings( QString(), true );
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QVERIFY( gs != nullptr ); QVERIFY( gs != nullptr );

View File

@ -93,6 +93,25 @@ DEFINE_CHECK_FUNC( maxLength )
} }
#ifdef HAVE_LIBPWQUALITY #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<long>( reinterpret_cast<intptr_t>( p ) );
}
/// @brief Handle libpwquality using void* to represent a char*
static inline const char* mungeString( void* p )
{
return reinterpret_cast<const char*>( p );
}
/** /**
* Class that acts as a RAII placeholder for pwquality_settings_t pointers. * Class that acts as a RAII placeholder for pwquality_settings_t pointers.
* Gets a new pointer and ensures it is deleted only once; provides * Gets a new pointer and ensures it is deleted only once; provides
@ -111,7 +130,6 @@ public:
~PWSettingsHolder() ~PWSettingsHolder()
{ {
cDebug() << "Freeing PWQ@" << ( void* )m_settings;
pwquality_free_settings( m_settings ); pwquality_free_settings( m_settings );
} }
@ -155,7 +173,7 @@ public:
case PWQ_ERROR_MEM_ALLOC: case PWQ_ERROR_MEM_ALLOC:
if ( auxerror ) 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 ); free( auxerror );
return s; return s;
} }
@ -176,41 +194,41 @@ public:
return QCoreApplication::translate( "PWQ", "The password contains forbidden words in some form" ); return QCoreApplication::translate( "PWQ", "The password contains forbidden words in some form" );
case PWQ_ERROR_MIN_DIGITS: case PWQ_ERROR_MIN_DIGITS:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too few digits" );
case PWQ_ERROR_MIN_UPPERS: case PWQ_ERROR_MIN_UPPERS:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too few uppercase letters" );
case PWQ_ERROR_MIN_LOWERS: case PWQ_ERROR_MIN_LOWERS:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too few lowercase letters" );
case PWQ_ERROR_MIN_OTHERS: case PWQ_ERROR_MIN_OTHERS:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too few non-alphanumeric characters" );
case PWQ_ERROR_MIN_LENGTH: case PWQ_ERROR_MIN_LENGTH:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password is too short" );
case PWQ_ERROR_ROTATED: case PWQ_ERROR_ROTATED:
return QCoreApplication::translate( "PWQ", "The password is just rotated old one" ); return QCoreApplication::translate( "PWQ", "The password is just rotated old one" );
case PWQ_ERROR_MIN_CLASSES: case PWQ_ERROR_MIN_CLASSES:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password does not contain enough character classes" );
case PWQ_ERROR_MAX_CONSECUTIVE: case PWQ_ERROR_MAX_CONSECUTIVE:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too many same characters consecutively" );
case PWQ_ERROR_MAX_CLASS_REPEAT: case PWQ_ERROR_MAX_CLASS_REPEAT:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too many characters of the same class consecutively" );
case PWQ_ERROR_MAX_SEQUENCE: case PWQ_ERROR_MAX_SEQUENCE:
if ( auxerror ) 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" ); return QCoreApplication::translate( "PWQ", "The password contains too long of a monotonic character sequence" );
case PWQ_ERROR_EMPTY_PASSWORD: case PWQ_ERROR_EMPTY_PASSWORD:
return QCoreApplication::translate( "PWQ", "No password supplied" ); return QCoreApplication::translate( "PWQ", "No password supplied" );
@ -222,13 +240,13 @@ public:
if ( auxerror ) if ( auxerror )
{ {
/* Here the string comes from cracklib, don't free? */ /* 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" ); return QCoreApplication::translate( "PWQ", "The password fails the dictionary check" );
case PWQ_ERROR_UNKNOWN_SETTING: case PWQ_ERROR_UNKNOWN_SETTING:
if ( auxerror ) 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 ); free( auxerror );
return s; return s;
} }
@ -236,7 +254,7 @@ public:
case PWQ_ERROR_INTEGER: case PWQ_ERROR_INTEGER:
if ( auxerror ) 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 ); free( auxerror );
return s; return s;
} }
@ -244,7 +262,7 @@ public:
case PWQ_ERROR_NON_INT_SETTING: case PWQ_ERROR_NON_INT_SETTING:
if ( auxerror ) 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 ); free( auxerror );
return s; return s;
} }
@ -252,7 +270,7 @@ public:
case PWQ_ERROR_NON_STR_SETTING: case PWQ_ERROR_NON_STR_SETTING:
if ( auxerror ) 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 ); free( auxerror );
return s; return s;
} }

View File

@ -105,44 +105,40 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
if ( entry == "storage" ) if ( entry == "storage" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return tr( "has at least %1 GB available drive space" ) [req=m_requiredStorageGB]{ return tr( "has at least %1 GB available drive space" ).arg( req ); },
.arg( m_requiredStorageGB ); }, [req=m_requiredStorageGB]{ return tr( "There is not enough drive space. At least %1 GB is required." ).arg( req ); },
[this]{ return tr( "There is not enough drive space. At least %1 GB is required." )
.arg( m_requiredStorageGB ); },
enoughStorage, enoughStorage,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
else if ( entry == "ram" ) else if ( entry == "ram" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return tr( "has at least %1 GB working memory" ) [req=m_requiredRamGB]{ return tr( "has at least %1 GB working memory" ).arg( req ); },
.arg( m_requiredRamGB ); }, [req=m_requiredRamGB]{ return tr( "The system does not have enough working memory. At least %1 GB is required." ).arg( req ); },
[this]{ return tr( "The system does not have enough working memory. At least %1 GB is required." )
.arg( m_requiredRamGB ); },
enoughRam, enoughRam,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
else if ( entry == "power" ) else if ( entry == "power" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return tr( "is plugged in to a power source" ); }, []{ return tr( "is plugged in to a power source" ); },
[this]{ return tr( "The system is not plugged in to a power source." ); }, []{ return tr( "The system is not plugged in to a power source." ); },
hasPower, hasPower,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
else if ( entry == "internet" ) else if ( entry == "internet" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return tr( "is connected to the Internet" ); }, []{ return tr( "is connected to the Internet" ); },
[this]{ return tr( "The system is not connected to the Internet." ); }, []{ return tr( "The system is not connected to the Internet." ); },
hasInternet, hasInternet,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
else if ( entry == "root" ) else if ( entry == "root" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return QString(); }, //we hide it []{ return QString(); }, //we hide it
[this]{ return Calamares::Settings::instance()->isSetupMode() []{ return Calamares::Settings::instance()->isSetupMode()
? tr( "The setup program is not running with administrator rights." ) ? tr( "The setup program is not running with administrator rights." )
: tr( "The installer is not running with administrator rights." ); }, : tr( "The installer is not running with administrator rights." ); },
isRoot, isRoot,
@ -151,8 +147,8 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
else if ( entry == "screen" ) else if ( entry == "screen" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[this]{ return QString(); }, // we hide it []{ return QString(); }, // we hide it
[this]{ return Calamares::Settings::instance()->isSetupMode() []{ 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 setup program." )
: tr( "The screen is too small to display the installer." ); }, : tr( "The screen is too small to display the installer." ); },
enoughScreen, enoughScreen,