libcalamares: ditch namespace CalamaresUtils

- Most CalamaresUtils things go to Calamares
- YAML support to Calamares::YAML and then remove redundant "yaml"
  from the function names.
This commit is contained in:
Adriaan de Groot 2023-09-11 20:13:15 +02:00
parent f4e3964ee5
commit eb840d4117
157 changed files with 878 additions and 1368 deletions

View File

@ -58,10 +58,9 @@ CalamaresApplication::CalamaresApplication( int& argc, char* argv[] )
setApplicationVersion( QStringLiteral( CALAMARES_VERSION ) ); setApplicationVersion( QStringLiteral( CALAMARES_VERSION ) );
QFont f = font(); QFont f = font();
CalamaresUtils::setDefaultFontSize( f.pointSize() ); Calamares::setDefaultFontSize( f.pointSize() );
} }
void void
CalamaresApplication::init() CalamaresApplication::init()
{ {
@ -77,7 +76,7 @@ CalamaresApplication::init()
initQmlPath(); initQmlPath();
initBranding(); initBranding();
CalamaresUtils::installTranslator(); Calamares::installTranslator();
setQuitOnLastWindowClosed( false ); setQuitOnLastWindowClosed( false );
setWindowIcon( QIcon( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductIcon ) ) ); setWindowIcon( QIcon( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductIcon ) ) );
@ -89,35 +88,31 @@ CalamaresApplication::init()
cDebug() << Logger::SubEntry << "STARTUP: initModuleManager: module init started"; cDebug() << Logger::SubEntry << "STARTUP: initModuleManager: module init started";
} }
CalamaresApplication::~CalamaresApplication() CalamaresApplication::~CalamaresApplication()
{ {
Logger::CDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares..."; Logger::CDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares...";
Logger::CDebug( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown."; Logger::CDebug( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown.";
} }
CalamaresApplication* CalamaresApplication*
CalamaresApplication::instance() CalamaresApplication::instance()
{ {
return qobject_cast< CalamaresApplication* >( QApplication::instance() ); return qobject_cast< CalamaresApplication* >( QApplication::instance() );
} }
CalamaresWindow* CalamaresWindow*
CalamaresApplication::mainWindow() CalamaresApplication::mainWindow()
{ {
return m_mainwindow; return m_mainwindow;
} }
static QStringList static QStringList
brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename ) brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
{ {
QStringList brandingPaths; QStringList brandingPaths;
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename ); brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename );
} }
else else
{ {
@ -125,31 +120,29 @@ brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
{ {
brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename ); brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename );
} }
if ( CalamaresUtils::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
for ( auto s : CalamaresUtils::extraDataDirs() ) for ( auto s : Calamares::extraDataDirs() )
{ {
brandingPaths << ( s + brandingFilename ); brandingPaths << ( s + brandingFilename );
} }
brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename ); brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename );
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename ); brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename );
} }
return brandingPaths; return brandingPaths;
} }
void void
CalamaresApplication::initQmlPath() CalamaresApplication::initQmlPath()
{ {
#ifdef WITH_QML #ifdef WITH_QML
if ( !CalamaresUtils::initQmlModulesDir() ) if ( !Calamares::initQmlModulesDir() )
{ {
::exit( EXIT_FAILURE ); ::exit( EXIT_FAILURE );
} }
#endif #endif
} }
void void
CalamaresApplication::initBranding() CalamaresApplication::initBranding()
{ {
@ -181,7 +174,7 @@ CalamaresApplication::initBranding()
{ {
cError() << "Cowardly refusing to continue startup without branding." cError() << "Cowardly refusing to continue startup without branding."
<< Logger::DebugList( brandingFileCandidatesByPriority ); << Logger::DebugList( brandingFileCandidatesByPriority );
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName; cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName;
} }
@ -195,7 +188,6 @@ CalamaresApplication::initBranding()
new Calamares::Branding( brandingFile.absoluteFilePath(), this, devicePixelRatio() ); new Calamares::Branding( brandingFile.absoluteFilePath(), this, devicePixelRatio() );
} }
void void
CalamaresApplication::initModuleManager() CalamaresApplication::initModuleManager()
{ {
@ -262,7 +254,6 @@ CalamaresApplication::initView()
cDebug() << "STARTUP: CalamaresWindow created; loadModules started"; cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
} }
void void
CalamaresApplication::initViewSteps() CalamaresApplication::initViewSteps()
{ {
@ -294,6 +285,6 @@ void
CalamaresApplication::initJobQueue() CalamaresApplication::initJobQueue()
{ {
Calamares::JobQueue* jobQueue = new Calamares::JobQueue( this ); Calamares::JobQueue* jobQueue = new Calamares::JobQueue( this );
new CalamaresUtils::System( Calamares::Settings::instance()->doChroot(), this ); new Calamares::System( Calamares::Settings::instance()->doChroot(), this );
Calamares::Branding::instance()->setGlobals( jobQueue->globalStorage() ); Calamares::Branding::instance()->setGlobals( jobQueue->globalStorage() );
} }

View File

@ -64,7 +64,7 @@ windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
} }
if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Fonties ) if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Fonties )
{ {
return static_cast< int >( u.value() * CalamaresUtils::defaultFontHeight() ); return static_cast< int >( u.value() * Calamares::defaultFontHeight() );
} }
return 0; return 0;
} }
@ -145,15 +145,14 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
QHBoxLayout* extraButtons = new QHBoxLayout; QHBoxLayout* extraButtons = new QHBoxLayout;
sideLayout->addLayout( extraButtons ); sideLayout->addLayout( extraButtons );
const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); const int defaultFontHeight = Calamares::defaultFontHeight();
if ( /* About-Calamares Button enabled */ true ) if ( /* About-Calamares Button enabled */ true )
{ {
QPushButton* aboutDialog = new QPushButton; QPushButton* aboutDialog = new QPushButton;
aboutDialog->setObjectName( "aboutButton" ); aboutDialog->setObjectName( "aboutButton" );
aboutDialog->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, aboutDialog->setIcon( Calamares::defaultPixmap(
CalamaresUtils::Original, Calamares::Information, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CALAMARES_RETRANSLATE_FOR( CALAMARES_RETRANSLATE_FOR(
aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) ); aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) );
aboutDialog->setToolTip( aboutDialog->setToolTip(
@ -167,8 +166,8 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
{ {
QPushButton* debugWindowBtn = new QPushButton; QPushButton* debugWindowBtn = new QPushButton;
debugWindowBtn->setObjectName( "debugButton" ); debugWindowBtn->setObjectName( "debugButton" );
debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap( debugWindowBtn->setIcon( Calamares::defaultPixmap(
CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); Calamares::Bugs, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CALAMARES_RETRANSLATE_FOR( CALAMARES_RETRANSLATE_FOR(
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) ); debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) );
debugWindowBtn->setToolTip( debugWindowBtn->setToolTip(
@ -181,7 +180,7 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
debug, &Calamares::DebugWindowManager::visibleChanged, debugWindowBtn, &QPushButton::setChecked ); debug, &Calamares::DebugWindowManager::visibleChanged, debugWindowBtn, &QPushButton::setChecked );
} }
CalamaresUtils::unmarginLayout( sideLayout ); Calamares::unmarginLayout( sideLayout );
return sideBox; return sideBox;
} }
@ -276,7 +275,6 @@ setDimension( QQuickWidget* w, Qt::Orientation o, int desiredWidth )
w->setResizeMode( QQuickWidget::SizeRootObjectToView ); w->setResizeMode( QQuickWidget::SizeRootObjectToView );
} }
static QWidget* static QWidget*
getQmlSidebar( Calamares::DebugWindowManager* debug, getQmlSidebar( Calamares::DebugWindowManager* debug,
Calamares::ViewManager*, Calamares::ViewManager*,
@ -284,15 +282,15 @@ getQmlSidebar( Calamares::DebugWindowManager* debug,
Qt::Orientation o, Qt::Orientation o,
int desiredWidth ) int desiredWidth )
{ {
CalamaresUtils::registerQmlModels(); Calamares::registerQmlModels();
QQuickWidget* w = new QQuickWidget( parent ); QQuickWidget* w = new QQuickWidget( parent );
if ( debug ) if ( debug )
{ {
w->engine()->rootContext()->setContextProperty( "debug", debug ); w->engine()->rootContext()->setContextProperty( "debug", debug );
} }
w->setSource( QUrl( w->setSource(
CalamaresUtils::searchQmlFile( CalamaresUtils::QmlSearch::Both, QStringLiteral( "calamares-sidebar" ) ) ) ); QUrl( Calamares::searchQmlFile( Calamares::QmlSearch::Both, QStringLiteral( "calamares-sidebar" ) ) ) );
setDimension( w, o, desiredWidth ); setDimension( w, o, desiredWidth );
return w; return w;
} }
@ -304,14 +302,14 @@ getQmlNavigation( Calamares::DebugWindowManager* debug,
Qt::Orientation o, Qt::Orientation o,
int desiredWidth ) int desiredWidth )
{ {
CalamaresUtils::registerQmlModels(); Calamares::registerQmlModels();
QQuickWidget* w = new QQuickWidget( parent ); QQuickWidget* w = new QQuickWidget( parent );
if ( debug ) if ( debug )
{ {
w->engine()->rootContext()->setContextProperty( "debug", debug ); w->engine()->rootContext()->setContextProperty( "debug", debug );
} }
w->setSource( QUrl( w->setSource(
CalamaresUtils::searchQmlFile( CalamaresUtils::QmlSearch::Both, QStringLiteral( "calamares-navigation" ) ) ) ); QUrl( Calamares::searchQmlFile( Calamares::QmlSearch::Both, QStringLiteral( "calamares-navigation" ) ) ) );
setDimension( w, o, desiredWidth ); setDimension( w, o, desiredWidth );
return w; return w;
} }
@ -392,7 +390,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
, m_debugManager( new Calamares::DebugWindowManager( this ) ) , m_debugManager( new Calamares::DebugWindowManager( this ) )
, m_viewManager( nullptr ) , m_viewManager( nullptr )
{ {
installEventFilter( CalamaresUtils::Retranslator::instance() ); installEventFilter( Calamares::Retranslator::instance() );
// If we can never cancel, don't show the window-close button // If we can never cancel, don't show the window-close button
if ( Calamares::Settings::instance()->disableCancel() ) if ( Calamares::Settings::instance()->disableCancel() )
@ -408,10 +406,10 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
const Calamares::Branding* const branding = Calamares::Branding::instance(); const Calamares::Branding* const branding = Calamares::Branding::instance();
using ImageEntry = Calamares::Branding::ImageEntry; using ImageEntry = Calamares::Branding::ImageEntry;
using CalamaresUtils::windowMinimumHeight; using Calamares::windowMinimumHeight;
using CalamaresUtils::windowMinimumWidth; using Calamares::windowMinimumWidth;
using CalamaresUtils::windowPreferredHeight; using Calamares::windowPreferredHeight;
using CalamaresUtils::windowPreferredWidth; using Calamares::windowPreferredWidth;
using PanelSide = Calamares::Branding::PanelSide; using PanelSide = Calamares::Branding::PanelSide;
@ -438,7 +436,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
{ {
QWidget* label = new QWidget( this ); QWidget* label = new QWidget( this );
QVBoxLayout* l = new QVBoxLayout; QVBoxLayout* l = new QVBoxLayout;
CalamaresUtils::unmarginLayout( l ); Calamares::unmarginLayout( l );
l->addWidget( label ); l->addWidget( label );
setLayout( l ); setLayout( l );
label->setObjectName( "backgroundWidget" ); label->setObjectName( "backgroundWidget" );
@ -467,14 +465,14 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
QBoxLayout* contentsLayout = new QVBoxLayout; QBoxLayout* contentsLayout = new QVBoxLayout;
contentsLayout->setSpacing( 0 ); contentsLayout->setSpacing( 0 );
QWidget* sideBox = flavoredWidget( QWidget* sideBox
branding->sidebarFlavor(), = flavoredWidget( branding->sidebarFlavor(),
::orientation( branding->sidebarSide() ), ::orientation( branding->sidebarSide() ),
m_debugManager, m_debugManager,
baseWidget, baseWidget,
::getWidgetSidebar, ::getWidgetSidebar,
::getQmlSidebar, ::getQmlSidebar,
qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) ); qBound( 100, Calamares::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
QWidget* navigation = flavoredWidget( branding->navigationFlavor(), QWidget* navigation = flavoredWidget( branding->navigationFlavor(),
::orientation( branding->navigationSide() ), ::orientation( branding->navigationSide() ),
m_debugManager, m_debugManager,
@ -506,8 +504,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
( contentsLayout->count() > 1 ? Qt::Orientations( Qt::Horizontal ) : Qt::Orientations() ) ( contentsLayout->count() > 1 ? Qt::Orientations( Qt::Horizontal ) : Qt::Orientations() )
| ( mainLayout->count() > 1 ? Qt::Orientations( Qt::Vertical ) : Qt::Orientations() ) ); | ( mainLayout->count() > 1 ? Qt::Orientations( Qt::Vertical ) : Qt::Orientations() ) );
CalamaresUtils::unmarginLayout( mainLayout ); Calamares::unmarginLayout( mainLayout );
CalamaresUtils::unmarginLayout( contentsLayout ); Calamares::unmarginLayout( contentsLayout );
baseWidget->setLayout( mainLayout ); baseWidget->setLayout( mainLayout );
setStyleSheet( Calamares::Branding::instance()->stylesheet() ); setStyleSheet( Calamares::Branding::instance()->stylesheet() );
} }

View File

@ -158,13 +158,12 @@ DebugWindow::DebugWindow()
} ); } );
// Send Log button only if it would be useful // Send Log button only if it would be useful
m_ui->sendLogButton->setVisible( CalamaresUtils::Paste::isEnabled() ); m_ui->sendLogButton->setVisible( Calamares::Paste::isEnabled() );
connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { CalamaresUtils::Paste::doLogUploadUI( this ); } ); connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { Calamares::Paste::doLogUploadUI( this ); } );
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); ); CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); );
} }
void void
DebugWindow::closeEvent( QCloseEvent* e ) DebugWindow::closeEvent( QCloseEvent* e )
{ {
@ -172,13 +171,11 @@ DebugWindow::closeEvent( QCloseEvent* e )
emit closed(); emit closed();
} }
DebugWindowManager::DebugWindowManager( QObject* parent ) DebugWindowManager::DebugWindowManager( QObject* parent )
: QObject( parent ) : QObject( parent )
{ {
} }
bool bool
DebugWindowManager::enabled() const DebugWindowManager::enabled() const
{ {
@ -186,7 +183,6 @@ DebugWindowManager::enabled() const
return ( Logger::logLevel() >= Logger::LOGVERBOSE ) || ( s ? s->debugMode() : false ); return ( Logger::logLevel() >= Logger::LOGVERBOSE ) || ( s ? s->debugMode() : false );
} }
void void
DebugWindowManager::show( bool visible ) DebugWindowManager::show( bool visible )
{ {
@ -244,14 +240,14 @@ DebugWindowManager::about()
QMessageBox::Ok, QMessageBox::Ok,
nullptr ); nullptr );
Calamares::fixButtonLabels( &mb ); Calamares::fixButtonLabels( &mb );
mb.setIconPixmap( CalamaresUtils::defaultPixmap( mb.setIconPixmap(
CalamaresUtils::Squid, Calamares::defaultPixmap( Calamares::Squid,
CalamaresUtils::Original, Calamares::Original,
QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) ); QSize( Calamares::defaultFontHeight() * 6, Calamares::defaultFontHeight() * 6 ) ) );
QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() ); QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() );
if ( layout ) if ( layout )
{ {
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 ); layout->setColumnMinimumWidth( 2, Calamares::defaultFontHeight() * 24 );
} }
mb.exec(); mb.exec();
} }

View File

@ -8,7 +8,6 @@
* *
*/ */
#include "CalamaresApplication.h" #include "CalamaresApplication.h"
#include "Settings.h" #include "Settings.h"
@ -93,13 +92,13 @@ handle_args( CalamaresApplication& a )
Logger::setupLogLevel( parser.isSet( debugOption ) ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) ); Logger::setupLogLevel( parser.isSet( debugOption ) ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
if ( parser.isSet( configOption ) ) if ( parser.isSet( configOption ) )
{ {
CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) ); Calamares::setAppDataDir( QDir( parser.value( configOption ) ) );
} }
if ( parser.isSet( xdgOption ) ) if ( parser.isSet( xdgOption ) )
{ {
CalamaresUtils::setXdgDirs(); Calamares::setXdgDirs();
} }
CalamaresUtils::setAllowLocalTranslation( parser.isSet( debugOption ) || parser.isSet( debugTxOption ) ); Calamares::setAllowLocalTranslation( parser.isSet( debugOption ) || parser.isSet( debugTxOption ) );
return parser.isSet( debugOption ); return parser.isSet( debugOption );
} }

View File

@ -22,7 +22,7 @@ static constexpr int const item_margin = 8;
static inline int static inline int
item_fontsize() item_fontsize()
{ {
return CalamaresUtils::defaultFontSize() + 4; return Calamares::defaultFontSize() + 4;
} }
static void static void
@ -49,7 +49,6 @@ paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QMod
} }
} }
// Draw the text at least once. If it doesn't fit, then shrink the font // Draw the text at least once. If it doesn't fit, then shrink the font
// being used by 1 pt on each iteration, up to a maximum of maximumShrink // being used by 1 pt on each iteration, up to a maximum of maximumShrink
// times. On each loop, we'll have to blank out the rectangle again, so this // times. On each loop, we'll have to blank out the rectangle again, so this
@ -100,7 +99,6 @@ ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
return QSize( option.rect.width(), height ); return QSize( option.rect.width(), height );
} }
void void
ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {

View File

@ -38,7 +38,6 @@
#include "utils/Qml.h" #include "utils/Qml.h"
#endif #endif
#include <QApplication> #include <QApplication>
#include <QCommandLineOption> #include <QCommandLineOption>
#include <QCommandLineParser> #include <QCommandLineParser>
@ -241,7 +240,6 @@ ExecViewModule::type() const
return Module::Type::View; return Module::Type::View;
} }
Calamares::Module::Interface Calamares::Module::Interface
ExecViewModule::interface() const ExecViewModule::interface() const
{ {
@ -304,7 +302,7 @@ load_module( const ModuleConfig& moduleConfig )
fi = QFileInfo( prefix + moduleName ); fi = QFileInfo( prefix + moduleName );
if ( fi.exists() && fi.isFile() ) if ( fi.exists() && fi.isFile() )
{ {
descriptor = CalamaresUtils::loadYaml( fi, &ok ); descriptor = Calamares::YAML::load( fi, &ok );
} }
if ( ok ) if ( ok )
{ {
@ -318,7 +316,7 @@ load_module( const ModuleConfig& moduleConfig )
fi = QFileInfo( prefix + moduleName + "/module.desc" ); fi = QFileInfo( prefix + moduleName + "/module.desc" );
if ( fi.exists() && fi.isFile() ) if ( fi.exists() && fi.isFile() )
{ {
descriptor = CalamaresUtils::loadYaml( fi, &ok ); descriptor = Calamares::YAML::load( fi, &ok );
} }
if ( ok ) if ( ok )
{ {
@ -478,7 +476,7 @@ main( int argc, char* argv[] )
} }
#endif #endif
#ifdef WITH_QML #ifdef WITH_QML
CalamaresUtils::initQmlModulesDir(); // don't care if failed Calamares::initQmlModulesDir(); // don't care if failed
#endif #endif
cDebug() << "Calamares module-loader testing" << module.moduleName(); cDebug() << "Calamares module-loader testing" << module.moduleName();
@ -505,7 +503,7 @@ main( int argc, char* argv[] )
mw = module.m_ui ? new QMainWindow() : nullptr; mw = module.m_ui ? new QMainWindow() : nullptr;
if ( mw ) if ( mw )
{ {
mw->installEventFilter( CalamaresUtils::Retranslator::instance() ); mw->installEventFilter( Calamares::Retranslator::instance() );
} }
(void)new Calamares::Branding( module.m_branding ); (void)new Calamares::Branding( module.m_branding );

View File

@ -20,7 +20,7 @@
#include <QFile> #include <QFile>
#include <QJsonDocument> #include <QJsonDocument>
using namespace CalamaresUtils::Units; using namespace Calamares::Units;
namespace Calamares namespace Calamares
{ {
@ -52,7 +52,6 @@ GlobalStorage::GlobalStorage( QObject* parent )
{ {
} }
bool bool
GlobalStorage::contains( const QString& key ) const GlobalStorage::contains( const QString& key ) const
{ {
@ -60,7 +59,6 @@ GlobalStorage::contains( const QString& key ) const
return m.contains( key ); return m.contains( key );
} }
int int
GlobalStorage::count() const GlobalStorage::count() const
{ {
@ -68,7 +66,6 @@ GlobalStorage::count() const
return m.count(); return m.count();
} }
void void
GlobalStorage::insert( const QString& key, const QVariant& value ) GlobalStorage::insert( const QString& key, const QVariant& value )
{ {
@ -76,7 +73,6 @@ GlobalStorage::insert( const QString& key, const QVariant& value )
m.insert( key, value ); m.insert( key, value );
} }
QStringList QStringList
GlobalStorage::keys() const GlobalStorage::keys() const
{ {
@ -84,7 +80,6 @@ GlobalStorage::keys() const
return m.keys(); return m.keys();
} }
int int
GlobalStorage::remove( const QString& key ) GlobalStorage::remove( const QString& key )
{ {
@ -93,7 +88,6 @@ GlobalStorage::remove( const QString& key )
return nItems; return nItems;
} }
QVariant QVariant
GlobalStorage::value( const QString& key ) const GlobalStorage::value( const QString& key ) const
{ {
@ -166,14 +160,14 @@ bool
GlobalStorage::saveYaml( const QString& filename ) const GlobalStorage::saveYaml( const QString& filename ) const
{ {
ReadLock l( this ); ReadLock l( this );
return CalamaresUtils::saveYaml( filename, m ); return Calamares::YAML::save( filename, m );
} }
bool bool
GlobalStorage::loadYaml( const QString& filename ) GlobalStorage::loadYaml( const QString& filename )
{ {
bool ok = false; bool ok = false;
auto map = CalamaresUtils::loadYaml( filename, &ok ); auto map = Calamares::YAML::load( filename, &ok );
if ( ok ) if ( ok )
{ {
WriteLock l( this ); WriteLock l( this );
@ -189,5 +183,4 @@ GlobalStorage::loadYaml( const QString& filename )
return false; return false;
} }
} // namespace Calamares } // namespace Calamares

View File

@ -18,7 +18,6 @@
namespace Calamares namespace Calamares
{ {
ProcessJob::ProcessJob( const QString& command, ProcessJob::ProcessJob( const QString& command,
const QString& workingPath, const QString& workingPath,
bool runInChroot, bool runInChroot,
@ -32,31 +31,27 @@ ProcessJob::ProcessJob( const QString& command,
{ {
} }
ProcessJob::~ProcessJob() {} ProcessJob::~ProcessJob() {}
QString QString
ProcessJob::prettyName() const ProcessJob::prettyName() const
{ {
return ( m_runInChroot ? tr( "Run command '%1' in target system." ) : tr( " Run command '%1'." ) ).arg( m_command ); return ( m_runInChroot ? tr( "Run command '%1' in target system." ) : tr( " Run command '%1'." ) ).arg( m_command );
} }
QString QString
ProcessJob::prettyStatusMessage() const ProcessJob::prettyStatusMessage() const
{ {
return tr( "Running command %1 %2" ).arg( m_command ).arg( m_runInChroot ? "in chroot." : " ." ); return tr( "Running command %1 %2" ).arg( m_command ).arg( m_runInChroot ? "in chroot." : " ." );
} }
JobResult JobResult
ProcessJob::exec() ProcessJob::exec()
{ {
using CalamaresUtils::System; using Calamares::System;
if ( m_runInChroot ) if ( m_runInChroot )
return CalamaresUtils::System::instance() return Calamares::System::instance()
->targetEnvCommand( { m_command }, m_workingPath, QString(), m_timeoutSec ) ->targetEnvCommand( { m_command }, m_workingPath, QString(), m_timeoutSec )
.explainProcess( m_command, m_timeoutSec ); .explainProcess( m_command, m_timeoutSec );
else else

View File

@ -23,7 +23,6 @@ namespace bp = boost::python;
namespace CalamaresPython namespace CalamaresPython
{ {
boost::python::object boost::python::object
variantToPyObject( const QVariant& variant ) variantToPyObject( const QVariant& variant )
{ {
@ -86,7 +85,6 @@ variantToPyObject( const QVariant& variant )
#endif #endif
} }
QVariant QVariant
variantFromPyObject( const boost::python::object& pyObject ) variantFromPyObject( const boost::python::object& pyObject )
{ {
@ -127,7 +125,6 @@ variantFromPyObject( const boost::python::object& pyObject )
} }
} }
boost::python::list boost::python::list
variantListToPyList( const QVariantList& variantList ) variantListToPyList( const QVariantList& variantList )
{ {
@ -139,7 +136,6 @@ variantListToPyList( const QVariantList& variantList )
return pyList; return pyList;
} }
QVariantList QVariantList
variantListFromPyList( const boost::python::list& pyList ) variantListFromPyList( const boost::python::list& pyList )
{ {
@ -151,7 +147,6 @@ variantListFromPyList( const boost::python::list& pyList )
return list; return list;
} }
boost::python::dict boost::python::dict
variantMapToPyDict( const QVariantMap& variantMap ) variantMapToPyDict( const QVariantMap& variantMap )
{ {
@ -163,7 +158,6 @@ variantMapToPyDict( const QVariantMap& variantMap )
return pyDict; return pyDict;
} }
QVariantMap QVariantMap
variantMapFromPyDict( const boost::python::dict& pyDict ) variantMapFromPyDict( const boost::python::dict& pyDict )
{ {
@ -198,7 +192,6 @@ variantHashToPyDict( const QVariantHash& variantHash )
return pyDict; return pyDict;
} }
QVariantHash QVariantHash
variantHashFromPyDict( const boost::python::dict& pyDict ) variantHashFromPyDict( const boost::python::dict& pyDict )
{ {
@ -222,7 +215,6 @@ variantHashFromPyDict( const boost::python::dict& pyDict )
return hash; return hash;
} }
static inline void static inline void
add_if_lib_exists( const QDir& dir, const char* name, QStringList& list ) add_if_lib_exists( const QDir& dir, const char* name, QStringList& list )
{ {
@ -253,7 +245,7 @@ Helper::Helper()
// If we're running from the build dir // If we're running from the build dir
add_if_lib_exists( QDir::current(), "libcalamares.so", m_pythonPaths ); add_if_lib_exists( QDir::current(), "libcalamares.so", m_pythonPaths );
QDir calaPythonPath( CalamaresUtils::systemLibDir().absolutePath() + QDir::separator() + "calamares" ); QDir calaPythonPath( Calamares::systemLibDir().absolutePath() + QDir::separator() + "calamares" );
add_if_lib_exists( calaPythonPath, "libcalamares.so", m_pythonPaths ); add_if_lib_exists( calaPythonPath, "libcalamares.so", m_pythonPaths );
bp::object sys = bp::import( "sys" ); bp::object sys = bp::import( "sys" );
@ -290,7 +282,6 @@ Helper::createCleanNamespace()
return scriptNamespace; return scriptNamespace;
} }
QString QString
Helper::handleLastError() Helper::handleLastError()
{ {
@ -385,7 +376,6 @@ Helper::handleLastError()
return tr( "Unfetchable Python error." ); return tr( "Unfetchable Python error." );
} }
QStringList msgList; QStringList msgList;
if ( !typeMsg.isEmpty() ) if ( !typeMsg.isEmpty() )
{ {
@ -429,14 +419,12 @@ GlobalStoragePythonWrapper::contains( const std::string& key ) const
return m_gs->contains( QString::fromStdString( key ) ); return m_gs->contains( QString::fromStdString( key ) );
} }
int int
GlobalStoragePythonWrapper::count() const GlobalStoragePythonWrapper::count() const
{ {
return m_gs->count(); return m_gs->count();
} }
void void
GlobalStoragePythonWrapper::insert( const std::string& key, const bp::object& value ) GlobalStoragePythonWrapper::insert( const std::string& key, const bp::object& value )
{ {
@ -455,7 +443,6 @@ GlobalStoragePythonWrapper::keys() const
return pyList; return pyList;
} }
int int
GlobalStoragePythonWrapper::remove( const std::string& key ) GlobalStoragePythonWrapper::remove( const std::string& key )
{ {
@ -467,7 +454,6 @@ GlobalStoragePythonWrapper::remove( const std::string& key )
return m_gs->remove( gsKey ); return m_gs->remove( gsKey );
} }
bp::object bp::object
GlobalStoragePythonWrapper::value( const std::string& key ) const GlobalStoragePythonWrapper::value( const std::string& key ) const
{ {

View File

@ -29,7 +29,7 @@
namespace bp = boost::python; namespace bp = boost::python;
static int static int
handle_check_target_env_call_error( const CalamaresUtils::ProcessResult& ec, const QString& cmd ) handle_check_target_env_call_error( const Calamares::ProcessResult& ec, const QString& cmd )
{ {
if ( !ec.first ) if ( !ec.first )
{ {
@ -61,12 +61,12 @@ bp_list_to_qstringlist( const bp::list& args )
return list; return list;
} }
static inline CalamaresUtils::ProcessResult static inline Calamares::ProcessResult
target_env_command( const QStringList& args, const std::string& input, int timeout ) target_env_command( const QStringList& args, const std::string& input, int timeout )
{ {
// Since Python doesn't give us the type system for distinguishing // Since Python doesn't give us the type system for distinguishing
// seconds from other integral types, massage to seconds here. // seconds from other integral types, massage to seconds here.
return CalamaresUtils::System::instance()->targetEnvCommand( return Calamares::System::instance()->targetEnvCommand(
args, QString(), QString::fromStdString( input ), std::chrono::seconds( timeout ) ); args, QString(), QString::fromStdString( input ), std::chrono::seconds( timeout ) );
} }
@ -80,9 +80,9 @@ mount( const std::string& device_path,
const std::string& options ) const std::string& options )
{ {
return Calamares::Partition::mount( QString::fromStdString( device_path ), return Calamares::Partition::mount( QString::fromStdString( device_path ),
QString::fromStdString( mount_point ), QString::fromStdString( mount_point ),
QString::fromStdString( filesystem_name ), QString::fromStdString( filesystem_name ),
QString::fromStdString( options ) ); QString::fromStdString( options ) );
} }
int int
@ -91,14 +91,12 @@ target_env_call( const std::string& command, const std::string& input, int timeo
return target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ).first; return target_env_command( QStringList { QString::fromStdString( command ) }, input, timeout ).first;
} }
int int
target_env_call( const bp::list& args, const std::string& input, int timeout ) target_env_call( const bp::list& args, const std::string& input, int timeout )
{ {
return target_env_command( bp_list_to_qstringlist( args ), input, timeout ).first; return target_env_command( bp_list_to_qstringlist( args ), input, timeout ).first;
} }
int int
check_target_env_call( const std::string& command, const std::string& input, int timeout ) check_target_env_call( const std::string& command, const std::string& input, int timeout )
{ {
@ -106,7 +104,6 @@ check_target_env_call( const std::string& command, const std::string& input, int
return handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); return handle_check_target_env_call_error( ec, QString::fromStdString( command ) );
} }
int int
check_target_env_call( const bp::list& args, const std::string& input, int timeout ) check_target_env_call( const bp::list& args, const std::string& input, int timeout )
{ {
@ -120,7 +117,6 @@ check_target_env_call( const bp::list& args, const std::string& input, int timeo
return handle_check_target_env_call_error( ec, failedCmdList.join( ' ' ) ); return handle_check_target_env_call_error( ec, failedCmdList.join( ' ' ) );
} }
std::string std::string
check_target_env_output( const std::string& command, const std::string& input, int timeout ) check_target_env_output( const std::string& command, const std::string& input, int timeout )
{ {
@ -129,7 +125,6 @@ check_target_env_output( const std::string& command, const std::string& input, i
return ec.second.toStdString(); return ec.second.toStdString();
} }
std::string std::string
check_target_env_output( const bp::list& args, const std::string& input, int timeout ) check_target_env_output( const bp::list& args, const std::string& input, int timeout )
{ {
@ -169,7 +164,7 @@ load_yaml( const std::string& path )
{ {
const QString filePath = QString::fromStdString( path ); const QString filePath = QString::fromStdString( path );
bool ok = false; bool ok = false;
auto map = CalamaresUtils::loadYaml( filePath, &ok ); auto map = Calamares::YAML::load( filePath, &ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "Loading YAML from" << filePath << "failed."; cWarning() << "Loading YAML from" << filePath << "failed.";
@ -177,7 +172,6 @@ load_yaml( const std::string& path )
return variantMapToPyDict( map ); return variantMapToPyDict( map );
} }
PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent ) PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )
: m_parent( parent ) : m_parent( parent )
{ {
@ -188,7 +182,6 @@ PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )
configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap ); configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap );
} }
void void
PythonJobInterface::setprogress( qreal progress ) PythonJobInterface::setprogress( qreal progress )
{ {
@ -259,7 +252,6 @@ host_env_process_output( const boost::python::list& args,
return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, input, timeout ); return _process_output( Calamares::Utils::RunLocation::RunInHost, args, callback, input, timeout );
} }
std::string std::string
obscure( const std::string& string ) obscure( const std::string& string )
{ {
@ -369,5 +361,4 @@ gettext_path()
return bp::object(); // None return bp::object(); // None
} }
} // namespace CalamaresPython } // namespace CalamaresPython

View File

@ -31,7 +31,7 @@ hasValue( const YAML::Node& v )
/** @brief Helper function to grab a QString out of the config, and to warn if not present. */ /** @brief Helper function to grab a QString out of the config, and to warn if not present. */
static QString static QString
requireString( const YAML::Node& config, const char* key ) requireString( const ::YAML::Node& config, const char* key )
{ {
auto v = config[ key ]; auto v = config[ key ];
if ( hasValue( v ) ) if ( hasValue( v ) )
@ -47,7 +47,7 @@ requireString( const YAML::Node& config, const char* key )
/** @brief Helper function to grab a bool out of the config, and to warn if not present. */ /** @brief Helper function to grab a bool out of the config, and to warn if not present. */
static bool static bool
requireBool( const YAML::Node& config, const char* key, bool d ) requireBool( const ::YAML::Node& config, const char* key, bool d )
{ {
auto v = config[ key ]; auto v = config[ key ];
if ( hasValue( v ) ) if ( hasValue( v ) )
@ -133,7 +133,7 @@ interpretModulesSearch( const bool debugMode, const QStringList& rawPaths, QStri
} }
// Install path is set in CalamaresAddPlugin.cmake // Install path is set in CalamaresAddPlugin.cmake
output.append( CalamaresUtils::systemLibDir().absolutePath() + QDir::separator() + "calamares" output.append( Calamares::systemLibDir().absolutePath() + QDir::separator() + "calamares"
+ QDir::separator() + "modules" ); + QDir::separator() + "modules" );
} }
else else
@ -152,12 +152,12 @@ interpretModulesSearch( const bool debugMode, const QStringList& rawPaths, QStri
} }
static void static void
interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& customInstances ) interpretInstances( const ::YAML::Node& node, Settings::InstanceDescriptionList& customInstances )
{ {
// Parse the custom instances section // Parse the custom instances section
if ( node ) if ( node )
{ {
QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList(); QVariant instancesV = Calamares::YAML::toVariant( node ).toList();
if ( typeOf( instancesV ) == ListVariantType ) if ( typeOf( instancesV ) == ListVariantType )
{ {
const auto instances = instancesV.toList(); const auto instances = instancesV.toList();
@ -180,15 +180,15 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
} }
static void static void
interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSequence ) interpretSequence( const ::YAML::Node& node, Settings::ModuleSequence& moduleSequence )
{ {
// Parse the modules sequence section // Parse the modules sequence section
if ( node ) if ( node )
{ {
QVariant sequenceV = CalamaresUtils::yamlToVariant( node ); QVariant sequenceV = Calamares::YAML::toVariant( node );
if ( typeOf( sequenceV ) != ListVariantType ) if ( typeOf( sequenceV ) != ListVariantType )
{ {
throw YAML::Exception( YAML::Mark(), "sequence key does not have a list-value" ); throw ::YAML::Exception( ::YAML::Mark(), "sequence key does not have a list-value" );
} }
const auto sequence = sequenceV.toList(); const auto sequence = sequenceV.toList();
@ -231,7 +231,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
} }
else else
{ {
throw YAML::Exception( YAML::Mark(), "sequence key is missing" ); throw ::YAML::Exception( ::YAML::Mark(), "sequence key is missing" );
} }
} }
@ -317,11 +317,12 @@ Settings::setConfiguration( const QByteArray& ba, const QString& explainName )
{ {
try try
{ {
YAML::Node config = YAML::Load( ba.constData() ); // Not using Calamares::YAML:: convenience methods because we **want** the exception here
auto config = ::YAML::Load( ba.constData() );
Q_ASSERT( config.IsMap() ); Q_ASSERT( config.IsMap() );
interpretModulesSearch( interpretModulesSearch(
debugMode(), CalamaresUtils::yamlToStringList( config[ "modules-search" ] ), m_modulesSearchPaths ); debugMode(), Calamares::YAML::toStringList( config[ "modules-search" ] ), m_modulesSearchPaths );
interpretInstances( config[ "instances" ], m_moduleInstances ); interpretInstances( config[ "instances" ], m_moduleInstances );
interpretSequence( config[ "sequence" ], m_modulesSequence ); interpretSequence( config[ "sequence" ], m_modulesSequence );
@ -336,9 +337,9 @@ Settings::setConfiguration( const QByteArray& ba, const QString& explainName )
reconcileInstancesAndSequence(); reconcileInstancesAndSequence();
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
CalamaresUtils::explainYamlException( e, ba, explainName ); Calamares::YAML::explainException( e, ba, explainName );
} }
} }
@ -348,21 +349,18 @@ Settings::modulesSearchPaths() const
return m_modulesSearchPaths; return m_modulesSearchPaths;
} }
Settings::InstanceDescriptionList Settings::InstanceDescriptionList
Settings::moduleInstances() const Settings::moduleInstances() const
{ {
return m_moduleInstances; return m_moduleInstances;
} }
Settings::ModuleSequence Settings::ModuleSequence
Settings::modulesSequence() const Settings::modulesSequence() const
{ {
return m_modulesSequence; return m_modulesSequence;
} }
QString QString
Settings::brandingComponentName() const Settings::brandingComponentName() const
{ {
@ -375,9 +373,9 @@ settingsFileCandidates( bool assumeBuilddir )
static const char settings[] = "settings.conf"; static const char settings[] = "settings.conf";
QStringList settingsPaths; QStringList settingsPaths;
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings ); settingsPaths << Calamares::appDataDir().absoluteFilePath( settings );
} }
else else
{ {
@ -385,13 +383,13 @@ settingsFileCandidates( bool assumeBuilddir )
{ {
settingsPaths << QDir::current().absoluteFilePath( settings ); settingsPaths << QDir::current().absoluteFilePath( settings );
} }
if ( CalamaresUtils::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
for ( auto s : CalamaresUtils::extraConfigDirs() ) for ( auto s : Calamares::extraConfigDirs() )
{ {
settingsPaths << ( s + settings ); settingsPaths << ( s + settings );
} }
settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings ); settingsPaths << Calamares::appDataDir().absoluteFilePath( settings );
} }
return settingsPaths; return settingsPaths;
@ -426,7 +424,7 @@ Settings::init( bool debugMode )
{ {
cError() << "Cowardly refusing to continue startup without settings." cError() << "Cowardly refusing to continue startup without settings."
<< Logger::DebugList( settingsFileCandidatesByPriority ); << Logger::DebugList( settingsFileCandidatesByPriority );
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
cError() << "FATAL: explicitly configured application data directory is missing settings.conf"; cError() << "FATAL: explicitly configured application data directory is missing settings.conf";
} }

View File

@ -44,14 +44,14 @@ selectMap( const QVariantMap& m, const QStringList& l, int index )
QString attributeName = l[ index ]; QString attributeName = l[ index ];
if ( index == l.count() - 1 ) if ( index == l.count() - 1 )
{ {
return CalamaresUtils::getString( m, attributeName ); return Calamares::getString( m, attributeName );
} }
else else
{ {
bool success = false; // bogus bool success = false; // bogus
if ( m.contains( attributeName ) ) if ( m.contains( attributeName ) )
{ {
return selectMap( CalamaresUtils::getSubMap( m, attributeName, success ), l, index + 1 ); return selectMap( Calamares::getSubMap( m, attributeName, success ), l, index + 1 );
} }
return QString(); return QString();
} }
@ -62,9 +62,9 @@ GeoIPJSON::rawReply( const QByteArray& data )
{ {
try try
{ {
YAML::Node doc = YAML::Load( data ); auto doc = ::YAML::Load( data );
QVariant var = CalamaresUtils::yamlToVariant( doc ); QVariant var = Calamares::YAML::toVariant( doc );
if ( !var.isNull() && var.isValid() && Calamares::typeOf( var ) == Calamares::MapVariantType ) if ( !var.isNull() && var.isValid() && Calamares::typeOf( var ) == Calamares::MapVariantType )
{ {
return selectMap( var.toMap(), m_element.split( '.' ), 0 ); return selectMap( var.toMap(), m_element.split( '.' ), 0 );
@ -74,9 +74,9 @@ GeoIPJSON::rawReply( const QByteArray& data )
cWarning() << "Invalid YAML data for GeoIPJSON"; cWarning() << "Invalid YAML data for GeoIPJSON";
} }
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
CalamaresUtils::explainYamlException( e, data, "GeoIP data" ); Calamares::YAML::explainException( e, data, "GeoIP data" );
} }
return QString(); return QString();

View File

@ -38,7 +38,7 @@ TranslatedString::TranslatedString( const QVariantMap& map, const QString& key,
: m_context( context ) : m_context( context )
{ {
// Get the un-decorated value for the key // Get the un-decorated value for the key
QString value = CalamaresUtils::getString( map, key ); QString value = Calamares::getString( map, key );
m_strings[ QString() ] = value; m_strings[ QString() ] = value;
for ( auto it = map.constBegin(); it != map.constEnd(); ++it ) for ( auto it = map.constBegin(); it != map.constEnd(); ++it )

View File

@ -18,14 +18,12 @@ namespace Calamares
namespace ModuleSystem namespace ModuleSystem
{ {
class Config::Private class Config::Private
{ {
public: public:
std::unique_ptr< Presets > m_presets; std::unique_ptr< Presets > m_presets;
}; };
Config::Config( QObject* parent ) Config::Config( QObject* parent )
: QObject( parent ) : QObject( parent )
, d( std::make_unique< Private >() ) , d( std::make_unique< Private >() )
@ -55,7 +53,7 @@ Config::isEditable( const QString& fieldName ) const
Config::ApplyPresets::ApplyPresets( Calamares::ModuleSystem::Config& c, const QVariantMap& configurationMap ) Config::ApplyPresets::ApplyPresets( Calamares::ModuleSystem::Config& c, const QVariantMap& configurationMap )
: m_c( c ) : m_c( c )
, m_bogus( true ) , m_bogus( true )
, m_map( CalamaresUtils::getSubMap( configurationMap, "presets", m_bogus ) ) , m_map( Calamares::getSubMap( configurationMap, "presets", m_bogus ) )
{ {
c.m_unlocked = true; c.m_unlocked = true;
if ( !c.d->m_presets ) if ( !c.d->m_presets )
@ -113,9 +111,9 @@ Config::ApplyPresets::apply( const char* fieldName )
if ( m_map.contains( key ) ) if ( m_map.contains( key ) )
{ {
// Key has an explicit setting // Key has an explicit setting
QVariantMap m = CalamaresUtils::getSubMap( m_map, key, m_bogus ); QVariantMap m = Calamares::getSubMap( m_map, key, m_bogus );
QVariant value = m[ "value" ]; QVariant value = m[ "value" ];
bool editable = CalamaresUtils::getBool( m, "editable", true ); bool editable = Calamares::getBool( m, "editable", true );
if ( value.isValid() ) if ( value.isValid() )
{ {

View File

@ -92,21 +92,21 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc, const QString& de
return d; return d;
} }
d.m_isEmergeny = CalamaresUtils::getBool( moduleDesc, "emergency", false ); d.m_isEmergeny = Calamares::getBool( moduleDesc, "emergency", false );
d.m_hasConfig = !CalamaresUtils::getBool( moduleDesc, "noconfig", false ); // Inverted logic during load d.m_hasConfig = !Calamares::getBool( moduleDesc, "noconfig", false ); // Inverted logic during load
d.m_requiredModules = CalamaresUtils::getStringList( moduleDesc, "requiredModules" ); d.m_requiredModules = Calamares::getStringList( moduleDesc, "requiredModules" );
d.m_weight = int( CalamaresUtils::getInteger( moduleDesc, "weight", -1 ) ); d.m_weight = int( Calamares::getInteger( moduleDesc, "weight", -1 ) );
QStringList consumedKeys { "type", "interface", "name", "emergency", "noconfig", "requiredModules", "weight" }; QStringList consumedKeys { "type", "interface", "name", "emergency", "noconfig", "requiredModules", "weight" };
switch ( d.interface() ) switch ( d.interface() )
{ {
case Interface::QtPlugin: case Interface::QtPlugin:
d.m_script = CalamaresUtils::getString( moduleDesc, "load" ); d.m_script = Calamares::getString( moduleDesc, "load" );
consumedKeys << "load"; consumedKeys << "load";
break; break;
case Interface::Python: case Interface::Python:
d.m_script = CalamaresUtils::getString( moduleDesc, "script" ); d.m_script = Calamares::getString( moduleDesc, "script" );
if ( d.m_script.isEmpty() ) if ( d.m_script.isEmpty() )
{ {
if ( o ) if ( o )
@ -119,9 +119,9 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc, const QString& de
consumedKeys << "script"; consumedKeys << "script";
break; break;
case Interface::Process: case Interface::Process:
d.m_script = CalamaresUtils::getString( moduleDesc, "command" ); d.m_script = Calamares::getString( moduleDesc, "command" );
d.m_processTimeout = int( CalamaresUtils::getInteger( moduleDesc, "timeout", 30 ) ); d.m_processTimeout = int( Calamares::getInteger( moduleDesc, "timeout", 30 ) );
d.m_processChroot = CalamaresUtils::getBool( moduleDesc, "chroot", false ); d.m_processChroot = Calamares::getBool( moduleDesc, "chroot", false );
if ( d.m_processTimeout < 0 ) if ( d.m_processTimeout < 0 )
{ {
d.m_processTimeout = 0; d.m_processTimeout = 0;

View File

@ -51,9 +51,9 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
{ {
QStringList paths; QStringList paths;
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
paths << CalamaresUtils::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) ); paths << Calamares::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) );
} }
else else
{ {
@ -73,14 +73,14 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
paths << QDir().absoluteFilePath( configFileName ); paths << QDir().absoluteFilePath( configFileName );
} }
if ( CalamaresUtils::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
for ( auto s : CalamaresUtils::extraConfigDirs() ) for ( auto s : Calamares::extraConfigDirs() )
{ {
paths << ( s + QString( "modules/%1" ).arg( configFileName ) ); paths << ( s + QString( "modules/%1" ).arg( configFileName ) );
} }
paths << QString( "/etc/calamares/modules/%1" ).arg( configFileName ); paths << QString( "/etc/calamares/modules/%1" ).arg( configFileName );
paths << CalamaresUtils::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) ); paths << Calamares::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) );
} }
return paths; return paths;
@ -98,7 +98,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
{ {
QByteArray ba = configFile.readAll(); QByteArray ba = configFile.readAll();
YAML::Node doc = YAML::Load( ba.constData() ); auto doc = ::YAML::Load( ba.constData() ); // Throws on error
if ( doc.IsNull() ) if ( doc.IsNull() )
{ {
cWarning() << "Found empty module configuration" << path; cWarning() << "Found empty module configuration" << path;
@ -112,7 +112,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
return; return;
} }
m_configurationMap = CalamaresUtils::yamlMapToVariant( doc ); m_configurationMap = Calamares::YAML::mapToVariant( doc );
m_emergency = m_maybe_emergency && m_configurationMap.contains( EMERGENCY ) m_emergency = m_maybe_emergency && m_configurationMap.contains( EMERGENCY )
&& m_configurationMap[ EMERGENCY ].toBool(); && m_configurationMap[ EMERGENCY ].toBool();
return; return;
@ -121,7 +121,6 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
cWarning() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates ); cWarning() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates );
} }
QString QString
Module::typeString() const Module::typeString() const
{ {
@ -130,7 +129,6 @@ Module::typeString() const
return ok ? v : QString(); return ok ? v : QString();
} }
QString QString
Module::interfaceString() const Module::interfaceString() const
{ {
@ -139,14 +137,12 @@ Module::interfaceString() const
return ok ? v : QString(); return ok ? v : QString();
} }
QVariantMap QVariantMap
Module::configurationMap() Module::configurationMap()
{ {
return m_configurationMap; return m_configurationMap;
} }
RequirementsList RequirementsList
Module::checkRequirements() Module::checkRequirements()
{ {

View File

@ -23,8 +23,8 @@ loadPresets( Calamares::ModuleSystem::Presets& preset,
if ( !it.key().isEmpty() && pred( it.key() ) ) if ( !it.key().isEmpty() && pred( it.key() ) )
{ {
QVariantMap m = it.value().toMap(); QVariantMap m = it.value().toMap();
QString value = CalamaresUtils::getString( m, "value" ); QString value = Calamares::getString( m, "value" );
bool editable = CalamaresUtils::getBool( m, "editable", true ); bool editable = Calamares::getBool( m, "editable", true );
preset.append( Calamares::ModuleSystem::PresetField { it.key(), value, editable } ); preset.append( Calamares::ModuleSystem::PresetField { it.key(), value, editable } );

View File

@ -38,7 +38,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
cWarning() << "Can't mount on an empty mountpoint."; cWarning() << "Can't mount on an empty mountpoint.";
} }
return static_cast< int >( CalamaresUtils::ProcessResult::Code::NoWorkingDirectory ); return static_cast< int >( Calamares::ProcessResult::Code::NoWorkingDirectory );
} }
QDir mountPointDir( mountPoint ); QDir mountPointDir( mountPoint );
@ -48,7 +48,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
if ( !ok ) if ( !ok )
{ {
cWarning() << "Could not create mountpoint" << mountPoint; cWarning() << "Could not create mountpoint" << mountPoint;
return static_cast< int >( CalamaresUtils::ProcessResult::Code::NoWorkingDirectory ); return static_cast< int >( Calamares::ProcessResult::Code::NoWorkingDirectory );
} }
} }
@ -71,7 +71,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
} }
args << devicePath << mountPoint; args << devicePath << mountPoint;
auto r = CalamaresUtils::System::runCommand( args, std::chrono::seconds( 10 ) ); auto r = Calamares::System::runCommand( args, std::chrono::seconds( 10 ) );
sync(); sync();
return r.getExitCode(); return r.getExitCode();
} }
@ -79,8 +79,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
int int
unmount( const QString& path, const QStringList& options ) unmount( const QString& path, const QStringList& options )
{ {
auto r auto r = Calamares::System::runCommand( QStringList { "umount" } << options << path, std::chrono::seconds( 10 ) );
= CalamaresUtils::System::runCommand( QStringList { "umount" } << options << path, std::chrono::seconds( 10 ) );
sync(); sync();
return r.getExitCode(); return r.getExitCode();
} }
@ -91,7 +90,6 @@ struct TemporaryMount::Private
QTemporaryDir m_mountDir; QTemporaryDir m_mountDir;
}; };
TemporaryMount::TemporaryMount( const QString& devicePath, const QString& filesystemName, const QString& options ) TemporaryMount::TemporaryMount( const QString& devicePath, const QString& filesystemName, const QString& options )
: m_d( std::make_unique< Private >() ) : m_d( std::make_unique< Private >() )
{ {

View File

@ -9,7 +9,6 @@
* *
*/ */
#include "partition/PartitionSize.h" #include "partition/PartitionSize.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Units.h" #include "utils/Units.h"
@ -99,7 +98,7 @@ PartitionSize::toSectors( qint64 totalSectors, qint64 sectorSize ) const
case SizeUnit::MiB: case SizeUnit::MiB:
case SizeUnit::GB: case SizeUnit::GB:
case SizeUnit::GiB: case SizeUnit::GiB:
return CalamaresUtils::bytesToSectors( toBytes(), sectorSize ); return Calamares::bytesToSectors( toBytes(), sectorSize );
} }
return -1; return -1;
@ -195,17 +194,17 @@ PartitionSize::toBytes() const
case SizeUnit::Byte: case SizeUnit::Byte:
return value(); return value();
case SizeUnit::KB: case SizeUnit::KB:
return CalamaresUtils::KBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::KBtoBytes( static_cast< unsigned long long >( value() ) );
case SizeUnit::KiB: case SizeUnit::KiB:
return CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::KiBtoBytes( static_cast< unsigned long long >( value() ) );
case SizeUnit::MB: case SizeUnit::MB:
return CalamaresUtils::MBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::MBtoBytes( static_cast< unsigned long long >( value() ) );
case SizeUnit::MiB: case SizeUnit::MiB:
return CalamaresUtils::MiBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::MiBtoBytes( static_cast< unsigned long long >( value() ) );
case SizeUnit::GB: case SizeUnit::GB:
return CalamaresUtils::GBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::GBtoBytes( static_cast< unsigned long long >( value() ) );
case SizeUnit::GiB: case SizeUnit::GiB:
return CalamaresUtils::GiBtoBytes( static_cast< unsigned long long >( value() ) ); return Calamares::GiBtoBytes( static_cast< unsigned long long >( value() ) );
} }
__builtin_unreachable(); __builtin_unreachable();
} }

View File

@ -23,7 +23,7 @@ Calamares::Partition::sync()
* either chroot(8) or env(1) is used to run the command, * either chroot(8) or env(1) is used to run the command,
* and they do suitable lookup. * and they do suitable lookup.
*/ */
auto r = CalamaresUtils::System::runCommand( { "udevadm", "settle" }, std::chrono::seconds( 10 ) ); auto r = Calamares::System::runCommand( { "udevadm", "settle" }, std::chrono::seconds( 10 ) );
if ( r.getExitCode() != 0 ) if ( r.getExitCode() != 0 )
{ {
@ -31,5 +31,5 @@ Calamares::Partition::sync()
r.explainProcess( "udevadm", std::chrono::seconds( 10 ) ); r.explainProcess( "udevadm", std::chrono::seconds( 10 ) );
} }
CalamaresUtils::System::runCommand( { "sync" }, std::chrono::seconds( 10 ) ); Calamares::System::runCommand( { "sync" }, std::chrono::seconds( 10 ) );
} }

View File

@ -32,12 +32,11 @@
// clang-format on // clang-format on
#endif #endif
namespace CalamaresUtils namespace Calamares
{ {
System* System::s_instance = nullptr; System* System::s_instance = nullptr;
System::System( bool doChroot, QObject* parent ) System::System( bool doChroot, QObject* parent )
: QObject( parent ) : QObject( parent )
, m_doChroot( doChroot ) , m_doChroot( doChroot )
@ -50,10 +49,8 @@ System::System( bool doChroot, QObject* parent )
} }
} }
System::~System() {} System::~System() {}
System* System*
System::instance() System::instance()
{ {
@ -66,7 +63,6 @@ System::instance()
return s_instance; return s_instance;
} }
ProcessResult ProcessResult
System::runCommand( System::RunLocation location, System::runCommand( System::RunLocation location,
const QStringList& args, const QStringList& args,
@ -229,7 +225,6 @@ System::createTargetParentDirs( const QString& filePath ) const
return createTargetDirs( QFileInfo( filePath ).dir().path() ); return createTargetDirs( QFileInfo( filePath ).dir().path() );
} }
QPair< quint64, qreal > QPair< quint64, qreal >
System::getTotalMemoryB() const System::getTotalMemoryB() const
{ {
@ -259,7 +254,6 @@ System::getTotalMemoryB() const
#endif #endif
} }
QString QString
System::getCpuDescription() const System::getCpuDescription() const
{ {
@ -342,4 +336,4 @@ ProcessResult::explainProcess( int ec, const QString& command, const QString& ou
+ outputMessage ); + outputMessage );
} }
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -21,7 +21,7 @@
#include <chrono> #include <chrono>
namespace CalamaresUtils namespace Calamares
{ {
class ProcessResult : public QPair< int, QString > class ProcessResult : public QPair< int, QString >
{ {
@ -234,7 +234,6 @@ public:
return targetEnvOutput( QStringList { command }, output, workingPath, stdInput, timeoutSec ); return targetEnvOutput( QStringList { command }, output, workingPath, stdInput, timeoutSec );
} }
/** @brief Gets a path to a file in the target system, from the host. /** @brief Gets a path to a file in the target system, from the host.
* *
* @param path Path to the file; this is interpreted * @param path Path to the file; this is interpreted
@ -361,6 +360,6 @@ private:
bool m_doChroot; bool m_doChroot;
}; };
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -22,14 +22,14 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QVariantList> #include <QVariantList>
namespace CalamaresUtils namespace Calamares
{ {
static CommandLine static CommandLine
get_variant_object( const QVariantMap& m ) get_variant_object( const QVariantMap& m )
{ {
QString command = CalamaresUtils::getString( m, "command" ); QString command = Calamares::getString( m, "command" );
qint64 timeout = CalamaresUtils::getInteger( m, "timeout", -1 ); qint64 timeout = Calamares::getInteger( m, "timeout", -1 );
if ( !command.isEmpty() ) if ( !command.isEmpty() )
{ {
@ -102,14 +102,13 @@ CommandLine::expand( KMacroExpanderBase& expander ) const
return { c, second }; return { c, second };
} }
CalamaresUtils::CommandLine Calamares::CommandLine
CommandLine::expand() const CommandLine::expand() const
{ {
auto expander = get_gs_expander( System::RunLocation::RunInHost ); auto expander = get_gs_expander( System::RunLocation::RunInHost );
return expand( expander ); return expand( expander );
} }
CommandList::CommandList( bool doChroot, std::chrono::seconds timeout ) CommandList::CommandList( bool doChroot, std::chrono::seconds timeout )
: m_doChroot( doChroot ) : m_doChroot( doChroot )
, m_timeout( timeout ) , m_timeout( timeout )
@ -220,5 +219,4 @@ CommandList::expand() const
return expand( expander ); return expand( expander );
} }
} // namespace Calamares
} // namespace CalamaresUtils

View File

@ -21,7 +21,7 @@
class KMacroExpanderBase; class KMacroExpanderBase;
namespace CalamaresUtils namespace Calamares
{ {
using CommandLineBase = std::pair< QString, std::chrono::seconds >; using CommandLineBase = std::pair< QString, std::chrono::seconds >;
@ -119,5 +119,5 @@ private:
std::chrono::seconds m_timeout; std::chrono::seconds m_timeout;
}; };
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -30,7 +30,7 @@
using std::cerr; using std::cerr;
namespace CalamaresUtils namespace Calamares
{ {
static QDir s_appDataDir( CMAKE_INSTALL_FULL_DATADIR ); static QDir s_appDataDir( CMAKE_INSTALL_FULL_DATADIR );
@ -69,7 +69,6 @@ isWritableDir( const QDir& dir )
return true; return true;
} }
void void
setAppDataDir( const QDir& dir ) setAppDataDir( const QDir& dir )
{ {
@ -147,14 +146,12 @@ isAppDataDirOverridden()
return s_isAppDataDirOverridden; return s_isAppDataDirOverridden;
} }
QDir QDir
appDataDir() appDataDir()
{ {
return s_appDataDir; return s_appDataDir;
} }
QDir QDir
systemLibDir() systemLibDir()
{ {
@ -162,7 +159,6 @@ systemLibDir()
return path; return path;
} }
QDir QDir
appLogDir() appLogDir()
{ {
@ -184,4 +180,4 @@ appLogDir()
return QDir::temp(); return QDir::temp();
} }
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -21,7 +21,7 @@
#include <QDir> #include <QDir>
namespace CalamaresUtils namespace Calamares
{ {
/** /**
* @brief appDataDir returns the directory with common application data. * @brief appDataDir returns the directory with common application data.
@ -56,6 +56,6 @@ DLLEXPORT bool haveExtraDirs();
DLLEXPORT QStringList extraConfigDirs(); DLLEXPORT QStringList extraConfigDirs();
/** @brief XDG_DATA_DIRS, each guaranteed to end with / */ /** @brief XDG_DATA_DIRS, each guaranteed to end with / */
DLLEXPORT QStringList extraDataDirs(); DLLEXPORT QStringList extraDataDirs();
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -15,8 +15,10 @@
#include <random> #include <random>
CalamaresUtils::EntropySource namespace Calamares
CalamaresUtils::getEntropy( int size, QByteArray& b ) {
EntropySource
getEntropy( int size, QByteArray& b )
{ {
constexpr const char filler = char( 0xcb ); constexpr const char filler = char( 0xcb );
@ -73,8 +75,8 @@ CalamaresUtils::getEntropy( int size, QByteArray& b )
return EntropySource::Twister; return EntropySource::Twister;
} }
CalamaresUtils::EntropySource EntropySource
CalamaresUtils::getPrintableEntropy( int size, QString& s ) getPrintableEntropy( int size, QString& s )
{ {
s.clear(); s.clear();
if ( size < 1 ) if ( size < 1 )
@ -117,3 +119,4 @@ CalamaresUtils::getPrintableEntropy( int size, QString& s )
return r; return r;
} }
} // namespace Calamares

View File

@ -16,7 +16,7 @@
#include <QByteArray> #include <QByteArray>
namespace CalamaresUtils namespace Calamares
{ {
/// @brief Which entropy source was actually used for the entropy. /// @brief Which entropy source was actually used for the entropy.
enum class EntropySource enum class EntropySource
@ -41,6 +41,6 @@ DLLEXPORT EntropySource getEntropy( int size, QByteArray& b );
* @see getEntropy * @see getEntropy
*/ */
DLLEXPORT EntropySource getPrintableEntropy( int size, QString& s ); DLLEXPORT EntropySource getPrintableEntropy( int size, QString& s );
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -44,7 +44,6 @@ static QMutex s_mutex;
static const char s_Continuation[] = "\n "; static const char s_Continuation[] = "\n ";
static const char s_SubEntry[] = " .. "; static const char s_SubEntry[] = " .. ";
namespace Logger namespace Logger
{ {
@ -109,7 +108,6 @@ log_implementation( const char* msg, unsigned int debugLevel, const bool withTim
} }
} }
static void static void
CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg ) CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg )
{ {
@ -139,14 +137,12 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& m
log_implementation( msg.toUtf8().constData(), level, true ); log_implementation( msg.toUtf8().constData(), level, true );
} }
QString QString
logFile() logFile()
{ {
return CalamaresUtils::appLogDir().filePath( "session.log" ); return Calamares::appLogDir().filePath( "session.log" );
} }
void void
setupLogfile() setupLogfile()
{ {
@ -202,7 +198,6 @@ CDebug::CDebug( unsigned int debugLevel, const char* func )
} }
} }
CDebug::~CDebug() CDebug::~CDebug()
{ {
if ( log_enabled( m_debugLevel ) ) if ( log_enabled( m_debugLevel ) )

View File

@ -73,7 +73,6 @@ public:
} }
} }
/** @brief Construct value from string. /** @brief Construct value from string.
* *
* This is not defined in the template, because it should probably * This is not defined in the template, because it should probably

View File

@ -15,7 +15,7 @@
#include <sys/stat.h> #include <sys/stat.h>
namespace CalamaresUtils namespace Calamares
{ {
Permissions::Permissions() Permissions::Permissions()
@ -26,7 +26,6 @@ Permissions::Permissions()
{ {
} }
Permissions::Permissions( QString const& p ) Permissions::Permissions( QString const& p )
: Permissions() : Permissions()
{ {
@ -91,7 +90,7 @@ Permissions::apply( const QString& path, int mode )
} }
bool bool
Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p ) Permissions::apply( const QString& path, const Calamares::Permissions& p )
{ {
if ( !p.isValid() ) if ( !p.isValid() )
{ {
@ -105,8 +104,8 @@ Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p )
// uid_t and gid_t values to pass to that system call. // uid_t and gid_t values to pass to that system call.
// //
// Do a lame cop-out and let the chown(8) utility do the heavy lifting. // Do a lame cop-out and let the chown(8) utility do the heavy lifting.
if ( CalamaresUtils::System::runCommand( { "chown", p.username() + ':' + p.group(), path }, if ( Calamares::System::runCommand( { "chown", p.username() + ':' + p.group(), path },
std::chrono::seconds( 3 ) ) std::chrono::seconds( 3 ) )
.getExitCode() ) .getExitCode() )
{ {
r = false; r = false;
@ -121,5 +120,4 @@ Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p )
return r; return r;
} }
} // namespace Calamares
} // namespace CalamaresUtils

View File

@ -12,7 +12,7 @@
#include <QString> #include <QString>
namespace CalamaresUtils namespace Calamares
{ {
/** /**
@ -90,6 +90,6 @@ private:
bool m_valid; bool m_valid;
}; };
} // namespace CalamaresUtils } // namespace Calamares
#endif // LIBCALAMARES_PERMISSIONS_H #endif // LIBCALAMARES_PERMISSIONS_H

View File

@ -88,7 +88,6 @@ BrandingLoader::tryLoad( QTranslator* translator )
QString filenameBase( m_prefix ); QString filenameBase( m_prefix );
filenameBase.remove( 0, lastDirSeparator + 1 ); filenameBase.remove( 0, lastDirSeparator + 1 );
if ( QDir( brandingTranslationsDirPath ).exists() ) if ( QDir( brandingTranslationsDirPath ).exists() )
{ {
const QString fileName = QStringLiteral( "%1_%2" ).arg( filenameBase, m_localeName ); const QString fileName = QStringLiteral( "%1_%2" ).arg( filenameBase, m_localeName );
@ -119,7 +118,7 @@ tryLoad( QTranslator* translator, const QString& prefix, const QString& localeNa
} }
// Or load from appDataDir -- often /usr/share/calamares -- subdirectory land/ // Or load from appDataDir -- often /usr/share/calamares -- subdirectory land/
QDir localeData( CalamaresUtils::appDataDir() ); QDir localeData( Calamares::appDataDir() );
if ( localeData.exists() if ( localeData.exists()
&& translator->load( localeData.absolutePath() + QStringLiteral( "/lang/" ) + prefix + localeName ) ) && translator->load( localeData.absolutePath() + QStringLiteral( "/lang/" ) + prefix + localeName ) )
{ {
@ -170,7 +169,7 @@ loadSingletonTranslator( TranslationLoader&& loader, QTranslator*& translator_p
} // namespace } // namespace
namespace CalamaresUtils namespace Calamares
{ {
static QTranslator* s_brandingTranslator = nullptr; static QTranslator* s_brandingTranslator = nullptr;
static QTranslator* s_translator = nullptr; static QTranslator* s_translator = nullptr;
@ -241,5 +240,4 @@ setAllowLocalTranslation( bool allow )
s_allowLocalTranslations = allow; s_allowLocalTranslations = allow;
} }
} // namespace Calamares
} // namespace CalamaresUtils

View File

@ -23,7 +23,7 @@ class QEvent;
class QLocale; class QLocale;
class QTranslator; class QTranslator;
namespace CalamaresUtils namespace Calamares
{ {
/** @brief changes the application language. /** @brief changes the application language.
* @param locale the new locale (names as defined by Calamares). * @param locale the new locale (names as defined by Calamares).
@ -69,7 +69,6 @@ loadTranslator( const Calamares::Locale::Translation::Id& locale, const QString&
*/ */
DLLEXPORT void setAllowLocalTranslation( bool allow ); DLLEXPORT void setAllowLocalTranslation( bool allow );
/** @brief Handles change-of-language events /** @brief Handles change-of-language events
* *
* There is one single Retranslator object. Use `instance()` to get it. * There is one single Retranslator object. Use `instance()` to get it.
@ -102,8 +101,7 @@ private:
explicit Retranslator( QObject* parent ); explicit Retranslator( QObject* parent );
}; };
} // namespace Calamares
} // namespace CalamaresUtils
/** @brief Call code for this object when language changes /** @brief Call code for this object when language changes
* *
@ -116,7 +114,7 @@ private:
* immediately after setting up the connection. This allows * immediately after setting up the connection. This allows
* setup and translation code to be mixed together. * setup and translation code to be mixed together.
*/ */
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [ = ] { body } ) #define CALAMARES_RETRANSLATE( body ) Calamares::Retranslator::attach( this, [ = ] { body } )
/** @brief Call code for the given object (widget) when language changes /** @brief Call code for the given object (widget) when language changes
* *
* This is identical to CALAMARES_RETRANSLATE, except the @p body is called * This is identical to CALAMARES_RETRANSLATE, except the @p body is called
@ -126,7 +124,7 @@ private:
* immediately after setting up the connection. This allows * immediately after setting up the connection. This allows
* setup and translation code to be mixed together. * setup and translation code to be mixed together.
*/ */
#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [ = ] { body } ) #define CALAMARES_RETRANSLATE_FOR( object, body ) Calamares::Retranslator::attach( object, [ = ] { body } )
/** @brief Call a slot in this object when language changes /** @brief Call a slot in this object when language changes
* *
* Given a slot (in method-function-pointer notation), call that slot when the * Given a slot (in method-function-pointer notation), call that slot when the
@ -140,10 +138,7 @@ private:
#define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \ #define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \
do \ do \
{ \ { \
connect( CalamaresUtils::Retranslator::instance(), \ connect( Calamares::Retranslator::instance(), &Calamares::Retranslator::languageChanged, this, slotfunc ); \
&CalamaresUtils::Retranslator::languageChanged, \
this, \
slotfunc ); \
( this->*slotfunc )(); \ ( this->*slotfunc )(); \
} while ( false ) } while ( false )

View File

@ -41,7 +41,6 @@ relativeChangeDirectory( QDir& directory, const QString& subdir )
return directory.cd( relPath ); return directory.cd( relPath );
} }
STATICTEST std::pair< bool, QDir > STATICTEST std::pair< bool, QDir >
calculateWorkingDirectory( Calamares::Utils::RunLocation location, const QString& directory ) calculateWorkingDirectory( Calamares::Utils::RunLocation location, const QString& directory )
{ {
@ -98,11 +97,9 @@ namespace Utils
Runner::Runner() {} Runner::Runner() {}
} // namespace Utils } // namespace Utils
} // namespace Calamares } // namespace Calamares
Calamares::Utils::Runner::Runner( const QStringList& command ) Calamares::Utils::Runner::Runner( const QStringList& command )
{ {
setCommand( command ); setCommand( command );

View File

@ -26,8 +26,8 @@ namespace Calamares
namespace Utils namespace Utils
{ {
using RunLocation = CalamaresUtils::System::RunLocation; using RunLocation = Calamares::System::RunLocation;
using ProcessResult = CalamaresUtils::ProcessResult; using ProcessResult = Calamares::ProcessResult;
/** @brief A Runner wraps a process and handles running it and processing output /** @brief A Runner wraps a process and handles running it and processing output
* *

View File

@ -86,8 +86,7 @@ removeDiacritics( const QString& string )
return output; return output;
} }
// Function Calamares::obscure based on KStringHandler::obscure,
// Function CalamaresUtils::obscure based on KStringHandler::obscure,
// part of KDElibs by KDE, file kstringhandler.cpp. // part of KDElibs by KDE, file kstringhandler.cpp.
// Original copyright statement follows. // Original copyright statement follows.
/* This file is part of the KDE libraries /* This file is part of the KDE libraries
@ -124,7 +123,6 @@ obscure( const QString& string )
return result; return result;
} }
QString QString
truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars ) truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars )
{ {

View File

@ -34,10 +34,8 @@ DictionaryExpander::DictionaryExpander( Calamares::String::DictionaryExpander&&
{ {
} }
DictionaryExpander::~DictionaryExpander() {} DictionaryExpander::~DictionaryExpander() {}
void void
DictionaryExpander::insert( const QString& key, const QString& value ) DictionaryExpander::insert( const QString& key, const QString& value )
{ {

View File

@ -25,7 +25,6 @@ namespace Calamares
namespace String namespace String
{ {
/** @brief Expand variables in a string against a dictionary. /** @brief Expand variables in a string against a dictionary.
* *
* This class provides a convenience API for building up a dictionary * This class provides a convenience API for building up a dictionary

View File

@ -41,7 +41,7 @@ private Q_SLOTS:
void testCreateTargetBasedirs(); void testCreateTargetBasedirs();
private: private:
CalamaresUtils::System* m_system = nullptr; // Points to singleton instance, not owned Calamares::System* m_system = nullptr; // Points to singleton instance, not owned
Calamares::GlobalStorage* m_gs = nullptr; Calamares::GlobalStorage* m_gs = nullptr;
}; };
@ -54,7 +54,7 @@ TestPaths::initTestCase()
Logger::setupLogLevel( Logger::LOGDEBUG ); Logger::setupLogLevel( Logger::LOGDEBUG );
// Ensure we have a system object, expect it to be a "bogus" one // Ensure we have a system object, expect it to be a "bogus" one
CalamaresUtils::System* system = CalamaresUtils::System::instance(); Calamares::System* system = Calamares::System::instance();
QVERIFY( system ); QVERIFY( system );
QVERIFY( system->doChroot() ); QVERIFY( system->doChroot() );
@ -88,11 +88,11 @@ TestPaths::init()
void void
TestPaths::testCreationResult() TestPaths::testCreationResult()
{ {
using Code = CalamaresUtils::CreationResult::Code; using Code = Calamares::CreationResult::Code;
for ( auto c : { Code::OK, Code::AlreadyExists, Code::Failed, Code::Invalid } ) for ( auto c : { Code::OK, Code::AlreadyExists, Code::Failed, Code::Invalid } )
{ {
auto r = CalamaresUtils::CreationResult( c ); auto r = Calamares::CreationResult( c );
QVERIFY( r.path().isEmpty() ); QVERIFY( r.path().isEmpty() );
QCOMPARE( r.path(), QString() ); QCOMPARE( r.path(), QString() );
// Get a warning from Clang if we're not covering everything // Get a warning from Clang if we're not covering everything
@ -115,14 +115,13 @@ TestPaths::testCreationResult()
} }
QString path( "/etc/os-release" ); QString path( "/etc/os-release" );
auto r = CalamaresUtils::CreationResult( path ); auto r = Calamares::CreationResult( path );
QVERIFY( !r.failed() ); QVERIFY( !r.failed() );
QVERIFY( r ); QVERIFY( r );
QCOMPARE( r.code(), Code::OK ); QCOMPARE( r.code(), Code::OK );
QCOMPARE( r.path(), path ); QCOMPARE( r.path(), path );
} }
void void
TestPaths::testTargetPath() TestPaths::testTargetPath()
{ {
@ -140,7 +139,6 @@ TestPaths::testTargetPath()
QCOMPARE( m_system->targetPath( QString() ), QString() ); // Without root, no path QCOMPARE( m_system->targetPath( QString() ), QString() ); // Without root, no path
} }
void void
TestPaths::testCreateTarget() TestPaths::testCreateTarget()
{ {
@ -170,7 +168,6 @@ struct GSRollback
QVariant m_value; QVariant m_value;
}; };
void void
TestPaths::testCreateTargetExists() TestPaths::testCreateTargetExists()
{ {
@ -211,14 +208,14 @@ TestPaths::testCreateTargetOverwrite()
QVERIFY( r.path().endsWith( QString( ltestFile ) ) ); QVERIFY( r.path().endsWith( QString( ltestFile ) ) );
QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 5 ); QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 5 );
r = m_system->createTargetFile( ltestFile, "Goodbye", CalamaresUtils::System::WriteMode::KeepExisting ); r = m_system->createTargetFile( ltestFile, "Goodbye", Calamares::System::WriteMode::KeepExisting );
QVERIFY( !r.failed() ); // It didn't fail! QVERIFY( !r.failed() ); // It didn't fail!
QVERIFY( !r ); // But not unqualified success, either QVERIFY( !r ); // But not unqualified success, either
QVERIFY( r.path().isEmpty() ); QVERIFY( r.path().isEmpty() );
QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 5 ); // Unchanged! QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 5 ); // Unchanged!
r = m_system->createTargetFile( ltestFile, "Goodbye", CalamaresUtils::System::WriteMode::Overwrite ); r = m_system->createTargetFile( ltestFile, "Goodbye", Calamares::System::WriteMode::Overwrite );
QVERIFY( !r.failed() ); // It didn't fail! QVERIFY( !r.failed() ); // It didn't fail!
QVERIFY( r ); // Total success QVERIFY( r ); // Total success
@ -226,7 +223,6 @@ TestPaths::testCreateTargetOverwrite()
QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 7 ); QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 7 );
} }
struct DirRemover struct DirRemover
{ {
DirRemover( const QString& base, const QString& dir ) DirRemover( const QString& base, const QString& dir )

View File

@ -150,7 +150,7 @@ LibCalamaresTests::testLoadSaveYaml()
cDebug() << QDir().absolutePath() << f.fileName() << f.exists(); cDebug() << QDir().absolutePath() << f.fileName() << f.exists();
QVERIFY( f.exists() ); QVERIFY( f.exists() );
auto map = CalamaresUtils::loadYaml( f.fileName() ); auto map = Calamares::YAML::load( f.fileName() );
QVERIFY( map.contains( "sequence" ) ); QVERIFY( map.contains( "sequence" ) );
QCOMPARE( Calamares::typeOf( map[ "sequence" ] ), Calamares::ListVariantType ); QCOMPARE( Calamares::typeOf( map[ "sequence" ] ), Calamares::ListVariantType );
@ -164,10 +164,10 @@ LibCalamaresTests::testLoadSaveYaml()
QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) ); QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) );
} }
CalamaresUtils::saveYaml( "out.yaml", map ); Calamares::YAML::save( "out.yaml", map );
auto other_map = CalamaresUtils::loadYaml( "out.yaml" ); auto other_map = Calamares::YAML::load( "out.yaml" );
CalamaresUtils::saveYaml( "out2.yaml", other_map ); Calamares::YAML::save( "out2.yaml", other_map );
QCOMPARE( map, other_map ); QCOMPARE( map, other_map );
QFile::remove( "out.yaml" ); QFile::remove( "out.yaml" );
@ -222,7 +222,6 @@ LibCalamaresTests::recursiveCompareMap( const QVariantMap& a, const QVariantMap&
} }
} }
void void
LibCalamaresTests::testLoadSaveYamlExtended() LibCalamaresTests::testLoadSaveYamlExtended()
{ {
@ -232,10 +231,10 @@ LibCalamaresTests::testLoadSaveYamlExtended()
{ {
loaded_ok = true; loaded_ok = true;
cDebug() << "Testing" << confname; cDebug() << "Testing" << confname;
auto map = CalamaresUtils::loadYaml( confname, &loaded_ok ); auto map = Calamares::YAML::load( confname, &loaded_ok );
QVERIFY( loaded_ok ); QVERIFY( loaded_ok );
QVERIFY( CalamaresUtils::saveYaml( "out.yaml", map ) ); QVERIFY( Calamares::YAML::save( "out.yaml", map ) );
auto othermap = CalamaresUtils::loadYaml( "out.yaml", &loaded_ok ); auto othermap = Calamares::YAML::load( "out.yaml", &loaded_ok );
QVERIFY( loaded_ok ); QVERIFY( loaded_ok );
QCOMPARE( map.keys(), othermap.keys() ); QCOMPARE( map.keys(), othermap.keys() );
recursiveCompareMap( map, othermap, 0 ); recursiveCompareMap( map, othermap, 0 );
@ -247,7 +246,7 @@ LibCalamaresTests::testLoadSaveYamlExtended()
void void
LibCalamaresTests::testCommands() LibCalamaresTests::testCommands()
{ {
using CalamaresUtils::System; using Calamares::System;
auto r = System::runCommand( System::RunLocation::RunInHost, { "/bin/ls", "/tmp" } ); auto r = System::runCommand( System::RunLocation::RunInHost, { "/bin/ls", "/tmp" } );
QVERIFY( r.getExitCode() == 0 ); QVERIFY( r.getExitCode() == 0 );
@ -292,8 +291,8 @@ LibCalamaresTests::testCommandExpansion()
QFETCH( QString, command ); QFETCH( QString, command );
QFETCH( QString, expected ); QFETCH( QString, expected );
CalamaresUtils::CommandLine c( command, std::chrono::seconds( 0 ) ); Calamares::CommandLine c( command, std::chrono::seconds( 0 ) );
CalamaresUtils::CommandLine e = c.expand(); Calamares::CommandLine e = c.expand();
QCOMPARE( c.command(), command ); QCOMPARE( c.command(), command );
QCOMPARE( e.command(), expected ); QCOMPARE( e.command(), expected );
@ -309,13 +308,13 @@ LibCalamaresTests::testUmask()
// m gets the previous value of the mask (depends on the environment the // m gets the previous value of the mask (depends on the environment the
// test is run in, might be 002, might be 077), .. // test is run in, might be 002, might be 077), ..
mode_t m = CalamaresUtils::setUMask( 022 ); mode_t m = Calamares::setUMask( 022 );
QCOMPARE( CalamaresUtils::setUMask( m ), mode_t( 022 ) ); // But now most recently set was 022 QCOMPARE( Calamares::setUMask( m ), mode_t( 022 ) ); // But now most recently set was 022
for ( mode_t i = 0; i <= 0777 /* octal! */; ++i ) for ( mode_t i = 0; i <= 0777 /* octal! */; ++i )
{ {
QByteArray name = ( ft.fileName() + QChar( '.' ) + QString::number( i, 8 ) ).toLatin1(); QByteArray name = ( ft.fileName() + QChar( '.' ) + QString::number( i, 8 ) ).toLatin1();
CalamaresUtils::UMask um( i ); Calamares::UMask um( i );
int fd = creat( name, 0777 ); int fd = creat( name, 0777 );
QVERIFY( fd >= 0 ); QVERIFY( fd >= 0 );
close( fd ); close( fd );
@ -325,8 +324,8 @@ LibCalamaresTests::testUmask()
QCOMPARE( mystat.st_mode & 0777, 0777 & ~i ); QCOMPARE( mystat.st_mode & 0777, 0777 & ~i );
QCOMPARE( unlink( name ), 0 ); QCOMPARE( unlink( name ), 0 );
} }
QCOMPARE( CalamaresUtils::setUMask( 022 ), m ); QCOMPARE( Calamares::setUMask( 022 ), m );
QCOMPARE( CalamaresUtils::setUMask( m ), mode_t( 022 ) ); QCOMPARE( Calamares::setUMask( m ), mode_t( 022 ) );
} }
void void
@ -334,18 +333,18 @@ LibCalamaresTests::testEntropy()
{ {
QByteArray data; QByteArray data;
auto r0 = CalamaresUtils::getEntropy( 0, data ); auto r0 = Calamares::getEntropy( 0, data );
QCOMPARE( CalamaresUtils::EntropySource::None, r0 ); QCOMPARE( Calamares::EntropySource::None, r0 );
QCOMPARE( data.size(), 0 ); QCOMPARE( data.size(), 0 );
auto r1 = CalamaresUtils::getEntropy( 16, data ); auto r1 = Calamares::getEntropy( 16, data );
QVERIFY( r1 != CalamaresUtils::EntropySource::None ); QVERIFY( r1 != Calamares::EntropySource::None );
QCOMPARE( data.size(), 16 ); QCOMPARE( data.size(), 16 );
// This can randomly fail (but not often) // This can randomly fail (but not often)
QVERIFY( data.at( data.size() - 1 ) != char( 0xcb ) ); QVERIFY( data.at( data.size() - 1 ) != char( 0xcb ) );
auto r2 = CalamaresUtils::getEntropy( 8, data ); auto r2 = Calamares::getEntropy( 8, data );
QVERIFY( r2 != CalamaresUtils::EntropySource::None ); QVERIFY( r2 != Calamares::EntropySource::None );
QCOMPARE( data.size(), 8 ); QCOMPARE( data.size(), 8 );
QCOMPARE( r1, r2 ); QCOMPARE( r1, r2 );
// This can randomly fail (but not often) // This can randomly fail (but not often)
@ -357,12 +356,12 @@ LibCalamaresTests::testPrintableEntropy()
{ {
QString s; QString s;
auto r0 = CalamaresUtils::getPrintableEntropy( 0, s ); auto r0 = Calamares::getPrintableEntropy( 0, s );
QCOMPARE( CalamaresUtils::EntropySource::None, r0 ); QCOMPARE( Calamares::EntropySource::None, r0 );
QCOMPARE( s.length(), 0 ); QCOMPARE( s.length(), 0 );
auto r1 = CalamaresUtils::getPrintableEntropy( 16, s ); auto r1 = Calamares::getPrintableEntropy( 16, s );
QVERIFY( r1 != CalamaresUtils::EntropySource::None ); QVERIFY( r1 != Calamares::EntropySource::None );
QCOMPARE( s.length(), 16 ); QCOMPARE( s.length(), 16 );
for ( QChar c : s ) for ( QChar c : s )
{ {
@ -379,14 +378,14 @@ LibCalamaresTests::testOddSizedPrintable()
QString s; QString s;
for ( int l = 0; l <= 37; ++l ) for ( int l = 0; l <= 37; ++l )
{ {
auto r = CalamaresUtils::getPrintableEntropy( l, s ); auto r = Calamares::getPrintableEntropy( l, s );
if ( l == 0 ) if ( l == 0 )
{ {
QCOMPARE( r, CalamaresUtils::EntropySource::None ); QCOMPARE( r, Calamares::EntropySource::None );
} }
else else
{ {
QVERIFY( r != CalamaresUtils::EntropySource::None ); QVERIFY( r != Calamares::EntropySource::None );
} }
QCOMPARE( s.length(), l ); QCOMPARE( s.length(), l );
@ -443,7 +442,6 @@ LibCalamaresTests::testPointerSetter()
QCOMPARE( special, 34 ); QCOMPARE( special, 34 );
} }
/* Demonstration of Traits support for has-a-method or not. /* Demonstration of Traits support for has-a-method or not.
* *
* We have two classes, c1 and c2; one has a method do_the_thing() and the * We have two classes, c1 and c2; one has a method do_the_thing() and the
@ -484,7 +482,6 @@ public:
} }
}; };
void void
LibCalamaresTests::testTraits() LibCalamaresTests::testTraits()
{ {
@ -507,7 +504,7 @@ LibCalamaresTests::testTraits()
void void
LibCalamaresTests::testVariantStringListCode() LibCalamaresTests::testVariantStringListCode()
{ {
using namespace CalamaresUtils; using namespace Calamares;
const QString key( "strings" ); const QString key( "strings" );
{ {
// Things that are not stringlists // Things that are not stringlists
@ -547,7 +544,7 @@ LibCalamaresTests::testVariantStringListCode()
void void
LibCalamaresTests::testVariantStringListYAMLDashed() LibCalamaresTests::testVariantStringListYAMLDashed()
{ {
using namespace CalamaresUtils; using namespace Calamares;
const QString key( "strings" ); const QString key( "strings" );
// Looks like a stringlist to me // Looks like a stringlist to me
@ -561,7 +558,7 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
)" ); )" );
f.close(); f.close();
bool ok = false; bool ok = false;
QVariantMap m = loadYaml( f.fileName(), &ok ); QVariantMap m = Calamares::YAML::load( f.fileName(), &ok );
QVERIFY( ok ); QVERIFY( ok );
QCOMPARE( m.count(), 1 ); QCOMPARE( m.count(), 1 );
@ -575,7 +572,7 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
void void
LibCalamaresTests::testVariantStringListYAMLBracketed() LibCalamaresTests::testVariantStringListYAMLBracketed()
{ {
using namespace CalamaresUtils; using namespace Calamares;
const QString key( "strings" ); const QString key( "strings" );
// Looks like a stringlist to me // Looks like a stringlist to me
@ -586,7 +583,7 @@ LibCalamaresTests::testVariantStringListYAMLBracketed()
)" ); )" );
f.close(); f.close();
bool ok = false; bool ok = false;
QVariantMap m = loadYaml( f.fileName(), &ok ); QVariantMap m = Calamares::YAML::load( f.fileName(), &ok );
QVERIFY( ok ); QVERIFY( ok );
QCOMPARE( m.count(), 1 ); QCOMPARE( m.count(), 1 );
@ -686,7 +683,6 @@ LibCalamaresTests::testStringTruncationShorter()
using namespace Calamares::String; using namespace Calamares::String;
// *INDENT-OFF* // *INDENT-OFF*
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
displayed in various user-facing messages. These have been removed displayed in various user-facing messages. These have been removed
@ -1034,24 +1030,24 @@ LibCalamaresTests::testCalculateWorkingDirectory()
gs->insert( "rootMountPoint", tempRoot.path() ); gs->insert( "rootMountPoint", tempRoot.path() );
{ {
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInHost, QString() ); auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInHost, QString() );
QVERIFY( ok ); QVERIFY( ok );
QCOMPARE( d, QDir::current() ); QCOMPARE( d, QDir::current() );
} }
{ {
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInTarget, QString() ); auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInTarget, QString() );
QVERIFY( ok ); QVERIFY( ok );
QCOMPARE( d.absolutePath(), tempRoot.path() ); QCOMPARE( d.absolutePath(), tempRoot.path() );
} }
gs->remove( "rootMountPoint" ); gs->remove( "rootMountPoint" );
{ {
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInHost, QString() ); auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInHost, QString() );
QVERIFY( ok ); QVERIFY( ok );
QCOMPARE( d, QDir::current() ); QCOMPARE( d, QDir::current() );
} }
{ {
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInTarget, QString() ); auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInTarget, QString() );
QVERIFY( !ok ); QVERIFY( !ok );
QCOMPARE( d, QDir::current() ); QCOMPARE( d, QDir::current() );
} }
@ -1121,14 +1117,13 @@ LibCalamaresTests::testRunnerOutput()
} }
} }
Calamares::System*
CalamaresUtils::System*
file_setup( const QTemporaryDir& tempRoot ) file_setup( const QTemporaryDir& tempRoot )
{ {
CalamaresUtils::System* ss = CalamaresUtils::System::instance(); Calamares::System* ss = Calamares::System::instance();
if ( !ss ) if ( !ss )
{ {
ss = new CalamaresUtils::System( true ); ss = new Calamares::System( true );
} }
Calamares::GlobalStorage* gs Calamares::GlobalStorage* gs
@ -1157,7 +1152,7 @@ LibCalamaresTests::testReadWriteFile()
QVERIFY( ss ); QVERIFY( ss );
{ {
auto fullPath = ss->createTargetFile( "test0", QByteArray(), CalamaresUtils::System::WriteMode::Overwrite ); auto fullPath = ss->createTargetFile( "test0", QByteArray(), Calamares::System::WriteMode::Overwrite );
QVERIFY( fullPath ); QVERIFY( fullPath );
QVERIFY( !fullPath.path().isEmpty() ); QVERIFY( !fullPath.path().isEmpty() );
@ -1180,7 +1175,7 @@ LibCalamaresTests::testReadWriteFile()
} }
// But it will if you say so explicitly // But it will if you say so explicitly
{ {
auto fullPath = ss->createTargetFile( "test0", otherContents, CalamaresUtils::System::WriteMode::Overwrite ); auto fullPath = ss->createTargetFile( "test0", otherContents, Calamares::System::WriteMode::Overwrite );
QVERIFY( fullPath ); QVERIFY( fullPath );
QVERIFY( !fullPath.path().isEmpty() ); QVERIFY( !fullPath.path().isEmpty() );
@ -1200,7 +1195,6 @@ LibCalamaresTests::testReadWriteFile()
} }
} }
QTEST_GUILESS_MAIN( LibCalamaresTests ) QTEST_GUILESS_MAIN( LibCalamaresTests )
#include "utils/moc-warnings.h" #include "utils/moc-warnings.h"

View File

@ -13,8 +13,7 @@
#include <type_traits> #include <type_traits>
namespace Calamares
namespace CalamaresUtils
{ {
/** @brief Traits machinery lives in this namespace /** @brief Traits machinery lives in this namespace
@ -54,10 +53,10 @@ struct sfinae_true : std::true_type
{ {
}; };
} // namespace Traits } // namespace Traits
} // namespace CalamaresUtils } // namespace Calamares
#define DECLARE_HAS_METHOD( m ) \ #define DECLARE_HAS_METHOD( m ) \
namespace CalamaresUtils \ namespace Calamares \
{ \ { \
namespace Traits \ namespace Traits \
{ \ { \
@ -73,6 +72,6 @@ struct sfinae_true : std::true_type
} \ } \
} \ } \
template < class T > \ template < class T > \
using has_##m = CalamaresUtils::Traits::has_##m ::t< T >; using has_##m = Calamares::Traits::has_##m ::t< T >;
#endif #endif

View File

@ -14,7 +14,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
namespace CalamaresUtils namespace Calamares
{ {
mode_t mode_t
setUMask( mode_t u ) setUMask( mode_t u )
@ -34,4 +34,4 @@ UMask::~UMask()
static_assert( UMask::Safe == ( S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH ), "Bad permissions." ); static_assert( UMask::Safe == ( S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH ), "Bad permissions." );
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -15,7 +15,7 @@
#include <sys/types.h> #include <sys/types.h>
namespace CalamaresUtils namespace Calamares
{ {
/** @brief Wrapper for umask(2) /** @brief Wrapper for umask(2)
* *
@ -45,6 +45,6 @@ public:
private: private:
mode_t m_mode; mode_t m_mode;
}; };
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -15,7 +15,7 @@
#include <QtCore/QIntegerForSize> #include <QtCore/QIntegerForSize>
namespace CalamaresUtils namespace Calamares
{ {
/// @brief Type for expressing units /// @brief Type for expressing units
using intunit_t = quint64; using intunit_t = quint64;
@ -170,6 +170,6 @@ bytesToSectors( qint64 bytes, qint64 blocksize )
return alignBytesToBlockSize( alignBytesToBlockSize( bytes, blocksize ), MiBtoBytes( 1ULL ) ) / blocksize; return alignBytesToBlockSize( alignBytesToBlockSize( bytes, blocksize ), MiBtoBytes( 1ULL ) ) / blocksize;
} }
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -22,7 +22,7 @@
#include <QString> #include <QString>
#include <QVariantMap> #include <QVariantMap>
namespace CalamaresUtils namespace Calamares
{ {
bool bool
getBool( const QVariantMap& map, const QString& key, bool d ) getBool( const QVariantMap& map, const QString& key, bool d )
@ -136,4 +136,4 @@ getSubMap( const QVariantMap& map, const QString& key, bool& success, const QVar
return d; return d;
} }
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -19,7 +19,7 @@
#include <QString> #include <QString>
#include <QVariantMap> #include <QVariantMap>
namespace CalamaresUtils namespace Calamares
{ {
/** /**
* Get a bool value from a mapping with a given key; returns @p d if no value. * Get a bool value from a mapping with a given key; returns @p d if no value.
@ -73,6 +73,6 @@ DLLEXPORT QVariantMap getSubMap( const QVariantMap& map,
const QString& key, const QString& key,
bool& success, bool& success,
const QVariantMap& d = QVariantMap() ); const QVariantMap& d = QVariantMap() );
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -21,7 +21,7 @@
#include <QRegularExpression> #include <QRegularExpression>
void void
operator>>( const YAML::Node& node, QStringList& v ) operator>>( const ::YAML::Node& node, QStringList& v )
{ {
for ( size_t i = 0; i < node.size(); ++i ) for ( size_t i = 0; i < node.size(); ++i )
{ {
@ -29,33 +29,33 @@ operator>>( const YAML::Node& node, QStringList& v )
} }
} }
namespace CalamaresUtils namespace Calamares
{
namespace YAML
{ {
QVariant QVariant
yamlToVariant( const YAML::Node& node ) toVariant( const ::YAML::Node& node )
{ {
switch ( node.Type() ) switch ( node.Type() )
{ {
case YAML::NodeType::Scalar: case ::YAML::NodeType::Scalar:
return yamlScalarToVariant( node ); return scalarToVariant( node );
case YAML::NodeType::Sequence: case ::YAML::NodeType::Sequence:
return yamlSequenceToVariant( node ); return sequenceToVariant( node );
case YAML::NodeType::Map: case ::YAML::NodeType::Map:
return yamlMapToVariant( node ); return mapToVariant( node );
case YAML::NodeType::Null: case ::YAML::NodeType::Null:
case YAML::NodeType::Undefined: case ::YAML::NodeType::Undefined:
return QVariant(); return QVariant();
} }
__builtin_unreachable(); __builtin_unreachable();
} }
QVariant QVariant
yamlScalarToVariant( const YAML::Node& scalarNode ) scalarToVariant( const ::YAML::Node& scalarNode )
{ {
static const auto yamlScalarTrueValues = QRegularExpression( "^(true|True|TRUE|on|On|ON)$" ); static const auto yamlScalarTrueValues = QRegularExpression( "^(true|True|TRUE|on|On|ON)$" );
static const auto yamlScalarFalseValues = QRegularExpression( "^(false|False|FALSE|off|Off|OFF)$" ); static const auto yamlScalarFalseValues = QRegularExpression( "^(false|False|FALSE|off|Off|OFF)$" );
@ -83,32 +83,30 @@ yamlScalarToVariant( const YAML::Node& scalarNode )
return QVariant( scalarString ); return QVariant( scalarString );
} }
QVariantList QVariantList
yamlSequenceToVariant( const YAML::Node& sequenceNode ) sequenceToVariant( const ::YAML::Node& sequenceNode )
{ {
QVariantList vl; QVariantList vl;
for ( YAML::const_iterator it = sequenceNode.begin(); it != sequenceNode.end(); ++it ) for ( ::YAML::const_iterator it = sequenceNode.begin(); it != sequenceNode.end(); ++it )
{ {
vl << yamlToVariant( *it ); vl << toVariant( *it );
} }
return vl; return vl;
} }
QVariantMap QVariantMap
yamlMapToVariant( const YAML::Node& mapNode ) mapToVariant( const ::YAML::Node& mapNode )
{ {
QVariantMap vm; QVariantMap vm;
for ( YAML::const_iterator it = mapNode.begin(); it != mapNode.end(); ++it ) for ( ::YAML::const_iterator it = mapNode.begin(); it != mapNode.end(); ++it )
{ {
vm.insert( QString::fromStdString( it->first.as< std::string >() ), yamlToVariant( it->second ) ); vm.insert( QString::fromStdString( it->first.as< std::string >() ), toVariant( it->second ) );
} }
return vm; return vm;
} }
QStringList QStringList
yamlToStringList( const YAML::Node& listNode ) toStringList( const ::YAML::Node& listNode )
{ {
QStringList l; QStringList l;
listNode >> l; listNode >> l;
@ -116,21 +114,21 @@ yamlToStringList( const YAML::Node& listNode )
} }
void void
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData, const char* label ) explainException( const ::YAML::Exception& e, const QByteArray& yamlData, const char* label )
{ {
cWarning() << "YAML error " << e.what() << "in" << label << '.'; cWarning() << "YAML error " << e.what() << "in" << label << '.';
explainYamlException( e, yamlData ); explainException( e, yamlData );
} }
void void
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData, const QString& label ) explainException( const ::YAML::Exception& e, const QByteArray& yamlData, const QString& label )
{ {
cWarning() << "YAML error " << e.what() << "in" << label << '.'; cWarning() << "YAML error " << e.what() << "in" << label << '.';
explainYamlException( e, yamlData ); explainException( e, yamlData );
} }
void void
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData ) explainException( const ::YAML::Exception& e, const QByteArray& yamlData )
{ {
if ( ( e.mark.line >= 0 ) && ( e.mark.column >= 0 ) ) if ( ( e.mark.line >= 0 ) && ( e.mark.column >= 0 ) )
{ {
@ -176,13 +174,13 @@ explainYamlException( const YAML::Exception& e, const QByteArray& yamlData )
} }
QVariantMap QVariantMap
loadYaml( const QFileInfo& fi, bool* ok ) load( const QFileInfo& fi, bool* ok )
{ {
return loadYaml( fi.absoluteFilePath(), ok ); return load( fi.absoluteFilePath(), ok );
} }
QVariantMap QVariantMap
loadYaml( const QString& filename, bool* ok ) load( const QString& filename, bool* ok )
{ {
if ( ok ) if ( ok )
{ {
@ -196,17 +194,16 @@ loadYaml( const QString& filename, bool* ok )
QByteArray ba = yamlFile.readAll(); QByteArray ba = yamlFile.readAll();
try try
{ {
YAML::Node doc = YAML::Load( ba.constData() ); ::YAML::Node doc = ::YAML::Load( ba.constData() );
yamlContents = CalamaresUtils::yamlToVariant( doc ); yamlContents = toVariant( doc );
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
explainYamlException( e, ba, filename ); explainException( e, ba, filename );
return QVariantMap(); return QVariantMap();
} }
} }
if ( yamlContents.isValid() && !yamlContents.isNull() if ( yamlContents.isValid() && !yamlContents.isNull()
&& Calamares::typeOf( yamlContents ) == Calamares::MapVariantType ) && Calamares::typeOf( yamlContents ) == Calamares::MapVariantType )
{ {
@ -317,7 +314,7 @@ dumpYaml( QFile& f, const QVariantMap& map, int indent )
} }
bool bool
saveYaml( const QString& filename, const QVariantMap& map ) save( const QString& filename, const QVariantMap& map )
{ {
QFile f( filename ); QFile f( filename );
if ( !f.open( QFile::WriteOnly ) ) if ( !f.open( QFile::WriteOnly ) )
@ -329,5 +326,5 @@ saveYaml( const QString& filename, const QVariantMap& map )
return dumpYaml( f, map, 0 ); return dumpYaml( f, map, 0 );
} }
} // namespace YAML
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -48,9 +48,11 @@ class QFileInfo;
#endif #endif
/// @brief Appends all the elements of @p node to the string list @p v /// @brief Appends all the elements of @p node to the string list @p v
void operator>>( const YAML::Node& node, QStringList& v ); void operator>>( const ::YAML::Node& node, QStringList& v );
namespace CalamaresUtils namespace Calamares
{
namespace YAML
{ {
/** /**
* Loads a given @p filename and returns the YAML data * Loads a given @p filename and returns the YAML data
@ -58,30 +60,31 @@ namespace CalamaresUtils
* malformed in some way, returns an empty map and sets * malformed in some way, returns an empty map and sets
* @p *ok to false. Otherwise sets @p *ok to true. * @p *ok to false. Otherwise sets @p *ok to true.
*/ */
QVariantMap loadYaml( const QString& filename, bool* ok = nullptr ); QVariantMap load( const QString& filename, bool* ok = nullptr );
/** Convenience overload. */ /** Convenience overload. */
QVariantMap loadYaml( const QFileInfo&, bool* ok = nullptr ); QVariantMap load( const QFileInfo&, bool* ok = nullptr );
QVariant yamlToVariant( const YAML::Node& node ); QVariant toVariant( const ::YAML::Node& node );
QVariant yamlScalarToVariant( const YAML::Node& scalarNode ); QVariant scalarToVariant( const ::YAML::Node& scalarNode );
QVariantList yamlSequenceToVariant( const YAML::Node& sequenceNode ); QVariantList sequenceToVariant( const ::YAML::Node& sequenceNode );
QVariantMap yamlMapToVariant( const YAML::Node& mapNode ); QVariantMap mapToVariant( const ::YAML::Node& mapNode );
/// @brief Returns all the elements of @p listNode in a StringList /// @brief Returns all the elements of @p listNode in a StringList
QStringList yamlToStringList( const YAML::Node& listNode ); QStringList toStringList( const ::YAML::Node& listNode );
/// @brief Save a @p map to @p filename as YAML /// @brief Save a @p map to @p filename as YAML
bool saveYaml( const QString& filename, const QVariantMap& map ); bool save( const QString& filename, const QVariantMap& map );
/** /**
* Given an exception from the YAML parser library, explain * Given an exception from the YAML parser library, explain
* what is going on in terms of the data passed to the parser. * what is going on in terms of the data passed to the parser.
* Uses @p label when labeling the data source (e.g. "netinstall data") * Uses @p label when labeling the data source (e.g. "netinstall data")
*/ */
void explainYamlException( const YAML::Exception& e, const QByteArray& data, const char* label ); void explainException( const ::YAML::Exception& e, const QByteArray& data, const char* label );
void explainYamlException( const YAML::Exception& e, const QByteArray& data, const QString& label ); void explainException( const ::YAML::Exception& e, const QByteArray& data, const QString& label );
void explainYamlException( const YAML::Exception& e, const QByteArray& data ); void explainException( const ::YAML::Exception& e, const QByteArray& data );
} // namespace CalamaresUtils } // namespace YAML
} // namespace Calamares
#endif #endif

View File

@ -57,7 +57,6 @@ Branding::instance()
return s_instance; return s_instance;
} }
// *INDENT-OFF* // *INDENT-OFF*
// clang-format off // clang-format off
const QStringList Branding::s_stringEntryStrings = const QStringList Branding::s_stringEntryStrings =
@ -76,7 +75,6 @@ const QStringList Branding::s_stringEntryStrings =
"donateUrl" "donateUrl"
}; };
const QStringList Branding::s_imageEntryStrings = const QStringList Branding::s_imageEntryStrings =
{ {
"productBanner", "productBanner",
@ -150,16 +148,16 @@ Branding::WindowDimension::suffixes()
*/ */
static void static void
loadStrings( QMap< QString, QString >& map, loadStrings( QMap< QString, QString >& map,
const YAML::Node& doc, const ::YAML::Node& doc,
const std::string& key, const std::string& key,
const std::function< QString( const QString& ) >& transform ) const std::function< QString( const QString& ) >& transform )
{ {
if ( !doc[ key ].IsMap() ) if ( !doc[ key ].IsMap() )
{ {
throw YAML::Exception( YAML::Mark(), std::string( "Branding configuration is not a map: " ) + key ); throw ::YAML::Exception( ::YAML::Mark(), std::string( "Branding configuration is not a map: " ) + key );
} }
const QVariantMap config = CalamaresUtils::yamlMapToVariant( doc[ key ] ); const QVariantMap config = Calamares::YAML::mapToVariant( doc[ key ] );
for ( auto it = config.constBegin(); it != config.constEnd(); ++it ) for ( auto it = config.constBegin(); it != config.constEnd(); ++it )
{ {
map.insert( it.key(), transform( it.value().toString() ) ); map.insert( it.key(), transform( it.value().toString() ) );
@ -189,11 +187,11 @@ uploadServerFromMap( const QVariantMap& map )
} }
bool bogus = false; // we don't care about type-name lookup success here bool bogus = false; // we don't care about type-name lookup success here
return Branding::UploadServerInfo { return Branding::UploadServerInfo { names.find( typestring, bogus ),
names.find( typestring, bogus ), QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
QUrl( urlstring, QUrl::ParsingMode::StrictMode ), sizeLimitKiB >= 0
sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1 ? Calamares::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) )
}; : -1 };
} }
/** @brief Load the @p map with strings from @p config /** @brief Load the @p map with strings from @p config
@ -226,7 +224,7 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
try try
{ {
YAML::Node doc = YAML::Load( ba.constData() ); auto doc = ::YAML::Load( ba.constData() );
Q_ASSERT( doc.IsMap() ); Q_ASSERT( doc.IsMap() );
m_componentName = QString::fromStdString( doc[ "componentName" ].as< std::string >() ); m_componentName = QString::fromStdString( doc[ "componentName" ].as< std::string >() );
@ -290,11 +288,11 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
} ); } );
loadStrings( m_style, doc, "style", []( const QString& s ) -> QString { return s; } ); loadStrings( m_style, doc, "style", []( const QString& s ) -> QString { return s; } );
m_uploadServer = uploadServerFromMap( CalamaresUtils::yamlMapToVariant( doc[ "uploadServer" ] ) ); m_uploadServer = uploadServerFromMap( Calamares::YAML::mapToVariant( doc[ "uploadServer" ] ) );
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
CalamaresUtils::explainYamlException( e, ba, file.fileName() ); Calamares::YAML::explainException( e, ba, file.fileName() );
bail( m_descriptorPath, e.what() ); bail( m_descriptorPath, e.what() );
} }
@ -323,7 +321,6 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
validateStyleEntries( m_style ); validateStyleEntries( m_style );
} }
QString QString
Branding::componentDirectory() const Branding::componentDirectory() const
{ {
@ -331,14 +328,12 @@ Branding::componentDirectory() const
return fi.absoluteDir().absolutePath(); return fi.absoluteDir().absolutePath();
} }
QString QString
Branding::string( Branding::StringEntry stringEntry ) const Branding::string( Branding::StringEntry stringEntry ) const
{ {
return m_strings.value( s_stringEntryStrings.value( stringEntry ) ); return m_strings.value( s_stringEntryStrings.value( stringEntry ) );
} }
QString QString
Branding::styleString( Branding::StyleEntry styleEntry ) const Branding::styleString( Branding::StyleEntry styleEntry ) const
{ {
@ -346,7 +341,6 @@ Branding::styleString( Branding::StyleEntry styleEntry ) const
return m_style.value( meta.valueToKey( styleEntry ) ); return m_style.value( meta.valueToKey( styleEntry ) );
} }
QString QString
Branding::imagePath( Branding::ImageEntry imageEntry ) const Branding::imagePath( Branding::ImageEntry imageEntry ) const
{ {
@ -410,7 +404,6 @@ Branding::image( const QStringList& list, const QSize& size ) const
return QPixmap(); return QPixmap();
} }
static QString static QString
_stylesheet( const QDir& dir ) _stylesheet( const QDir& dir )
{ {
@ -451,10 +444,9 @@ Branding::WindowDimension::isValid() const
return ( unit() != none ) && ( value() > 0 ); return ( unit() != none ) && ( value() > 0 );
} }
/// @brief Get a string (empty is @p key doesn't exist) from @p key in @p doc /// @brief Get a string (empty is @p key doesn't exist) from @p key in @p doc
static inline QString static inline QString
getString( const YAML::Node& doc, const char* key ) getString( const ::YAML::Node& doc, const char* key )
{ {
if ( doc[ key ] ) if ( doc[ key ] )
{ {
@ -464,19 +456,19 @@ getString( const YAML::Node& doc, const char* key )
} }
/// @brief Get a node (throws if @p key doesn't exist) from @p key in @p doc /// @brief Get a node (throws if @p key doesn't exist) from @p key in @p doc
static inline YAML::Node static inline ::YAML::Node
get( const YAML::Node& doc, const char* key ) get( const ::YAML::Node& doc, const char* key )
{ {
auto r = doc[ key ]; auto r = doc[ key ];
if ( !r.IsDefined() ) if ( !r.IsDefined() )
{ {
throw YAML::KeyNotFound( YAML::Mark::null_mark(), std::string( key ) ); throw ::YAML::KeyNotFound( ::YAML::Mark::null_mark(), std::string( key ) );
} }
return r; return r;
} }
static inline void static inline void
flavorAndSide( const YAML::Node& doc, const char* key, Branding::PanelFlavor& flavor, Branding::PanelSide& side ) flavorAndSide( const ::YAML::Node& doc, const char* key, Branding::PanelFlavor& flavor, Branding::PanelSide& side )
{ {
using PanelFlavor = Branding::PanelFlavor; using PanelFlavor = Branding::PanelFlavor;
using PanelSide = Branding::PanelSide; using PanelSide = Branding::PanelSide;
@ -552,7 +544,7 @@ flavorAndSide( const YAML::Node& doc, const char* key, Branding::PanelFlavor& fl
} }
void void
Branding::initSimpleSettings( const YAML::Node& doc ) Branding::initSimpleSettings( const ::YAML::Node& doc )
{ {
// *INDENT-OFF* // *INDENT-OFF*
// clang-format off // clang-format off
@ -598,16 +590,16 @@ Branding::initSimpleSettings( const YAML::Node& doc )
} }
if ( !m_windowWidth.isValid() ) if ( !m_windowWidth.isValid() )
{ {
m_windowWidth = WindowDimension( CalamaresUtils::windowPreferredWidth, WindowDimensionUnit::Pixies ); m_windowWidth = WindowDimension( Calamares::windowPreferredWidth, WindowDimensionUnit::Pixies );
} }
if ( !m_windowHeight.isValid() ) if ( !m_windowHeight.isValid() )
{ {
m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies ); m_windowHeight = WindowDimension( Calamares::windowPreferredHeight, WindowDimensionUnit::Pixies );
} }
} }
void void
Branding::initSlideshowSettings( const YAML::Node& doc ) Branding::initSlideshowSettings( const ::YAML::Node& doc )
{ {
QDir componentDir( componentDirectory() ); QDir componentDir( componentDirectory() );
@ -666,5 +658,4 @@ Branding::initSlideshowSettings( const YAML::Node& doc )
} }
} }
} // namespace Calamares } // namespace Calamares

View File

@ -93,21 +93,18 @@ ViewManager::ViewManager( QObject* parent )
#endif #endif
} }
ViewManager::~ViewManager() ViewManager::~ViewManager()
{ {
m_widget->deleteLater(); m_widget->deleteLater();
s_instance = nullptr; s_instance = nullptr;
} }
QWidget* QWidget*
ViewManager::centralWidget() ViewManager::centralWidget()
{ {
return m_widget; return m_widget;
} }
void void
ViewManager::addViewStep( ViewStep* step ) ViewManager::addViewStep( ViewStep* step )
{ {
@ -120,7 +117,6 @@ ViewManager::addViewStep( ViewStep* step )
} }
} }
void void
ViewManager::insertViewStep( int before, ViewStep* step ) ViewManager::insertViewStep( int before, ViewStep* step )
{ {
@ -174,13 +170,12 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
{ {
if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() ) if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() )
{ {
CalamaresUtils::Paste::doLogUploadUI( errorDialog ); Calamares::Paste::doLogUploadUI( errorDialog );
} }
QApplication::quit(); QApplication::quit();
} ); } );
} }
void void
ViewManager::onInitFailed( const QStringList& modules ) ViewManager::onInitFailed( const QStringList& modules )
{ {
@ -237,21 +232,18 @@ ViewManager::updateNextStatus( bool status )
} }
} }
ViewStepList ViewStepList
ViewManager::viewSteps() const ViewManager::viewSteps() const
{ {
return m_steps; return m_steps;
} }
ViewStep* ViewStep*
ViewManager::currentStep() const ViewManager::currentStep() const
{ {
return currentStepValid() ? m_steps.value( m_currentStep ) : nullptr; return currentStepValid() ? m_steps.value( m_currentStep ) : nullptr;
} }
int int
ViewManager::currentStepIndex() const ViewManager::currentStepIndex() const
{ {
@ -487,7 +479,6 @@ ViewManager::back()
updateButtonLabels(); updateButtonLabels();
} }
void void
ViewManager::quit() ViewManager::quit()
{ {
@ -594,7 +585,6 @@ ViewManager::data( const QModelIndex& index, int role ) const
} }
} }
int int
ViewManager::rowCount( const QModelIndex& parent ) const ViewManager::rowCount( const QModelIndex& parent ) const
{ {

View File

@ -29,7 +29,6 @@
#include <QFileInfo> #include <QFileInfo>
#include <QString> #include <QString>
namespace Calamares namespace Calamares
{ {
@ -126,7 +125,7 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
{ {
m->loadConfigurationFile( configFileName ); m->loadConfigurationFile( configFileName );
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
cError() << "YAML parser error " << e.what(); cError() << "YAML parser error " << e.what();
return nullptr; return nullptr;
@ -135,5 +134,4 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
return m.release(); return m.release();
} }
} // namespace Calamares } // namespace Calamares

View File

@ -34,7 +34,6 @@ ModuleManager::instance()
return s_instance; return s_instance;
} }
ModuleManager::ModuleManager( const QStringList& paths, QObject* parent ) ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
: QObject( parent ) : QObject( parent )
, m_paths( paths ) , m_paths( paths )
@ -44,7 +43,6 @@ ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
s_instance = this; s_instance = this;
} }
ModuleManager::~ModuleManager() ModuleManager::~ModuleManager()
{ {
// The map is populated with Module::fromDescriptor(), which allocates on the heap. // The map is populated with Module::fromDescriptor(), which allocates on the heap.
@ -54,7 +52,6 @@ ModuleManager::~ModuleManager()
} }
} }
void void
ModuleManager::init() ModuleManager::init()
{ {
@ -98,7 +95,7 @@ ModuleManager::doInit()
} }
bool ok = false; bool ok = false;
QVariantMap moduleDescriptorMap = CalamaresUtils::loadYaml( descriptorFileInfo, &ok ); QVariantMap moduleDescriptorMap = Calamares::YAML::load( descriptorFileInfo, &ok );
QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString(); QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString();
if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() ) if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
@ -136,14 +133,12 @@ ModuleManager::doInit()
QTimer::singleShot( 10, this, &ModuleManager::initDone ); QTimer::singleShot( 10, this, &ModuleManager::initDone );
} }
QList< ModuleSystem::InstanceKey > QList< ModuleSystem::InstanceKey >
ModuleManager::loadedInstanceKeys() ModuleManager::loadedInstanceKeys()
{ {
return m_loadedModulesByInstanceKey.keys(); return m_loadedModulesByInstanceKey.keys();
} }
Calamares::ModuleSystem::Descriptor Calamares::ModuleSystem::Descriptor
ModuleManager::moduleDescriptor( const QString& name ) ModuleManager::moduleDescriptor( const QString& name )
{ {
@ -156,7 +151,6 @@ ModuleManager::moduleInstance( const ModuleSystem::InstanceKey& instanceKey )
return m_loadedModulesByInstanceKey.value( instanceKey ); return m_loadedModulesByInstanceKey.value( instanceKey );
} }
/** @brief Returns the config file name for the given @p instanceKey /** @brief Returns the config file name for the given @p instanceKey
* *
* Custom instances have custom config files, non-custom ones * Custom instances have custom config files, non-custom ones
@ -185,7 +179,6 @@ getConfigFileName( const Settings::InstanceDescriptionList& descriptorList,
} }
} }
// This should already have been checked and failed the module already // This should already have been checked and failed the module already
return QString(); return QString();
} }

View File

@ -22,13 +22,12 @@
#define RESPATH ":/data/" #define RESPATH ":/data/"
namespace CalamaresUtils namespace Calamares
{ {
static int s_defaultFontSize = 0; static int s_defaultFontSize = 0;
static int s_defaultFontHeight = 0; static int s_defaultFontHeight = 0;
QPixmap QPixmap
defaultPixmap( ImageType type, ImageMode mode, const QSize& size ) defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
{ {
@ -127,7 +126,6 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
return pixmap; return pixmap;
} }
void void
unmarginLayout( QLayout* layout ) unmarginLayout( QLayout* layout )
{ {
@ -148,7 +146,6 @@ unmarginLayout( QLayout* layout )
} }
} }
int int
defaultFontSize() defaultFontSize()
{ {
@ -159,7 +156,6 @@ defaultFontSize()
return s_defaultFontSize; return s_defaultFontSize;
} }
int int
defaultFontHeight() defaultFontHeight()
{ {
@ -173,7 +169,6 @@ defaultFontHeight()
return s_defaultFontHeight; return s_defaultFontHeight;
} }
QFont QFont
largeFont() largeFont()
{ {
@ -182,7 +177,6 @@ largeFont()
return f; return f;
} }
void void
setDefaultFontSize( int points ) setDefaultFontSize( int points )
{ {
@ -190,7 +184,6 @@ setDefaultFontSize( int points )
s_defaultFontHeight = 0; // Recalculate on next call to defaultFontHeight() s_defaultFontHeight = 0; // Recalculate on next call to defaultFontHeight()
} }
QSize QSize
defaultIconSize() defaultIconSize()
{ {
@ -198,4 +191,4 @@ defaultIconSize()
return QSize( w, w ); return QSize( w, w );
} }
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -19,7 +19,7 @@
class QLayout; class QLayout;
namespace CalamaresUtils namespace Calamares
{ {
/** /**
@ -74,7 +74,7 @@ enum ImageMode
* @return the new pixmap. * @return the new pixmap.
*/ */
UIDLLEXPORT QPixmap defaultPixmap( ImageType type, UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
ImageMode mode = CalamaresUtils::Original, ImageMode mode = Calamares::Original,
const QSize& size = QSize( 0, 0 ) ); const QSize& size = QSize( 0, 0 ) );
/** /**
@ -97,6 +97,6 @@ constexpr int windowMinimumHeight = 520;
constexpr int windowPreferredWidth = 1024; constexpr int windowPreferredWidth = 1024;
constexpr int windowPreferredHeight = 520; constexpr int windowPreferredHeight = 520;
} // namespace CalamaresUtils } // namespace Calamares
#endif // CALAMARESUTILSGUI_H #endif // CALAMARESUTILSGUI_H

View File

@ -15,7 +15,6 @@
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache; static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
ImageRegistry* ImageRegistry*
ImageRegistry::instance() ImageRegistry::instance()
{ {
@ -23,26 +22,22 @@ ImageRegistry::instance()
return s_instance; return s_instance;
} }
ImageRegistry::ImageRegistry() {} ImageRegistry::ImageRegistry() {}
QIcon QIcon
ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode ) ImageRegistry::icon( const QString& image, Calamares::ImageMode mode )
{ {
return pixmap( image, CalamaresUtils::defaultIconSize(), mode ); return pixmap( image, Calamares::defaultIconSize(), mode );
} }
qint64 qint64
ImageRegistry::cacheKey( const QSize& size ) ImageRegistry::cacheKey( const QSize& size )
{ {
return size.width() * 100 + size.height() * 10; return size.width() * 100 + size.height() * 10;
} }
QPixmap QPixmap
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode ) ImageRegistry::pixmap( const QString& image, const QSize& size, Calamares::ImageMode mode )
{ {
Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) ); Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) );
if ( size.width() < 0 || size.height() < 0 ) if ( size.width() < 0 || size.height() < 0 )
@ -112,12 +107,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
return pixmap; return pixmap;
} }
void void
ImageRegistry::putInCache( const QString& image, ImageRegistry::putInCache( const QString& image, const QSize& size, Calamares::ImageMode mode, const QPixmap& pixmap )
const QSize& size,
CalamaresUtils::ImageMode mode,
const QPixmap& pixmap )
{ {
QHash< qint64, QPixmap > subsubcache; QHash< qint64, QPixmap > subsubcache;
QHash< int, QHash< qint64, QPixmap > > subcache; QHash< int, QHash< qint64, QPixmap > > subcache;

View File

@ -21,13 +21,12 @@ public:
explicit ImageRegistry(); explicit ImageRegistry();
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original ); QIcon icon( const QString& image, Calamares::ImageMode mode = Calamares::Original );
QPixmap QPixmap pixmap( const QString& image, const QSize& size, Calamares::ImageMode mode = Calamares::Original );
pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
private: private:
qint64 cacheKey( const QSize& size ); qint64 cacheKey( const QSize& size );
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, const QPixmap& pixmap ); void putInCache( const QString& image, const QSize& size, Calamares::ImageMode mode, const QPixmap& pixmap );
}; };
#endif // IMAGE_REGISTRY_H #endif // IMAGE_REGISTRY_H

View File

@ -24,7 +24,7 @@
#include <QUrl> #include <QUrl>
#include <QWidget> #include <QWidget>
using namespace CalamaresUtils::Units; using namespace Calamares::Units;
/** @brief Reads the logfile, returns its contents. /** @brief Reads the logfile, returns its contents.
* *
@ -64,7 +64,6 @@ logFileContents( const qint64 sizeLimitBytes )
return pasteSourceFile.read( sizeLimitBytes ); return pasteSourceFile.read( sizeLimitBytes );
} }
STATICTEST QString STATICTEST QString
ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* parent ) ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* parent )
{ {
@ -117,7 +116,7 @@ ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* par
} }
QString QString
CalamaresUtils::Paste::doLogUpload( QObject* parent ) Calamares::Paste::doLogUpload( QObject* parent )
{ {
auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer(); auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer();
if ( !serverUrl.isValid() ) if ( !serverUrl.isValid() )
@ -156,10 +155,10 @@ CalamaresUtils::Paste::doLogUpload( QObject* parent )
} }
QString QString
CalamaresUtils::Paste::doLogUploadUI( QWidget* parent ) Calamares::Paste::doLogUploadUI( QWidget* parent )
{ {
// These strings originated in the ViewManager class // These strings originated in the ViewManager class
QString pasteUrl = CalamaresUtils::Paste::doLogUpload( parent ); QString pasteUrl = Calamares::Paste::doLogUpload( parent );
QString pasteUrlMessage; QString pasteUrlMessage;
if ( pasteUrl.isEmpty() ) if ( pasteUrl.isEmpty() )
{ {
@ -189,9 +188,8 @@ CalamaresUtils::Paste::doLogUploadUI( QWidget* parent )
return pasteUrl; return pasteUrl;
} }
bool bool
CalamaresUtils::Paste::isEnabled() Calamares::Paste::isEnabled()
{ {
auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer(); auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer();
return type != Calamares::Branding::UploadServerType::None && sizeLimitBytes != 0; return type != Calamares::Branding::UploadServerType::None && sizeLimitBytes != 0;

View File

@ -15,7 +15,7 @@
class QObject; class QObject;
class QWidget; class QWidget;
namespace CalamaresUtils namespace Calamares
{ {
namespace Paste namespace Paste
{ {
@ -39,6 +39,6 @@ QString doLogUploadUI( QWidget* parent );
bool isEnabled(); bool isEnabled();
} // namespace Paste } // namespace Paste
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -26,7 +26,7 @@
static QDir s_qmlModulesDir( QString( CMAKE_INSTALL_FULL_DATADIR ) + "/qml" ); static QDir s_qmlModulesDir( QString( CMAKE_INSTALL_FULL_DATADIR ) + "/qml" );
namespace CalamaresUtils namespace Calamares
{ {
QDir QDir
qmlModulesDir() qmlModulesDir()
@ -46,9 +46,9 @@ qmlDirCandidates( bool assumeBuilddir )
static const char QML[] = "qml"; static const char QML[] = "qml";
QStringList qmlDirs; QStringList qmlDirs;
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML ); qmlDirs << Calamares::appDataDir().absoluteFilePath( QML );
} }
else else
{ {
@ -56,12 +56,12 @@ qmlDirCandidates( bool assumeBuilddir )
{ {
qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir
} }
if ( CalamaresUtils::haveExtraDirs() ) if ( Calamares::haveExtraDirs() )
for ( auto s : CalamaresUtils::extraDataDirs() ) for ( auto s : Calamares::extraDataDirs() )
{ {
qmlDirs << ( s + QML ); qmlDirs << ( s + QML );
} }
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML ); qmlDirs << Calamares::appDataDir().absoluteFilePath( QML );
} }
return qmlDirs; return qmlDirs;
@ -79,14 +79,14 @@ initQmlModulesDir()
if ( dir.exists() && dir.isReadable() ) if ( dir.exists() && dir.isReadable() )
{ {
cDebug() << "Using Calamares QML directory" << dir.absolutePath(); cDebug() << "Using Calamares QML directory" << dir.absolutePath();
CalamaresUtils::setQmlModulesDir( dir ); Calamares::setQmlModulesDir( dir );
return true; return true;
} }
} }
cError() << "Cowardly refusing to continue startup without a QML directory." cError() << "Cowardly refusing to continue startup without a QML directory."
<< Logger::DebugList( qmlDirCandidatesByPriority ); << Logger::DebugList( qmlDirCandidatesByPriority );
if ( CalamaresUtils::isAppDataDirOverridden() ) if ( Calamares::isAppDataDirOverridden() )
{ {
cError() << "FATAL: explicitly configured application data directory is missing qml/"; cError() << "FATAL: explicitly configured application data directory is missing qml/";
} }
@ -240,13 +240,13 @@ registerQmlModels()
0, 0,
"Global", "Global",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } ); []( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } );
qmlRegisterSingletonType< Calamares::Network::Manager >( qmlRegisterSingletonType< Calamares::Network::Manager >( "io.calamares.core",
"io.calamares.core", 1,
1, 0,
0, "Network",
"Network", []( QQmlEngine*, QJSEngine* ) -> QObject*
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return &Calamares::Network::Manager::instance(); } ); { return &Calamares::Network::Manager::instance(); } );
} }
} }
} // namespace CalamaresUtils } // namespace Calamares

View File

@ -19,7 +19,7 @@
class QQuickItem; class QQuickItem;
namespace CalamaresUtils namespace Calamares
{ {
/// @brief the extra directory where Calamares searches for QML files /// @brief the extra directory where Calamares searches for QML files
UIDLLEXPORT QDir qmlModulesDir(); UIDLLEXPORT QDir qmlModulesDir();
@ -85,6 +85,6 @@ UIDLLEXPORT QString searchQmlFile( QmlSearch method,
const Calamares::ModuleSystem::InstanceKey& i ); const Calamares::ModuleSystem::InstanceKey& i );
UIDLLEXPORT QString searchQmlFile( QmlSearch method, const QString& fileNameNoSuffix ); UIDLLEXPORT QString searchQmlFile( QmlSearch method, const QString& fileNameNoSuffix );
} // namespace CalamaresUtils } // namespace Calamares
#endif #endif

View File

@ -31,7 +31,7 @@ BlankViewStep::BlankViewStep( const QString& title,
auto* label = new QLabel( title ); auto* label = new QLabel( title );
label->setAlignment( Qt::AlignHCenter ); label->setAlignment( Qt::AlignHCenter );
label->setFont( CalamaresUtils::largeFont() ); label->setFont( Calamares::largeFont() );
layout->addWidget( label ); layout->addWidget( label );
label = new QLabel( description ); label = new QLabel( description );

View File

@ -73,7 +73,7 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
{ {
m_widget->setObjectName( "slideshow" ); m_widget->setObjectName( "slideshow" );
m_progressBar->setObjectName( "exec-progress" ); m_progressBar->setObjectName( "exec-progress" );
m_progressBar->setFormat(tr("%p%", "Progress percentage indicator: %p is where the number 0..100 is placed")); m_progressBar->setFormat( tr( "%p%", "Progress percentage indicator: %p is where the number 0..100 is placed" ) );
m_label->setObjectName( "exec-message" ); m_label->setObjectName( "exec-message" );
QVBoxLayout* layout = new QVBoxLayout( m_widget ); QVBoxLayout* layout = new QVBoxLayout( m_widget );
@ -87,10 +87,10 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
m_tab_widget->tabBar()->hide(); m_tab_widget->tabBar()->hide();
layout->addWidget( m_tab_widget ); layout->addWidget( m_tab_widget );
CalamaresUtils::unmarginLayout( layout ); Calamares::unmarginLayout( layout );
layout->addLayout( bottomLayout ); layout->addLayout( bottomLayout );
bottomLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 ); bottomLayout->addSpacing( Calamares::defaultFontHeight() / 2 );
bottomLayout->addLayout( barLayout ); bottomLayout->addLayout( barLayout );
bottomLayout->addWidget( m_label ); bottomLayout->addWidget( m_label );
@ -104,62 +104,52 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
auto toggleLogButton = dynamic_cast< QToolButton* >( toolBar->widgetForAction( toggleLogAction ) ); auto toggleLogButton = dynamic_cast< QToolButton* >( toolBar->widgetForAction( toggleLogAction ) );
connect( toggleLogButton, &QToolButton::clicked, this, &ExecutionViewStep::toggleLog ); connect( toggleLogButton, &QToolButton::clicked, this, &ExecutionViewStep::toggleLog );
barLayout->addWidget( m_progressBar ); barLayout->addWidget( m_progressBar );
barLayout->addWidget( toolBar ); barLayout->addWidget( toolBar );
connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue ); connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue );
} }
QString QString
ExecutionViewStep::prettyName() const ExecutionViewStep::prettyName() const
{ {
return Calamares::Settings::instance()->isSetupMode() ? tr( "Set up" ) : tr( "Install" ); return Calamares::Settings::instance()->isSetupMode() ? tr( "Set up" ) : tr( "Install" );
} }
QWidget* QWidget*
ExecutionViewStep::widget() ExecutionViewStep::widget()
{ {
return m_widget; return m_widget;
} }
void void
ExecutionViewStep::next() ExecutionViewStep::next()
{ {
} }
void void
ExecutionViewStep::back() ExecutionViewStep::back()
{ {
} }
bool bool
ExecutionViewStep::isNextEnabled() const ExecutionViewStep::isNextEnabled() const
{ {
return false; return false;
} }
bool bool
ExecutionViewStep::isBackEnabled() const ExecutionViewStep::isBackEnabled() const
{ {
return false; return false;
} }
bool bool
ExecutionViewStep::isAtBeginning() const ExecutionViewStep::isAtBeginning() const
{ {
return true; return true;
} }
bool bool
ExecutionViewStep::isAtEnd() const ExecutionViewStep::isAtEnd() const
{ {
@ -206,21 +196,18 @@ ExecutionViewStep::onActivate()
queue->start(); queue->start();
} }
JobList JobList
ExecutionViewStep::jobs() const ExecutionViewStep::jobs() const
{ {
return JobList(); return JobList();
} }
void void
ExecutionViewStep::appendJobModuleInstanceKey( const ModuleSystem::InstanceKey& instanceKey ) ExecutionViewStep::appendJobModuleInstanceKey( const ModuleSystem::InstanceKey& instanceKey )
{ {
m_jobInstanceKeys.append( instanceKey ); m_jobInstanceKeys.append( instanceKey );
} }
void void
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message ) ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
{ {
@ -253,5 +240,4 @@ ExecutionViewStep::onLeave()
m_slideshow->changeSlideShowState( Slideshow::Stop ); m_slideshow->changeSlideShowState( Slideshow::Stop );
} }
} // namespace Calamares } // namespace Calamares

View File

@ -28,7 +28,6 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
/// @brief State-change of the QML, for changeQMLState() /// @brief State-change of the QML, for changeQMLState()
enum class QMLAction enum class QMLAction
{ {
@ -50,7 +49,7 @@ changeQMLState( QMLAction action, QQuickItem* item )
static const char propertyName[] = "activatedInCalamares"; static const char propertyName[] = "activatedInCalamares";
bool activate = action == QMLAction::Start; bool activate = action == QMLAction::Start;
CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" ); Calamares::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
auto property = item->property( propertyName ); auto property = item->property( propertyName );
if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType ) if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType )
@ -69,14 +68,14 @@ QmlViewStep::QmlViewStep( QObject* parent )
, m_spinner( new WaitingWidget( tr( "Loading ..." ) ) ) , m_spinner( new WaitingWidget( tr( "Loading ..." ) ) )
, m_qmlWidget( new QQuickWidget ) , m_qmlWidget( new QQuickWidget )
{ {
CalamaresUtils::registerQmlModels(); Calamares::registerQmlModels();
QVBoxLayout* layout = new QVBoxLayout( m_widget ); QVBoxLayout* layout = new QVBoxLayout( m_widget );
layout->addWidget( m_spinner ); layout->addWidget( m_spinner );
m_qmlWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_qmlWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_qmlWidget->setResizeMode( QQuickWidget::SizeRootObjectToView ); m_qmlWidget->setResizeMode( QQuickWidget::SizeRootObjectToView );
m_qmlWidget->engine()->addImportPath( CalamaresUtils::qmlModulesDir().absolutePath() ); m_qmlWidget->engine()->addImportPath( Calamares::qmlModulesDir().absolutePath() );
// QML Loading starts when the configuration for the module is set. // QML Loading starts when the configuration for the module is set.
} }
@ -90,7 +89,6 @@ QmlViewStep::prettyName() const
return tr( "QML Step <i>%1</i>." ).arg( moduleInstanceKey().module() ); return tr( "QML Step <i>%1</i>." ).arg( moduleInstanceKey().module() );
} }
bool bool
QmlViewStep::isAtBeginning() const QmlViewStep::isAtBeginning() const
{ {
@ -221,19 +219,17 @@ QmlViewStep::showQml()
} }
} }
void void
QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
bool ok = false; bool ok = false;
m_searchMethod m_searchMethod = Calamares::qmlSearchNames().find( Calamares::getString( configurationMap, "qmlSearch" ), ok );
= CalamaresUtils::qmlSearchNames().find( CalamaresUtils::getString( configurationMap, "qmlSearch" ), ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "Bad QML search mode set for" << moduleInstanceKey(); cWarning() << "Bad QML search mode set for" << moduleInstanceKey();
} }
QString qmlFile = CalamaresUtils::getString( configurationMap, "qmlFilename" ); QString qmlFile = Calamares::getString( configurationMap, "qmlFilename" );
if ( !m_qmlComponent ) if ( !m_qmlComponent )
{ {
m_qmlFileName = searchQmlFile( m_searchMethod, qmlFile, moduleInstanceKey() ); m_qmlFileName = searchQmlFile( m_searchMethod, qmlFile, moduleInstanceKey() );

View File

@ -102,7 +102,7 @@ private:
void showFailedQml(); void showFailedQml();
/// @brief Controls where m_name is searched /// @brief Controls where m_name is searched
CalamaresUtils::QmlSearch m_searchMethod; Calamares::QmlSearch m_searchMethod;
QString m_name; QString m_name;
QString m_qmlFileName; QString m_qmlFileName;

View File

@ -47,11 +47,11 @@ SlideshowQML::SlideshowQML( QWidget* parent )
{ {
m_qmlShow->setObjectName( "qml" ); m_qmlShow->setObjectName( "qml" );
CalamaresUtils::registerQmlModels(); Calamares::registerQmlModels();
m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView ); m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView );
m_qmlShow->engine()->addImportPath( CalamaresUtils::qmlModulesDir().absolutePath() ); m_qmlShow->engine()->addImportPath( Calamares::qmlModulesDir().absolutePath() );
cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() ); cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
@ -149,7 +149,6 @@ SlideshowQML::startSlideShow()
changeSlideShowState( Slideshow::Start ); changeSlideShowState( Slideshow::Start );
} }
/* /*
* Applies V1 and V2 QML activation / deactivation: * Applies V1 and V2 QML activation / deactivation:
* - V1 loads the QML in @p widget on activation. Sets root object property * - V1 loads the QML in @p widget on activation. Sets root object property
@ -166,7 +165,7 @@ SlideshowQML::changeSlideShowState( Action state )
if ( Branding::instance()->slideshowAPI() == 2 ) if ( Branding::instance()->slideshowAPI() == 2 )
{ {
// The QML was already loaded in the constructor, need to start it // The QML was already loaded in the constructor, need to start it
CalamaresUtils::callQmlFunction( m_qmlObject, activate ? "onActivate" : "onLeave" ); Calamares::callQmlFunction( m_qmlObject, activate ? "onActivate" : "onLeave" );
} }
else if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() ) else if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() )
{ {
@ -184,7 +183,8 @@ SlideshowQML::changeSlideShowState( Action state )
{ {
static const char propertyName[] = "activatedInCalamares"; static const char propertyName[] = "activatedInCalamares";
auto property = m_qmlObject->property( propertyName ); auto property = m_qmlObject->property( propertyName );
if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType ) && ( property.toBool() != activate ) ) if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType )
&& ( property.toBool() != activate ) )
{ {
m_qmlObject->setProperty( propertyName, activate ); m_qmlObject->setProperty( propertyName, activate );
} }
@ -282,5 +282,4 @@ SlideshowPictures::next()
m_label->setPixmap( QPixmap( m_images.at( m_imageIndex ) ) ); m_label->setPixmap( QPixmap( m_images.at( m_imageIndex ) ) );
} }
} // namespace Calamares } // namespace Calamares

View File

@ -19,7 +19,7 @@
WaitingWidget::WaitingWidget( const QString& text, QWidget* parent ) WaitingWidget::WaitingWidget( const QString& text, QWidget* parent )
: WaitingSpinnerWidget( parent, false, false ) : WaitingSpinnerWidget( parent, false, false )
{ {
int spnrSize = CalamaresUtils::defaultFontHeight() * 4; int spnrSize = Calamares::defaultFontHeight() * 4;
setFixedSize( spnrSize, spnrSize ); setFixedSize( spnrSize, spnrSize );
setInnerRadius( spnrSize / 2 ); setInnerRadius( spnrSize / 2 );
setLineLength( spnrSize / 2 ); setLineLength( spnrSize / 2 );
@ -51,7 +51,7 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q
, d( std::make_unique< Private >( duration, this ) ) , d( std::make_unique< Private >( duration, this ) )
{ {
// Set up the label first for sizing // Set up the label first for sizing
const int labelHeight = qBound( 16, CalamaresUtils::defaultFontHeight() * 3 / 2, 64 ); const int labelHeight = qBound( 16, Calamares::defaultFontHeight() * 3 / 2, 64 );
// Set up the spinner // Set up the spinner
setFixedSize( labelHeight, labelHeight ); setFixedSize( labelHeight, labelHeight );

View File

@ -19,19 +19,16 @@
#include <QPair> #include <QPair>
#include <QString> #include <QString>
namespace CalamaresUtils
{
class CommandList;
} // namespace CalamaresUtils
namespace Calamares namespace Calamares
{ {
class CommandList;
class GlobalStorage; class GlobalStorage;
} // namespace Calamares } // namespace Calamares
struct ValueCheck : public QPair< QString, CalamaresUtils::CommandList* > struct ValueCheck : public QPair< QString, Calamares::CommandList* >
{ {
ValueCheck( const QString& value, CalamaresUtils::CommandList* commands ) ValueCheck( const QString& value, Calamares::CommandList* commands )
: QPair< QString, CalamaresUtils::CommandList* >( value, commands ) : QPair< QString, Calamares::CommandList* >( value, commands )
{ {
} }
@ -44,7 +41,7 @@ struct ValueCheck : public QPair< QString, CalamaresUtils::CommandList* >
// by) pass-by-value in QList::append(). // by) pass-by-value in QList::append().
QString value() const { return first; } QString value() const { return first; }
CalamaresUtils::CommandList* commands() const { return second; } Calamares::CommandList* commands() const { return second; }
}; };
class ContextualProcessBinding class ContextualProcessBinding
@ -65,7 +62,7 @@ public:
* *
* Ownership of the CommandList passes to this binding. * Ownership of the CommandList passes to this binding.
*/ */
void append( const QString& value, CalamaresUtils::CommandList* commands ); void append( const QString& value, Calamares::CommandList* commands );
///@brief The bound variable has @p value , run the associated commands. ///@brief The bound variable has @p value , run the associated commands.
Calamares::JobResult run( const QString& value ) const; Calamares::JobResult run( const QString& value ) const;
@ -81,8 +78,7 @@ public:
private: private:
QString m_variable; QString m_variable;
QList< ValueCheck > m_checks; QList< ValueCheck > m_checks;
CalamaresUtils::CommandList* m_wildcard = nullptr; Calamares::CommandList* m_wildcard = nullptr;
}; };
#endif #endif

View File

@ -20,7 +20,6 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Variant.h" #include "utils/Variant.h"
ContextualProcessBinding::~ContextualProcessBinding() ContextualProcessBinding::~ContextualProcessBinding()
{ {
m_wildcard = nullptr; m_wildcard = nullptr;
@ -31,7 +30,7 @@ ContextualProcessBinding::~ContextualProcessBinding()
} }
void void
ContextualProcessBinding::append( const QString& value, CalamaresUtils::CommandList* commands ) ContextualProcessBinding::append( const QString& value, Calamares::CommandList* commands )
{ {
m_checks.append( ValueCheck( value, commands ) ); m_checks.append( ValueCheck( value, commands ) );
if ( value == QString( "*" ) ) if ( value == QString( "*" ) )
@ -80,7 +79,6 @@ fetch( QString& value, QStringList& selector, int index, const QVariant& v )
} }
} }
bool bool
ContextualProcessBinding::fetch( Calamares::GlobalStorage* storage, QString& value ) const ContextualProcessBinding::fetch( Calamares::GlobalStorage* storage, QString& value ) const
{ {
@ -101,26 +99,22 @@ ContextualProcessBinding::fetch( Calamares::GlobalStorage* storage, QString& val
} }
} }
ContextualProcessJob::ContextualProcessJob( QObject* parent ) ContextualProcessJob::ContextualProcessJob( QObject* parent )
: Calamares::CppJob( parent ) : Calamares::CppJob( parent )
{ {
} }
ContextualProcessJob::~ContextualProcessJob() ContextualProcessJob::~ContextualProcessJob()
{ {
qDeleteAll( m_commands ); qDeleteAll( m_commands );
} }
QString QString
ContextualProcessJob::prettyName() const ContextualProcessJob::prettyName() const
{ {
return tr( "Contextual Processes Job" ); return tr( "Contextual Processes Job" );
} }
Calamares::JobResult Calamares::JobResult
ContextualProcessJob::exec() ContextualProcessJob::exec()
{ {
@ -145,12 +139,11 @@ ContextualProcessJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
void void
ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap ) ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false ); bool dontChroot = Calamares::getBool( configurationMap, "dontChroot", false );
qint64 timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 ); qint64 timeout = Calamares::getInteger( configurationMap, "timeout", 10 );
if ( timeout < 1 ) if ( timeout < 1 )
{ {
timeout = 10; timeout = 10;
@ -183,8 +176,8 @@ ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
continue; continue;
} }
CalamaresUtils::CommandList* commands Calamares::CommandList* commands
= new CalamaresUtils::CommandList( valueiter.value(), !dontChroot, std::chrono::seconds( timeout ) ); = new Calamares::CommandList( valueiter.value(), !dontChroot, std::chrono::seconds( timeout ) );
binding->append( valueString, commands ); binding->append( valueString, commands );
} }

View File

@ -26,7 +26,7 @@
QTEST_GUILESS_MAIN( ContextualProcessTests ) QTEST_GUILESS_MAIN( ContextualProcessTests )
using CommandList = CalamaresUtils::CommandList; using CommandList = Calamares::CommandList;
ContextualProcessTests::ContextualProcessTests() {} ContextualProcessTests::ContextualProcessTests() {}
@ -38,7 +38,7 @@ ContextualProcessTests::initTestCase()
Logger::setupLogLevel( Logger::LOGDEBUG ); Logger::setupLogLevel( Logger::LOGDEBUG );
// Ensure we have a system object, expect it to be a "bogus" one // Ensure we have a system object, expect it to be a "bogus" one
CalamaresUtils::System* system = CalamaresUtils::System::instance(); Calamares::System* system = Calamares::System::instance();
QVERIFY( system ); QVERIFY( system );
QVERIFY( system->doChroot() ); QVERIFY( system->doChroot() );
@ -70,7 +70,7 @@ ContextualProcessTests::testProcessListSampleConfig()
} }
ContextualProcessJob job; ContextualProcessJob job;
job.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc ) ); job.setConfigurationMap( Calamares::YAML::mapToVariant( doc ) );
QCOMPARE( job.count(), 2 ); // Only "firmwareType" and "branding.shortVersion" QCOMPARE( job.count(), 2 ); // Only "firmwareType" and "branding.shortVersion"
QCOMPARE( job.count( "firmwareType" ), 4 ); QCOMPARE( job.count( "firmwareType" ), 4 );

View File

@ -27,22 +27,18 @@ DummyCppJob::DummyCppJob( QObject* parent )
{ {
} }
DummyCppJob::~DummyCppJob() {} DummyCppJob::~DummyCppJob() {}
QString QString
DummyCppJob::prettyName() const DummyCppJob::prettyName() const
{ {
return tr( "Dummy C++ Job" ); return tr( "Dummy C++ Job" );
} }
static QString variantListToString( const QVariantList& variantList ); static QString variantListToString( const QVariantList& variantList );
static QString variantMapToString( const QVariantMap& variantMap ); static QString variantMapToString( const QVariantMap& variantMap );
static QString variantHashToString( const QVariantHash& variantHash ); static QString variantHashToString( const QVariantHash& variantHash );
static QString static QString
variantToString( const QVariant& variant ) variantToString( const QVariant& variant )
{ {
@ -65,7 +61,6 @@ variantToString( const QVariant& variant )
} }
} }
static QString static QString
variantListToString( const QVariantList& variantList ) variantListToString( const QVariantList& variantList )
{ {
@ -77,7 +72,6 @@ variantListToString( const QVariantList& variantList )
return '{' + result.join( ',' ) + '}'; return '{' + result.join( ',' ) + '}';
} }
static QString static QString
variantMapToString( const QVariantMap& variantMap ) variantMapToString( const QVariantMap& variantMap )
{ {
@ -89,7 +83,6 @@ variantMapToString( const QVariantMap& variantMap )
return '[' + result.join( ',' ) + ']'; return '[' + result.join( ',' ) + ']';
} }
static QString static QString
variantHashToString( const QVariantHash& variantHash ) variantHashToString( const QVariantHash& variantHash )
{ {
@ -101,15 +94,14 @@ variantHashToString( const QVariantHash& variantHash )
return '<' + result.join( ',' ) + '>'; return '<' + result.join( ',' ) + '>';
} }
Calamares::JobResult Calamares::JobResult
DummyCppJob::exec() DummyCppJob::exec()
{ {
// Ported from dummypython // Ported from dummypython
CalamaresUtils::System::runCommand( CalamaresUtils::System::RunLocation::RunInHost, Calamares::System::runCommand( Calamares::System::RunLocation::RunInHost,
QStringList() << "/bin/sh" QStringList() << "/bin/sh"
<< "-c" << "-c"
<< "touch ~/calamares-dummycpp" ); << "touch ~/calamares-dummycpp" );
QString accumulator = QDateTime::currentDateTimeUtc().toString( Qt::ISODate ) + '\n'; QString accumulator = QDateTime::currentDateTimeUtc().toString( Qt::ISODate ) + '\n';
accumulator += QStringLiteral( "Calamares version: " ) + CALAMARES_VERSION_SHORT + '\n'; accumulator += QStringLiteral( "Calamares version: " ) + CALAMARES_VERSION_SHORT + '\n';
accumulator += QStringLiteral( "This job's name: " ) + prettyName() + '\n'; accumulator += QStringLiteral( "This job's name: " ) + prettyName() + '\n';
@ -141,7 +133,6 @@ DummyCppJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
void void
DummyCppJob::setConfigurationMap( const QVariantMap& configurationMap ) DummyCppJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {

View File

@ -34,7 +34,6 @@ restartModes()
return table; return table;
} }
Config::Config( QObject* parent ) Config::Config( QObject* parent )
: QObject( parent ) : QObject( parent )
{ {
@ -107,7 +106,6 @@ Config::onInstallationFailed( const QString& message, const QString& details )
} }
} }
void void
Config::doRestart( bool restartAnyway ) Config::doRestart( bool restartAnyway )
{ {
@ -120,7 +118,6 @@ Config::doRestart( bool restartAnyway )
} }
} }
void void
Config::doNotify( bool hasFailed, bool sendAnyway ) Config::doNotify( bool hasFailed, bool sendAnyway )
{ {
@ -176,14 +173,13 @@ Config::doNotify( bool hasFailed, bool sendAnyway )
} }
} }
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
RestartMode mode = RestartMode::Never; RestartMode mode = RestartMode::Never;
//TODO:3.3 remove deprecated restart settings //TODO:3.3 remove deprecated restart settings
QString restartMode = CalamaresUtils::getString( configurationMap, "restartNowMode" ); QString restartMode = Calamares::getString( configurationMap, "restartNowMode" );
if ( restartMode.isEmpty() ) if ( restartMode.isEmpty() )
{ {
if ( configurationMap.contains( "restartNowEnabled" ) ) if ( configurationMap.contains( "restartNowEnabled" ) )
@ -191,8 +187,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings"; cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings";
} }
bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false ); bool restartNowEnabled = Calamares::getBool( configurationMap, "restartNowEnabled", false );
bool restartNowChecked = CalamaresUtils::getBool( configurationMap, "restartNowChecked", false ); bool restartNowChecked = Calamares::getBool( configurationMap, "restartNowChecked", false );
if ( !restartNowEnabled ) if ( !restartNowEnabled )
{ {
@ -220,7 +216,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
if ( mode != RestartMode::Never ) if ( mode != RestartMode::Never )
{ {
QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" ); QString restartNowCommand = Calamares::getString( configurationMap, "restartNowCommand" );
if ( restartNowCommand.isEmpty() ) if ( restartNowCommand.isEmpty() )
{ {
restartNowCommand = QStringLiteral( "shutdown -r now" ); restartNowCommand = QStringLiteral( "shutdown -r now" );
@ -228,5 +224,5 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
m_restartNowCommand = restartNowCommand; m_restartNowCommand = restartNowCommand;
} }
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false ); m_notifyOnFinished = Calamares::getBool( configurationMap, "notifyOnFinished", false );
} }

View File

@ -35,10 +35,8 @@ ResizeFSJob::ResizeFSJob( QObject* parent )
{ {
} }
ResizeFSJob::~ResizeFSJob() {} ResizeFSJob::~ResizeFSJob() {}
QString QString
ResizeFSJob::prettyName() const ResizeFSJob::prettyName() const
{ {
@ -155,7 +153,6 @@ ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m )
return last_available; return last_available;
} }
Calamares::JobResult Calamares::JobResult
ResizeFSJob::exec() ResizeFSJob::exec()
{ {
@ -230,7 +227,6 @@ ResizeFSJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
void void
ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap ) ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {
@ -246,7 +242,7 @@ ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap )
m_size = PartitionSize( configurationMap[ "size" ].toString() ); m_size = PartitionSize( configurationMap[ "size" ].toString() );
m_atleast = PartitionSize( configurationMap[ "atleast" ].toString() ); m_atleast = PartitionSize( configurationMap[ "atleast" ].toString() );
m_required = CalamaresUtils::getBool( configurationMap, "required", false ); m_required = Calamares::getBool( configurationMap, "required", false );
} }
CALAMARES_PLUGIN_FACTORY_DEFINITION( ResizeFSJobFactory, registerPlugin< ResizeFSJob >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( ResizeFSJobFactory, registerPlugin< ResizeFSJob >(); )

View File

@ -49,10 +49,10 @@ FSResizerTests::testConfigurationRobust()
// Config is missing fs and dev, so it isn't valid // Config is missing fs and dev, so it isn't valid
YAML::Node doc0 = YAML::Load( R"(--- YAML::Node doc0 = YAML::Load( R"(---
size: 100% size: 100%
atleast: 600MiB atleast: 600MiB
)" ); )" );
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
QVERIFY( j.name().isEmpty() ); QVERIFY( j.name().isEmpty() );
QCOMPARE( j.size().unit(), SizeUnit::None ); QCOMPARE( j.size().unit(), SizeUnit::None );
QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None );
@ -67,11 +67,11 @@ FSResizerTests::testConfigurationValues()
// Check both // Check both
YAML::Node doc0 = YAML::Load( R"(--- YAML::Node doc0 = YAML::Load( R"(---
fs: / fs: /
size: 100% size: 100%
atleast: 600MiB atleast: 600MiB
)" ); )" );
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
QVERIFY( !j.name().isEmpty() ); QVERIFY( !j.name().isEmpty() );
QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.name(), QString( "/" ) );
QCOMPARE( j.size().unit(), SizeUnit::Percent ); QCOMPARE( j.size().unit(), SizeUnit::Percent );
@ -81,12 +81,12 @@ atleast: 600MiB
// Silly config has bad atleast value // Silly config has bad atleast value
doc0 = YAML::Load( R"(--- doc0 = YAML::Load( R"(---
fs: / fs: /
dev: /dev/m00 dev: /dev/m00
size: 72 MiB size: 72 MiB
atleast: 127 % atleast: 127 %
)" ); )" );
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
QVERIFY( !j.name().isEmpty() ); QVERIFY( !j.name().isEmpty() );
QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.name(), QString( "/" ) );
QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.size().unit(), SizeUnit::MiB );
@ -96,11 +96,11 @@ atleast: 127 %
// Silly config has bad atleast value // Silly config has bad atleast value
doc0 = YAML::Load( R"(--- doc0 = YAML::Load( R"(---
dev: /dev/m00 dev: /dev/m00
size: 72 MiB size: 72 MiB
atleast: 127 % atleast: 127 %
)" ); )" );
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
QVERIFY( !j.name().isEmpty() ); QVERIFY( !j.name().isEmpty() );
QCOMPARE( j.name(), QString( "/dev/m00" ) ); QCOMPARE( j.name(), QString( "/dev/m00" ) );
QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.size().unit(), SizeUnit::MiB );
@ -110,12 +110,12 @@ atleast: 127 %
// Normal config // Normal config
doc0 = YAML::Load( R"(--- doc0 = YAML::Load( R"(---
fs: / fs: /
# dev: /dev/m00 # dev: /dev/m00
size: 71MiB size: 71MiB
# atleast: 127% # atleast: 127%
)" ); )" );
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
QVERIFY( !j.name().isEmpty() ); QVERIFY( !j.name().isEmpty() );
QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.name(), QString( "/" ) );
QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.size().unit(), SizeUnit::MiB );

View File

@ -35,7 +35,6 @@ HostInfoJob::HostInfoJob( QObject* parent )
HostInfoJob::~HostInfoJob() {} HostInfoJob::~HostInfoJob() {}
QString QString
HostInfoJob::prettyName() const HostInfoJob::prettyName() const
{ {
@ -172,7 +171,6 @@ hostCPU()
#endif #endif
} }
Calamares::JobResult Calamares::JobResult
HostInfoJob::exec() HostInfoJob::exec()
{ {
@ -184,7 +182,7 @@ HostInfoJob::exec()
gs->insert( "hostCPU", hostCPU() ); gs->insert( "hostCPU", hostCPU() );
// Memory can't be negative, so it's reported as unsigned long. // Memory can't be negative, so it's reported as unsigned long.
auto ram = CalamaresUtils::BytesToMiB( qint64( CalamaresUtils::System::instance()->getTotalMemoryB().first ) ); auto ram = Calamares::BytesToMiB( qint64( Calamares::System::instance()->getTotalMemoryB().first ) );
if ( ram ) if ( ram )
{ {
gs->insert( "hostRAMMiB", ram ); gs->insert( "hostRAMMiB", ram );

View File

@ -25,7 +25,6 @@ InitcpioJob::InitcpioJob( QObject* parent )
InitcpioJob::~InitcpioJob() {} InitcpioJob::~InitcpioJob() {}
QString QString
InitcpioJob::prettyName() const InitcpioJob::prettyName() const
{ {
@ -56,7 +55,7 @@ fixPermissions( const QDir& d )
Calamares::JobResult Calamares::JobResult
InitcpioJob::exec() InitcpioJob::exec()
{ {
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe ); Calamares::UMask m( Calamares::UMask::Safe );
if ( m_unsafe ) if ( m_unsafe )
{ {
@ -64,7 +63,7 @@ InitcpioJob::exec()
} }
else else
{ {
QDir d( CalamaresUtils::System::instance()->targetPath( "/boot" ) ); QDir d( Calamares::System::instance()->targetPath( "/boot" ) );
if ( d.exists() ) if ( d.exists() )
{ {
fixPermissions( d ); fixPermissions( d );
@ -83,16 +82,16 @@ InitcpioJob::exec()
} }
cDebug() << "Updating initramfs with kernel" << m_kernel; cDebug() << "Updating initramfs with kernel" << m_kernel;
auto r = CalamaresUtils::System::instance()->targetEnvCommand( command, QString(), QString() /* no timeout , 0 */ ); auto r = Calamares::System::instance()->targetEnvCommand( command, QString(), QString() /* no timeout , 0 */ );
return r.explainProcess( "mkinitcpio", std::chrono::seconds( 10 ) /* fake timeout */ ); return r.explainProcess( "mkinitcpio", std::chrono::seconds( 10 ) /* fake timeout */ );
} }
void void
InitcpioJob::setConfigurationMap( const QVariantMap& configurationMap ) InitcpioJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_kernel = CalamaresUtils::getString( configurationMap, "kernel" ); m_kernel = Calamares::getString( configurationMap, "kernel" );
m_unsafe = CalamaresUtils::getBool( configurationMap, "be_unsafe", false ); m_unsafe = Calamares::getBool( configurationMap, "be_unsafe", false );
} }
CALAMARES_PLUGIN_FACTORY_DEFINITION( InitcpioJobFactory, registerPlugin< InitcpioJob >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( InitcpioJobFactory, registerPlugin< InitcpioJob >(); )

View File

@ -21,18 +21,16 @@ InitramfsJob::InitramfsJob( QObject* parent )
InitramfsJob::~InitramfsJob() {} InitramfsJob::~InitramfsJob() {}
QString QString
InitramfsJob::prettyName() const InitramfsJob::prettyName() const
{ {
return tr( "Creating initramfs." ); return tr( "Creating initramfs." );
} }
Calamares::JobResult Calamares::JobResult
InitramfsJob::exec() InitramfsJob::exec()
{ {
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe ); Calamares::UMask m( Calamares::UMask::Safe );
cDebug() << "Updating initramfs with kernel" << m_kernel; cDebug() << "Updating initramfs with kernel" << m_kernel;
@ -45,7 +43,7 @@ InitramfsJob::exec()
// First make sure we generate a safe initramfs with suitable permissions. // First make sure we generate a safe initramfs with suitable permissions.
static const char confFile[] = "/etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf"; static const char confFile[] = "/etc/initramfs-tools/conf.d/calamares-safe-initramfs.conf";
static const char contents[] = "UMASK=0077\n"; static const char contents[] = "UMASK=0077\n";
if ( CalamaresUtils::System::instance()->createTargetFile( confFile, QByteArray( contents ) ).failed() ) if ( Calamares::System::instance()->createTargetFile( confFile, QByteArray( contents ) ).failed() )
{ {
cWarning() << Logger::SubEntry << "Could not configure safe UMASK for initramfs."; cWarning() << Logger::SubEntry << "Could not configure safe UMASK for initramfs.";
// But continue anyway. // But continue anyway.
@ -53,27 +51,26 @@ InitramfsJob::exec()
} }
// And then do the ACTUAL work. // And then do the ACTUAL work.
auto r = CalamaresUtils::System::instance()->targetEnvCommand( auto r = Calamares::System::instance()->targetEnvCommand(
{ "update-initramfs", "-k", m_kernel, "-c", "-t" }, QString(), QString() /* no timeout, 0 */ ); { "update-initramfs", "-k", m_kernel, "-c", "-t" }, QString(), QString() /* no timeout, 0 */ );
return r.explainProcess( "update-initramfs", std::chrono::seconds( 10 ) /* fake timeout */ ); return r.explainProcess( "update-initramfs", std::chrono::seconds( 10 ) /* fake timeout */ );
} }
void void
InitramfsJob::setConfigurationMap( const QVariantMap& configurationMap ) InitramfsJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_kernel = CalamaresUtils::getString( configurationMap, "kernel" ); m_kernel = Calamares::getString( configurationMap, "kernel" );
if ( m_kernel.isEmpty() ) if ( m_kernel.isEmpty() )
{ {
m_kernel = QStringLiteral( "all" ); m_kernel = QStringLiteral( "all" );
} }
else if ( m_kernel == "$uname" ) else if ( m_kernel == "$uname" )
{ {
auto r = CalamaresUtils::System::runCommand( CalamaresUtils::System::RunLocation::RunInHost, auto r = Calamares::System::runCommand( Calamares::System::RunLocation::RunInHost,
{ "/bin/uname", "-r" }, { "/bin/uname", "-r" },
QString(), QString(),
QString(), QString(),
std::chrono::seconds( 3 ) ); std::chrono::seconds( 3 ) );
if ( r.getExitCode() == 0 ) if ( r.getExitCode() == 0 )
{ {
m_kernel = r.getOutput(); m_kernel = r.getOutput();
@ -87,7 +84,7 @@ InitramfsJob::setConfigurationMap( const QVariantMap& configurationMap )
} }
} }
m_unsafe = CalamaresUtils::getBool( configurationMap, "be_unsafe", false ); m_unsafe = Calamares::getBool( configurationMap, "be_unsafe", false );
} }
CALAMARES_PLUGIN_FACTORY_DEFINITION( InitramfsJobFactory, registerPlugin< InitramfsJob >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( InitramfsJobFactory, registerPlugin< InitramfsJob >(); )

View File

@ -34,7 +34,7 @@ InitramfsTests::initTestCase()
Logger::setupLogLevel( Logger::LOGDEBUG ); Logger::setupLogLevel( Logger::LOGDEBUG );
(void)new Calamares::JobQueue(); (void)new Calamares::JobQueue();
(void)new CalamaresUtils::System( true ); (void)new Calamares::System( true );
} }
static const char contents[] = "UMASK=0077\n"; static const char contents[] = "UMASK=0077\n";
@ -51,7 +51,7 @@ InitramfsTests::testCreateTargetFile()
{ {
static const char short_confFile[] = "/calamares-safe-umask"; static const char short_confFile[] = "/calamares-safe-umask";
auto* s = CalamaresUtils::System::instance(); auto* s = Calamares::System::instance();
auto r = s->createTargetFile( short_confFile, QByteArray( contents ) ); auto r = s->createTargetFile( short_confFile, QByteArray( contents ) );
QVERIFY( r.failed() ); QVERIFY( r.failed() );
QVERIFY( !r ); QVERIFY( !r );

View File

@ -43,7 +43,6 @@ xkbmap_model_args( const QString& model )
return r; return r;
} }
/* Returns stringlist with suitable setxkbmap command-line arguments /* Returns stringlist with suitable setxkbmap command-line arguments
* to set the given @p layout and @p variant. * to set the given @p layout and @p variant.
*/ */
@ -213,7 +212,10 @@ Config::Config( QObject* parent )
connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, this, &Config::selectionChange ); connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, this, &Config::selectionChange );
connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, this, &Config::selectionChange ); connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, this, &Config::selectionChange );
connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, this, &Config::selectionChange ); connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, this, &Config::selectionChange );
connect( m_KeyboardGroupSwitcherModel, &KeyboardGroupsSwitchersModel::currentIndexChanged, this, &Config::selectionChange ); connect( m_KeyboardGroupSwitcherModel,
&KeyboardGroupsSwitchersModel::currentIndexChanged,
this,
&Config::selectionChange );
m_selectedModel = m_keyboardModelsModel->key( m_keyboardModelsModel->currentIndex() ); m_selectedModel = m_keyboardModelsModel->key( m_keyboardModelsModel->currentIndex() );
m_selectedLayout = m_keyboardLayoutsModel->item( m_keyboardLayoutsModel->currentIndex() ).first; m_selectedLayout = m_keyboardLayoutsModel->item( m_keyboardLayoutsModel->currentIndex() ).first;
@ -306,7 +308,6 @@ Config::xkbApply()
{ m_additionalLayoutInfo.additionalVariant, m_selectedVariant }, { m_additionalLayoutInfo.additionalVariant, m_selectedVariant },
m_additionalLayoutInfo.groupSwitcher ) ); m_additionalLayoutInfo.groupSwitcher ) );
cDebug() << "xkbmap selection changed to: " << m_selectedLayout << '-' << m_selectedVariant << "(added " cDebug() << "xkbmap selection changed to: " << m_selectedLayout << '-' << m_selectedVariant << "(added "
<< m_additionalLayoutInfo.additionalLayout << "-" << m_additionalLayoutInfo.additionalVariant << m_additionalLayoutInfo.additionalLayout << "-" << m_additionalLayoutInfo.additionalVariant
<< " since current layout is not ASCII-capable)"; << " since current layout is not ASCII-capable)";
@ -319,7 +320,6 @@ Config::xkbApply()
m_setxkbmapTimer.disconnect( this ); m_setxkbmapTimer.disconnect( this );
} }
KeyboardModelsModel* KeyboardModelsModel*
Config::keyboardModels() const Config::keyboardModels() const
{ {
@ -706,7 +706,7 @@ Config::updateVariants( const QPersistentModelIndex& currentItem, QString curren
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
using namespace CalamaresUtils; using namespace Calamares;
bool isX11 = QGuiApplication::platformName() == "xcb"; bool isX11 = QGuiApplication::platformName() == "xcb";
const auto xorgConfDefault = QStringLiteral( "00-keyboard.conf" ); const auto xorgConfDefault = QStringLiteral( "00-keyboard.conf" );

View File

@ -27,11 +27,9 @@ retranslateKeyboardModels()
{ {
s_kbtranslator = new QTranslator; s_kbtranslator = new QTranslator;
} }
(void)CalamaresUtils::loadTranslator( (void)Calamares::loadTranslator( Calamares::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator );
CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator );
} }
XKBListModel::XKBListModel( QObject* parent ) XKBListModel::XKBListModel( QObject* parent )
: QAbstractListModel( parent ) : QAbstractListModel( parent )
{ {
@ -141,7 +139,6 @@ KeyboardModelsModel::KeyboardModelsModel( QObject* parent )
setCurrentIndex(); // If pc105 was seen, select it now setCurrentIndex(); // If pc105 was seen, select it now
} }
KeyboardLayoutModel::KeyboardLayoutModel( QObject* parent ) KeyboardLayoutModel::KeyboardLayoutModel( QObject* parent )
: QAbstractListModel( parent ) : QAbstractListModel( parent )
{ {
@ -155,7 +152,6 @@ KeyboardLayoutModel::rowCount( const QModelIndex& parent ) const
return m_layouts.count(); return m_layouts.count();
} }
QVariant QVariant
KeyboardLayoutModel::data( const QModelIndex& index, int role ) const KeyboardLayoutModel::data( const QModelIndex& index, int role ) const
{ {
@ -252,7 +248,6 @@ KeyboardLayoutModel::currentIndex() const
return m_currentIndex; return m_currentIndex;
} }
KeyboardVariantsModel::KeyboardVariantsModel( QObject* parent ) KeyboardVariantsModel::KeyboardVariantsModel( QObject* parent )
: XKBListModel( parent ) : XKBListModel( parent )
{ {

View File

@ -67,8 +67,8 @@ LicenseEntry::LicenseEntry( const QVariantMap& conf )
m_prettyVendor = conf.value( "vendor" ).toString(); m_prettyVendor = conf.value( "vendor" ).toString();
m_url = QUrl( conf[ "url" ].toString() ); m_url = QUrl( conf[ "url" ].toString() );
m_required = CalamaresUtils::getBool( conf, "required", false ); m_required = Calamares::getBool( conf, "required", false );
m_expand = CalamaresUtils::getBool( conf, "expand", false ); m_expand = Calamares::getBool( conf, "expand", false );
bool ok = false; bool ok = false;
QString typeString = conf.value( "type", "software" ).toString(); QString typeString = conf.value( "type", "software" ).toString();
@ -85,7 +85,6 @@ LicenseEntry::isLocal() const
return m_url.isLocalFile(); return m_url.isLocalFile();
} }
LicensePage::LicensePage( QWidget* parent ) LicensePage::LicensePage( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
, m_isNextEnabled( false ) , m_isNextEnabled( false )
@ -94,14 +93,14 @@ LicensePage::LicensePage( QWidget* parent )
{ {
ui->setupUi( this ); ui->setupUi( this );
// ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() ); // ui->verticalLayout->insertSpacing( 1, Calamares::defaultFontHeight() );
CalamaresUtils::unmarginLayout( ui->verticalLayout ); Calamares::unmarginLayout( ui->verticalLayout );
ui->acceptFrame->setStyleSheet( mustAccept ); ui->acceptFrame->setStyleSheet( mustAccept );
{ {
// The inner frame was unmargined (above), reinstate margins so all are // The inner frame was unmargined (above), reinstate margins so all are
// the same *x* (an x-height, approximately). // the same *x* (an x-height, approximately).
const auto x = CalamaresUtils::defaultFontHeight() / 2; const auto x = Calamares::defaultFontHeight() / 2;
ui->acceptFrame->layout()->setContentsMargins( x, x, x, x ); ui->acceptFrame->layout()->setContentsMargins( x, x, x, x );
} }
@ -172,7 +171,6 @@ LicensePage::retranslate()
} }
} }
bool bool
LicensePage::isNextEnabled() const LicensePage::isNextEnabled() const
{ {

View File

@ -395,7 +395,6 @@ Config::currentTimezoneName() const
return QString(); return QString();
} }
static inline QString static inline QString
localeLabel( const QString& s ) localeLabel( const QString& s )
{ {
@ -429,7 +428,7 @@ Config::prettyStatus() const
static inline void static inline void
getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLines ) getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLines )
{ {
QString localeGenPath = CalamaresUtils::getString( configurationMap, "localeGenPath" ); QString localeGenPath = Calamares::getString( configurationMap, "localeGenPath" );
if ( localeGenPath.isEmpty() ) if ( localeGenPath.isEmpty() )
{ {
localeGenPath = QStringLiteral( "/etc/locale.gen" ); localeGenPath = QStringLiteral( "/etc/locale.gen" );
@ -440,8 +439,8 @@ getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLi
static inline void static inline void
getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTimezone ) getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTimezone )
{ {
adjustLiveTimezone = CalamaresUtils::getBool( adjustLiveTimezone
configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() ); = Calamares::getBool( configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
#ifdef DEBUG_TIMEZONES #ifdef DEBUG_TIMEZONES
if ( adjustLiveTimezone ) if ( adjustLiveTimezone )
{ {
@ -461,8 +460,8 @@ getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTime
static inline void static inline void
getStartingTimezone( const QVariantMap& configurationMap, Calamares::GeoIP::RegionZonePair& startingTimezone ) getStartingTimezone( const QVariantMap& configurationMap, Calamares::GeoIP::RegionZonePair& startingTimezone )
{ {
QString region = CalamaresUtils::getString( configurationMap, "region" ); QString region = Calamares::getString( configurationMap, "region" );
QString zone = CalamaresUtils::getString( configurationMap, "zone" ); QString zone = Calamares::getString( configurationMap, "zone" );
if ( !region.isEmpty() && !zone.isEmpty() ) if ( !region.isEmpty() && !zone.isEmpty() )
{ {
startingTimezone = Calamares::GeoIP::RegionZonePair( region, zone ); startingTimezone = Calamares::GeoIP::RegionZonePair( region, zone );
@ -473,7 +472,7 @@ getStartingTimezone( const QVariantMap& configurationMap, Calamares::GeoIP::Regi
= Calamares::GeoIP::RegionZonePair( QStringLiteral( "America" ), QStringLiteral( "New_York" ) ); = Calamares::GeoIP::RegionZonePair( QStringLiteral( "America" ), QStringLiteral( "New_York" ) );
} }
if ( CalamaresUtils::getBool( configurationMap, "useSystemTimezone", false ) ) if ( Calamares::getBool( configurationMap, "useSystemTimezone", false ) )
{ {
auto systemtz = Calamares::GeoIP::splitTZString( QTimeZone::systemTimeZoneId() ); auto systemtz = Calamares::GeoIP::splitTZString( QTimeZone::systemTimeZoneId() );
if ( systemtz.isValid() ) if ( systemtz.isValid() )
@ -488,12 +487,12 @@ static inline void
getGeoIP( const QVariantMap& configurationMap, std::unique_ptr< Calamares::GeoIP::Handler >& geoip ) getGeoIP( const QVariantMap& configurationMap, std::unique_ptr< Calamares::GeoIP::Handler >& geoip )
{ {
bool ok = false; bool ok = false;
QVariantMap map = CalamaresUtils::getSubMap( configurationMap, "geoip", ok ); QVariantMap map = Calamares::getSubMap( configurationMap, "geoip", ok );
if ( ok ) if ( ok )
{ {
QString url = CalamaresUtils::getString( map, "url" ); QString url = Calamares::getString( map, "url" );
QString style = CalamaresUtils::getString( map, "style" ); QString style = Calamares::getString( map, "style" );
QString selector = CalamaresUtils::getString( map, "selector" ); QString selector = Calamares::getString( map, "selector" );
geoip = std::make_unique< Calamares::GeoIP::Handler >( style, url, selector ); geoip = std::make_unique< Calamares::GeoIP::Handler >( style, url, selector );
if ( !geoip->isValid() ) if ( !geoip->isValid() )
@ -543,7 +542,6 @@ Config::finalizeGlobalStorage() const
updateGSLocation( gs, currentLocation() ); updateGSLocation( gs, currentLocation() );
} }
void void
Config::startGeoIP() Config::startGeoIP()
{ {

View File

@ -25,7 +25,6 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QLabel> #include <QLabel>
CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin< LocaleViewStep >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin< LocaleViewStep >(); )
LocaleViewStep::LocaleViewStep( QObject* parent ) LocaleViewStep::LocaleViewStep( QObject* parent )
@ -37,12 +36,11 @@ LocaleViewStep::LocaleViewStep( QObject* parent )
{ {
QBoxLayout* mainLayout = new QHBoxLayout; QBoxLayout* mainLayout = new QHBoxLayout;
m_widget->setLayout( mainLayout ); m_widget->setLayout( mainLayout );
CalamaresUtils::unmarginLayout( mainLayout ); Calamares::unmarginLayout( mainLayout );
emit nextStatusChanged( m_nextEnabled ); emit nextStatusChanged( m_nextEnabled );
} }
LocaleViewStep::~LocaleViewStep() LocaleViewStep::~LocaleViewStep()
{ {
if ( m_widget && m_widget->parent() == nullptr ) if ( m_widget && m_widget->parent() == nullptr )
@ -51,7 +49,6 @@ LocaleViewStep::~LocaleViewStep()
} }
} }
void void
LocaleViewStep::setUpPage() LocaleViewStep::setUpPage()
{ {
@ -68,63 +65,54 @@ LocaleViewStep::setUpPage()
emit nextStatusChanged( m_nextEnabled ); emit nextStatusChanged( m_nextEnabled );
} }
QString QString
LocaleViewStep::prettyName() const LocaleViewStep::prettyName() const
{ {
return tr( "Location" ); return tr( "Location" );
} }
QString QString
LocaleViewStep::prettyStatus() const LocaleViewStep::prettyStatus() const
{ {
return m_config->prettyStatus(); return m_config->prettyStatus();
} }
QWidget* QWidget*
LocaleViewStep::widget() LocaleViewStep::widget()
{ {
return m_widget; return m_widget;
} }
bool bool
LocaleViewStep::isNextEnabled() const LocaleViewStep::isNextEnabled() const
{ {
return m_nextEnabled; return m_nextEnabled;
} }
bool bool
LocaleViewStep::isBackEnabled() const LocaleViewStep::isBackEnabled() const
{ {
return true; return true;
} }
bool bool
LocaleViewStep::isAtBeginning() const LocaleViewStep::isAtBeginning() const
{ {
return true; return true;
} }
bool bool
LocaleViewStep::isAtEnd() const LocaleViewStep::isAtEnd() const
{ {
return true; return true;
} }
Calamares::JobList Calamares::JobList
LocaleViewStep::jobs() const LocaleViewStep::jobs() const
{ {
return m_config->createJobs(); return m_config->createJobs();
} }
void void
LocaleViewStep::onActivate() LocaleViewStep::onActivate()
{ {
@ -136,14 +124,12 @@ LocaleViewStep::onActivate()
m_actualWidget->onActivate(); m_actualWidget->onActivate();
} }
void void
LocaleViewStep::onLeave() LocaleViewStep::onLeave()
{ {
m_config->finalizeGlobalStorage(); m_config->finalizeGlobalStorage();
} }
void void
LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap ) LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {

View File

@ -19,7 +19,6 @@
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
SetTimezoneJob::SetTimezoneJob( const QString& region, const QString& zone ) SetTimezoneJob::SetTimezoneJob( const QString& region, const QString& zone )
: Calamares::Job() : Calamares::Job()
, m_region( region ) , m_region( region )
@ -27,14 +26,12 @@ SetTimezoneJob::SetTimezoneJob( const QString& region, const QString& zone )
{ {
} }
QString QString
SetTimezoneJob::prettyName() const SetTimezoneJob::prettyName() const
{ {
return tr( "Set timezone to %1/%2" ).arg( m_region ).arg( m_zone ); return tr( "Set timezone to %1/%2" ).arg( m_region ).arg( m_zone );
} }
Calamares::JobResult Calamares::JobResult
SetTimezoneJob::exec() SetTimezoneJob::exec()
{ {
@ -42,7 +39,7 @@ SetTimezoneJob::exec()
// to a running timedated over D-Bus), and we have code that works // to a running timedated over D-Bus), and we have code that works
if ( !Calamares::Settings::instance()->doChroot() ) if ( !Calamares::Settings::instance()->doChroot() )
{ {
int ec = CalamaresUtils::System::instance()->targetEnvCall( int ec = Calamares::System::instance()->targetEnvCall(
{ "timedatectl", "set-timezone", m_region + '/' + m_zone } ); { "timedatectl", "set-timezone", m_region + '/' + m_zone } );
if ( !ec ) if ( !ec )
@ -63,9 +60,9 @@ SetTimezoneJob::exec()
tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) ); tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) );
// Make sure /etc/localtime doesn't exist, otherwise symlinking will fail // Make sure /etc/localtime doesn't exist, otherwise symlinking will fail
CalamaresUtils::System::instance()->targetEnvCall( { "rm", "-f", localtimeSlink } ); Calamares::System::instance()->targetEnvCall( { "rm", "-f", localtimeSlink } );
int ec = CalamaresUtils::System::instance()->targetEnvCall( { "ln", "-s", zoneinfoPath, localtimeSlink } ); int ec = Calamares::System::instance()->targetEnvCall( { "ln", "-s", zoneinfoPath, localtimeSlink } );
if ( ec ) if ( ec )
return Calamares::JobResult::error( return Calamares::JobResult::error(
tr( "Cannot set timezone." ), tr( "Cannot set timezone." ),

View File

@ -106,19 +106,19 @@ static const char keyfile[] = "/crypto_keyfile.bin";
static bool static bool
generateTargetKeyfile() generateTargetKeyfile()
{ {
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe ); Calamares::UMask m( Calamares::UMask::Safe );
// Get the data // Get the data
QByteArray entropy; QByteArray entropy;
auto entropySource = CalamaresUtils::getEntropy( 2048, entropy ); auto entropySource = Calamares::getEntropy( 2048, entropy );
if ( entropySource != CalamaresUtils::EntropySource::URandom ) if ( entropySource != Calamares::EntropySource::URandom )
{ {
cWarning() << "Could not get entropy from /dev/urandom for LUKS."; cWarning() << "Could not get entropy from /dev/urandom for LUKS.";
return false; return false;
} }
auto fileResult = CalamaresUtils::System::instance()->createTargetFile( auto fileResult
keyfile, entropy, CalamaresUtils::System::WriteMode::Overwrite ); = Calamares::System::instance()->createTargetFile( keyfile, entropy, Calamares::System::WriteMode::Overwrite );
entropy.fill( 'A' ); entropy.fill( 'A' );
if ( !fileResult ) if ( !fileResult )
{ {
@ -128,7 +128,7 @@ generateTargetKeyfile()
// Give ample time to check that the file was created correctly; // Give ample time to check that the file was created correctly;
// we actually expect ls to return pretty-much-instantly. // we actually expect ls to return pretty-much-instantly.
auto r = CalamaresUtils::System::instance()->targetEnvCommand( auto r = Calamares::System::instance()->targetEnvCommand(
{ "ls", "-la", "/" }, QString(), QString(), std::chrono::seconds( 5 ) ); { "ls", "-la", "/" }, QString(), QString(), std::chrono::seconds( 5 ) );
cDebug() << "In target system after creating LUKS file" << r.getOutput(); cDebug() << "In target system after creating LUKS file" << r.getOutput();
return true; return true;
@ -138,7 +138,7 @@ static bool
setupLuks( const LuksDevice& d, const QString& luks2Hash ) setupLuks( const LuksDevice& d, const QString& luks2Hash )
{ {
// Get luksDump for this device // Get luksDump for this device
auto luks_dump = CalamaresUtils::System::instance()->targetEnvCommand( auto luks_dump = Calamares::System::instance()->targetEnvCommand(
{ QStringLiteral( "cryptsetup" ), QStringLiteral( "luksDump" ), d.device }, { QStringLiteral( "cryptsetup" ), QStringLiteral( "luksDump" ), d.device },
QString(), QString(),
QString(), QString(),
@ -187,8 +187,8 @@ setupLuks( const LuksDevice& d, const QString& luks2Hash )
args.insert( 2, "--pbkdf" ); args.insert( 2, "--pbkdf" );
args.insert( 3, luks2Hash ); args.insert( 3, luks2Hash );
} }
auto r = CalamaresUtils::System::instance()->targetEnvCommand( auto r
args, QString(), d.passphrase, std::chrono::seconds( 60 ) ); = Calamares::System::instance()->targetEnvCommand( args, QString(), d.passphrase, std::chrono::seconds( 60 ) );
if ( r.getExitCode() != 0 ) if ( r.getExitCode() != 0 )
{ {
cWarning() << "Could not configure LUKS keyfile on" << d.device << ':' << r.getOutput() << "(exit code" cWarning() << "Could not configure LUKS keyfile on" << d.device << ':' << r.getOutput() << "(exit code"
@ -337,7 +337,7 @@ LuksBootKeyFileJob::setConfigurationMap( const QVariantMap& configurationMap )
return QString(); // Empty is used internally for "default from cryptsetup" return QString(); // Empty is used internally for "default from cryptsetup"
} }
return value.toLower(); return value.toLower();
}( CalamaresUtils::getString( configurationMap, QStringLiteral( "luks2Hash" ), QString() ) ); }( Calamares::getString( configurationMap, QStringLiteral( "luks2Hash" ), QString() ) );
} }
CALAMARES_PLUGIN_FACTORY_DEFINITION( LuksBootKeyFileJobFactory, registerPlugin< LuksBootKeyFileJob >(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( LuksBootKeyFileJobFactory, registerPlugin< LuksBootKeyFileJob >(); )

View File

@ -29,7 +29,6 @@ LOSHJob::LOSHJob( QObject* parent )
LOSHJob::~LOSHJob() {} LOSHJob::~LOSHJob() {}
QString QString
LOSHJob::prettyName() const LOSHJob::prettyName() const
{ {
@ -69,8 +68,8 @@ write_openswap_conf( const QString& path, QStringList& contents, const LOSHInfo&
} }
cDebug() << "Writing" << contents.length() << "line configuration to" << path; cDebug() << "Writing" << contents.length() << "line configuration to" << path;
// \n between each two lines, and a \n at the end // \n between each two lines, and a \n at the end
CalamaresUtils::System::instance()->createTargetFile( Calamares::System::instance()->createTargetFile(
path, contents.join( '\n' ).append( '\n' ).toUtf8(), CalamaresUtils::System::WriteMode::Overwrite ); path, contents.join( '\n' ).append( '\n' ).toUtf8(), Calamares::System::WriteMode::Overwrite );
} }
else else
{ {
@ -81,7 +80,7 @@ write_openswap_conf( const QString& path, QStringList& contents, const LOSHInfo&
Calamares::JobResult Calamares::JobResult
LOSHJob::exec() LOSHJob::exec()
{ {
const auto* sys = CalamaresUtils::System::instance(); const auto* sys = Calamares::System::instance();
if ( !sys ) if ( !sys )
{ {
return Calamares::JobResult::internalError( return Calamares::JobResult::internalError(
@ -116,7 +115,7 @@ LOSHJob::exec()
void void
LOSHJob::setConfigurationMap( const QVariantMap& configurationMap ) LOSHJob::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_configFilePath = CalamaresUtils::getString( m_configFilePath = Calamares::getString(
configurationMap, QStringLiteral( "configFilePath" ), QStringLiteral( "/etc/openswap.conf" ) ); configurationMap, QStringLiteral( "configFilePath" ), QStringLiteral( "/etc/openswap.conf" ) );
} }
@ -164,8 +163,7 @@ globalStoragePartitionInfo( Calamares::GlobalStorage* gs, LOSHInfo& info )
if ( !btrfsRootSubvolume.isEmpty() ) if ( !btrfsRootSubvolume.isEmpty() )
{ {
Calamares::String::removeLeading( btrfsRootSubvolume, '/' ); Calamares::String::removeLeading( btrfsRootSubvolume, '/' );
info.keyfile_device_mount_options info.keyfile_device_mount_options = QStringLiteral( "--options=subvol=" ) + btrfsRootSubvolume;
= QStringLiteral( "--options=subvol=" ) + btrfsRootSubvolume;
} }
} }

View File

@ -48,7 +48,6 @@ LOSHTests::initTestCase()
cDebug() << "LOSH test started."; cDebug() << "LOSH test started.";
} }
void void
LOSHTests::testAssignmentExtraction_data() LOSHTests::testAssignmentExtraction_data()
{ {
@ -65,7 +64,6 @@ LOSHTests::testAssignmentExtraction_data()
// We look for assignments, but only for single-words // We look for assignments, but only for single-words
QTest::newRow( "comment-space-eq" ) << QStringLiteral( "# Check that a = b" ) << QString(); QTest::newRow( "comment-space-eq" ) << QStringLiteral( "# Check that a = b" ) << QString();
QTest::newRow( "assignment1" ) << QStringLiteral( "a=1" ) << QStringLiteral( "a" ); QTest::newRow( "assignment1" ) << QStringLiteral( "a=1" ) << QStringLiteral( "a" );
QTest::newRow( "assignment2" ) << QStringLiteral( "a = 1" ) << QStringLiteral( "a" ); QTest::newRow( "assignment2" ) << QStringLiteral( "a = 1" ) << QStringLiteral( "a" );
QTest::newRow( "assignment3" ) << QStringLiteral( "# a=1" ) << QStringLiteral( "a" ); QTest::newRow( "assignment3" ) << QStringLiteral( "# a=1" ) << QStringLiteral( "a" );
@ -90,13 +88,13 @@ LOSHTests::testAssignmentExtraction()
QCOMPARE( get_assignment_part( line ), match ); QCOMPARE( get_assignment_part( line ), match );
} }
static CalamaresUtils::System* static Calamares::System*
file_setup( const QTemporaryDir& tempRoot ) file_setup( const QTemporaryDir& tempRoot )
{ {
CalamaresUtils::System* ss = CalamaresUtils::System::instance(); Calamares::System* ss = Calamares::System::instance();
if ( !ss ) if ( !ss )
{ {
ss = new CalamaresUtils::System( true ); ss = new Calamares::System( true );
} }
Calamares::GlobalStorage* gs Calamares::GlobalStorage* gs
@ -136,7 +134,6 @@ LOSHTests::testLOSHInfo()
QCOMPARE( i.replacementFor( QStringLiteral( "duck" ) ), QString() ); QCOMPARE( i.replacementFor( QStringLiteral( "duck" ) ), QString() );
} }
void void
LOSHTests::testConfigWriting() LOSHTests::testConfigWriting()
{ {
@ -199,7 +196,6 @@ LOSHTests::testConfigWriting()
QCOMPARE( contents.at( 1 ), QStringLiteral( "swap_device=/dev/zram/0.zram" ) ); // expected line QCOMPARE( contents.at( 1 ), QStringLiteral( "swap_device=/dev/zram/0.zram" ) ); // expected line
} }
void void
LOSHTests::testJob() LOSHTests::testJob()
{ {
@ -245,7 +241,6 @@ LOSHTests::testJob()
} }
} }
QTEST_GUILESS_MAIN( LOSHTests ) QTEST_GUILESS_MAIN( LOSHTests )
#include "utils/moc-warnings.h" #include "utils/moc-warnings.h"

View File

@ -27,10 +27,8 @@ MachineIdJob::MachineIdJob( QObject* parent )
{ {
} }
MachineIdJob::~MachineIdJob() {} MachineIdJob::~MachineIdJob() {}
QString QString
MachineIdJob::prettyName() const MachineIdJob::prettyName() const
{ {
@ -58,7 +56,7 @@ MachineIdJob::exec()
QString target_systemd_machineid_file = QStringLiteral( "/etc/machine-id" ); QString target_systemd_machineid_file = QStringLiteral( "/etc/machine-id" );
QString target_dbus_machineid_file = QStringLiteral( "/var/lib/dbus/machine-id" ); QString target_dbus_machineid_file = QStringLiteral( "/var/lib/dbus/machine-id" );
const CalamaresUtils::System* system = CalamaresUtils::System::instance(); const Calamares::System* system = Calamares::System::instance();
// Clear existing files // Clear existing files
for ( const auto& entropy_file : m_entropy_files ) for ( const auto& entropy_file : m_entropy_files )
@ -77,7 +75,7 @@ MachineIdJob::exec()
//Create new files //Create new files
for ( const auto& entropy_file : m_entropy_files ) for ( const auto& entropy_file : m_entropy_files )
{ {
if ( !CalamaresUtils::System::instance()->createTargetParentDirs( entropy_file ) ) if ( !Calamares::System::instance()->createTargetParentDirs( entropy_file ) )
{ {
return Calamares::JobResult::error( return Calamares::JobResult::error(
QObject::tr( "Directory not found" ), QObject::tr( "Directory not found" ),
@ -131,20 +129,19 @@ MachineIdJob::exec()
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
void void
MachineIdJob::setConfigurationMap( const QVariantMap& map ) MachineIdJob::setConfigurationMap( const QVariantMap& map )
{ {
m_systemd = CalamaresUtils::getBool( map, "systemd", false ); m_systemd = Calamares::getBool( map, "systemd", false );
m_dbus = CalamaresUtils::getBool( map, "dbus", false ); m_dbus = Calamares::getBool( map, "dbus", false );
if ( map.contains( "dbus-symlink" ) ) if ( map.contains( "dbus-symlink" ) )
{ {
m_dbus_symlink = CalamaresUtils::getBool( map, "dbus-symlink", false ); m_dbus_symlink = Calamares::getBool( map, "dbus-symlink", false );
} }
else if ( map.contains( "symlink" ) ) else if ( map.contains( "symlink" ) )
{ {
m_dbus_symlink = CalamaresUtils::getBool( map, "symlink", false ); m_dbus_symlink = Calamares::getBool( map, "symlink", false );
cWarning() << "MachineId: configuration setting *symlink* is deprecated, use *dbus-symlink*."; cWarning() << "MachineId: configuration setting *symlink* is deprecated, use *dbus-symlink*.";
} }
// else it's still false from the constructor // else it's still false from the constructor
@ -152,9 +149,9 @@ MachineIdJob::setConfigurationMap( const QVariantMap& map )
// ignore it, though, if dbus is false // ignore it, though, if dbus is false
m_dbus_symlink = m_dbus && m_dbus_symlink; m_dbus_symlink = m_dbus && m_dbus_symlink;
m_entropy_copy = CalamaresUtils::getBool( map, "entropy-copy", false ); m_entropy_copy = Calamares::getBool( map, "entropy-copy", false );
m_entropy_files = CalamaresUtils::getStringList( map, "entropy-files" ); m_entropy_files = Calamares::getStringList( map, "entropy-files" );
if ( CalamaresUtils::getBool( map, "entropy", false ) ) if ( Calamares::getBool( map, "entropy", false ) )
{ {
cWarning() << "MachineId:: configuration setting *entropy* is deprecated, use *entropy-files* instead."; cWarning() << "MachineId:: configuration setting *entropy* is deprecated, use *entropy-files* instead.";
m_entropy_files.append( QStringLiteral( "/var/lib/urandom/random-seed" ) ); m_entropy_files.append( QStringLiteral( "/var/lib/urandom/random-seed" ) );

View File

@ -104,7 +104,6 @@ MachineIdTests::testConfigEntropyFiles()
} }
} }
void void
MachineIdTests::testCopyFile() MachineIdTests::testCopyFile()
{ {
@ -165,7 +164,7 @@ MachineIdTests::testJob()
cDebug() << "Temporary files as" << QDir::tempPath(); cDebug() << "Temporary files as" << QDir::tempPath();
// Ensure we have a system object, expect it to be a "bogus" one // Ensure we have a system object, expect it to be a "bogus" one
CalamaresUtils::System* system = CalamaresUtils::System::instance(); Calamares::System* system = Calamares::System::instance();
QVERIFY( system ); QVERIFY( system );
QVERIFY( system->doChroot() ); QVERIFY( system->doChroot() );

View File

@ -95,7 +95,7 @@ createNewEntropy( int poolSize, const QString& rootMountPoint, const QString& fi
} }
QByteArray data; QByteArray data;
CalamaresUtils::EntropySource source = CalamaresUtils::getEntropy( poolSize, data ); Calamares::EntropySource source = Calamares::getEntropy( poolSize, data );
entropyFile.write( data ); entropyFile.write( data );
entropyFile.close(); entropyFile.close();
if ( entropyFile.size() < data.length() ) if ( entropyFile.size() < data.length() )
@ -106,14 +106,13 @@ createNewEntropy( int poolSize, const QString& rootMountPoint, const QString& fi
{ {
cWarning() << "Entropy data is" << data.length() << "bytes, rather than poolSize" << poolSize; cWarning() << "Entropy data is" << data.length() << "bytes, rather than poolSize" << poolSize;
} }
if ( source != CalamaresUtils::EntropySource::URandom ) if ( source != Calamares::EntropySource::URandom )
{ {
cWarning() << "Entropy data for pool is low-quality."; cWarning() << "Entropy data for pool is low-quality.";
} }
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }
Calamares::JobResult Calamares::JobResult
createEntropy( const EntropyGeneration kind, const QString& rootMountPoint, const QString& fileName ) createEntropy( const EntropyGeneration kind, const QString& rootMountPoint, const QString& fileName )
{ {
@ -144,7 +143,7 @@ createEntropy( const EntropyGeneration kind, const QString& rootMountPoint, cons
static Calamares::JobResult static Calamares::JobResult
runCmd( const QStringList& cmd ) runCmd( const QStringList& cmd )
{ {
auto r = CalamaresUtils::System::instance()->targetEnvCommand( cmd ); auto r = Calamares::System::instance()->targetEnvCommand( cmd );
if ( r.getExitCode() ) if ( r.getExitCode() )
{ {
return r.explainProcess( cmd, std::chrono::seconds( 0 ) ); return r.explainProcess( cmd, std::chrono::seconds( 0 ) );

View File

@ -42,7 +42,6 @@ Config::retranslate()
emit titleLabelChanged( titleLabel() ); emit titleLabelChanged( titleLabel() );
} }
QString QString
Config::status() const Config::status() const
{ {
@ -64,7 +63,6 @@ Config::status() const
__builtin_unreachable(); __builtin_unreachable();
} }
void void
Config::setStatus( Status s ) Config::setStatus( Status s )
{ {
@ -84,7 +82,6 @@ Config::titleLabel() const
return m_titleLabel ? m_titleLabel->get() : QString(); return m_titleLabel ? m_titleLabel->get() : QString();
} }
void void
Config::loadGroupList( const QVariantList& groupData ) Config::loadGroupList( const QVariantList& groupData )
{ {
@ -111,15 +108,14 @@ Config::loadingDone()
emit statusReady(); emit statusReady();
} }
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
setRequired( CalamaresUtils::getBool( configurationMap, "required", false ) ); setRequired( Calamares::getBool( configurationMap, "required", false ) );
// Get the translations, if any // Get the translations, if any
bool bogus = false; bool bogus = false;
auto label = CalamaresUtils::getSubMap( configurationMap, "label", bogus ); auto label = Calamares::getSubMap( configurationMap, "label", bogus );
// Use a different class name for translation lookup because the // Use a different class name for translation lookup because the
// .. table of strings lives in NetInstallViewStep.cpp and moving them // .. table of strings lives in NetInstallViewStep.cpp and moving them
// .. around is annoying for translators. // .. around is annoying for translators.

View File

@ -92,7 +92,6 @@ LoaderQueue::load()
QMetaObject::invokeMethod( this, "fetchNext", Qt::QueuedConnection ); QMetaObject::invokeMethod( this, "fetchNext", Qt::QueuedConnection );
} }
void void
LoaderQueue::fetchNext() LoaderQueue::fetchNext()
{ {
@ -180,16 +179,16 @@ LoaderQueue::dataArrived()
QByteArray yamlData = m_reply->readAll(); QByteArray yamlData = m_reply->readAll();
try try
{ {
YAML::Node groups = YAML::Load( yamlData.constData() ); auto groups = ::YAML::Load( yamlData.constData() );
if ( groups.IsSequence() ) if ( groups.IsSequence() )
{ {
m_config->loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) ); m_config->loadGroupList( Calamares::YAML::sequenceToVariant( groups ) );
next.done( m_config->statusCode() == Config::Status::Ok ); next.done( m_config->statusCode() == Config::Status::Ok );
} }
else if ( groups.IsMap() ) else if ( groups.IsMap() )
{ {
auto map = CalamaresUtils::yamlMapToVariant( groups ); auto map = Calamares::YAML::mapToVariant( groups );
m_config->loadGroupList( map.value( "groups" ).toList() ); m_config->loadGroupList( map.value( "groups" ).toList() );
next.done( m_config->statusCode() == Config::Status::Ok ); next.done( m_config->statusCode() == Config::Status::Ok );
} }
@ -198,9 +197,9 @@ LoaderQueue::dataArrived()
cWarning() << "NetInstall groups data does not form a sequence."; cWarning() << "NetInstall groups data does not form a sequence.";
} }
} }
catch ( YAML::Exception& e ) catch ( ::YAML::Exception& e )
{ {
CalamaresUtils::explainYamlException( e, yamlData, "netinstall groups data" ); Calamares::YAML::explainException( e, yamlData, "netinstall groups data" );
m_config->setStatus( Config::Status::FailedBadData ); m_config->setStatus( Config::Status::FailedBadData );
} }
} }

View File

@ -274,7 +274,7 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
PackageTreeItem* item = new PackageTreeItem( groupMap, PackageTreeItem::GroupTag { parent } ); PackageTreeItem* item = new PackageTreeItem( groupMap, PackageTreeItem::GroupTag { parent } );
if ( groupMap.contains( "selected" ) ) if ( groupMap.contains( "selected" ) )
{ {
item->setSelected( CalamaresUtils::getBool( groupMap, "selected", false ) ? Qt::Checked : Qt::Unchecked ); item->setSelected( Calamares::getBool( groupMap, "selected", false ) ? Qt::Checked : Qt::Unchecked );
} }
if ( groupMap.contains( "packages" ) ) if ( groupMap.contains( "packages" ) )
{ {

View File

@ -37,7 +37,7 @@ parentCriticality( const QVariantMap& groupData, PackageTreeItem* parent )
{ {
if ( groupData.contains( "critical" ) ) if ( groupData.contains( "critical" ) )
{ {
return CalamaresUtils::getBool( groupData, "critical", false ); return Calamares::getBool( groupData, "critical", false );
} }
return parent ? parent->isCritical() : false; return parent ? parent->isCritical() : false;
} }
@ -55,9 +55,9 @@ PackageTreeItem::PackageTreeItem( const QString& packageName, PackageTreeItem* p
PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTag&& parent ) PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTag&& parent )
: m_parentItem( parent.parent ) : m_parentItem( parent.parent )
, m_packageName( CalamaresUtils::getString( groupData, "name" ) ) , m_packageName( Calamares::getString( groupData, "name" ) )
, m_selected( parentCheckState( parent.parent ) ) , m_selected( parentCheckState( parent.parent ) )
, m_description( CalamaresUtils::getString( groupData, "description" ) ) , m_description( Calamares::getString( groupData, "description" ) )
, m_isGroup( false ) , m_isGroup( false )
, m_isCritical( parent.parent ? parent.parent->isCritical() : false ) , m_isCritical( parent.parent ? parent.parent->isCritical() : false )
, m_showReadOnly( parent.parent ? parent.parent->isImmutable() : false ) , m_showReadOnly( parent.parent ? parent.parent->isImmutable() : false )
@ -67,18 +67,18 @@ PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTag&& par
PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, GroupTag&& parent ) PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, GroupTag&& parent )
: m_parentItem( parent.parent ) : m_parentItem( parent.parent )
, m_name( CalamaresUtils::getString( groupData, "name" ) ) , m_name( Calamares::getString( groupData, "name" ) )
, m_selected( parentCheckState( parent.parent ) ) , m_selected( parentCheckState( parent.parent ) )
, m_description( CalamaresUtils::getString( groupData, "description" ) ) , m_description( Calamares::getString( groupData, "description" ) )
, m_preScript( CalamaresUtils::getString( groupData, "pre-install" ) ) , m_preScript( Calamares::getString( groupData, "pre-install" ) )
, m_postScript( CalamaresUtils::getString( groupData, "post-install" ) ) , m_postScript( Calamares::getString( groupData, "post-install" ) )
, m_source( CalamaresUtils::getString( groupData, "source" ) ) , m_source( Calamares::getString( groupData, "source" ) )
, m_isGroup( true ) , m_isGroup( true )
, m_isCritical( parentCriticality( groupData, parent.parent ) ) , m_isCritical( parentCriticality( groupData, parent.parent ) )
, m_isHidden( CalamaresUtils::getBool( groupData, "hidden", false ) ) , m_isHidden( Calamares::getBool( groupData, "hidden", false ) )
, m_showReadOnly( CalamaresUtils::getBool( groupData, "immutable", false ) ) , m_showReadOnly( Calamares::getBool( groupData, "immutable", false ) )
, m_showNoncheckable( CalamaresUtils::getBool( groupData, "noncheckable", false ) ) , m_showNoncheckable( Calamares::getBool( groupData, "noncheckable", false ) )
, m_startExpanded( CalamaresUtils::getBool( groupData, "expanded", false ) ) , m_startExpanded( Calamares::getBool( groupData, "expanded", false ) )
{ {
} }
@ -151,7 +151,6 @@ PackageTreeItem::parentItem() const
return m_parentItem; return m_parentItem;
} }
bool bool
PackageTreeItem::hiddenSelected() const PackageTreeItem::hiddenSelected() const
{ {
@ -179,7 +178,6 @@ PackageTreeItem::hiddenSelected() const
return m_selected != Qt::Unchecked; return m_selected != Qt::Unchecked;
} }
void void
PackageTreeItem::setSelected( Qt::CheckState isSelected ) PackageTreeItem::setSelected( Qt::CheckState isSelected )
{ {
@ -239,7 +237,6 @@ PackageTreeItem::updateSelected()
} }
} }
void void
PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected ) PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected )
{ {

View File

@ -131,8 +131,8 @@ static const char doc_with_expanded[] =
void void
ItemTests::testExtendedPackage() ItemTests::testExtendedPackage()
{ {
YAML::Node yamldoc = YAML::Load( doc ); auto yamldoc = ::YAML::Load( doc );
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc ); QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
QCOMPARE( yamlContents.length(), 1 ); QCOMPARE( yamlContents.length(), 1 );
@ -154,12 +154,11 @@ ItemTests::testExtendedPackage()
QVERIFY( p == p ); QVERIFY( p == p );
} }
void void
ItemTests::testGroup() ItemTests::testGroup()
{ {
YAML::Node yamldoc = YAML::Load( doc ); auto yamldoc = ::YAML::Load( doc );
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc ); QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
QCOMPARE( yamlContents.length(), 1 ); QCOMPARE( yamlContents.length(), 1 );
@ -209,8 +208,8 @@ ItemTests::testCompare()
PackageTreeItem r3( "<root>", nullptr ); PackageTreeItem r3( "<root>", nullptr );
QVERIFY( r3 == r2 ); QVERIFY( r3 == r2 );
YAML::Node yamldoc = YAML::Load( doc ); // See testGroup() auto yamldoc = ::YAML::Load( doc ); // See testGroup()
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc ); QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
QCOMPARE( yamlContents.length(), 1 ); QCOMPARE( yamlContents.length(), 1 );
PackageTreeItem p3( yamlContents[ 0 ].toMap(), PackageTreeItem::GroupTag { nullptr } ); PackageTreeItem p3( yamlContents[ 0 ].toMap(), PackageTreeItem::GroupTag { nullptr } );
@ -219,10 +218,10 @@ ItemTests::testCompare()
QVERIFY( p1 != p3 ); QVERIFY( p1 != p3 );
QCOMPARE( p3.childCount(), 0 ); // Doesn't load the packages: list QCOMPARE( p3.childCount(), 0 ); // Doesn't load the packages: list
PackageTreeItem p4( CalamaresUtils::yamlSequenceToVariant( YAML::Load( doc ) )[ 0 ].toMap(), PackageTreeItem p4( Calamares::YAML::sequenceToVariant( YAML::Load( doc ) )[ 0 ].toMap(),
PackageTreeItem::GroupTag { nullptr } ); PackageTreeItem::GroupTag { nullptr } );
QVERIFY( p3 == p4 ); QVERIFY( p3 == p4 );
PackageTreeItem p5( CalamaresUtils::yamlSequenceToVariant( YAML::Load( doc_no_packages ) )[ 0 ].toMap(), PackageTreeItem p5( Calamares::YAML::sequenceToVariant( YAML::Load( doc_no_packages ) )[ 0 ].toMap(),
PackageTreeItem::GroupTag { nullptr } ); PackageTreeItem::GroupTag { nullptr } );
QVERIFY( p3 == p5 ); QVERIFY( p3 == p5 );
} }
@ -257,12 +256,11 @@ ItemTests::recursiveCompare( PackageModel& l, PackageModel& r )
return recursiveCompare( l.m_rootItem, r.m_rootItem ); return recursiveCompare( l.m_rootItem, r.m_rootItem );
} }
void void
ItemTests::testModel() ItemTests::testModel()
{ {
YAML::Node yamldoc = YAML::Load( doc ); // See testGroup() auto yamldoc = ::YAML::Load( doc ); // See testGroup()
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc ); QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
QCOMPARE( yamlContents.length(), 1 ); QCOMPARE( yamlContents.length(), 1 );
PackageModel m0( nullptr ); PackageModel m0( nullptr );
@ -275,7 +273,7 @@ ItemTests::testModel()
checkAllSelected( m0.m_rootItem ); checkAllSelected( m0.m_rootItem );
PackageModel m2( nullptr ); PackageModel m2( nullptr );
m2.setupModelData( CalamaresUtils::yamlSequenceToVariant( YAML::Load( doc_with_expanded ) ) ); m2.setupModelData( Calamares::YAML::sequenceToVariant( YAML::Load( doc_with_expanded ) ) );
QCOMPARE( m2.m_hiddenItems.count(), 0 ); QCOMPARE( m2.m_hiddenItems.count(), 0 );
QCOMPARE( m2.rowCount(), 1 ); // Group, now the packages expanded but not counted QCOMPARE( m2.rowCount(), 1 ); // Group, now the packages expanded but not counted
QCOMPARE( m2.rowCount( m2.index( 0, 0 ) ), 3 ); // The packages QCOMPARE( m2.rowCount( m2.index( 0, 0 ) ), 3 ); // The packages
@ -324,7 +322,7 @@ ItemTests::testExampleFiles()
QVERIFY( !contents.isEmpty() ); QVERIFY( !contents.isEmpty() );
YAML::Node yamldoc = YAML::Load( contents.constData() ); YAML::Node yamldoc = YAML::Load( contents.constData() );
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc ); QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
PackageModel m1( nullptr ); PackageModel m1( nullptr );
m1.setupModelData( yamlContents ); m1.setupModelData( yamlContents );
@ -388,7 +386,7 @@ ItemTests::testUrlFallback()
try try
{ {
YAML::Node yamldoc = YAML::Load( correctedDocument.toUtf8() ); YAML::Node yamldoc = YAML::Load( correctedDocument.toUtf8() );
auto map = CalamaresUtils::yamlToVariant( yamldoc ).toMap(); auto map = Calamares::YAML::toVariant( yamldoc ).toMap();
QVERIFY( map.count() > 0 ); QVERIFY( map.count() > 0 );
c.setConfigurationMap( map ); c.setConfigurationMap( map );
} }
@ -420,7 +418,6 @@ ItemTests::testUrlFallback()
QCOMPARE( c.model()->rowCount(), count ); QCOMPARE( c.model()->rowCount(), count );
} }
QTEST_GUILESS_MAIN( ItemTests ) QTEST_GUILESS_MAIN( ItemTests )
#include "utils/moc-warnings.h" #include "utils/moc-warnings.h"

View File

@ -27,7 +27,7 @@ void
NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
bool qmlLabel_ok = false; bool qmlLabel_ok = false;
auto qmlLabel = CalamaresUtils::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok ); auto qmlLabel = Calamares::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
if ( qmlLabel.contains( "notes" ) ) if ( qmlLabel.contains( "notes" ) )
{ {

View File

@ -40,7 +40,6 @@ public:
OEMPage::~OEMPage() {} OEMPage::~OEMPage() {}
OEMViewStep::OEMViewStep( QObject* parent ) OEMViewStep::OEMViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( nullptr ) , m_widget( nullptr )
@ -125,7 +124,6 @@ OEMViewStep::prettyStatus() const
return tr( "Set the OEM Batch Identifier to <code>%1</code>." ).arg( m_user_batchIdentifier ); return tr( "Set the OEM Batch Identifier to <code>%1</code>." ).arg( m_user_batchIdentifier );
} }
QWidget* QWidget*
OEMViewStep::widget() OEMViewStep::widget()
{ {
@ -145,7 +143,7 @@ OEMViewStep::jobs() const
void void
OEMViewStep::setConfigurationMap( const QVariantMap& configurationMap ) OEMViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_conf_batchIdentifier = CalamaresUtils::getString( configurationMap, "batch-identifier" ); m_conf_batchIdentifier = Calamares::getString( configurationMap, "batch-identifier" );
m_user_batchIdentifier = substitute( m_conf_batchIdentifier ); m_user_batchIdentifier = substitute( m_conf_batchIdentifier );
} }

View File

@ -20,7 +20,6 @@
#include <memory> #include <memory>
#endif #endif
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h" #include "compat/Variant.h"
@ -223,7 +222,6 @@ Config::updateGlobalStorage() const
} }
} }
void void
Config::setPackageChoice( const QString& packageChoice ) Config::setPackageChoice( const QString& packageChoice )
{ {
@ -312,9 +310,9 @@ fillModel( PackageListModel* model, const QVariantList& items )
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_mode = packageChooserModeNames().find( CalamaresUtils::getString( configurationMap, "mode" ), m_mode = packageChooserModeNames().find( Calamares::getString( configurationMap, "mode" ),
PackageChooserMode::Required ); PackageChooserMode::Required );
m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ), m_method = PackageChooserMethodNames().find( Calamares::getString( configurationMap, "method" ),
PackageChooserMethod::Legacy ); PackageChooserMethod::Legacy );
if ( m_method == PackageChooserMethod::Legacy ) if ( m_method == PackageChooserMethod::Legacy )
@ -326,7 +324,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
fillModel( m_model, configurationMap.value( "items" ).toList() ); fillModel( m_model, configurationMap.value( "items" ).toList() );
QString default_item_id = CalamaresUtils::getString( configurationMap, "default" ); QString default_item_id = Calamares::getString( configurationMap, "default" );
if ( !default_item_id.isEmpty() ) if ( !default_item_id.isEmpty() )
{ {
for ( int item_n = 0; item_n < m_model->packageCount(); ++item_n ) for ( int item_n = 0; item_n < m_model->packageCount(); ++item_n )
@ -344,7 +342,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
} }
else else
{ {
setPackageChoice( CalamaresUtils::getString( configurationMap, "packageChoice" ) ); setPackageChoice( Calamares::getString( configurationMap, "packageChoice" ) );
if ( m_method != PackageChooserMethod::Legacy ) if ( m_method != PackageChooserMethod::Legacy )
{ {
cWarning() << "Single-selection QML module must use 'Legacy' method."; cWarning() << "Single-selection QML module must use 'Legacy' method.";
@ -352,7 +350,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
} }
bool labels_ok = false; bool labels_ok = false;
auto labels = CalamaresUtils::getSubMap( configurationMap, "labels", labels_ok ); auto labels = Calamares::getSubMap( configurationMap, "labels", labels_ok );
if ( labels_ok ) if ( labels_ok )
{ {
if ( labels.contains( "step" ) ) if ( labels.contains( "step" ) )

View File

@ -179,7 +179,7 @@ getNameAndSummary( const QDomNode& n )
PackageItem PackageItem
fromAppData( const QVariantMap& item_map ) fromAppData( const QVariantMap& item_map )
{ {
QString fileName = CalamaresUtils::getString( item_map, "appdata" ); QString fileName = Calamares::getString( item_map, "appdata" );
if ( fileName.isEmpty() ) if ( fileName.isEmpty() )
{ {
cWarning() << "Can't load AppData without a suitable key."; cWarning() << "Can't load AppData without a suitable key.";
@ -197,7 +197,7 @@ fromAppData( const QVariantMap& item_map )
if ( !componentNode.isNull() && componentNode.tagName() == "component" ) if ( !componentNode.isNull() && componentNode.tagName() == "component" )
{ {
// An "id" entry in the Calamares config overrides ID in the AppData // An "id" entry in the Calamares config overrides ID in the AppData
QString id = CalamaresUtils::getString( item_map, "id" ); QString id = Calamares::getString( item_map, "id" );
if ( id.isEmpty() ) if ( id.isEmpty() )
{ {
id = getChildText( componentNode, "id" ); id = getChildText( componentNode, "id" );
@ -208,7 +208,7 @@ fromAppData( const QVariantMap& item_map )
} }
// A "screenshot" entry in the Calamares config overrides AppData // A "screenshot" entry in the Calamares config overrides AppData
QString screenshotPath = CalamaresUtils::getString( item_map, "screenshot" ); QString screenshotPath = Calamares::getString( item_map, "screenshot" );
if ( screenshotPath.isEmpty() ) if ( screenshotPath.isEmpty() )
{ {
screenshotPath = getScreenshotPath( componentNode ); screenshotPath = getScreenshotPath( componentNode );

View File

@ -112,7 +112,7 @@ fromComponent( AppStream::Component& component )
PackageItem PackageItem
fromAppStream( AppStream::Pool& pool, const QVariantMap& item_map ) fromAppStream( AppStream::Pool& pool, const QVariantMap& item_map )
{ {
QString appstreamId = CalamaresUtils::getString( item_map, "appstream" ); QString appstreamId = Calamares::getString( item_map, "appstream" );
if ( appstreamId.isEmpty() ) if ( appstreamId.isEmpty() )
{ {
cWarning() << "Can't load AppStream without a suitable appstreamId."; cWarning() << "Can't load AppStream without a suitable appstreamId.";
@ -134,8 +134,8 @@ fromAppStream( AppStream::Pool& pool, const QVariantMap& item_map )
auto r = fromComponent( itemList.first() ); auto r = fromComponent( itemList.first() );
if ( r.isValid() ) if ( r.isValid() )
{ {
QString id = CalamaresUtils::getString( item_map, "id" ); QString id = Calamares::getString( item_map, "id" );
QString screenshotPath = CalamaresUtils::getString( item_map, "screenshot" ); QString screenshotPath = Calamares::getString( item_map, "screenshot" );
if ( !id.isEmpty() ) if ( !id.isEmpty() )
{ {
r.id = id; r.id = id;

Some files were not shown because too many files have changed in this diff Show More