CI: apply coding style across the entire codebase again

main
Adriaan de Groot 5 years ago
parent 1cd9b93a22
commit a2180936ef

@ -26,29 +26,31 @@
#include <QDomDocument>
static const char usage[] = "Usage: txload <origin> [<alternate> ...]\n"
"\n"
"Reads a .ts source file <origin> and zero or more .ts <alternate>\n"
"files, and does a comparison between the translations. Source (English)\n"
"strings that are untranslated are flagged in each of the translation\n"
"files, while differences in the translations are themselves also shown.\n"
"\n"
"Outputs to stdout a human-readable list of differences between the\n"
"translations.\n";
bool load_file(const char* filename, QDomDocument& doc)
"\n"
"Reads a .ts source file <origin> and zero or more .ts <alternate>\n"
"files, and does a comparison between the translations. Source (English)\n"
"strings that are untranslated are flagged in each of the translation\n"
"files, while differences in the translations are themselves also shown.\n"
"\n"
"Outputs to stdout a human-readable list of differences between the\n"
"translations.\n";
bool
load_file( const char* filename, QDomDocument& doc )
{
QFile file(filename);
QFile file( filename );
QString err;
int err_line, err_column;
if (!file.open(QIODevice::ReadOnly))
if ( !file.open( QIODevice::ReadOnly ) )
{
qDebug() << "Could not open" << filename;
return false;
}
QByteArray ba( file.read(1024 * 1024) );
QByteArray ba( file.read( 1024 * 1024 ) );
qDebug() << "Read" << ba.length() << "bytes from" << filename;
if (!doc.setContent(ba, &err, &err_line, &err_column)) {
if ( !doc.setContent( ba, &err, &err_line, &err_column ) )
{
qDebug() << "Could not read" << filename << ':' << err_line << ':' << err_column << ' ' << err;
file.close();
return false;
@ -58,15 +60,20 @@ bool load_file(const char* filename, QDomDocument& doc)
return true;
}
QDomElement find_context(QDomDocument& doc, const QString& name)
QDomElement
find_context( QDomDocument& doc, const QString& name )
{
QDomElement top = doc.documentElement();
QDomNode n = top.firstChild();
while (!n.isNull()) {
if (n.isElement()) {
while ( !n.isNull() )
{
if ( n.isElement() )
{
QDomElement e = n.toElement();
if ( ( e.tagName() == "context" ) && ( e.firstChildElement( "name" ).text() == name ) )
{
return e;
}
}
n = n.nextSibling();
}
@ -74,17 +81,22 @@ QDomElement find_context(QDomDocument& doc, const QString& name)
return QDomElement();
}
QDomElement find_message(QDomElement& context, const QString& source)
QDomElement
find_message( QDomElement& context, const QString& source )
{
QDomNode n = context.firstChild();
while (!n.isNull()) {
if (n.isElement()) {
while ( !n.isNull() )
{
if ( n.isElement() )
{
QDomElement e = n.toElement();
if ( e.tagName() == "message" )
{
QString msource = e.firstChildElement( "source" ).text();
if ( msource == source )
{
return e;
}
}
}
n = n.nextSibling();
@ -92,11 +104,14 @@ QDomElement find_message(QDomElement& context, const QString& source)
return QDomElement();
}
bool merge_into(QDomElement& origin, QDomElement& alternate)
bool
merge_into( QDomElement& origin, QDomElement& alternate )
{
QDomNode n = alternate.firstChild();
while (!n.isNull()) {
if (n.isElement()) {
while ( !n.isNull() )
{
if ( n.isElement() )
{
QDomElement alternateMessage = n.toElement();
if ( alternateMessage.tagName() == "message" )
{
@ -119,7 +134,8 @@ bool merge_into(QDomElement& origin, QDomElement& alternate)
}
if ( !alternateTranslationText.isEmpty() && ( alternateTranslationText != originTranslationText ) )
{
qDebug() << "\n\n\nSource:" << alternateSourceText << "\nTL1:" << originTranslationText << "\nTL2:" << alternateTranslationText;
qDebug() << "\n\n\nSource:" << alternateSourceText << "\nTL1:" << originTranslationText
<< "\nTL2:" << alternateTranslationText;
}
}
}
@ -130,12 +146,14 @@ bool merge_into(QDomElement& origin, QDomElement& alternate)
}
bool merge_into(QDomDocument& originDocument, QDomElement& context)
bool
merge_into( QDomDocument& originDocument, QDomElement& context )
{
QDomElement name = context.firstChildElement( "name" );
if ( name.isNull() )
{
return false;
}
QString contextname = name.text();
QDomElement originContext = find_context( originDocument, contextname );
@ -148,16 +166,21 @@ bool merge_into(QDomDocument& originDocument, QDomElement& context)
return merge_into( originContext, context );
}
bool merge_into(QDomDocument& originDocument, QDomDocument& alternateDocument)
bool
merge_into( QDomDocument& originDocument, QDomDocument& alternateDocument )
{
QDomElement top = alternateDocument.documentElement();
QDomNode n = top.firstChild();
while (!n.isNull()) {
if (n.isElement()) {
while ( !n.isNull() )
{
if ( n.isElement() )
{
QDomElement e = n.toElement();
if ( e.tagName() == "context" )
if ( !merge_into( originDocument, e ) )
{
return false;
}
}
n = n.nextSibling();
}
@ -165,39 +188,46 @@ bool merge_into(QDomDocument& originDocument, QDomDocument& alternateDocument)
return true;
}
int main(int argc, char** argv)
int
main( int argc, char** argv )
{
QCoreApplication a(argc, argv);
QCoreApplication a( argc, argv );
if (argc < 2)
if ( argc < 2 )
{
qWarning() << usage;
return 1;
}
QDomDocument originDocument("origin");
if ( !load_file(argv[1], originDocument) )
QDomDocument originDocument( "origin" );
if ( !load_file( argv[ 1 ], originDocument ) )
{
return 1;
}
for (int i = 2; i < argc; ++i)
for ( int i = 2; i < argc; ++i )
{
QDomDocument alternateDocument("alternate");
if ( !load_file(argv[i], alternateDocument) )
QDomDocument alternateDocument( "alternate" );
if ( !load_file( argv[ i ], alternateDocument ) )
{
return 1;
}
if ( !merge_into( originDocument, alternateDocument ) )
{
return 1;
}
}
QString outfilename( argv[1] );
QString outfilename( argv[ 1 ] );
outfilename.append( ".new" );
QFile outfile(outfilename);
if (!outfile.open(QIODevice::WriteOnly))
QFile outfile( outfilename );
if ( !outfile.open( QIODevice::WriteOnly ) )
{
qDebug() << "Could not open" << outfilename;
return 1;
}
outfile.write( originDocument.toString(4).toUtf8() );
outfile.write( originDocument.toString( 4 ).toUtf8() );
outfile.close();
return 0;

@ -67,7 +67,8 @@ CalamaresApplication::init()
{
Logger::setupLogfile();
cDebug() << "Calamares version:" << CALAMARES_VERSION;
cDebug() << Logger::SubEntry << " languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
cDebug() << Logger::SubEntry
<< " languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
if ( !Calamares::Settings::instance() )
{

@ -28,7 +28,7 @@ class CalamaresWindow : public QWidget
Q_OBJECT
public:
CalamaresWindow( QWidget* parent = nullptr );
virtual ~CalamaresWindow() override { }
virtual ~CalamaresWindow() override {}
public slots:
/**

@ -184,7 +184,8 @@ DebugWindow::DebugWindow()
#endif
] {
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
Module* module
= ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
if ( module )
{
m_module = module->configurationMap();

@ -14,26 +14,29 @@
#include "utils/Yaml.h"
#include <unistd.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <QFile>
#include <QByteArray>
#include <QFile>
using std::cerr;
static const char usage[] = "Usage: test_conf [-v] [-b] <file> ...\n";
int main(int argc, char** argv)
int
main( int argc, char** argv )
{
bool verbose = false;
bool bytes = false;
int opt;
while ((opt = getopt(argc, argv, "vb")) != -1) {
switch (opt) {
while ( ( opt = getopt( argc, argv, "vb" ) ) != -1 )
{
switch ( opt )
{
case 'v':
verbose = true;
break;
@ -52,7 +55,7 @@ int main(int argc, char** argv)
return 1;
}
const char* filename = argv[optind];
const char* filename = argv[ optind ];
try
{
YAML::Node doc;
@ -60,10 +63,14 @@ int main(int argc, char** argv)
{
QFile f( filename );
if ( f.open( QFile::ReadOnly | QFile::Text ) )
{
doc = YAML::Load( f.readAll().constData() );
}
}
else
{
doc = YAML::LoadFile( filename );
}
if ( doc.IsNull() )
{
@ -86,12 +93,14 @@ int main(int argc, char** argv)
{
cerr << "Keys:\n";
for ( auto i = doc.begin(); i != doc.end(); ++i )
cerr << i->first.as<std::string>() << '\n';
{
cerr << i->first.as< std::string >() << '\n';
}
}
}
catch ( YAML::Exception& e )
{
cerr << "WARNING:" << filename << '\n';
cerr << "WARNING:" << filename << '\n';
cerr << "WARNING: YAML parser error " << e.what() << '\n';
return 1;
}

@ -192,7 +192,7 @@ ExecViewModule::ExecViewModule()
// We don't have one, so build one -- this gives us "x@x".
QVariantMap m;
m.insert( "name", "x" );
Calamares::Module::initFrom( Calamares::ModuleSystem::Descriptor::fromDescriptorData(m), "x" );
Calamares::Module::initFrom( Calamares::ModuleSystem::Descriptor::fromDescriptorData( m ), "x" );
}
ExecViewModule::~ExecViewModule() {}
@ -323,7 +323,8 @@ load_module( const ModuleConfig& moduleConfig )
cDebug() << "Module" << moduleName << "job-configuration:" << configFile;
Calamares::Module* module = Calamares::moduleFromDescriptor( Calamares::ModuleSystem::Descriptor::fromDescriptorData( descriptor ), name, configFile, moduleDirectory );
Calamares::Module* module = Calamares::moduleFromDescriptor(
Calamares::ModuleSystem::Descriptor::fromDescriptorData( descriptor ), name, configFile, moduleDirectory );
return module;
}

@ -67,7 +67,8 @@ Handler::Handler( const QString& implementation, const QString& url, const QStri
{
cWarning() << "GeoIP style *none* does not do anything.";
}
else if ( m_type == Type::Fixed && Calamares::Settings::instance() && !Calamares::Settings::instance()->debugMode() )
else if ( m_type == Type::Fixed && Calamares::Settings::instance()
&& !Calamares::Settings::instance()->debugMode() )
{
cWarning() << "GeoIP style *fixed* is not recommended for production.";
}

@ -34,10 +34,10 @@ class DLLEXPORT Handler
public:
enum class Type
{
None, // No lookup, returns empty string
JSON, // JSON-formatted data, returns extracted field
None, // No lookup, returns empty string
JSON, // JSON-formatted data, returns extracted field
XML, // XML-formatted data, returns extracted field
Fixed // Returns selector string verbatim
Fixed // Returns selector string verbatim
};
/** @brief An unconfigured handler; this always returns errors. */

@ -358,7 +358,9 @@ ZonesModel::find( const QString& region, const QString& zone ) const
}
STATICTEST const TimeZoneData*
find( double startingDistance, const ZoneVector& zones, const std::function< double( const TimeZoneData* ) >& distanceFunc )
find( double startingDistance,
const ZoneVector& zones,
const std::function< double( const TimeZoneData* ) >& distanceFunc )
{
double smallestDistance = startingDistance;
const TimeZoneData* closest = nullptr;
@ -379,7 +381,8 @@ const TimeZoneData*
ZonesModel::find( const std::function< double( const TimeZoneData* ) >& distanceFunc ) const
{
const auto* officialZone = CalamaresUtils::Locale::find( 1000000.0, m_private->m_zones, distanceFunc );
const auto* altZone = CalamaresUtils::Locale::find( distanceFunc( officialZone ), m_private->m_altZones, distanceFunc );
const auto* altZone
= CalamaresUtils::Locale::find( distanceFunc( officialZone ), m_private->m_altZones, distanceFunc );
// If nothing was closer than the official zone already was, altZone is
// nullptr; but if there is a spot-patch, then we need to re-find

@ -86,8 +86,7 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
return paths;
}
void
Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
void Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
{
QStringList configCandidates
= moduleConfigurationCandidates( Settings::instance()->debugMode(), name(), configFileName );

@ -89,9 +89,8 @@ RequirementsModel::describe() const
int count = 0;
for ( const auto& r : m_requirements )
{
cDebug() << Logger::SubEntry << "requirement" << count << r.name
<< "satisfied?" << r.satisfied
<< "mandatory?" << r.mandatory;
cDebug() << Logger::SubEntry << "requirement" << count << r.name << "satisfied?" << r.satisfied << "mandatory?"
<< r.mandatory;
if ( r.mandatory && !r.satisfied )
{
acceptable = false;

@ -62,7 +62,8 @@ InternalManager::InternalManager()
else
{
auto* backend_p = CoreBackendManager::self()->backend();
cDebug() << Logger::SubEntry << "Backend" << Logger::Pointer(backend_p) << backend_p->id() << backend_p->version();
cDebug() << Logger::SubEntry << "Backend" << Logger::Pointer( backend_p ) << backend_p->id()
<< backend_p->version();
s_kpm_loaded = true;
}
}

@ -187,7 +187,8 @@ System::runCommand( System::RunLocation location,
? ( static_cast< int >( std::chrono::milliseconds( timeoutSec ).count() ) )
: -1 ) )
{
cWarning() << "Process" << args.first() << "timed out after" << timeoutSec.count() << "s. Output so far:\n" << Logger::NoQuote{} << process.readAllStandardOutput();
cWarning() << "Process" << args.first() << "timed out after" << timeoutSec.count() << "s. Output so far:\n"
<< Logger::NoQuote {} << process.readAllStandardOutput();
return ProcessResult::Code::TimedOut;
}
@ -195,7 +196,7 @@ System::runCommand( System::RunLocation location,
if ( process.exitStatus() == QProcess::CrashExit )
{
cWarning() << "Process" << args.first() << "crashed. Output so far:\n" << Logger::NoQuote{} << output;
cWarning() << "Process" << args.first() << "crashed. Output so far:\n" << Logger::NoQuote {} << output;
return ProcessResult::Code::Crashed;
}
@ -204,7 +205,8 @@ System::runCommand( System::RunLocation location,
bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() );
if ( ( r != 0 ) || showDebug )
{
cDebug() << Logger::SubEntry << "Target cmd:" << RedactedList( args ) << "output:\n" << Logger::NoQuote{} << output;
cDebug() << Logger::SubEntry << "Target cmd:" << RedactedList( args ) << "output:\n"
<< Logger::NoQuote {} << output;
}
return ProcessResult( r, output );
}

@ -412,7 +412,8 @@ LibCalamaresTests::testVariantStringListCode()
m.insert( key, 17 );
QCOMPARE( getStringList( m, key ), QStringList {} );
m.insert( key, QString( "more strings" ) );
QCOMPARE( getStringList( m, key ), QStringList { "more strings" } ); // A single string **can** be considered a stringlist!
QCOMPARE( getStringList( m, key ),
QStringList { "more strings" } ); // A single string **can** be considered a stringlist!
m.insert( key, QVariant {} );
QCOMPARE( getStringList( m, key ), QStringList {} );
}

@ -49,17 +49,30 @@ namespace CalamaresUtils
*/
namespace Traits
{
template< class > struct sfinae_true : std::true_type{};
}
}
template < class >
struct sfinae_true : std::true_type
{
};
} // namespace Traits
} // namespace CalamaresUtils
#define DECLARE_HAS_METHOD(m) \
namespace CalamaresUtils { namespace Traits { \
struct has_ ## m { \
template< class T > static auto f(int) -> sfinae_true<decltype(&T:: m)>; \
template< class T > static auto f(long) -> std::false_type; \
template< class T > using t = decltype( f <T>(0) ); \
}; } } \
template< class T > using has_ ## m = CalamaresUtils::Traits:: has_ ## m ::t<T>;
#define DECLARE_HAS_METHOD( m ) \
namespace CalamaresUtils \
{ \
namespace Traits \
{ \
struct has_##m \
{ \
template < class T > \
static auto f( int ) -> sfinae_true< decltype( &T::m ) >; \
template < class T > \
static auto f( long ) -> std::false_type; \
template < class T > \
using t = decltype( f< T >( 0 ) ); \
}; \
} \
} \
template < class T > \
using has_##m = CalamaresUtils::Traits::has_##m ::t< T >;
#endif

@ -38,7 +38,7 @@ DLLEXPORT QStringList getStringList( const QVariantMap& map, const QString& key,
/**
* Get an integer value from a mapping with a given key; returns @p d if no value.
*/
DLLEXPORT qint64 getInteger( const QVariantMap& map, const QString& key, qint64 d = 0);
DLLEXPORT qint64 getInteger( const QVariantMap& map, const QString& key, qint64 d = 0 );
/**
* Get an unsigned integer value from a mapping with a given key; returns @p d if no value.
@ -58,7 +58,10 @@ DLLEXPORT double getDouble( const QVariantMap& map, const QString& key, double d
* Returns @p d if there is no such key or it is not a map-value.
* (e.g. if @p success is false).
*/
DLLEXPORT QVariantMap getSubMap( const QVariantMap& map, const QString& key, bool& success, const QVariantMap& d = QVariantMap() );
DLLEXPORT QVariantMap getSubMap( const QVariantMap& map,
const QString& key,
bool& success,
const QVariantMap& d = QVariantMap() );
} // namespace CalamaresUtils
#endif

@ -180,7 +180,7 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
msgBox->show();
cDebug() << "Calamares will quit when the dialog closes.";
connect( msgBox, &QMessageBox::buttonClicked, [ msgBox ]( QAbstractButton* button ) {
connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) {
if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole )
{
// TODO: host and port should be configurable

@ -48,7 +48,8 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
std::unique_ptr< Module > m;
if ( !moduleDescriptor.isValid() ) {
if ( !moduleDescriptor.isValid() )
{
cError() << "Bad module descriptor format" << instanceId;
return nullptr;
}
@ -68,7 +69,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
}
else
{
cError() << "Bad interface" << Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() ) << "for module type" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() );
cError() << "Bad interface"
<< Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() )
<< "for module type" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() );
}
}
else if ( moduleDescriptor.type() == Type::Job )
@ -91,7 +94,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
}
else
{
cError() << "Bad interface" << Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() ) << "for module type" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() );
cError() << "Bad interface"
<< Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() )
<< "for module type" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() );
}
}
else
@ -101,7 +106,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
if ( !m )
{
cError() << "Bad module type (" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() ) << ") or interface string (" << Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() ) << ") for module "
cError() << "Bad module type (" << Calamares::ModuleSystem::typeNames().find( moduleDescriptor.type() )
<< ") or interface string ("
<< Calamares::ModuleSystem::interfaceNames().find( moduleDescriptor.interface() ) << ") for module "
<< instanceId;
return nullptr;
}

@ -104,8 +104,9 @@ ModuleManager::doInit()
if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
&& !m_availableDescriptorsByModuleName.contains( moduleName ) )
{
auto descriptor = Calamares::ModuleSystem::Descriptor::fromDescriptorData( moduleDescriptorMap );
descriptor.setDirectory(descriptorFileInfo.absoluteDir().absolutePath() );
auto descriptor
= Calamares::ModuleSystem::Descriptor::fromDescriptorData( moduleDescriptorMap );
descriptor.setDirectory( descriptorFileInfo.absoluteDir().absolutePath() );
m_availableDescriptorsByModuleName.insert( moduleName, descriptor );
}
}
@ -243,11 +244,8 @@ ModuleManager::loadModules()
}
else
{
thisModule
= Calamares::moduleFromDescriptor( descriptor,
instanceKey.id(),
configFileName,
descriptor.directory() );
thisModule = Calamares::moduleFromDescriptor(
descriptor, instanceKey.id(), configFileName, descriptor.directory() );
if ( !thisModule )
{
cError() << "Module" << instanceKey.toString() << "cannot be created from descriptor"
@ -375,8 +373,7 @@ ModuleManager::checkDependencies()
for ( auto it = m_availableDescriptorsByModuleName.begin(); it != m_availableDescriptorsByModuleName.end();
++it )
{
QStringList unmet = missingRequiredModules( it->requiredModules(),
m_availableDescriptorsByModuleName );
QStringList unmet = missingRequiredModules( it->requiredModules(), m_availableDescriptorsByModuleName );
if ( unmet.count() > 0 )
{
@ -403,8 +400,7 @@ ModuleManager::checkModuleDependencies( const Module& m )
}
bool allRequirementsFound = true;
QStringList requiredModules
= m_availableDescriptorsByModuleName[ m.name() ].requiredModules();
QStringList requiredModules = m_availableDescriptorsByModuleName[ m.name() ].requiredModules();
for ( const QString& required : requiredModules )
{

@ -71,7 +71,7 @@ ProcessJobModule::ProcessJobModule()
}
ProcessJobModule::~ProcessJobModule() { }
ProcessJobModule::~ProcessJobModule() {}
} // namespace Calamares

@ -67,7 +67,7 @@ PythonJobModule::PythonJobModule()
}
PythonJobModule::~PythonJobModule() { }
PythonJobModule::~PythonJobModule() {}
} // namespace Calamares

@ -179,6 +179,6 @@ PythonQtViewModule::PythonQtViewModule()
{
}
PythonQtViewModule::~PythonQtViewModule() { }
PythonQtViewModule::~PythonQtViewModule() {}
} // namespace Calamares

@ -23,7 +23,7 @@ ImageRegistry::instance()
}
ImageRegistry::ImageRegistry() { }
ImageRegistry::ImageRegistry() {}
QIcon

@ -53,7 +53,7 @@ BlankViewStep::BlankViewStep( const QString& title,
m_widget->setLayout( layout );
}
BlankViewStep::~BlankViewStep() { }
BlankViewStep::~BlankViewStep() {}
QString
BlankViewStep::prettyName() const

@ -31,7 +31,7 @@ class GlobalStorage : public QObject
Q_OBJECT
public:
explicit GlobalStorage( Calamares::GlobalStorage* gs );
virtual ~GlobalStorage() { }
virtual ~GlobalStorage() {}
public slots:
bool contains( const QString& key ) const;

@ -35,7 +35,7 @@ class PythonQtJob : public Calamares::Job
{
Q_OBJECT
public:
virtual ~PythonQtJob() { }
virtual ~PythonQtJob() {}
QString prettyName() const override;
QString prettyDescription() const override;

@ -24,7 +24,7 @@ class Utils : public QObject
Q_OBJECT
public:
explicit Utils( QObject* parent = nullptr );
virtual ~Utils() { }
virtual ~Utils() {}
public slots:
void debug( const QString& s ) const;

@ -79,7 +79,7 @@ QmlViewStep::QmlViewStep( QObject* parent )
// QML Loading starts when the configuration for the module is set.
}
QmlViewStep::~QmlViewStep() { }
QmlViewStep::~QmlViewStep() {}
QString
QmlViewStep::prettyName() const

@ -22,7 +22,7 @@ ViewStep::ViewStep( QObject* parent )
}
ViewStep::~ViewStep() { }
ViewStep::~ViewStep() {}
QString

@ -27,7 +27,7 @@ ClickableLabel::ClickableLabel( const QString& text, QWidget* parent )
}
ClickableLabel::~ClickableLabel() { }
ClickableLabel::~ClickableLabel() {}
void

@ -17,7 +17,7 @@ FixedAspectRatioLabel::FixedAspectRatioLabel( QWidget* parent )
}
FixedAspectRatioLabel::~FixedAspectRatioLabel() { }
FixedAspectRatioLabel::~FixedAspectRatioLabel() {}
void

@ -38,7 +38,7 @@ class UIDLLEXPORT PrettyRadioButton : public QWidget
Q_OBJECT
public:
explicit PrettyRadioButton( QWidget* parent = nullptr );
virtual ~PrettyRadioButton() { }
virtual ~PrettyRadioButton() {}
/// @brief Passes @p text on to the ClickableLabel
void setText( const QString& text );

@ -202,7 +202,8 @@ PreserveFiles::setConfigurationMap( const QVariantMap& configurationMap )
{
QString filename = li.toString();
if ( !filename.isEmpty() )
m_items.append( Item { filename, filename, CalamaresUtils::Permissions( defaultPermissions ), ItemType::Path } );
m_items.append(
Item { filename, filename, CalamaresUtils::Permissions( defaultPermissions ), ItemType::Path } );
else
{
cDebug() << "Empty filename for preservefiles, item" << c;

@ -8,8 +8,8 @@
#include "utils/Logger.h"
#include <QtTest/QtTest>
#include <QObject>
#include <QtTest/QtTest>
class TrackingTests : public QObject
{
@ -28,17 +28,17 @@ TrackingTests::TrackingTests()
{
}
TrackingTests::~TrackingTests()
{
}
TrackingTests::~TrackingTests() {}
void TrackingTests::initTestCase()
void
TrackingTests::initTestCase()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
cDebug() << "Tracking test started.";
}
void TrackingTests::testEmptyConfig()
void
TrackingTests::testEmptyConfig()
{
Logger::setupLogLevel( Logger::LOGDEBUG );

@ -16,11 +16,11 @@
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include <QDir>
#include <QFile>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDir>
#include <QFile>
using WriteMode = CalamaresUtils::System::WriteMode;

@ -106,15 +106,16 @@ UserTests::testDefaultGroups()
}
}
void UserTests::testDefaultGroupsYAML_data()
void
UserTests::testDefaultGroupsYAML_data()
{
QTest::addColumn< QString >( "filename" );
QTest::addColumn< int >("count");
QTest::addColumn<QString>("group");
QTest::addColumn< int >( "count" );
QTest::addColumn< QString >( "group" );
QTest::newRow("users.conf") << "users.conf" << 7 << "video";
QTest::newRow("dashed list") << "tests/4-audio.conf" << 4 << "audio";
QTest::newRow("blocked list") << "tests/3-wing.conf" << 3 << "wing";
QTest::newRow( "users.conf" ) << "users.conf" << 7 << "video";
QTest::newRow( "dashed list" ) << "tests/4-audio.conf" << 4 << "audio";
QTest::newRow( "blocked list" ) << "tests/3-wing.conf" << 3 << "wing";
}
void
@ -125,23 +126,23 @@ UserTests::testDefaultGroupsYAML()
(void)new Calamares::JobQueue();
}
QFETCH(QString, filename);
QFETCH(int, count);
QFETCH(QString, group);
QFETCH( QString, filename );
QFETCH( int, count );
QFETCH( QString, group );
QFile fi( QString("%1/%2").arg(BUILD_AS_TEST, filename) );
QVERIFY(fi.exists());
QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
QVERIFY( fi.exists() );
bool ok = false;
const auto map = CalamaresUtils::loadYaml(fi, &ok);
QVERIFY(ok);
QVERIFY(map.count() > 0);
const auto map = CalamaresUtils::loadYaml( fi, &ok );
QVERIFY( ok );
QVERIFY( map.count() > 0 );
Config c;
c.setConfigurationMap(map);
Config c;
c.setConfigurationMap( map );
QCOMPARE( c.defaultGroups().count(), count);
QVERIFY( c.defaultGroups().contains( group ) );
QCOMPARE( c.defaultGroups().count(), count );
QVERIFY( c.defaultGroups().contains( group ) );
}

@ -45,7 +45,8 @@ static inline void
labelOk( QLabel* pix, QLabel* label )
{
label->clear();
pix->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::StatusOk, CalamaresUtils::Original, label->size() ) );
pix->setPixmap(
CalamaresUtils::defaultPixmap( CalamaresUtils::StatusOk, CalamaresUtils::Original, label->size() ) );
}
/** @brief Sets error or ok on a label depending on @p status and @p value

@ -25,8 +25,8 @@
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersQmlViewStepFactory, registerPlugin< UsersQmlViewStep >(); )
UsersQmlViewStep::UsersQmlViewStep( QObject* parent )
: Calamares::QmlViewStep( parent )
, m_config( new Config(this) )
: Calamares::QmlViewStep( parent )
, m_config( new Config( this ) )
{
connect( m_config, &Config::readyChanged, this, &UsersQmlViewStep::nextStatusChanged );
@ -96,6 +96,6 @@ UsersQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
m_config->setConfigurationMap( configurationMap );
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
setContextProperty( "Users", m_config );
}

@ -19,8 +19,8 @@
#include <DllMacro.h>
#include <QVariant>
#include "Config.h"
#include <QVariant>
class PLUGINDLLEXPORT UsersQmlViewStep : public Calamares::QmlViewStep
{
@ -44,13 +44,10 @@ public:
void setConfigurationMap( const QVariantMap& configurationMap ) override;
QObject * getConfig() override
{
return m_config;
}
QObject* getConfig() override { return m_config; }
private:
Config *m_config;
Config* m_config;
Calamares::JobList m_jobs;
};

@ -8,8 +8,8 @@
*
*/
#include "WebViewConfig.h"
#include "WebViewStep.h"
#include "WebViewConfig.h"
#include <QVariant>

@ -39,7 +39,7 @@
WelcomePage::WelcomePage( Config* conf, QWidget* parent )
: QWidget( parent )
, ui( new Ui::WelcomePage )
, m_checkingWidget( new CheckerContainer( *(conf->requirementsModel()), this ) )
, m_checkingWidget( new CheckerContainer( *( conf->requirementsModel() ), this ) )
, m_languages( nullptr )
, m_conf( conf )
{

@ -146,10 +146,8 @@ GeneralRequirements::checkRequirements()
{
checkEntries.append(
{ entry,
[ req = m_requiredStorageGiB ] {
return tr( "has at least %1 GiB available drive space" ).arg( req );
},
[ req = m_requiredStorageGiB ] {
[req = m_requiredStorageGiB] { return tr( "has at least %1 GiB available drive space" ).arg( req ); },
[req = m_requiredStorageGiB] {
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req );
},
enoughStorage,
@ -159,8 +157,8 @@ GeneralRequirements::checkRequirements()
{
checkEntries.append(
{ entry,
[ req = m_requiredRamGiB ] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
[ req = m_requiredRamGiB ] {
[req = m_requiredRamGiB] { return tr( "has at least %1 GiB working memory" ).arg( req ); },
[req = m_requiredRamGiB] {
return tr( "The system does not have enough working memory. At least %1 GiB is required." )
.arg( req );
},
@ -349,7 +347,7 @@ GeneralRequirements::checkEnoughRam( qint64 requiredRam )
// Ignore the guesstimate-factor; we get an under-estimate
// which is probably the usable RAM for programs.
quint64 availableRam = CalamaresUtils::System::instance()->getTotalMemoryB().first;
return double(availableRam) >= double(requiredRam) * 0.95; // cast to silence 64-bit-int conversion to double
return double( availableRam ) >= double( requiredRam ) * 0.95; // cast to silence 64-bit-int conversion to double
}

@ -11,13 +11,14 @@
#define PARTMAN_DEVICES_H
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
int check_big_enough(long long required_space);
int check_big_enough( long long required_space );
#ifdef __cplusplus
} // extern "C"
#endif
#endif // PARTMAN_DEVICES_H
#endif // PARTMAN_DEVICES_H

@ -29,9 +29,9 @@ WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
, m_requirementsChecker( new GeneralRequirements( this ) )
{
connect( Calamares::ModuleManager::instance(),
&Calamares::ModuleManager::requirementsComplete,
this,
&WelcomeQmlViewStep::nextStatusChanged );
&Calamares::ModuleManager::requirementsComplete,
this,
&WelcomeQmlViewStep::nextStatusChanged );
}

Loading…
Cancel
Save