mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 03:45:38 -04:00
CI: apply coding style across the entire codebase again
This commit is contained in:
parent
1cd9b93a22
commit
a2180936ef
44 changed files with 234 additions and 168 deletions
|
@ -35,7 +35,8 @@ static const char usage[] = "Usage: txload <origin> [<alternate> ...]\n"
|
||||||
"Outputs to stdout a human-readable list of differences between the\n"
|
"Outputs to stdout a human-readable list of differences between the\n"
|
||||||
"translations.\n";
|
"translations.\n";
|
||||||
|
|
||||||
bool load_file(const char* filename, QDomDocument& doc)
|
bool
|
||||||
|
load_file( const char* filename, QDomDocument& doc )
|
||||||
{
|
{
|
||||||
QFile file( filename );
|
QFile file( filename );
|
||||||
QString err;
|
QString err;
|
||||||
|
@ -48,7 +49,8 @@ bool load_file(const char* filename, QDomDocument& doc)
|
||||||
QByteArray ba( file.read( 1024 * 1024 ) );
|
QByteArray ba( file.read( 1024 * 1024 ) );
|
||||||
qDebug() << "Read" << ba.length() << "bytes from" << filename;
|
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;
|
qDebug() << "Could not read" << filename << ':' << err_line << ':' << err_column << ' ' << err;
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
|
@ -58,45 +60,58 @@ bool load_file(const char* filename, QDomDocument& doc)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomElement find_context(QDomDocument& doc, const QString& name)
|
QDomElement
|
||||||
|
find_context( QDomDocument& doc, const QString& name )
|
||||||
{
|
{
|
||||||
QDomElement top = doc.documentElement();
|
QDomElement top = doc.documentElement();
|
||||||
QDomNode n = top.firstChild();
|
QDomNode n = top.firstChild();
|
||||||
while (!n.isNull()) {
|
while ( !n.isNull() )
|
||||||
if (n.isElement()) {
|
{
|
||||||
|
if ( n.isElement() )
|
||||||
|
{
|
||||||
QDomElement e = n.toElement();
|
QDomElement e = n.toElement();
|
||||||
if ( ( e.tagName() == "context" ) && ( e.firstChildElement( "name" ).text() == name ) )
|
if ( ( e.tagName() == "context" ) && ( e.firstChildElement( "name" ).text() == name ) )
|
||||||
|
{
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n = n.nextSibling();
|
n = n.nextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QDomElement();
|
return QDomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomElement find_message(QDomElement& context, const QString& source)
|
QDomElement
|
||||||
|
find_message( QDomElement& context, const QString& source )
|
||||||
{
|
{
|
||||||
QDomNode n = context.firstChild();
|
QDomNode n = context.firstChild();
|
||||||
while (!n.isNull()) {
|
while ( !n.isNull() )
|
||||||
if (n.isElement()) {
|
{
|
||||||
|
if ( n.isElement() )
|
||||||
|
{
|
||||||
QDomElement e = n.toElement();
|
QDomElement e = n.toElement();
|
||||||
if ( e.tagName() == "message" )
|
if ( e.tagName() == "message" )
|
||||||
{
|
{
|
||||||
QString msource = e.firstChildElement( "source" ).text();
|
QString msource = e.firstChildElement( "source" ).text();
|
||||||
if ( msource == source )
|
if ( msource == source )
|
||||||
|
{
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n = n.nextSibling();
|
n = n.nextSibling();
|
||||||
}
|
}
|
||||||
return QDomElement();
|
return QDomElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool merge_into(QDomElement& origin, QDomElement& alternate)
|
bool
|
||||||
|
merge_into( QDomElement& origin, QDomElement& alternate )
|
||||||
{
|
{
|
||||||
QDomNode n = alternate.firstChild();
|
QDomNode n = alternate.firstChild();
|
||||||
while (!n.isNull()) {
|
while ( !n.isNull() )
|
||||||
if (n.isElement()) {
|
{
|
||||||
|
if ( n.isElement() )
|
||||||
|
{
|
||||||
QDomElement alternateMessage = n.toElement();
|
QDomElement alternateMessage = n.toElement();
|
||||||
if ( alternateMessage.tagName() == "message" )
|
if ( alternateMessage.tagName() == "message" )
|
||||||
{
|
{
|
||||||
|
@ -119,7 +134,8 @@ bool merge_into(QDomElement& origin, QDomElement& alternate)
|
||||||
}
|
}
|
||||||
if ( !alternateTranslationText.isEmpty() && ( alternateTranslationText != originTranslationText ) )
|
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
|
||||||
bool merge_into(QDomDocument& originDocument, QDomElement& context)
|
merge_into( QDomDocument& originDocument, QDomElement& context )
|
||||||
{
|
{
|
||||||
QDomElement name = context.firstChildElement( "name" );
|
QDomElement name = context.firstChildElement( "name" );
|
||||||
if ( name.isNull() )
|
if ( name.isNull() )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString contextname = name.text();
|
QString contextname = name.text();
|
||||||
QDomElement originContext = find_context( originDocument, contextname );
|
QDomElement originContext = find_context( originDocument, contextname );
|
||||||
|
@ -148,24 +166,30 @@ bool merge_into(QDomDocument& originDocument, QDomElement& context)
|
||||||
return merge_into( originContext, context );
|
return merge_into( originContext, context );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool merge_into(QDomDocument& originDocument, QDomDocument& alternateDocument)
|
bool
|
||||||
|
merge_into( QDomDocument& originDocument, QDomDocument& alternateDocument )
|
||||||
{
|
{
|
||||||
QDomElement top = alternateDocument.documentElement();
|
QDomElement top = alternateDocument.documentElement();
|
||||||
QDomNode n = top.firstChild();
|
QDomNode n = top.firstChild();
|
||||||
while (!n.isNull()) {
|
while ( !n.isNull() )
|
||||||
if (n.isElement()) {
|
{
|
||||||
|
if ( n.isElement() )
|
||||||
|
{
|
||||||
QDomElement e = n.toElement();
|
QDomElement e = n.toElement();
|
||||||
if ( e.tagName() == "context" )
|
if ( e.tagName() == "context" )
|
||||||
if ( !merge_into( originDocument, e ) )
|
if ( !merge_into( originDocument, e ) )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n = n.nextSibling();
|
n = n.nextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int
|
||||||
|
main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
QCoreApplication a( argc, argv );
|
QCoreApplication a( argc, argv );
|
||||||
|
|
||||||
|
@ -177,16 +201,22 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
QDomDocument originDocument( "origin" );
|
QDomDocument originDocument( "origin" );
|
||||||
if ( !load_file( argv[ 1 ], originDocument ) )
|
if ( !load_file( argv[ 1 ], originDocument ) )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
for ( int i = 2; i < argc; ++i )
|
for ( int i = 2; i < argc; ++i )
|
||||||
{
|
{
|
||||||
QDomDocument alternateDocument( "alternate" );
|
QDomDocument alternateDocument( "alternate" );
|
||||||
if ( !load_file( argv[ i ], alternateDocument ) )
|
if ( !load_file( argv[ i ], alternateDocument ) )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
if ( !merge_into( originDocument, alternateDocument ) )
|
if ( !merge_into( originDocument, alternateDocument ) )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString outfilename( argv[ 1 ] );
|
QString outfilename( argv[ 1 ] );
|
||||||
outfilename.append( ".new" );
|
outfilename.append( ".new" );
|
||||||
|
|
|
@ -67,7 +67,8 @@ CalamaresApplication::init()
|
||||||
{
|
{
|
||||||
Logger::setupLogfile();
|
Logger::setupLogfile();
|
||||||
cDebug() << "Calamares version:" << CALAMARES_VERSION;
|
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() )
|
if ( !Calamares::Settings::instance() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,7 +184,8 @@ DebugWindow::DebugWindow()
|
||||||
#endif
|
#endif
|
||||||
] {
|
] {
|
||||||
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
|
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 )
|
if ( module )
|
||||||
{
|
{
|
||||||
m_module = module->configurationMap();
|
m_module = module->configurationMap();
|
||||||
|
|
|
@ -14,26 +14,29 @@
|
||||||
|
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QFile>
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
|
||||||
static const char usage[] = "Usage: test_conf [-v] [-b] <file> ...\n";
|
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 verbose = false;
|
||||||
bool bytes = false;
|
bool bytes = false;
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "vb")) != -1) {
|
while ( ( opt = getopt( argc, argv, "vb" ) ) != -1 )
|
||||||
switch (opt) {
|
{
|
||||||
|
switch ( opt )
|
||||||
|
{
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = true;
|
||||||
break;
|
break;
|
||||||
|
@ -60,10 +63,14 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
QFile f( filename );
|
QFile f( filename );
|
||||||
if ( f.open( QFile::ReadOnly | QFile::Text ) )
|
if ( f.open( QFile::ReadOnly | QFile::Text ) )
|
||||||
|
{
|
||||||
doc = YAML::Load( f.readAll().constData() );
|
doc = YAML::Load( f.readAll().constData() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
doc = YAML::LoadFile( filename );
|
doc = YAML::LoadFile( filename );
|
||||||
|
}
|
||||||
|
|
||||||
if ( doc.IsNull() )
|
if ( doc.IsNull() )
|
||||||
{
|
{
|
||||||
|
@ -86,9 +93,11 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
cerr << "Keys:\n";
|
cerr << "Keys:\n";
|
||||||
for ( auto i = doc.begin(); i != doc.end(); ++i )
|
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 )
|
catch ( YAML::Exception& e )
|
||||||
{
|
{
|
||||||
cerr << "WARNING:" << filename << '\n';
|
cerr << "WARNING:" << filename << '\n';
|
||||||
|
|
|
@ -323,7 +323,8 @@ load_module( const ModuleConfig& moduleConfig )
|
||||||
|
|
||||||
cDebug() << "Module" << moduleName << "job-configuration:" << configFile;
|
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;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,8 @@ Handler::Handler( const QString& implementation, const QString& url, const QStri
|
||||||
{
|
{
|
||||||
cWarning() << "GeoIP style *none* does not do anything.";
|
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.";
|
cWarning() << "GeoIP style *fixed* is not recommended for production.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,9 @@ ZonesModel::find( const QString& region, const QString& zone ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
STATICTEST const TimeZoneData*
|
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;
|
double smallestDistance = startingDistance;
|
||||||
const TimeZoneData* closest = nullptr;
|
const TimeZoneData* closest = nullptr;
|
||||||
|
@ -379,7 +381,8 @@ const TimeZoneData*
|
||||||
ZonesModel::find( const std::function< double( const TimeZoneData* ) >& distanceFunc ) const
|
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* 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
|
// 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
|
// 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;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
|
||||||
Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
|
|
||||||
{
|
{
|
||||||
QStringList configCandidates
|
QStringList configCandidates
|
||||||
= moduleConfigurationCandidates( Settings::instance()->debugMode(), name(), configFileName );
|
= moduleConfigurationCandidates( Settings::instance()->debugMode(), name(), configFileName );
|
||||||
|
|
|
@ -89,9 +89,8 @@ RequirementsModel::describe() const
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for ( const auto& r : m_requirements )
|
for ( const auto& r : m_requirements )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "requirement" << count << r.name
|
cDebug() << Logger::SubEntry << "requirement" << count << r.name << "satisfied?" << r.satisfied << "mandatory?"
|
||||||
<< "satisfied?" << r.satisfied
|
<< r.mandatory;
|
||||||
<< "mandatory?" << r.mandatory;
|
|
||||||
if ( r.mandatory && !r.satisfied )
|
if ( r.mandatory && !r.satisfied )
|
||||||
{
|
{
|
||||||
acceptable = false;
|
acceptable = false;
|
||||||
|
|
|
@ -62,7 +62,8 @@ InternalManager::InternalManager()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto* backend_p = CoreBackendManager::self()->backend();
|
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;
|
s_kpm_loaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@ System::runCommand( System::RunLocation location,
|
||||||
? ( static_cast< int >( std::chrono::milliseconds( timeoutSec ).count() ) )
|
? ( static_cast< int >( std::chrono::milliseconds( timeoutSec ).count() ) )
|
||||||
: -1 ) )
|
: -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;
|
return ProcessResult::Code::TimedOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +205,8 @@ System::runCommand( System::RunLocation location,
|
||||||
bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() );
|
bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() );
|
||||||
if ( ( r != 0 ) || showDebug )
|
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 );
|
return ProcessResult( r, output );
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,8 @@ LibCalamaresTests::testVariantStringListCode()
|
||||||
m.insert( key, 17 );
|
m.insert( key, 17 );
|
||||||
QCOMPARE( getStringList( m, key ), QStringList {} );
|
QCOMPARE( getStringList( m, key ), QStringList {} );
|
||||||
m.insert( key, QString( "more strings" ) );
|
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 {} );
|
m.insert( key, QVariant {} );
|
||||||
QCOMPARE( getStringList( m, key ), QStringList {} );
|
QCOMPARE( getStringList( m, key ), QStringList {} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,30 @@ namespace CalamaresUtils
|
||||||
*/
|
*/
|
||||||
namespace Traits
|
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 ) \
|
#define DECLARE_HAS_METHOD( m ) \
|
||||||
namespace CalamaresUtils { namespace Traits { \
|
namespace CalamaresUtils \
|
||||||
struct has_ ## m { \
|
{ \
|
||||||
template< class T > static auto f(int) -> sfinae_true<decltype(&T:: m)>; \
|
namespace Traits \
|
||||||
template< class T > static auto f(long) -> std::false_type; \
|
{ \
|
||||||
template< class T > using t = decltype( f <T>(0) ); \
|
struct has_##m \
|
||||||
}; } } \
|
{ \
|
||||||
template< class T > using has_ ## m = CalamaresUtils::Traits:: has_ ## m ::t<T>;
|
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
|
#endif
|
||||||
|
|
|
@ -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.
|
* Returns @p d if there is no such key or it is not a map-value.
|
||||||
* (e.g. if @p success is false).
|
* (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
|
} // namespace CalamaresUtils
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,7 +48,8 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||||
|
|
||||||
std::unique_ptr< Module > m;
|
std::unique_ptr< Module > m;
|
||||||
|
|
||||||
if ( !moduleDescriptor.isValid() ) {
|
if ( !moduleDescriptor.isValid() )
|
||||||
|
{
|
||||||
cError() << "Bad module descriptor format" << instanceId;
|
cError() << "Bad module descriptor format" << instanceId;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||||
}
|
}
|
||||||
else
|
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 )
|
else if ( moduleDescriptor.type() == Type::Job )
|
||||||
|
@ -91,7 +94,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
|
@ -101,7 +106,9 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||||
|
|
||||||
if ( !m )
|
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;
|
<< instanceId;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,8 @@ ModuleManager::doInit()
|
||||||
if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
|
if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
|
||||||
&& !m_availableDescriptorsByModuleName.contains( moduleName ) )
|
&& !m_availableDescriptorsByModuleName.contains( moduleName ) )
|
||||||
{
|
{
|
||||||
auto descriptor = Calamares::ModuleSystem::Descriptor::fromDescriptorData( moduleDescriptorMap );
|
auto descriptor
|
||||||
|
= Calamares::ModuleSystem::Descriptor::fromDescriptorData( moduleDescriptorMap );
|
||||||
descriptor.setDirectory( descriptorFileInfo.absoluteDir().absolutePath() );
|
descriptor.setDirectory( descriptorFileInfo.absoluteDir().absolutePath() );
|
||||||
m_availableDescriptorsByModuleName.insert( moduleName, descriptor );
|
m_availableDescriptorsByModuleName.insert( moduleName, descriptor );
|
||||||
}
|
}
|
||||||
|
@ -243,11 +244,8 @@ ModuleManager::loadModules()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thisModule
|
thisModule = Calamares::moduleFromDescriptor(
|
||||||
= Calamares::moduleFromDescriptor( descriptor,
|
descriptor, instanceKey.id(), configFileName, descriptor.directory() );
|
||||||
instanceKey.id(),
|
|
||||||
configFileName,
|
|
||||||
descriptor.directory() );
|
|
||||||
if ( !thisModule )
|
if ( !thisModule )
|
||||||
{
|
{
|
||||||
cError() << "Module" << instanceKey.toString() << "cannot be created from descriptor"
|
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();
|
for ( auto it = m_availableDescriptorsByModuleName.begin(); it != m_availableDescriptorsByModuleName.end();
|
||||||
++it )
|
++it )
|
||||||
{
|
{
|
||||||
QStringList unmet = missingRequiredModules( it->requiredModules(),
|
QStringList unmet = missingRequiredModules( it->requiredModules(), m_availableDescriptorsByModuleName );
|
||||||
m_availableDescriptorsByModuleName );
|
|
||||||
|
|
||||||
if ( unmet.count() > 0 )
|
if ( unmet.count() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -403,8 +400,7 @@ ModuleManager::checkModuleDependencies( const Module& m )
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allRequirementsFound = true;
|
bool allRequirementsFound = true;
|
||||||
QStringList requiredModules
|
QStringList requiredModules = m_availableDescriptorsByModuleName[ m.name() ].requiredModules();
|
||||||
= m_availableDescriptorsByModuleName[ m.name() ].requiredModules();
|
|
||||||
|
|
||||||
for ( const QString& required : requiredModules )
|
for ( const QString& required : requiredModules )
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,7 +202,8 @@ PreserveFiles::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
QString filename = li.toString();
|
QString filename = li.toString();
|
||||||
if ( !filename.isEmpty() )
|
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
|
else
|
||||||
{
|
{
|
||||||
cDebug() << "Empty filename for preservefiles, item" << c;
|
cDebug() << "Empty filename for preservefiles, item" << c;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
class TrackingTests : public QObject
|
class TrackingTests : public QObject
|
||||||
{
|
{
|
||||||
|
@ -28,17 +28,17 @@ TrackingTests::TrackingTests()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackingTests::~TrackingTests()
|
TrackingTests::~TrackingTests() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackingTests::initTestCase()
|
void
|
||||||
|
TrackingTests::initTestCase()
|
||||||
{
|
{
|
||||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||||
cDebug() << "Tracking test started.";
|
cDebug() << "Tracking test started.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackingTests::testEmptyConfig()
|
void
|
||||||
|
TrackingTests::testEmptyConfig()
|
||||||
{
|
{
|
||||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include <QDBusReply>
|
#include <QDBusReply>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
using WriteMode = CalamaresUtils::System::WriteMode;
|
using WriteMode = CalamaresUtils::System::WriteMode;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,8 @@ UserTests::testDefaultGroups()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserTests::testDefaultGroupsYAML_data()
|
void
|
||||||
|
UserTests::testDefaultGroupsYAML_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn< QString >( "filename" );
|
QTest::addColumn< QString >( "filename" );
|
||||||
QTest::addColumn< int >( "count" );
|
QTest::addColumn< int >( "count" );
|
||||||
|
|
|
@ -45,7 +45,8 @@ static inline void
|
||||||
labelOk( QLabel* pix, QLabel* label )
|
labelOk( QLabel* pix, QLabel* label )
|
||||||
{
|
{
|
||||||
label->clear();
|
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
|
/** @brief Sets error or ok on a label depending on @p status and @p value
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
#include <DllMacro.h>
|
#include <DllMacro.h>
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
class PLUGINDLLEXPORT UsersQmlViewStep : public Calamares::QmlViewStep
|
class PLUGINDLLEXPORT UsersQmlViewStep : public Calamares::QmlViewStep
|
||||||
{
|
{
|
||||||
|
@ -44,10 +44,7 @@ public:
|
||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||||
|
|
||||||
QObject * getConfig() override
|
QObject* getConfig() override { return m_config; }
|
||||||
{
|
|
||||||
return m_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Config* m_config;
|
Config* m_config;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebViewConfig.h"
|
|
||||||
#include "WebViewStep.h"
|
#include "WebViewStep.h"
|
||||||
|
#include "WebViewConfig.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,7 @@ GeneralRequirements::checkRequirements()
|
||||||
{
|
{
|
||||||
checkEntries.append(
|
checkEntries.append(
|
||||||
{ entry,
|
{ entry,
|
||||||
[ req = m_requiredStorageGiB ] {
|
[req = m_requiredStorageGiB] { return tr( "has at least %1 GiB available drive space" ).arg( req ); },
|
||||||
return tr( "has at least %1 GiB available drive space" ).arg( req );
|
|
||||||
},
|
|
||||||
[req = m_requiredStorageGiB] {
|
[req = m_requiredStorageGiB] {
|
||||||
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req );
|
return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req );
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
#define PARTMAN_DEVICES_H
|
#define PARTMAN_DEVICES_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int check_big_enough( long long required_space );
|
int check_big_enough( long long required_space );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue