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:
parent
f4e3964ee5
commit
eb840d4117
@ -58,10 +58,9 @@ CalamaresApplication::CalamaresApplication( int& argc, char* argv[] )
|
||||
setApplicationVersion( QStringLiteral( CALAMARES_VERSION ) );
|
||||
|
||||
QFont f = font();
|
||||
CalamaresUtils::setDefaultFontSize( f.pointSize() );
|
||||
Calamares::setDefaultFontSize( f.pointSize() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::init()
|
||||
{
|
||||
@ -77,7 +76,7 @@ CalamaresApplication::init()
|
||||
initQmlPath();
|
||||
initBranding();
|
||||
|
||||
CalamaresUtils::installTranslator();
|
||||
Calamares::installTranslator();
|
||||
|
||||
setQuitOnLastWindowClosed( false );
|
||||
setWindowIcon( QIcon( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductIcon ) ) );
|
||||
@ -89,35 +88,31 @@ CalamaresApplication::init()
|
||||
cDebug() << Logger::SubEntry << "STARTUP: initModuleManager: module init started";
|
||||
}
|
||||
|
||||
|
||||
CalamaresApplication::~CalamaresApplication()
|
||||
{
|
||||
Logger::CDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares...";
|
||||
Logger::CDebug( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown.";
|
||||
}
|
||||
|
||||
|
||||
CalamaresApplication*
|
||||
CalamaresApplication::instance()
|
||||
{
|
||||
return qobject_cast< CalamaresApplication* >( QApplication::instance() );
|
||||
}
|
||||
|
||||
|
||||
CalamaresWindow*
|
||||
CalamaresApplication::mainWindow()
|
||||
{
|
||||
return m_mainwindow;
|
||||
}
|
||||
|
||||
|
||||
static QStringList
|
||||
brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
|
||||
{
|
||||
QStringList brandingPaths;
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
||||
brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -125,31 +120,29 @@ brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename )
|
||||
{
|
||||
brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename );
|
||||
}
|
||||
if ( CalamaresUtils::haveExtraDirs() )
|
||||
for ( auto s : CalamaresUtils::extraDataDirs() )
|
||||
if ( Calamares::haveExtraDirs() )
|
||||
for ( auto s : Calamares::extraDataDirs() )
|
||||
{
|
||||
brandingPaths << ( s + brandingFilename );
|
||||
}
|
||||
brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename );
|
||||
brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename );
|
||||
brandingPaths << Calamares::appDataDir().absoluteFilePath( brandingFilename );
|
||||
}
|
||||
|
||||
return brandingPaths;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::initQmlPath()
|
||||
{
|
||||
#ifdef WITH_QML
|
||||
if ( !CalamaresUtils::initQmlModulesDir() )
|
||||
if ( !Calamares::initQmlModulesDir() )
|
||||
{
|
||||
::exit( EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::initBranding()
|
||||
{
|
||||
@ -181,7 +174,7 @@ CalamaresApplication::initBranding()
|
||||
{
|
||||
cError() << "Cowardly refusing to continue startup without branding."
|
||||
<< Logger::DebugList( brandingFileCandidatesByPriority );
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName;
|
||||
}
|
||||
@ -195,7 +188,6 @@ CalamaresApplication::initBranding()
|
||||
new Calamares::Branding( brandingFile.absoluteFilePath(), this, devicePixelRatio() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::initModuleManager()
|
||||
{
|
||||
@ -262,7 +254,6 @@ CalamaresApplication::initView()
|
||||
cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::initViewSteps()
|
||||
{
|
||||
@ -294,6 +285,6 @@ void
|
||||
CalamaresApplication::initJobQueue()
|
||||
{
|
||||
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() );
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -145,15 +145,14 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
||||
QHBoxLayout* extraButtons = new QHBoxLayout;
|
||||
sideLayout->addLayout( extraButtons );
|
||||
|
||||
const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
|
||||
const int defaultFontHeight = Calamares::defaultFontHeight();
|
||||
|
||||
if ( /* About-Calamares Button enabled */ true )
|
||||
{
|
||||
QPushButton* aboutDialog = new QPushButton;
|
||||
aboutDialog->setObjectName( "aboutButton" );
|
||||
aboutDialog->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information,
|
||||
CalamaresUtils::Original,
|
||||
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
aboutDialog->setIcon( Calamares::defaultPixmap(
|
||||
Calamares::Information, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
CALAMARES_RETRANSLATE_FOR(
|
||||
aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) );
|
||||
aboutDialog->setToolTip(
|
||||
@ -167,8 +166,8 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
||||
{
|
||||
QPushButton* debugWindowBtn = new QPushButton;
|
||||
debugWindowBtn->setObjectName( "debugButton" );
|
||||
debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap(
|
||||
CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
debugWindowBtn->setIcon( Calamares::defaultPixmap(
|
||||
Calamares::Bugs, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
CALAMARES_RETRANSLATE_FOR(
|
||||
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) );
|
||||
debugWindowBtn->setToolTip(
|
||||
@ -181,7 +180,7 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
||||
debug, &Calamares::DebugWindowManager::visibleChanged, debugWindowBtn, &QPushButton::setChecked );
|
||||
}
|
||||
|
||||
CalamaresUtils::unmarginLayout( sideLayout );
|
||||
Calamares::unmarginLayout( sideLayout );
|
||||
return sideBox;
|
||||
}
|
||||
|
||||
@ -276,7 +275,6 @@ setDimension( QQuickWidget* w, Qt::Orientation o, int desiredWidth )
|
||||
w->setResizeMode( QQuickWidget::SizeRootObjectToView );
|
||||
}
|
||||
|
||||
|
||||
static QWidget*
|
||||
getQmlSidebar( Calamares::DebugWindowManager* debug,
|
||||
Calamares::ViewManager*,
|
||||
@ -284,15 +282,15 @@ getQmlSidebar( Calamares::DebugWindowManager* debug,
|
||||
Qt::Orientation o,
|
||||
int desiredWidth )
|
||||
{
|
||||
CalamaresUtils::registerQmlModels();
|
||||
Calamares::registerQmlModels();
|
||||
QQuickWidget* w = new QQuickWidget( parent );
|
||||
if ( debug )
|
||||
{
|
||||
w->engine()->rootContext()->setContextProperty( "debug", debug );
|
||||
}
|
||||
|
||||
w->setSource( QUrl(
|
||||
CalamaresUtils::searchQmlFile( CalamaresUtils::QmlSearch::Both, QStringLiteral( "calamares-sidebar" ) ) ) );
|
||||
w->setSource(
|
||||
QUrl( Calamares::searchQmlFile( Calamares::QmlSearch::Both, QStringLiteral( "calamares-sidebar" ) ) ) );
|
||||
setDimension( w, o, desiredWidth );
|
||||
return w;
|
||||
}
|
||||
@ -304,14 +302,14 @@ getQmlNavigation( Calamares::DebugWindowManager* debug,
|
||||
Qt::Orientation o,
|
||||
int desiredWidth )
|
||||
{
|
||||
CalamaresUtils::registerQmlModels();
|
||||
Calamares::registerQmlModels();
|
||||
QQuickWidget* w = new QQuickWidget( parent );
|
||||
if ( debug )
|
||||
{
|
||||
w->engine()->rootContext()->setContextProperty( "debug", debug );
|
||||
}
|
||||
w->setSource( QUrl(
|
||||
CalamaresUtils::searchQmlFile( CalamaresUtils::QmlSearch::Both, QStringLiteral( "calamares-navigation" ) ) ) );
|
||||
w->setSource(
|
||||
QUrl( Calamares::searchQmlFile( Calamares::QmlSearch::Both, QStringLiteral( "calamares-navigation" ) ) ) );
|
||||
setDimension( w, o, desiredWidth );
|
||||
return w;
|
||||
}
|
||||
@ -392,7 +390,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
, m_debugManager( new Calamares::DebugWindowManager( this ) )
|
||||
, m_viewManager( nullptr )
|
||||
{
|
||||
installEventFilter( CalamaresUtils::Retranslator::instance() );
|
||||
installEventFilter( Calamares::Retranslator::instance() );
|
||||
|
||||
// If we can never cancel, don't show the window-close button
|
||||
if ( Calamares::Settings::instance()->disableCancel() )
|
||||
@ -408,10 +406,10 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
const Calamares::Branding* const branding = Calamares::Branding::instance();
|
||||
using ImageEntry = Calamares::Branding::ImageEntry;
|
||||
|
||||
using CalamaresUtils::windowMinimumHeight;
|
||||
using CalamaresUtils::windowMinimumWidth;
|
||||
using CalamaresUtils::windowPreferredHeight;
|
||||
using CalamaresUtils::windowPreferredWidth;
|
||||
using Calamares::windowMinimumHeight;
|
||||
using Calamares::windowMinimumWidth;
|
||||
using Calamares::windowPreferredHeight;
|
||||
using Calamares::windowPreferredWidth;
|
||||
|
||||
using PanelSide = Calamares::Branding::PanelSide;
|
||||
|
||||
@ -438,7 +436,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
{
|
||||
QWidget* label = new QWidget( this );
|
||||
QVBoxLayout* l = new QVBoxLayout;
|
||||
CalamaresUtils::unmarginLayout( l );
|
||||
Calamares::unmarginLayout( l );
|
||||
l->addWidget( label );
|
||||
setLayout( l );
|
||||
label->setObjectName( "backgroundWidget" );
|
||||
@ -467,14 +465,14 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
QBoxLayout* contentsLayout = new QVBoxLayout;
|
||||
contentsLayout->setSpacing( 0 );
|
||||
|
||||
QWidget* sideBox = flavoredWidget(
|
||||
branding->sidebarFlavor(),
|
||||
QWidget* sideBox
|
||||
= flavoredWidget( branding->sidebarFlavor(),
|
||||
::orientation( branding->sidebarSide() ),
|
||||
m_debugManager,
|
||||
baseWidget,
|
||||
::getWidgetSidebar,
|
||||
::getQmlSidebar,
|
||||
qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
|
||||
qBound( 100, Calamares::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
|
||||
QWidget* navigation = flavoredWidget( branding->navigationFlavor(),
|
||||
::orientation( branding->navigationSide() ),
|
||||
m_debugManager,
|
||||
@ -506,8 +504,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
( contentsLayout->count() > 1 ? Qt::Orientations( Qt::Horizontal ) : Qt::Orientations() )
|
||||
| ( mainLayout->count() > 1 ? Qt::Orientations( Qt::Vertical ) : Qt::Orientations() ) );
|
||||
|
||||
CalamaresUtils::unmarginLayout( mainLayout );
|
||||
CalamaresUtils::unmarginLayout( contentsLayout );
|
||||
Calamares::unmarginLayout( mainLayout );
|
||||
Calamares::unmarginLayout( contentsLayout );
|
||||
baseWidget->setLayout( mainLayout );
|
||||
setStyleSheet( Calamares::Branding::instance()->stylesheet() );
|
||||
}
|
||||
|
@ -158,13 +158,12 @@ DebugWindow::DebugWindow()
|
||||
} );
|
||||
|
||||
// Send Log button only if it would be useful
|
||||
m_ui->sendLogButton->setVisible( CalamaresUtils::Paste::isEnabled() );
|
||||
connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { CalamaresUtils::Paste::doLogUploadUI( this ); } );
|
||||
m_ui->sendLogButton->setVisible( Calamares::Paste::isEnabled() );
|
||||
connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { Calamares::Paste::doLogUploadUI( this ); } );
|
||||
|
||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DebugWindow::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
@ -172,13 +171,11 @@ DebugWindow::closeEvent( QCloseEvent* e )
|
||||
emit closed();
|
||||
}
|
||||
|
||||
|
||||
DebugWindowManager::DebugWindowManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DebugWindowManager::enabled() const
|
||||
{
|
||||
@ -186,7 +183,6 @@ DebugWindowManager::enabled() const
|
||||
return ( Logger::logLevel() >= Logger::LOGVERBOSE ) || ( s ? s->debugMode() : false );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DebugWindowManager::show( bool visible )
|
||||
{
|
||||
@ -244,14 +240,14 @@ DebugWindowManager::about()
|
||||
QMessageBox::Ok,
|
||||
nullptr );
|
||||
Calamares::fixButtonLabels( &mb );
|
||||
mb.setIconPixmap( CalamaresUtils::defaultPixmap(
|
||||
CalamaresUtils::Squid,
|
||||
CalamaresUtils::Original,
|
||||
QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) );
|
||||
mb.setIconPixmap(
|
||||
Calamares::defaultPixmap( Calamares::Squid,
|
||||
Calamares::Original,
|
||||
QSize( Calamares::defaultFontHeight() * 6, Calamares::defaultFontHeight() * 6 ) ) );
|
||||
QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() );
|
||||
if ( layout )
|
||||
{
|
||||
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 );
|
||||
layout->setColumnMinimumWidth( 2, Calamares::defaultFontHeight() * 24 );
|
||||
}
|
||||
mb.exec();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "CalamaresApplication.h"
|
||||
|
||||
#include "Settings.h"
|
||||
@ -93,13 +92,13 @@ handle_args( CalamaresApplication& a )
|
||||
Logger::setupLogLevel( parser.isSet( debugOption ) ? Logger::LOGVERBOSE : debug_level( parser, debugLevelOption ) );
|
||||
if ( parser.isSet( configOption ) )
|
||||
{
|
||||
CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) );
|
||||
Calamares::setAppDataDir( QDir( parser.value( configOption ) ) );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ static constexpr int const item_margin = 8;
|
||||
static inline int
|
||||
item_fontsize()
|
||||
{
|
||||
return CalamaresUtils::defaultFontSize() + 4;
|
||||
return Calamares::defaultFontSize() + 4;
|
||||
}
|
||||
|
||||
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
|
||||
// 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
|
||||
@ -100,7 +99,6 @@ ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
|
||||
return QSize( option.rect.width(), height );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "utils/Qml.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineOption>
|
||||
#include <QCommandLineParser>
|
||||
@ -241,7 +240,6 @@ ExecViewModule::type() const
|
||||
return Module::Type::View;
|
||||
}
|
||||
|
||||
|
||||
Calamares::Module::Interface
|
||||
ExecViewModule::interface() const
|
||||
{
|
||||
@ -304,7 +302,7 @@ load_module( const ModuleConfig& moduleConfig )
|
||||
fi = QFileInfo( prefix + moduleName );
|
||||
if ( fi.exists() && fi.isFile() )
|
||||
{
|
||||
descriptor = CalamaresUtils::loadYaml( fi, &ok );
|
||||
descriptor = Calamares::YAML::load( fi, &ok );
|
||||
}
|
||||
if ( ok )
|
||||
{
|
||||
@ -318,7 +316,7 @@ load_module( const ModuleConfig& moduleConfig )
|
||||
fi = QFileInfo( prefix + moduleName + "/module.desc" );
|
||||
if ( fi.exists() && fi.isFile() )
|
||||
{
|
||||
descriptor = CalamaresUtils::loadYaml( fi, &ok );
|
||||
descriptor = Calamares::YAML::load( fi, &ok );
|
||||
}
|
||||
if ( ok )
|
||||
{
|
||||
@ -478,7 +476,7 @@ main( int argc, char* argv[] )
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_QML
|
||||
CalamaresUtils::initQmlModulesDir(); // don't care if failed
|
||||
Calamares::initQmlModulesDir(); // don't care if failed
|
||||
#endif
|
||||
|
||||
cDebug() << "Calamares module-loader testing" << module.moduleName();
|
||||
@ -505,7 +503,7 @@ main( int argc, char* argv[] )
|
||||
mw = module.m_ui ? new QMainWindow() : nullptr;
|
||||
if ( mw )
|
||||
{
|
||||
mw->installEventFilter( CalamaresUtils::Retranslator::instance() );
|
||||
mw->installEventFilter( Calamares::Retranslator::instance() );
|
||||
}
|
||||
|
||||
(void)new Calamares::Branding( module.m_branding );
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
|
||||
using namespace CalamaresUtils::Units;
|
||||
using namespace Calamares::Units;
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
@ -52,7 +52,6 @@ GlobalStorage::GlobalStorage( QObject* parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GlobalStorage::contains( const QString& key ) const
|
||||
{
|
||||
@ -60,7 +59,6 @@ GlobalStorage::contains( const QString& key ) const
|
||||
return m.contains( key );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GlobalStorage::count() const
|
||||
{
|
||||
@ -68,7 +66,6 @@ GlobalStorage::count() const
|
||||
return m.count();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalStorage::insert( const QString& key, const QVariant& value )
|
||||
{
|
||||
@ -76,7 +73,6 @@ GlobalStorage::insert( const QString& key, const QVariant& value )
|
||||
m.insert( key, value );
|
||||
}
|
||||
|
||||
|
||||
QStringList
|
||||
GlobalStorage::keys() const
|
||||
{
|
||||
@ -84,7 +80,6 @@ GlobalStorage::keys() const
|
||||
return m.keys();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GlobalStorage::remove( const QString& key )
|
||||
{
|
||||
@ -93,7 +88,6 @@ GlobalStorage::remove( const QString& key )
|
||||
return nItems;
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
GlobalStorage::value( const QString& key ) const
|
||||
{
|
||||
@ -166,14 +160,14 @@ bool
|
||||
GlobalStorage::saveYaml( const QString& filename ) const
|
||||
{
|
||||
ReadLock l( this );
|
||||
return CalamaresUtils::saveYaml( filename, m );
|
||||
return Calamares::YAML::save( filename, m );
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalStorage::loadYaml( const QString& filename )
|
||||
{
|
||||
bool ok = false;
|
||||
auto map = CalamaresUtils::loadYaml( filename, &ok );
|
||||
auto map = Calamares::YAML::load( filename, &ok );
|
||||
if ( ok )
|
||||
{
|
||||
WriteLock l( this );
|
||||
@ -189,5 +183,4 @@ GlobalStorage::loadYaml( const QString& filename )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -18,7 +18,6 @@
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
|
||||
ProcessJob::ProcessJob( const QString& command,
|
||||
const QString& workingPath,
|
||||
bool runInChroot,
|
||||
@ -32,31 +31,27 @@ ProcessJob::ProcessJob( const QString& command,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ProcessJob::~ProcessJob() {}
|
||||
|
||||
|
||||
QString
|
||||
ProcessJob::prettyName() const
|
||||
{
|
||||
return ( m_runInChroot ? tr( "Run command '%1' in target system." ) : tr( " Run command '%1'." ) ).arg( m_command );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ProcessJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Running command %1 %2" ).arg( m_command ).arg( m_runInChroot ? "in chroot." : " ." );
|
||||
}
|
||||
|
||||
|
||||
JobResult
|
||||
ProcessJob::exec()
|
||||
{
|
||||
using CalamaresUtils::System;
|
||||
using Calamares::System;
|
||||
|
||||
if ( m_runInChroot )
|
||||
return CalamaresUtils::System::instance()
|
||||
return Calamares::System::instance()
|
||||
->targetEnvCommand( { m_command }, m_workingPath, QString(), m_timeoutSec )
|
||||
.explainProcess( m_command, m_timeoutSec );
|
||||
else
|
||||
|
@ -23,7 +23,6 @@ namespace bp = boost::python;
|
||||
namespace CalamaresPython
|
||||
{
|
||||
|
||||
|
||||
boost::python::object
|
||||
variantToPyObject( const QVariant& variant )
|
||||
{
|
||||
@ -86,7 +85,6 @@ variantToPyObject( const QVariant& variant )
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
variantFromPyObject( const boost::python::object& pyObject )
|
||||
{
|
||||
@ -127,7 +125,6 @@ variantFromPyObject( const boost::python::object& pyObject )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boost::python::list
|
||||
variantListToPyList( const QVariantList& variantList )
|
||||
{
|
||||
@ -139,7 +136,6 @@ variantListToPyList( const QVariantList& variantList )
|
||||
return pyList;
|
||||
}
|
||||
|
||||
|
||||
QVariantList
|
||||
variantListFromPyList( const boost::python::list& pyList )
|
||||
{
|
||||
@ -151,7 +147,6 @@ variantListFromPyList( const boost::python::list& pyList )
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
boost::python::dict
|
||||
variantMapToPyDict( const QVariantMap& variantMap )
|
||||
{
|
||||
@ -163,7 +158,6 @@ variantMapToPyDict( const QVariantMap& variantMap )
|
||||
return pyDict;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap
|
||||
variantMapFromPyDict( const boost::python::dict& pyDict )
|
||||
{
|
||||
@ -198,7 +192,6 @@ variantHashToPyDict( const QVariantHash& variantHash )
|
||||
return pyDict;
|
||||
}
|
||||
|
||||
|
||||
QVariantHash
|
||||
variantHashFromPyDict( const boost::python::dict& pyDict )
|
||||
{
|
||||
@ -222,7 +215,6 @@ variantHashFromPyDict( const boost::python::dict& pyDict )
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
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
|
||||
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 );
|
||||
|
||||
bp::object sys = bp::import( "sys" );
|
||||
@ -290,7 +282,6 @@ Helper::createCleanNamespace()
|
||||
return scriptNamespace;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Helper::handleLastError()
|
||||
{
|
||||
@ -385,7 +376,6 @@ Helper::handleLastError()
|
||||
return tr( "Unfetchable Python error." );
|
||||
}
|
||||
|
||||
|
||||
QStringList msgList;
|
||||
if ( !typeMsg.isEmpty() )
|
||||
{
|
||||
@ -429,14 +419,12 @@ GlobalStoragePythonWrapper::contains( const std::string& key ) const
|
||||
return m_gs->contains( QString::fromStdString( key ) );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GlobalStoragePythonWrapper::count() const
|
||||
{
|
||||
return m_gs->count();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalStoragePythonWrapper::insert( const std::string& key, const bp::object& value )
|
||||
{
|
||||
@ -455,7 +443,6 @@ GlobalStoragePythonWrapper::keys() const
|
||||
return pyList;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GlobalStoragePythonWrapper::remove( const std::string& key )
|
||||
{
|
||||
@ -467,7 +454,6 @@ GlobalStoragePythonWrapper::remove( const std::string& key )
|
||||
return m_gs->remove( gsKey );
|
||||
}
|
||||
|
||||
|
||||
bp::object
|
||||
GlobalStoragePythonWrapper::value( const std::string& key ) const
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
namespace bp = boost::python;
|
||||
|
||||
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 )
|
||||
{
|
||||
@ -61,12 +61,12 @@ bp_list_to_qstringlist( const bp::list& args )
|
||||
return list;
|
||||
}
|
||||
|
||||
static inline CalamaresUtils::ProcessResult
|
||||
static inline Calamares::ProcessResult
|
||||
target_env_command( const QStringList& args, const std::string& input, int timeout )
|
||||
{
|
||||
// Since Python doesn't give us the type system for distinguishing
|
||||
// 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 ) );
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
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 ) );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
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( ' ' ) );
|
||||
}
|
||||
|
||||
|
||||
std::string
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
std::string
|
||||
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 );
|
||||
bool ok = false;
|
||||
auto map = CalamaresUtils::loadYaml( filePath, &ok );
|
||||
auto map = Calamares::YAML::load( filePath, &ok );
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "Loading YAML from" << filePath << "failed.";
|
||||
@ -177,7 +172,6 @@ load_yaml( const std::string& path )
|
||||
return variantMapToPyDict( map );
|
||||
}
|
||||
|
||||
|
||||
PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )
|
||||
: m_parent( parent )
|
||||
{
|
||||
@ -188,7 +182,6 @@ PythonJobInterface::PythonJobInterface( Calamares::PythonJob* parent )
|
||||
configuration = CalamaresPython::variantMapToPyDict( m_parent->m_configurationMap );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
std::string
|
||||
obscure( const std::string& string )
|
||||
{
|
||||
@ -369,5 +361,4 @@ gettext_path()
|
||||
return bp::object(); // None
|
||||
}
|
||||
|
||||
|
||||
} // namespace CalamaresPython
|
||||
|
@ -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. */
|
||||
static QString
|
||||
requireString( const YAML::Node& config, const char* key )
|
||||
requireString( const ::YAML::Node& config, const char* key )
|
||||
{
|
||||
auto v = config[ key ];
|
||||
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. */
|
||||
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 ];
|
||||
if ( hasValue( v ) )
|
||||
@ -133,7 +133,7 @@ interpretModulesSearch( const bool debugMode, const QStringList& rawPaths, QStri
|
||||
}
|
||||
|
||||
// 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" );
|
||||
}
|
||||
else
|
||||
@ -152,12 +152,12 @@ interpretModulesSearch( const bool debugMode, const QStringList& rawPaths, QStri
|
||||
}
|
||||
|
||||
static void
|
||||
interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& customInstances )
|
||||
interpretInstances( const ::YAML::Node& node, Settings::InstanceDescriptionList& customInstances )
|
||||
{
|
||||
// Parse the custom instances section
|
||||
if ( node )
|
||||
{
|
||||
QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList();
|
||||
QVariant instancesV = Calamares::YAML::toVariant( node ).toList();
|
||||
if ( typeOf( instancesV ) == ListVariantType )
|
||||
{
|
||||
const auto instances = instancesV.toList();
|
||||
@ -180,15 +180,15 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
|
||||
}
|
||||
|
||||
static void
|
||||
interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSequence )
|
||||
interpretSequence( const ::YAML::Node& node, Settings::ModuleSequence& moduleSequence )
|
||||
{
|
||||
// Parse the modules sequence section
|
||||
if ( node )
|
||||
{
|
||||
QVariant sequenceV = CalamaresUtils::yamlToVariant( node );
|
||||
QVariant sequenceV = Calamares::YAML::toVariant( node );
|
||||
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();
|
||||
@ -231,7 +231,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
|
||||
}
|
||||
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
|
||||
{
|
||||
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() );
|
||||
|
||||
interpretModulesSearch(
|
||||
debugMode(), CalamaresUtils::yamlToStringList( config[ "modules-search" ] ), m_modulesSearchPaths );
|
||||
debugMode(), Calamares::YAML::toStringList( config[ "modules-search" ] ), m_modulesSearchPaths );
|
||||
interpretInstances( config[ "instances" ], m_moduleInstances );
|
||||
interpretSequence( config[ "sequence" ], m_modulesSequence );
|
||||
|
||||
@ -336,9 +337,9 @@ Settings::setConfiguration( const QByteArray& ba, const QString& explainName )
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Settings::InstanceDescriptionList
|
||||
Settings::moduleInstances() const
|
||||
{
|
||||
return m_moduleInstances;
|
||||
}
|
||||
|
||||
|
||||
Settings::ModuleSequence
|
||||
Settings::modulesSequence() const
|
||||
{
|
||||
return m_modulesSequence;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Settings::brandingComponentName() const
|
||||
{
|
||||
@ -375,9 +373,9 @@ settingsFileCandidates( bool assumeBuilddir )
|
||||
static const char settings[] = "settings.conf";
|
||||
|
||||
QStringList settingsPaths;
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
||||
settingsPaths << Calamares::appDataDir().absoluteFilePath( settings );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -385,13 +383,13 @@ settingsFileCandidates( bool assumeBuilddir )
|
||||
{
|
||||
settingsPaths << QDir::current().absoluteFilePath( settings );
|
||||
}
|
||||
if ( CalamaresUtils::haveExtraDirs() )
|
||||
for ( auto s : CalamaresUtils::extraConfigDirs() )
|
||||
if ( Calamares::haveExtraDirs() )
|
||||
for ( auto s : Calamares::extraConfigDirs() )
|
||||
{
|
||||
settingsPaths << ( s + settings );
|
||||
}
|
||||
settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat
|
||||
settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings );
|
||||
settingsPaths << Calamares::appDataDir().absoluteFilePath( settings );
|
||||
}
|
||||
|
||||
return settingsPaths;
|
||||
@ -426,7 +424,7 @@ Settings::init( bool debugMode )
|
||||
{
|
||||
cError() << "Cowardly refusing to continue startup without settings."
|
||||
<< Logger::DebugList( settingsFileCandidatesByPriority );
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
cError() << "FATAL: explicitly configured application data directory is missing settings.conf";
|
||||
}
|
||||
|
@ -44,14 +44,14 @@ selectMap( const QVariantMap& m, const QStringList& l, int index )
|
||||
QString attributeName = l[ index ];
|
||||
if ( index == l.count() - 1 )
|
||||
{
|
||||
return CalamaresUtils::getString( m, attributeName );
|
||||
return Calamares::getString( m, attributeName );
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = false; // bogus
|
||||
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();
|
||||
}
|
||||
@ -62,9 +62,9 @@ GeoIPJSON::rawReply( const QByteArray& data )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
return selectMap( var.toMap(), m_element.split( '.' ), 0 );
|
||||
@ -74,9 +74,9 @@ GeoIPJSON::rawReply( const QByteArray& data )
|
||||
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();
|
||||
|
@ -38,7 +38,7 @@ TranslatedString::TranslatedString( const QVariantMap& map, const QString& key,
|
||||
: m_context( context )
|
||||
{
|
||||
// Get the un-decorated value for the key
|
||||
QString value = CalamaresUtils::getString( map, key );
|
||||
QString value = Calamares::getString( map, key );
|
||||
m_strings[ QString() ] = value;
|
||||
|
||||
for ( auto it = map.constBegin(); it != map.constEnd(); ++it )
|
||||
|
@ -18,14 +18,12 @@ namespace Calamares
|
||||
namespace ModuleSystem
|
||||
{
|
||||
|
||||
|
||||
class Config::Private
|
||||
{
|
||||
public:
|
||||
std::unique_ptr< Presets > m_presets;
|
||||
};
|
||||
|
||||
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
, 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 )
|
||||
: m_c( c )
|
||||
, m_bogus( true )
|
||||
, m_map( CalamaresUtils::getSubMap( configurationMap, "presets", m_bogus ) )
|
||||
, m_map( Calamares::getSubMap( configurationMap, "presets", m_bogus ) )
|
||||
{
|
||||
c.m_unlocked = true;
|
||||
if ( !c.d->m_presets )
|
||||
@ -113,9 +111,9 @@ Config::ApplyPresets::apply( const char* fieldName )
|
||||
if ( m_map.contains( key ) )
|
||||
{
|
||||
// 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" ];
|
||||
bool editable = CalamaresUtils::getBool( m, "editable", true );
|
||||
bool editable = Calamares::getBool( m, "editable", true );
|
||||
|
||||
if ( value.isValid() )
|
||||
{
|
||||
|
@ -92,21 +92,21 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc, const QString& de
|
||||
return d;
|
||||
}
|
||||
|
||||
d.m_isEmergeny = CalamaresUtils::getBool( moduleDesc, "emergency", false );
|
||||
d.m_hasConfig = !CalamaresUtils::getBool( moduleDesc, "noconfig", false ); // Inverted logic during load
|
||||
d.m_requiredModules = CalamaresUtils::getStringList( moduleDesc, "requiredModules" );
|
||||
d.m_weight = int( CalamaresUtils::getInteger( moduleDesc, "weight", -1 ) );
|
||||
d.m_isEmergeny = Calamares::getBool( moduleDesc, "emergency", false );
|
||||
d.m_hasConfig = !Calamares::getBool( moduleDesc, "noconfig", false ); // Inverted logic during load
|
||||
d.m_requiredModules = Calamares::getStringList( moduleDesc, "requiredModules" );
|
||||
d.m_weight = int( Calamares::getInteger( moduleDesc, "weight", -1 ) );
|
||||
|
||||
QStringList consumedKeys { "type", "interface", "name", "emergency", "noconfig", "requiredModules", "weight" };
|
||||
|
||||
switch ( d.interface() )
|
||||
{
|
||||
case Interface::QtPlugin:
|
||||
d.m_script = CalamaresUtils::getString( moduleDesc, "load" );
|
||||
d.m_script = Calamares::getString( moduleDesc, "load" );
|
||||
consumedKeys << "load";
|
||||
break;
|
||||
case Interface::Python:
|
||||
d.m_script = CalamaresUtils::getString( moduleDesc, "script" );
|
||||
d.m_script = Calamares::getString( moduleDesc, "script" );
|
||||
if ( d.m_script.isEmpty() )
|
||||
{
|
||||
if ( o )
|
||||
@ -119,9 +119,9 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc, const QString& de
|
||||
consumedKeys << "script";
|
||||
break;
|
||||
case Interface::Process:
|
||||
d.m_script = CalamaresUtils::getString( moduleDesc, "command" );
|
||||
d.m_processTimeout = int( CalamaresUtils::getInteger( moduleDesc, "timeout", 30 ) );
|
||||
d.m_processChroot = CalamaresUtils::getBool( moduleDesc, "chroot", false );
|
||||
d.m_script = Calamares::getString( moduleDesc, "command" );
|
||||
d.m_processTimeout = int( Calamares::getInteger( moduleDesc, "timeout", 30 ) );
|
||||
d.m_processChroot = Calamares::getBool( moduleDesc, "chroot", false );
|
||||
if ( d.m_processTimeout < 0 )
|
||||
{
|
||||
d.m_processTimeout = 0;
|
||||
|
@ -51,9 +51,9 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -73,14 +73,14 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
|
||||
paths << QDir().absoluteFilePath( configFileName );
|
||||
}
|
||||
|
||||
if ( CalamaresUtils::haveExtraDirs() )
|
||||
for ( auto s : CalamaresUtils::extraConfigDirs() )
|
||||
if ( Calamares::haveExtraDirs() )
|
||||
for ( auto s : Calamares::extraConfigDirs() )
|
||||
{
|
||||
paths << ( s + QString( "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;
|
||||
@ -98,7 +98,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
|
||||
{
|
||||
QByteArray ba = configFile.readAll();
|
||||
|
||||
YAML::Node doc = YAML::Load( ba.constData() );
|
||||
auto doc = ::YAML::Load( ba.constData() ); // Throws on error
|
||||
if ( doc.IsNull() )
|
||||
{
|
||||
cWarning() << "Found empty module configuration" << path;
|
||||
@ -112,7 +112,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
|
||||
return;
|
||||
}
|
||||
|
||||
m_configurationMap = CalamaresUtils::yamlMapToVariant( doc );
|
||||
m_configurationMap = Calamares::YAML::mapToVariant( doc );
|
||||
m_emergency = m_maybe_emergency && m_configurationMap.contains( EMERGENCY )
|
||||
&& m_configurationMap[ EMERGENCY ].toBool();
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Module::typeString() const
|
||||
{
|
||||
@ -130,7 +129,6 @@ Module::typeString() const
|
||||
return ok ? v : QString();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Module::interfaceString() const
|
||||
{
|
||||
@ -139,14 +137,12 @@ Module::interfaceString() const
|
||||
return ok ? v : QString();
|
||||
}
|
||||
|
||||
|
||||
QVariantMap
|
||||
Module::configurationMap()
|
||||
{
|
||||
return m_configurationMap;
|
||||
}
|
||||
|
||||
|
||||
RequirementsList
|
||||
Module::checkRequirements()
|
||||
{
|
||||
|
@ -23,8 +23,8 @@ loadPresets( Calamares::ModuleSystem::Presets& preset,
|
||||
if ( !it.key().isEmpty() && pred( it.key() ) )
|
||||
{
|
||||
QVariantMap m = it.value().toMap();
|
||||
QString value = CalamaresUtils::getString( m, "value" );
|
||||
bool editable = CalamaresUtils::getBool( m, "editable", true );
|
||||
QString value = Calamares::getString( m, "value" );
|
||||
bool editable = Calamares::getBool( m, "editable", true );
|
||||
|
||||
preset.append( Calamares::ModuleSystem::PresetField { it.key(), value, editable } );
|
||||
|
||||
|
@ -38,7 +38,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
|
||||
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 );
|
||||
@ -48,7 +48,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
|
||||
if ( !ok )
|
||||
{
|
||||
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;
|
||||
|
||||
auto r = CalamaresUtils::System::runCommand( args, std::chrono::seconds( 10 ) );
|
||||
auto r = Calamares::System::runCommand( args, std::chrono::seconds( 10 ) );
|
||||
sync();
|
||||
return r.getExitCode();
|
||||
}
|
||||
@ -79,8 +79,7 @@ mount( const QString& devicePath, const QString& mountPoint, const QString& file
|
||||
int
|
||||
unmount( const QString& path, const QStringList& options )
|
||||
{
|
||||
auto r
|
||||
= CalamaresUtils::System::runCommand( QStringList { "umount" } << options << path, std::chrono::seconds( 10 ) );
|
||||
auto r = Calamares::System::runCommand( QStringList { "umount" } << options << path, std::chrono::seconds( 10 ) );
|
||||
sync();
|
||||
return r.getExitCode();
|
||||
}
|
||||
@ -91,7 +90,6 @@ struct TemporaryMount::Private
|
||||
QTemporaryDir m_mountDir;
|
||||
};
|
||||
|
||||
|
||||
TemporaryMount::TemporaryMount( const QString& devicePath, const QString& filesystemName, const QString& options )
|
||||
: m_d( std::make_unique< Private >() )
|
||||
{
|
||||
|
@ -9,7 +9,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "partition/PartitionSize.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Units.h"
|
||||
@ -99,7 +98,7 @@ PartitionSize::toSectors( qint64 totalSectors, qint64 sectorSize ) const
|
||||
case SizeUnit::MiB:
|
||||
case SizeUnit::GB:
|
||||
case SizeUnit::GiB:
|
||||
return CalamaresUtils::bytesToSectors( toBytes(), sectorSize );
|
||||
return Calamares::bytesToSectors( toBytes(), sectorSize );
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -195,17 +194,17 @@ PartitionSize::toBytes() const
|
||||
case SizeUnit::Byte:
|
||||
return value();
|
||||
case SizeUnit::KB:
|
||||
return CalamaresUtils::KBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::KBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
case SizeUnit::KiB:
|
||||
return CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::KiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
case SizeUnit::MB:
|
||||
return CalamaresUtils::MBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::MBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
case SizeUnit::MiB:
|
||||
return CalamaresUtils::MiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::MiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
case SizeUnit::GB:
|
||||
return CalamaresUtils::GBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::GBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
case SizeUnit::GiB:
|
||||
return CalamaresUtils::GiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
return Calamares::GiBtoBytes( static_cast< unsigned long long >( value() ) );
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ Calamares::Partition::sync()
|
||||
* either chroot(8) or env(1) is used to run the command,
|
||||
* 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 )
|
||||
{
|
||||
@ -31,5 +31,5 @@ Calamares::Partition::sync()
|
||||
r.explainProcess( "udevadm", std::chrono::seconds( 10 ) );
|
||||
}
|
||||
|
||||
CalamaresUtils::System::runCommand( { "sync" }, std::chrono::seconds( 10 ) );
|
||||
Calamares::System::runCommand( { "sync" }, std::chrono::seconds( 10 ) );
|
||||
}
|
||||
|
@ -32,12 +32,11 @@
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
System* System::s_instance = nullptr;
|
||||
|
||||
|
||||
System::System( bool doChroot, QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_doChroot( doChroot )
|
||||
@ -50,10 +49,8 @@ System::System( bool doChroot, QObject* parent )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
System::~System() {}
|
||||
|
||||
|
||||
System*
|
||||
System::instance()
|
||||
{
|
||||
@ -66,7 +63,6 @@ System::instance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
ProcessResult
|
||||
System::runCommand( System::RunLocation location,
|
||||
const QStringList& args,
|
||||
@ -229,7 +225,6 @@ System::createTargetParentDirs( const QString& filePath ) const
|
||||
return createTargetDirs( QFileInfo( filePath ).dir().path() );
|
||||
}
|
||||
|
||||
|
||||
QPair< quint64, qreal >
|
||||
System::getTotalMemoryB() const
|
||||
{
|
||||
@ -259,7 +254,6 @@ System::getTotalMemoryB() const
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
System::getCpuDescription() const
|
||||
{
|
||||
@ -342,4 +336,4 @@ ProcessResult::explainProcess( int ec, const QString& command, const QString& ou
|
||||
+ outputMessage );
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
class ProcessResult : public QPair< int, QString >
|
||||
{
|
||||
@ -234,7 +234,6 @@ public:
|
||||
return targetEnvOutput( QStringList { command }, output, workingPath, stdInput, timeoutSec );
|
||||
}
|
||||
|
||||
|
||||
/** @brief Gets a path to a file in the target system, from the host.
|
||||
*
|
||||
* @param path Path to the file; this is interpreted
|
||||
@ -361,6 +360,6 @@ private:
|
||||
bool m_doChroot;
|
||||
};
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -22,14 +22,14 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QVariantList>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
static CommandLine
|
||||
get_variant_object( const QVariantMap& m )
|
||||
{
|
||||
QString command = CalamaresUtils::getString( m, "command" );
|
||||
qint64 timeout = CalamaresUtils::getInteger( m, "timeout", -1 );
|
||||
QString command = Calamares::getString( m, "command" );
|
||||
qint64 timeout = Calamares::getInteger( m, "timeout", -1 );
|
||||
|
||||
if ( !command.isEmpty() )
|
||||
{
|
||||
@ -102,14 +102,13 @@ CommandLine::expand( KMacroExpanderBase& expander ) const
|
||||
return { c, second };
|
||||
}
|
||||
|
||||
CalamaresUtils::CommandLine
|
||||
Calamares::CommandLine
|
||||
CommandLine::expand() const
|
||||
{
|
||||
auto expander = get_gs_expander( System::RunLocation::RunInHost );
|
||||
return expand( expander );
|
||||
}
|
||||
|
||||
|
||||
CommandList::CommandList( bool doChroot, std::chrono::seconds timeout )
|
||||
: m_doChroot( doChroot )
|
||||
, m_timeout( timeout )
|
||||
@ -220,5 +219,4 @@ CommandList::expand() const
|
||||
return expand( expander );
|
||||
}
|
||||
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
class KMacroExpanderBase;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
using CommandLineBase = std::pair< QString, std::chrono::seconds >;
|
||||
|
||||
@ -119,5 +119,5 @@ private:
|
||||
std::chrono::seconds m_timeout;
|
||||
};
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
using std::cerr;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
static QDir s_appDataDir( CMAKE_INSTALL_FULL_DATADIR );
|
||||
@ -69,7 +69,6 @@ isWritableDir( const QDir& dir )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
setAppDataDir( const QDir& dir )
|
||||
{
|
||||
@ -147,14 +146,12 @@ isAppDataDirOverridden()
|
||||
return s_isAppDataDirOverridden;
|
||||
}
|
||||
|
||||
|
||||
QDir
|
||||
appDataDir()
|
||||
{
|
||||
return s_appDataDir;
|
||||
}
|
||||
|
||||
|
||||
QDir
|
||||
systemLibDir()
|
||||
{
|
||||
@ -162,7 +159,6 @@ systemLibDir()
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
QDir
|
||||
appLogDir()
|
||||
{
|
||||
@ -184,4 +180,4 @@ appLogDir()
|
||||
return QDir::temp();
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/**
|
||||
* @brief appDataDir returns the directory with common application data.
|
||||
@ -56,6 +56,6 @@ DLLEXPORT bool haveExtraDirs();
|
||||
DLLEXPORT QStringList extraConfigDirs();
|
||||
/** @brief XDG_DATA_DIRS, each guaranteed to end with / */
|
||||
DLLEXPORT QStringList extraDataDirs();
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -15,8 +15,10 @@
|
||||
|
||||
#include <random>
|
||||
|
||||
CalamaresUtils::EntropySource
|
||||
CalamaresUtils::getEntropy( int size, QByteArray& b )
|
||||
namespace Calamares
|
||||
{
|
||||
EntropySource
|
||||
getEntropy( int size, QByteArray& b )
|
||||
{
|
||||
constexpr const char filler = char( 0xcb );
|
||||
|
||||
@ -73,8 +75,8 @@ CalamaresUtils::getEntropy( int size, QByteArray& b )
|
||||
return EntropySource::Twister;
|
||||
}
|
||||
|
||||
CalamaresUtils::EntropySource
|
||||
CalamaresUtils::getPrintableEntropy( int size, QString& s )
|
||||
EntropySource
|
||||
getPrintableEntropy( int size, QString& s )
|
||||
{
|
||||
s.clear();
|
||||
if ( size < 1 )
|
||||
@ -117,3 +119,4 @@ CalamaresUtils::getPrintableEntropy( int size, QString& s )
|
||||
|
||||
return r;
|
||||
}
|
||||
} // namespace Calamares
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/// @brief Which entropy source was actually used for the entropy.
|
||||
enum class EntropySource
|
||||
@ -41,6 +41,6 @@ DLLEXPORT EntropySource getEntropy( int size, QByteArray& b );
|
||||
* @see getEntropy
|
||||
*/
|
||||
DLLEXPORT EntropySource getPrintableEntropy( int size, QString& s );
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -44,7 +44,6 @@ static QMutex s_mutex;
|
||||
static const char s_Continuation[] = "\n ";
|
||||
static const char s_SubEntry[] = " .. ";
|
||||
|
||||
|
||||
namespace Logger
|
||||
{
|
||||
|
||||
@ -109,7 +108,6 @@ log_implementation( const char* msg, unsigned int debugLevel, const bool withTim
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
logFile()
|
||||
{
|
||||
return CalamaresUtils::appLogDir().filePath( "session.log" );
|
||||
return Calamares::appLogDir().filePath( "session.log" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
setupLogfile()
|
||||
{
|
||||
@ -202,7 +198,6 @@ CDebug::CDebug( unsigned int debugLevel, const char* func )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CDebug::~CDebug()
|
||||
{
|
||||
if ( log_enabled( m_debugLevel ) )
|
||||
|
@ -73,7 +73,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** @brief Construct value from string.
|
||||
*
|
||||
* This is not defined in the template, because it should probably
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
Permissions::Permissions()
|
||||
@ -26,7 +26,6 @@ Permissions::Permissions()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Permissions::Permissions( QString const& p )
|
||||
: Permissions()
|
||||
{
|
||||
@ -91,7 +90,7 @@ Permissions::apply( const QString& path, int mode )
|
||||
}
|
||||
|
||||
bool
|
||||
Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p )
|
||||
Permissions::apply( const QString& path, const Calamares::Permissions& p )
|
||||
{
|
||||
if ( !p.isValid() )
|
||||
{
|
||||
@ -105,7 +104,7 @@ Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p )
|
||||
// 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.
|
||||
if ( CalamaresUtils::System::runCommand( { "chown", p.username() + ':' + p.group(), path },
|
||||
if ( Calamares::System::runCommand( { "chown", p.username() + ':' + p.group(), path },
|
||||
std::chrono::seconds( 3 ) )
|
||||
.getExitCode() )
|
||||
{
|
||||
@ -121,5 +120,4 @@ Permissions::apply( const QString& path, const CalamaresUtils::Permissions& p )
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
/**
|
||||
@ -90,6 +90,6 @@ private:
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif // LIBCALAMARES_PERMISSIONS_H
|
||||
|
@ -88,7 +88,6 @@ BrandingLoader::tryLoad( QTranslator* translator )
|
||||
QString filenameBase( m_prefix );
|
||||
filenameBase.remove( 0, lastDirSeparator + 1 );
|
||||
|
||||
|
||||
if ( QDir( brandingTranslationsDirPath ).exists() )
|
||||
{
|
||||
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/
|
||||
QDir localeData( CalamaresUtils::appDataDir() );
|
||||
QDir localeData( Calamares::appDataDir() );
|
||||
if ( localeData.exists()
|
||||
&& translator->load( localeData.absolutePath() + QStringLiteral( "/lang/" ) + prefix + localeName ) )
|
||||
{
|
||||
@ -170,7 +169,7 @@ loadSingletonTranslator( TranslationLoader&& loader, QTranslator*& translator_p
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
static QTranslator* s_brandingTranslator = nullptr;
|
||||
static QTranslator* s_translator = nullptr;
|
||||
@ -241,5 +240,4 @@ setAllowLocalTranslation( bool allow )
|
||||
s_allowLocalTranslations = allow;
|
||||
}
|
||||
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -23,7 +23,7 @@ class QEvent;
|
||||
class QLocale;
|
||||
class QTranslator;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/** @brief changes the application language.
|
||||
* @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 );
|
||||
|
||||
|
||||
/** @brief Handles change-of-language events
|
||||
*
|
||||
* There is one single Retranslator object. Use `instance()` to get it.
|
||||
@ -102,8 +101,7 @@ private:
|
||||
explicit Retranslator( QObject* parent );
|
||||
};
|
||||
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
/** @brief Call code for this object when language changes
|
||||
*
|
||||
@ -116,7 +114,7 @@ private:
|
||||
* immediately after setting up the connection. This allows
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* Given a slot (in method-function-pointer notation), call that slot when the
|
||||
@ -140,10 +138,7 @@ private:
|
||||
#define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \
|
||||
do \
|
||||
{ \
|
||||
connect( CalamaresUtils::Retranslator::instance(), \
|
||||
&CalamaresUtils::Retranslator::languageChanged, \
|
||||
this, \
|
||||
slotfunc ); \
|
||||
connect( Calamares::Retranslator::instance(), &Calamares::Retranslator::languageChanged, this, slotfunc ); \
|
||||
( this->*slotfunc )(); \
|
||||
} while ( false )
|
||||
|
||||
|
@ -41,7 +41,6 @@ relativeChangeDirectory( QDir& directory, const QString& subdir )
|
||||
return directory.cd( relPath );
|
||||
}
|
||||
|
||||
|
||||
STATICTEST std::pair< bool, QDir >
|
||||
calculateWorkingDirectory( Calamares::Utils::RunLocation location, const QString& directory )
|
||||
{
|
||||
@ -98,11 +97,9 @@ namespace Utils
|
||||
|
||||
Runner::Runner() {}
|
||||
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Calamares
|
||||
|
||||
|
||||
Calamares::Utils::Runner::Runner( const QStringList& command )
|
||||
{
|
||||
setCommand( command );
|
||||
|
@ -26,8 +26,8 @@ namespace Calamares
|
||||
namespace Utils
|
||||
{
|
||||
|
||||
using RunLocation = CalamaresUtils::System::RunLocation;
|
||||
using ProcessResult = CalamaresUtils::ProcessResult;
|
||||
using RunLocation = Calamares::System::RunLocation;
|
||||
using ProcessResult = Calamares::ProcessResult;
|
||||
|
||||
/** @brief A Runner wraps a process and handles running it and processing output
|
||||
*
|
||||
|
@ -86,8 +86,7 @@ removeDiacritics( const QString& string )
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// Function CalamaresUtils::obscure based on KStringHandler::obscure,
|
||||
// Function Calamares::obscure based on KStringHandler::obscure,
|
||||
// part of KDElibs by KDE, file kstringhandler.cpp.
|
||||
// Original copyright statement follows.
|
||||
/* This file is part of the KDE libraries
|
||||
@ -124,7 +123,6 @@ obscure( const QString& string )
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars )
|
||||
{
|
||||
|
@ -34,10 +34,8 @@ DictionaryExpander::DictionaryExpander( Calamares::String::DictionaryExpander&&
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DictionaryExpander::~DictionaryExpander() {}
|
||||
|
||||
|
||||
void
|
||||
DictionaryExpander::insert( const QString& key, const QString& value )
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ namespace Calamares
|
||||
namespace String
|
||||
{
|
||||
|
||||
|
||||
/** @brief Expand variables in a string against a dictionary.
|
||||
*
|
||||
* This class provides a convenience API for building up a dictionary
|
||||
|
@ -41,7 +41,7 @@ private Q_SLOTS:
|
||||
void testCreateTargetBasedirs();
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@ -54,7 +54,7 @@ TestPaths::initTestCase()
|
||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||
|
||||
// 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->doChroot() );
|
||||
|
||||
@ -88,11 +88,11 @@ TestPaths::init()
|
||||
void
|
||||
TestPaths::testCreationResult()
|
||||
{
|
||||
using Code = CalamaresUtils::CreationResult::Code;
|
||||
using Code = Calamares::CreationResult::Code;
|
||||
|
||||
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() );
|
||||
QCOMPARE( r.path(), QString() );
|
||||
// Get a warning from Clang if we're not covering everything
|
||||
@ -115,14 +115,13 @@ TestPaths::testCreationResult()
|
||||
}
|
||||
|
||||
QString path( "/etc/os-release" );
|
||||
auto r = CalamaresUtils::CreationResult( path );
|
||||
auto r = Calamares::CreationResult( path );
|
||||
QVERIFY( !r.failed() );
|
||||
QVERIFY( r );
|
||||
QCOMPARE( r.code(), Code::OK );
|
||||
QCOMPARE( r.path(), path );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TestPaths::testTargetPath()
|
||||
{
|
||||
@ -140,7 +139,6 @@ TestPaths::testTargetPath()
|
||||
QCOMPARE( m_system->targetPath( QString() ), QString() ); // Without root, no path
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TestPaths::testCreateTarget()
|
||||
{
|
||||
@ -170,7 +168,6 @@ struct GSRollback
|
||||
QVariant m_value;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
TestPaths::testCreateTargetExists()
|
||||
{
|
||||
@ -211,14 +208,14 @@ TestPaths::testCreateTargetOverwrite()
|
||||
QVERIFY( r.path().endsWith( QString( ltestFile ) ) );
|
||||
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 ); // But not unqualified success, either
|
||||
|
||||
QVERIFY( r.path().isEmpty() );
|
||||
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 ); // Total success
|
||||
|
||||
@ -226,7 +223,6 @@ TestPaths::testCreateTargetOverwrite()
|
||||
QCOMPARE( QFileInfo( d.filePath( QString( ltestFile ) ) ).size(), 7 );
|
||||
}
|
||||
|
||||
|
||||
struct DirRemover
|
||||
{
|
||||
DirRemover( const QString& base, const QString& dir )
|
||||
|
@ -150,7 +150,7 @@ LibCalamaresTests::testLoadSaveYaml()
|
||||
cDebug() << QDir().absolutePath() << f.fileName() << f.exists();
|
||||
QVERIFY( f.exists() );
|
||||
|
||||
auto map = CalamaresUtils::loadYaml( f.fileName() );
|
||||
auto map = Calamares::YAML::load( f.fileName() );
|
||||
QVERIFY( map.contains( "sequence" ) );
|
||||
QCOMPARE( Calamares::typeOf( map[ "sequence" ] ), Calamares::ListVariantType );
|
||||
|
||||
@ -164,10 +164,10 @@ LibCalamaresTests::testLoadSaveYaml()
|
||||
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" );
|
||||
CalamaresUtils::saveYaml( "out2.yaml", other_map );
|
||||
auto other_map = Calamares::YAML::load( "out.yaml" );
|
||||
Calamares::YAML::save( "out2.yaml", other_map );
|
||||
QCOMPARE( map, other_map );
|
||||
|
||||
QFile::remove( "out.yaml" );
|
||||
@ -222,7 +222,6 @@ LibCalamaresTests::recursiveCompareMap( const QVariantMap& a, const QVariantMap&
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LibCalamaresTests::testLoadSaveYamlExtended()
|
||||
{
|
||||
@ -232,10 +231,10 @@ LibCalamaresTests::testLoadSaveYamlExtended()
|
||||
{
|
||||
loaded_ok = true;
|
||||
cDebug() << "Testing" << confname;
|
||||
auto map = CalamaresUtils::loadYaml( confname, &loaded_ok );
|
||||
auto map = Calamares::YAML::load( confname, &loaded_ok );
|
||||
QVERIFY( loaded_ok );
|
||||
QVERIFY( CalamaresUtils::saveYaml( "out.yaml", map ) );
|
||||
auto othermap = CalamaresUtils::loadYaml( "out.yaml", &loaded_ok );
|
||||
QVERIFY( Calamares::YAML::save( "out.yaml", map ) );
|
||||
auto othermap = Calamares::YAML::load( "out.yaml", &loaded_ok );
|
||||
QVERIFY( loaded_ok );
|
||||
QCOMPARE( map.keys(), othermap.keys() );
|
||||
recursiveCompareMap( map, othermap, 0 );
|
||||
@ -247,7 +246,7 @@ LibCalamaresTests::testLoadSaveYamlExtended()
|
||||
void
|
||||
LibCalamaresTests::testCommands()
|
||||
{
|
||||
using CalamaresUtils::System;
|
||||
using Calamares::System;
|
||||
auto r = System::runCommand( System::RunLocation::RunInHost, { "/bin/ls", "/tmp" } );
|
||||
|
||||
QVERIFY( r.getExitCode() == 0 );
|
||||
@ -292,8 +291,8 @@ LibCalamaresTests::testCommandExpansion()
|
||||
|
||||
QFETCH( QString, command );
|
||||
QFETCH( QString, expected );
|
||||
CalamaresUtils::CommandLine c( command, std::chrono::seconds( 0 ) );
|
||||
CalamaresUtils::CommandLine e = c.expand();
|
||||
Calamares::CommandLine c( command, std::chrono::seconds( 0 ) );
|
||||
Calamares::CommandLine e = c.expand();
|
||||
|
||||
QCOMPARE( c.command(), command );
|
||||
QCOMPARE( e.command(), expected );
|
||||
@ -309,13 +308,13 @@ LibCalamaresTests::testUmask()
|
||||
|
||||
// m gets the previous value of the mask (depends on the environment the
|
||||
// test is run in, might be 002, might be 077), ..
|
||||
mode_t m = CalamaresUtils::setUMask( 022 );
|
||||
QCOMPARE( CalamaresUtils::setUMask( m ), mode_t( 022 ) ); // But now most recently set was 022
|
||||
mode_t m = Calamares::setUMask( 022 );
|
||||
QCOMPARE( Calamares::setUMask( m ), mode_t( 022 ) ); // But now most recently set was 022
|
||||
|
||||
for ( mode_t i = 0; i <= 0777 /* octal! */; ++i )
|
||||
{
|
||||
QByteArray name = ( ft.fileName() + QChar( '.' ) + QString::number( i, 8 ) ).toLatin1();
|
||||
CalamaresUtils::UMask um( i );
|
||||
Calamares::UMask um( i );
|
||||
int fd = creat( name, 0777 );
|
||||
QVERIFY( fd >= 0 );
|
||||
close( fd );
|
||||
@ -325,8 +324,8 @@ LibCalamaresTests::testUmask()
|
||||
QCOMPARE( mystat.st_mode & 0777, 0777 & ~i );
|
||||
QCOMPARE( unlink( name ), 0 );
|
||||
}
|
||||
QCOMPARE( CalamaresUtils::setUMask( 022 ), m );
|
||||
QCOMPARE( CalamaresUtils::setUMask( m ), mode_t( 022 ) );
|
||||
QCOMPARE( Calamares::setUMask( 022 ), m );
|
||||
QCOMPARE( Calamares::setUMask( m ), mode_t( 022 ) );
|
||||
}
|
||||
|
||||
void
|
||||
@ -334,18 +333,18 @@ LibCalamaresTests::testEntropy()
|
||||
{
|
||||
QByteArray data;
|
||||
|
||||
auto r0 = CalamaresUtils::getEntropy( 0, data );
|
||||
QCOMPARE( CalamaresUtils::EntropySource::None, r0 );
|
||||
auto r0 = Calamares::getEntropy( 0, data );
|
||||
QCOMPARE( Calamares::EntropySource::None, r0 );
|
||||
QCOMPARE( data.size(), 0 );
|
||||
|
||||
auto r1 = CalamaresUtils::getEntropy( 16, data );
|
||||
QVERIFY( r1 != CalamaresUtils::EntropySource::None );
|
||||
auto r1 = Calamares::getEntropy( 16, data );
|
||||
QVERIFY( r1 != Calamares::EntropySource::None );
|
||||
QCOMPARE( data.size(), 16 );
|
||||
// This can randomly fail (but not often)
|
||||
QVERIFY( data.at( data.size() - 1 ) != char( 0xcb ) );
|
||||
|
||||
auto r2 = CalamaresUtils::getEntropy( 8, data );
|
||||
QVERIFY( r2 != CalamaresUtils::EntropySource::None );
|
||||
auto r2 = Calamares::getEntropy( 8, data );
|
||||
QVERIFY( r2 != Calamares::EntropySource::None );
|
||||
QCOMPARE( data.size(), 8 );
|
||||
QCOMPARE( r1, r2 );
|
||||
// This can randomly fail (but not often)
|
||||
@ -357,12 +356,12 @@ LibCalamaresTests::testPrintableEntropy()
|
||||
{
|
||||
QString s;
|
||||
|
||||
auto r0 = CalamaresUtils::getPrintableEntropy( 0, s );
|
||||
QCOMPARE( CalamaresUtils::EntropySource::None, r0 );
|
||||
auto r0 = Calamares::getPrintableEntropy( 0, s );
|
||||
QCOMPARE( Calamares::EntropySource::None, r0 );
|
||||
QCOMPARE( s.length(), 0 );
|
||||
|
||||
auto r1 = CalamaresUtils::getPrintableEntropy( 16, s );
|
||||
QVERIFY( r1 != CalamaresUtils::EntropySource::None );
|
||||
auto r1 = Calamares::getPrintableEntropy( 16, s );
|
||||
QVERIFY( r1 != Calamares::EntropySource::None );
|
||||
QCOMPARE( s.length(), 16 );
|
||||
for ( QChar c : s )
|
||||
{
|
||||
@ -379,14 +378,14 @@ LibCalamaresTests::testOddSizedPrintable()
|
||||
QString s;
|
||||
for ( int l = 0; l <= 37; ++l )
|
||||
{
|
||||
auto r = CalamaresUtils::getPrintableEntropy( l, s );
|
||||
auto r = Calamares::getPrintableEntropy( l, s );
|
||||
if ( l == 0 )
|
||||
{
|
||||
QCOMPARE( r, CalamaresUtils::EntropySource::None );
|
||||
QCOMPARE( r, Calamares::EntropySource::None );
|
||||
}
|
||||
else
|
||||
{
|
||||
QVERIFY( r != CalamaresUtils::EntropySource::None );
|
||||
QVERIFY( r != Calamares::EntropySource::None );
|
||||
}
|
||||
QCOMPARE( s.length(), l );
|
||||
|
||||
@ -443,7 +442,6 @@ LibCalamaresTests::testPointerSetter()
|
||||
QCOMPARE( special, 34 );
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
@ -484,7 +482,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
LibCalamaresTests::testTraits()
|
||||
{
|
||||
@ -507,7 +504,7 @@ LibCalamaresTests::testTraits()
|
||||
void
|
||||
LibCalamaresTests::testVariantStringListCode()
|
||||
{
|
||||
using namespace CalamaresUtils;
|
||||
using namespace Calamares;
|
||||
const QString key( "strings" );
|
||||
{
|
||||
// Things that are not stringlists
|
||||
@ -547,7 +544,7 @@ LibCalamaresTests::testVariantStringListCode()
|
||||
void
|
||||
LibCalamaresTests::testVariantStringListYAMLDashed()
|
||||
{
|
||||
using namespace CalamaresUtils;
|
||||
using namespace Calamares;
|
||||
const QString key( "strings" );
|
||||
|
||||
// Looks like a stringlist to me
|
||||
@ -561,7 +558,7 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
|
||||
)" );
|
||||
f.close();
|
||||
bool ok = false;
|
||||
QVariantMap m = loadYaml( f.fileName(), &ok );
|
||||
QVariantMap m = Calamares::YAML::load( f.fileName(), &ok );
|
||||
|
||||
QVERIFY( ok );
|
||||
QCOMPARE( m.count(), 1 );
|
||||
@ -575,7 +572,7 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
|
||||
void
|
||||
LibCalamaresTests::testVariantStringListYAMLBracketed()
|
||||
{
|
||||
using namespace CalamaresUtils;
|
||||
using namespace Calamares;
|
||||
const QString key( "strings" );
|
||||
|
||||
// Looks like a stringlist to me
|
||||
@ -586,7 +583,7 @@ LibCalamaresTests::testVariantStringListYAMLBracketed()
|
||||
)" );
|
||||
f.close();
|
||||
bool ok = false;
|
||||
QVariantMap m = loadYaml( f.fileName(), &ok );
|
||||
QVariantMap m = Calamares::YAML::load( f.fileName(), &ok );
|
||||
|
||||
QVERIFY( ok );
|
||||
QCOMPARE( m.count(), 1 );
|
||||
@ -686,7 +683,6 @@ LibCalamaresTests::testStringTruncationShorter()
|
||||
|
||||
using namespace Calamares::String;
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
|
||||
displayed in various user-facing messages. These have been removed
|
||||
@ -1034,24 +1030,24 @@ LibCalamaresTests::testCalculateWorkingDirectory()
|
||||
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 );
|
||||
QCOMPARE( d, QDir::current() );
|
||||
}
|
||||
{
|
||||
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInTarget, QString() );
|
||||
auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInTarget, QString() );
|
||||
QVERIFY( ok );
|
||||
QCOMPARE( d.absolutePath(), tempRoot.path() );
|
||||
}
|
||||
|
||||
gs->remove( "rootMountPoint" );
|
||||
{
|
||||
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInHost, QString() );
|
||||
auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInHost, QString() );
|
||||
QVERIFY( ok );
|
||||
QCOMPARE( d, QDir::current() );
|
||||
}
|
||||
{
|
||||
auto [ ok, d ] = calculateWorkingDirectory( CalamaresUtils::System::RunLocation::RunInTarget, QString() );
|
||||
auto [ ok, d ] = calculateWorkingDirectory( Calamares::System::RunLocation::RunInTarget, QString() );
|
||||
QVERIFY( !ok );
|
||||
QCOMPARE( d, QDir::current() );
|
||||
}
|
||||
@ -1121,14 +1117,13 @@ LibCalamaresTests::testRunnerOutput()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CalamaresUtils::System*
|
||||
Calamares::System*
|
||||
file_setup( const QTemporaryDir& tempRoot )
|
||||
{
|
||||
CalamaresUtils::System* ss = CalamaresUtils::System::instance();
|
||||
Calamares::System* ss = Calamares::System::instance();
|
||||
if ( !ss )
|
||||
{
|
||||
ss = new CalamaresUtils::System( true );
|
||||
ss = new Calamares::System( true );
|
||||
}
|
||||
|
||||
Calamares::GlobalStorage* gs
|
||||
@ -1157,7 +1152,7 @@ LibCalamaresTests::testReadWriteFile()
|
||||
|
||||
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.path().isEmpty() );
|
||||
|
||||
@ -1180,7 +1175,7 @@ LibCalamaresTests::testReadWriteFile()
|
||||
}
|
||||
// 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.path().isEmpty() );
|
||||
|
||||
@ -1200,7 +1195,6 @@ LibCalamaresTests::testReadWriteFile()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( LibCalamaresTests )
|
||||
|
||||
#include "utils/moc-warnings.h"
|
||||
|
@ -13,8 +13,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
/** @brief Traits machinery lives in this namespace
|
||||
@ -54,10 +53,10 @@ struct sfinae_true : std::true_type
|
||||
{
|
||||
};
|
||||
} // namespace Traits
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#define DECLARE_HAS_METHOD( m ) \
|
||||
namespace CalamaresUtils \
|
||||
namespace Calamares \
|
||||
{ \
|
||||
namespace Traits \
|
||||
{ \
|
||||
@ -73,6 +72,6 @@ struct sfinae_true : std::true_type
|
||||
} \
|
||||
} \
|
||||
template < class T > \
|
||||
using has_##m = CalamaresUtils::Traits::has_##m ::t< T >;
|
||||
using has_##m = Calamares::Traits::has_##m ::t< T >;
|
||||
|
||||
#endif
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
mode_t
|
||||
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." );
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/** @brief Wrapper for umask(2)
|
||||
*
|
||||
@ -45,6 +45,6 @@ public:
|
||||
private:
|
||||
mode_t m_mode;
|
||||
};
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <QtCore/QIntegerForSize>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/// @brief Type for expressing units
|
||||
using intunit_t = quint64;
|
||||
@ -170,6 +170,6 @@ bytesToSectors( qint64 bytes, qint64 blocksize )
|
||||
return alignBytesToBlockSize( alignBytesToBlockSize( bytes, blocksize ), MiBtoBytes( 1ULL ) ) / blocksize;
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
bool
|
||||
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;
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/**
|
||||
* 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,
|
||||
bool& success,
|
||||
const QVariantMap& d = QVariantMap() );
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QRegularExpression>
|
||||
|
||||
void
|
||||
operator>>( const YAML::Node& node, QStringList& v )
|
||||
operator>>( const ::YAML::Node& node, QStringList& v )
|
||||
{
|
||||
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
|
||||
yamlToVariant( const YAML::Node& node )
|
||||
toVariant( const ::YAML::Node& node )
|
||||
{
|
||||
switch ( node.Type() )
|
||||
{
|
||||
case YAML::NodeType::Scalar:
|
||||
return yamlScalarToVariant( node );
|
||||
case ::YAML::NodeType::Scalar:
|
||||
return scalarToVariant( node );
|
||||
|
||||
case YAML::NodeType::Sequence:
|
||||
return yamlSequenceToVariant( node );
|
||||
case ::YAML::NodeType::Sequence:
|
||||
return sequenceToVariant( node );
|
||||
|
||||
case YAML::NodeType::Map:
|
||||
return yamlMapToVariant( node );
|
||||
case ::YAML::NodeType::Map:
|
||||
return mapToVariant( node );
|
||||
|
||||
case YAML::NodeType::Null:
|
||||
case YAML::NodeType::Undefined:
|
||||
case ::YAML::NodeType::Null:
|
||||
case ::YAML::NodeType::Undefined:
|
||||
return QVariant();
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
|
||||
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 yamlScalarFalseValues = QRegularExpression( "^(false|False|FALSE|off|Off|OFF)$" );
|
||||
@ -83,32 +83,30 @@ yamlScalarToVariant( const YAML::Node& scalarNode )
|
||||
return QVariant( scalarString );
|
||||
}
|
||||
|
||||
|
||||
QVariantList
|
||||
yamlSequenceToVariant( const YAML::Node& sequenceNode )
|
||||
sequenceToVariant( const ::YAML::Node& sequenceNode )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap
|
||||
yamlMapToVariant( const YAML::Node& mapNode )
|
||||
mapToVariant( const ::YAML::Node& mapNode )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
QStringList
|
||||
yamlToStringList( const YAML::Node& listNode )
|
||||
toStringList( const ::YAML::Node& listNode )
|
||||
{
|
||||
QStringList l;
|
||||
listNode >> l;
|
||||
@ -116,21 +114,21 @@ yamlToStringList( const YAML::Node& listNode )
|
||||
}
|
||||
|
||||
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 << '.';
|
||||
explainYamlException( e, yamlData );
|
||||
explainException( e, yamlData );
|
||||
}
|
||||
|
||||
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 << '.';
|
||||
explainYamlException( e, yamlData );
|
||||
explainException( e, yamlData );
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
@ -176,13 +174,13 @@ explainYamlException( const YAML::Exception& e, const QByteArray& yamlData )
|
||||
}
|
||||
|
||||
QVariantMap
|
||||
loadYaml( const QFileInfo& fi, bool* ok )
|
||||
load( const QFileInfo& fi, bool* ok )
|
||||
{
|
||||
return loadYaml( fi.absoluteFilePath(), ok );
|
||||
return load( fi.absoluteFilePath(), ok );
|
||||
}
|
||||
|
||||
QVariantMap
|
||||
loadYaml( const QString& filename, bool* ok )
|
||||
load( const QString& filename, bool* ok )
|
||||
{
|
||||
if ( ok )
|
||||
{
|
||||
@ -196,17 +194,16 @@ loadYaml( const QString& filename, bool* ok )
|
||||
QByteArray ba = yamlFile.readAll();
|
||||
try
|
||||
{
|
||||
YAML::Node doc = YAML::Load( ba.constData() );
|
||||
yamlContents = CalamaresUtils::yamlToVariant( doc );
|
||||
::YAML::Node doc = ::YAML::Load( ba.constData() );
|
||||
yamlContents = toVariant( doc );
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
catch ( ::YAML::Exception& e )
|
||||
{
|
||||
explainYamlException( e, ba, filename );
|
||||
explainException( e, ba, filename );
|
||||
return QVariantMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( yamlContents.isValid() && !yamlContents.isNull()
|
||||
&& Calamares::typeOf( yamlContents ) == Calamares::MapVariantType )
|
||||
{
|
||||
@ -317,7 +314,7 @@ dumpYaml( QFile& f, const QVariantMap& map, int indent )
|
||||
}
|
||||
|
||||
bool
|
||||
saveYaml( const QString& filename, const QVariantMap& map )
|
||||
save( const QString& filename, const QVariantMap& map )
|
||||
{
|
||||
QFile f( filename );
|
||||
if ( !f.open( QFile::WriteOnly ) )
|
||||
@ -329,5 +326,5 @@ saveYaml( const QString& filename, const QVariantMap& map )
|
||||
return dumpYaml( f, map, 0 );
|
||||
}
|
||||
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace YAML
|
||||
} // namespace Calamares
|
||||
|
@ -48,9 +48,11 @@ class QFileInfo;
|
||||
#endif
|
||||
|
||||
/// @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
|
||||
@ -58,30 +60,31 @@ namespace CalamaresUtils
|
||||
* malformed in some way, returns an empty map and sets
|
||||
* @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. */
|
||||
QVariantMap loadYaml( const QFileInfo&, bool* ok = nullptr );
|
||||
QVariantMap load( const QFileInfo&, bool* ok = nullptr );
|
||||
|
||||
QVariant yamlToVariant( const YAML::Node& node );
|
||||
QVariant yamlScalarToVariant( const YAML::Node& scalarNode );
|
||||
QVariantList yamlSequenceToVariant( const YAML::Node& sequenceNode );
|
||||
QVariantMap yamlMapToVariant( const YAML::Node& mapNode );
|
||||
QVariant toVariant( const ::YAML::Node& node );
|
||||
QVariant scalarToVariant( const ::YAML::Node& scalarNode );
|
||||
QVariantList sequenceToVariant( const ::YAML::Node& sequenceNode );
|
||||
QVariantMap mapToVariant( const ::YAML::Node& mapNode );
|
||||
|
||||
/// @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
|
||||
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
|
||||
* 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")
|
||||
*/
|
||||
void explainYamlException( const YAML::Exception& e, const QByteArray& data, const char* label );
|
||||
void explainYamlException( 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, const char* label );
|
||||
void explainException( const ::YAML::Exception& e, const QByteArray& data, const QString& label );
|
||||
void explainException( const ::YAML::Exception& e, const QByteArray& data );
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace YAML
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,6 @@ Branding::instance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
// clang-format off
|
||||
const QStringList Branding::s_stringEntryStrings =
|
||||
@ -76,7 +75,6 @@ const QStringList Branding::s_stringEntryStrings =
|
||||
"donateUrl"
|
||||
};
|
||||
|
||||
|
||||
const QStringList Branding::s_imageEntryStrings =
|
||||
{
|
||||
"productBanner",
|
||||
@ -150,16 +148,16 @@ Branding::WindowDimension::suffixes()
|
||||
*/
|
||||
static void
|
||||
loadStrings( QMap< QString, QString >& map,
|
||||
const YAML::Node& doc,
|
||||
const ::YAML::Node& doc,
|
||||
const std::string& key,
|
||||
const std::function< QString( const QString& ) >& transform )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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
|
||||
return Branding::UploadServerInfo {
|
||||
names.find( typestring, bogus ),
|
||||
return Branding::UploadServerInfo { names.find( typestring, bogus ),
|
||||
QUrl( urlstring, QUrl::ParsingMode::StrictMode ),
|
||||
sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1
|
||||
};
|
||||
sizeLimitKiB >= 0
|
||||
? Calamares::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) )
|
||||
: -1 };
|
||||
}
|
||||
|
||||
/** @brief Load the @p map with strings from @p config
|
||||
@ -226,7 +224,7 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
|
||||
|
||||
try
|
||||
{
|
||||
YAML::Node doc = YAML::Load( ba.constData() );
|
||||
auto doc = ::YAML::Load( ba.constData() );
|
||||
Q_ASSERT( doc.IsMap() );
|
||||
|
||||
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; } );
|
||||
|
||||
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() );
|
||||
}
|
||||
|
||||
@ -323,7 +321,6 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devi
|
||||
validateStyleEntries( m_style );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::componentDirectory() const
|
||||
{
|
||||
@ -331,14 +328,12 @@ Branding::componentDirectory() const
|
||||
return fi.absoluteDir().absolutePath();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::string( Branding::StringEntry stringEntry ) const
|
||||
{
|
||||
return m_strings.value( s_stringEntryStrings.value( stringEntry ) );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::styleString( Branding::StyleEntry styleEntry ) const
|
||||
{
|
||||
@ -346,7 +341,6 @@ Branding::styleString( Branding::StyleEntry styleEntry ) const
|
||||
return m_style.value( meta.valueToKey( styleEntry ) );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::imagePath( Branding::ImageEntry imageEntry ) const
|
||||
{
|
||||
@ -410,7 +404,6 @@ Branding::image( const QStringList& list, const QSize& size ) const
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
|
||||
static QString
|
||||
_stylesheet( const QDir& dir )
|
||||
{
|
||||
@ -451,10 +444,9 @@ Branding::WindowDimension::isValid() const
|
||||
return ( unit() != none ) && ( value() > 0 );
|
||||
}
|
||||
|
||||
|
||||
/// @brief Get a string (empty is @p key doesn't exist) from @p key in @p doc
|
||||
static inline QString
|
||||
getString( const YAML::Node& doc, const char* key )
|
||||
getString( const ::YAML::Node& doc, const char* 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
|
||||
static inline YAML::Node
|
||||
get( const YAML::Node& doc, const char* key )
|
||||
static inline ::YAML::Node
|
||||
get( const ::YAML::Node& doc, const char* key )
|
||||
{
|
||||
auto r = doc[ key ];
|
||||
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;
|
||||
}
|
||||
|
||||
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 PanelSide = Branding::PanelSide;
|
||||
@ -552,7 +544,7 @@ flavorAndSide( const YAML::Node& doc, const char* key, Branding::PanelFlavor& fl
|
||||
}
|
||||
|
||||
void
|
||||
Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
Branding::initSimpleSettings( const ::YAML::Node& doc )
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
// clang-format off
|
||||
@ -598,16 +590,16 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
||||
}
|
||||
if ( !m_windowWidth.isValid() )
|
||||
{
|
||||
m_windowWidth = WindowDimension( CalamaresUtils::windowPreferredWidth, WindowDimensionUnit::Pixies );
|
||||
m_windowWidth = WindowDimension( Calamares::windowPreferredWidth, WindowDimensionUnit::Pixies );
|
||||
}
|
||||
if ( !m_windowHeight.isValid() )
|
||||
{
|
||||
m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies );
|
||||
m_windowHeight = WindowDimension( Calamares::windowPreferredHeight, WindowDimensionUnit::Pixies );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Branding::initSlideshowSettings( const YAML::Node& doc )
|
||||
Branding::initSlideshowSettings( const ::YAML::Node& doc )
|
||||
{
|
||||
QDir componentDir( componentDirectory() );
|
||||
|
||||
@ -666,5 +658,4 @@ Branding::initSlideshowSettings( const YAML::Node& doc )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -93,21 +93,18 @@ ViewManager::ViewManager( QObject* parent )
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ViewManager::~ViewManager()
|
||||
{
|
||||
m_widget->deleteLater();
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
ViewManager::centralWidget()
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::addViewStep( ViewStep* step )
|
||||
{
|
||||
@ -120,7 +117,6 @@ ViewManager::addViewStep( ViewStep* step )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::insertViewStep( int before, ViewStep* step )
|
||||
{
|
||||
@ -174,13 +170,12 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
|
||||
{
|
||||
if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() )
|
||||
{
|
||||
CalamaresUtils::Paste::doLogUploadUI( errorDialog );
|
||||
Calamares::Paste::doLogUploadUI( errorDialog );
|
||||
}
|
||||
QApplication::quit();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::onInitFailed( const QStringList& modules )
|
||||
{
|
||||
@ -237,21 +232,18 @@ ViewManager::updateNextStatus( bool status )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ViewStepList
|
||||
ViewManager::viewSteps() const
|
||||
{
|
||||
return m_steps;
|
||||
}
|
||||
|
||||
|
||||
ViewStep*
|
||||
ViewManager::currentStep() const
|
||||
{
|
||||
return currentStepValid() ? m_steps.value( m_currentStep ) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ViewManager::currentStepIndex() const
|
||||
{
|
||||
@ -487,7 +479,6 @@ ViewManager::back()
|
||||
updateButtonLabels();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::quit()
|
||||
{
|
||||
@ -594,7 +585,6 @@ ViewManager::data( const QModelIndex& index, int role ) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ViewManager::rowCount( const QModelIndex& parent ) const
|
||||
{
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
@ -126,7 +125,7 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||
{
|
||||
m->loadConfigurationFile( configFileName );
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
catch ( ::YAML::Exception& e )
|
||||
{
|
||||
cError() << "YAML parser error " << e.what();
|
||||
return nullptr;
|
||||
@ -135,5 +134,4 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
|
||||
return m.release();
|
||||
}
|
||||
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -34,7 +34,6 @@ ModuleManager::instance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_paths( paths )
|
||||
@ -44,7 +43,6 @@ ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
|
||||
ModuleManager::~ModuleManager()
|
||||
{
|
||||
// The map is populated with Module::fromDescriptor(), which allocates on the heap.
|
||||
@ -54,7 +52,6 @@ ModuleManager::~ModuleManager()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ModuleManager::init()
|
||||
{
|
||||
@ -98,7 +95,7 @@ ModuleManager::doInit()
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
QVariantMap moduleDescriptorMap = CalamaresUtils::loadYaml( descriptorFileInfo, &ok );
|
||||
QVariantMap moduleDescriptorMap = Calamares::YAML::load( descriptorFileInfo, &ok );
|
||||
QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString();
|
||||
|
||||
if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
|
||||
@ -136,14 +133,12 @@ ModuleManager::doInit()
|
||||
QTimer::singleShot( 10, this, &ModuleManager::initDone );
|
||||
}
|
||||
|
||||
|
||||
QList< ModuleSystem::InstanceKey >
|
||||
ModuleManager::loadedInstanceKeys()
|
||||
{
|
||||
return m_loadedModulesByInstanceKey.keys();
|
||||
}
|
||||
|
||||
|
||||
Calamares::ModuleSystem::Descriptor
|
||||
ModuleManager::moduleDescriptor( const QString& name )
|
||||
{
|
||||
@ -156,7 +151,6 @@ ModuleManager::moduleInstance( const ModuleSystem::InstanceKey& instanceKey )
|
||||
return m_loadedModulesByInstanceKey.value( instanceKey );
|
||||
}
|
||||
|
||||
|
||||
/** @brief Returns the config file name for the given @p instanceKey
|
||||
*
|
||||
* 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
|
||||
return QString();
|
||||
}
|
||||
|
@ -22,13 +22,12 @@
|
||||
|
||||
#define RESPATH ":/data/"
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
static int s_defaultFontSize = 0;
|
||||
static int s_defaultFontHeight = 0;
|
||||
|
||||
|
||||
QPixmap
|
||||
defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
||||
{
|
||||
@ -127,7 +126,6 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unmarginLayout( QLayout* layout )
|
||||
{
|
||||
@ -148,7 +146,6 @@ unmarginLayout( QLayout* layout )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
defaultFontSize()
|
||||
{
|
||||
@ -159,7 +156,6 @@ defaultFontSize()
|
||||
return s_defaultFontSize;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
defaultFontHeight()
|
||||
{
|
||||
@ -173,7 +169,6 @@ defaultFontHeight()
|
||||
return s_defaultFontHeight;
|
||||
}
|
||||
|
||||
|
||||
QFont
|
||||
largeFont()
|
||||
{
|
||||
@ -182,7 +177,6 @@ largeFont()
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
setDefaultFontSize( int points )
|
||||
{
|
||||
@ -190,7 +184,6 @@ setDefaultFontSize( int points )
|
||||
s_defaultFontHeight = 0; // Recalculate on next call to defaultFontHeight()
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
defaultIconSize()
|
||||
{
|
||||
@ -198,4 +191,4 @@ defaultIconSize()
|
||||
return QSize( w, w );
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
class QLayout;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ enum ImageMode
|
||||
* @return the new pixmap.
|
||||
*/
|
||||
UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
|
||||
ImageMode mode = CalamaresUtils::Original,
|
||||
ImageMode mode = Calamares::Original,
|
||||
const QSize& size = QSize( 0, 0 ) );
|
||||
|
||||
/**
|
||||
@ -97,6 +97,6 @@ constexpr int windowMinimumHeight = 520;
|
||||
constexpr int windowPreferredWidth = 1024;
|
||||
constexpr int windowPreferredHeight = 520;
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif // CALAMARESUTILSGUI_H
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
|
||||
|
||||
|
||||
ImageRegistry*
|
||||
ImageRegistry::instance()
|
||||
{
|
||||
@ -23,26 +22,22 @@ ImageRegistry::instance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
ImageRegistry::ImageRegistry() {}
|
||||
|
||||
|
||||
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
|
||||
ImageRegistry::cacheKey( const QSize& size )
|
||||
{
|
||||
return size.width() * 100 + size.height() * 10;
|
||||
}
|
||||
|
||||
|
||||
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 ) );
|
||||
if ( size.width() < 0 || size.height() < 0 )
|
||||
@ -112,12 +107,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ImageRegistry::putInCache( const QString& image,
|
||||
const QSize& size,
|
||||
CalamaresUtils::ImageMode mode,
|
||||
const QPixmap& pixmap )
|
||||
ImageRegistry::putInCache( const QString& image, const QSize& size, Calamares::ImageMode mode, const QPixmap& pixmap )
|
||||
{
|
||||
QHash< qint64, QPixmap > subsubcache;
|
||||
QHash< int, QHash< qint64, QPixmap > > subcache;
|
||||
|
@ -21,13 +21,12 @@ public:
|
||||
|
||||
explicit ImageRegistry();
|
||||
|
||||
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
||||
QPixmap
|
||||
pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
||||
QIcon icon( const QString& image, Calamares::ImageMode mode = Calamares::Original );
|
||||
QPixmap pixmap( const QString& image, const QSize& size, Calamares::ImageMode mode = Calamares::Original );
|
||||
|
||||
private:
|
||||
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
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
|
||||
using namespace CalamaresUtils::Units;
|
||||
using namespace Calamares::Units;
|
||||
|
||||
/** @brief Reads the logfile, returns its contents.
|
||||
*
|
||||
@ -64,7 +64,6 @@ logFileContents( const qint64 sizeLimitBytes )
|
||||
return pasteSourceFile.read( sizeLimitBytes );
|
||||
}
|
||||
|
||||
|
||||
STATICTEST QString
|
||||
ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* parent )
|
||||
{
|
||||
@ -117,7 +116,7 @@ ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* par
|
||||
}
|
||||
|
||||
QString
|
||||
CalamaresUtils::Paste::doLogUpload( QObject* parent )
|
||||
Calamares::Paste::doLogUpload( QObject* parent )
|
||||
{
|
||||
auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer();
|
||||
if ( !serverUrl.isValid() )
|
||||
@ -156,10 +155,10 @@ CalamaresUtils::Paste::doLogUpload( QObject* parent )
|
||||
}
|
||||
|
||||
QString
|
||||
CalamaresUtils::Paste::doLogUploadUI( QWidget* parent )
|
||||
Calamares::Paste::doLogUploadUI( QWidget* parent )
|
||||
{
|
||||
// These strings originated in the ViewManager class
|
||||
QString pasteUrl = CalamaresUtils::Paste::doLogUpload( parent );
|
||||
QString pasteUrl = Calamares::Paste::doLogUpload( parent );
|
||||
QString pasteUrlMessage;
|
||||
if ( pasteUrl.isEmpty() )
|
||||
{
|
||||
@ -189,9 +188,8 @@ CalamaresUtils::Paste::doLogUploadUI( QWidget* parent )
|
||||
return pasteUrl;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
CalamaresUtils::Paste::isEnabled()
|
||||
Calamares::Paste::isEnabled()
|
||||
{
|
||||
auto [ type, serverUrl, sizeLimitBytes ] = Calamares::Branding::instance()->uploadServer();
|
||||
return type != Calamares::Branding::UploadServerType::None && sizeLimitBytes != 0;
|
||||
|
@ -15,7 +15,7 @@
|
||||
class QObject;
|
||||
class QWidget;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
namespace Paste
|
||||
{
|
||||
@ -39,6 +39,6 @@ QString doLogUploadUI( QWidget* parent );
|
||||
bool isEnabled();
|
||||
} // namespace Paste
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
static QDir s_qmlModulesDir( QString( CMAKE_INSTALL_FULL_DATADIR ) + "/qml" );
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
QDir
|
||||
qmlModulesDir()
|
||||
@ -46,9 +46,9 @@ qmlDirCandidates( bool assumeBuilddir )
|
||||
static const char QML[] = "qml";
|
||||
|
||||
QStringList qmlDirs;
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
||||
qmlDirs << Calamares::appDataDir().absoluteFilePath( QML );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -56,12 +56,12 @@ qmlDirCandidates( bool assumeBuilddir )
|
||||
{
|
||||
qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir
|
||||
}
|
||||
if ( CalamaresUtils::haveExtraDirs() )
|
||||
for ( auto s : CalamaresUtils::extraDataDirs() )
|
||||
if ( Calamares::haveExtraDirs() )
|
||||
for ( auto s : Calamares::extraDataDirs() )
|
||||
{
|
||||
qmlDirs << ( s + QML );
|
||||
}
|
||||
qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML );
|
||||
qmlDirs << Calamares::appDataDir().absoluteFilePath( QML );
|
||||
}
|
||||
|
||||
return qmlDirs;
|
||||
@ -79,14 +79,14 @@ initQmlModulesDir()
|
||||
if ( dir.exists() && dir.isReadable() )
|
||||
{
|
||||
cDebug() << "Using Calamares QML directory" << dir.absolutePath();
|
||||
CalamaresUtils::setQmlModulesDir( dir );
|
||||
Calamares::setQmlModulesDir( dir );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cError() << "Cowardly refusing to continue startup without a QML directory."
|
||||
<< Logger::DebugList( qmlDirCandidatesByPriority );
|
||||
if ( CalamaresUtils::isAppDataDirOverridden() )
|
||||
if ( Calamares::isAppDataDirOverridden() )
|
||||
{
|
||||
cError() << "FATAL: explicitly configured application data directory is missing qml/";
|
||||
}
|
||||
@ -240,13 +240,13 @@ registerQmlModels()
|
||||
0,
|
||||
"Global",
|
||||
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } );
|
||||
qmlRegisterSingletonType< Calamares::Network::Manager >(
|
||||
"io.calamares.core",
|
||||
qmlRegisterSingletonType< Calamares::Network::Manager >( "io.calamares.core",
|
||||
1,
|
||||
0,
|
||||
"Network",
|
||||
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return &Calamares::Network::Manager::instance(); } );
|
||||
[]( QQmlEngine*, QJSEngine* ) -> QObject*
|
||||
{ return &Calamares::Network::Manager::instance(); } );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
class QQuickItem;
|
||||
|
||||
namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
/// @brief the extra directory where Calamares searches for QML files
|
||||
UIDLLEXPORT QDir qmlModulesDir();
|
||||
@ -85,6 +85,6 @@ UIDLLEXPORT QString searchQmlFile( QmlSearch method,
|
||||
const Calamares::ModuleSystem::InstanceKey& i );
|
||||
UIDLLEXPORT QString searchQmlFile( QmlSearch method, const QString& fileNameNoSuffix );
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ BlankViewStep::BlankViewStep( const QString& title,
|
||||
|
||||
auto* label = new QLabel( title );
|
||||
label->setAlignment( Qt::AlignHCenter );
|
||||
label->setFont( CalamaresUtils::largeFont() );
|
||||
label->setFont( Calamares::largeFont() );
|
||||
layout->addWidget( label );
|
||||
|
||||
label = new QLabel( description );
|
||||
|
@ -87,10 +87,10 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
||||
m_tab_widget->tabBar()->hide();
|
||||
|
||||
layout->addWidget( m_tab_widget );
|
||||
CalamaresUtils::unmarginLayout( layout );
|
||||
Calamares::unmarginLayout( layout );
|
||||
layout->addLayout( bottomLayout );
|
||||
|
||||
bottomLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
||||
bottomLayout->addSpacing( Calamares::defaultFontHeight() / 2 );
|
||||
bottomLayout->addLayout( barLayout );
|
||||
bottomLayout->addWidget( m_label );
|
||||
|
||||
@ -104,62 +104,52 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
||||
auto toggleLogButton = dynamic_cast< QToolButton* >( toolBar->widgetForAction( toggleLogAction ) );
|
||||
connect( toggleLogButton, &QToolButton::clicked, this, &ExecutionViewStep::toggleLog );
|
||||
|
||||
|
||||
barLayout->addWidget( m_progressBar );
|
||||
barLayout->addWidget( toolBar );
|
||||
|
||||
|
||||
connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ExecutionViewStep::prettyName() const
|
||||
{
|
||||
return Calamares::Settings::instance()->isSetupMode() ? tr( "Set up" ) : tr( "Install" );
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
ExecutionViewStep::widget()
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExecutionViewStep::next()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExecutionViewStep::back()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ExecutionViewStep::isNextEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ExecutionViewStep::isBackEnabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ExecutionViewStep::isAtBeginning() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ExecutionViewStep::isAtEnd() const
|
||||
{
|
||||
@ -206,21 +196,18 @@ ExecutionViewStep::onActivate()
|
||||
queue->start();
|
||||
}
|
||||
|
||||
|
||||
JobList
|
||||
ExecutionViewStep::jobs() const
|
||||
{
|
||||
return JobList();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExecutionViewStep::appendJobModuleInstanceKey( const ModuleSystem::InstanceKey& instanceKey )
|
||||
{
|
||||
m_jobInstanceKeys.append( instanceKey );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
||||
{
|
||||
@ -253,5 +240,4 @@ ExecutionViewStep::onLeave()
|
||||
m_slideshow->changeSlideShowState( Slideshow::Stop );
|
||||
}
|
||||
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
/// @brief State-change of the QML, for changeQMLState()
|
||||
enum class QMLAction
|
||||
{
|
||||
@ -50,7 +49,7 @@ changeQMLState( QMLAction action, QQuickItem* item )
|
||||
static const char propertyName[] = "activatedInCalamares";
|
||||
|
||||
bool activate = action == QMLAction::Start;
|
||||
CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
|
||||
Calamares::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
|
||||
|
||||
auto property = item->property( propertyName );
|
||||
if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType )
|
||||
@ -69,14 +68,14 @@ QmlViewStep::QmlViewStep( QObject* parent )
|
||||
, m_spinner( new WaitingWidget( tr( "Loading ..." ) ) )
|
||||
, m_qmlWidget( new QQuickWidget )
|
||||
{
|
||||
CalamaresUtils::registerQmlModels();
|
||||
Calamares::registerQmlModels();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( m_widget );
|
||||
layout->addWidget( m_spinner );
|
||||
|
||||
m_qmlWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
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.
|
||||
}
|
||||
@ -90,7 +89,6 @@ QmlViewStep::prettyName() const
|
||||
return tr( "QML Step <i>%1</i>." ).arg( moduleInstanceKey().module() );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
QmlViewStep::isAtBeginning() const
|
||||
{
|
||||
@ -221,19 +219,17 @@ QmlViewStep::showQml()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
bool ok = false;
|
||||
m_searchMethod
|
||||
= CalamaresUtils::qmlSearchNames().find( CalamaresUtils::getString( configurationMap, "qmlSearch" ), ok );
|
||||
m_searchMethod = Calamares::qmlSearchNames().find( Calamares::getString( configurationMap, "qmlSearch" ), ok );
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "Bad QML search mode set for" << moduleInstanceKey();
|
||||
}
|
||||
|
||||
QString qmlFile = CalamaresUtils::getString( configurationMap, "qmlFilename" );
|
||||
QString qmlFile = Calamares::getString( configurationMap, "qmlFilename" );
|
||||
if ( !m_qmlComponent )
|
||||
{
|
||||
m_qmlFileName = searchQmlFile( m_searchMethod, qmlFile, moduleInstanceKey() );
|
||||
|
@ -102,7 +102,7 @@ private:
|
||||
void showFailedQml();
|
||||
|
||||
/// @brief Controls where m_name is searched
|
||||
CalamaresUtils::QmlSearch m_searchMethod;
|
||||
Calamares::QmlSearch m_searchMethod;
|
||||
|
||||
QString m_name;
|
||||
QString m_qmlFileName;
|
||||
|
@ -47,11 +47,11 @@ SlideshowQML::SlideshowQML( QWidget* parent )
|
||||
{
|
||||
m_qmlShow->setObjectName( "qml" );
|
||||
|
||||
CalamaresUtils::registerQmlModels();
|
||||
Calamares::registerQmlModels();
|
||||
|
||||
m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
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() );
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||
@ -149,7 +149,6 @@ SlideshowQML::startSlideShow()
|
||||
changeSlideShowState( Slideshow::Start );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Applies V1 and V2 QML activation / deactivation:
|
||||
* - 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 )
|
||||
{
|
||||
// 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() )
|
||||
{
|
||||
@ -184,7 +183,8 @@ SlideshowQML::changeSlideShowState( Action state )
|
||||
{
|
||||
static const char propertyName[] = "activatedInCalamares";
|
||||
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 );
|
||||
}
|
||||
@ -282,5 +282,4 @@ SlideshowPictures::next()
|
||||
m_label->setPixmap( QPixmap( m_images.at( m_imageIndex ) ) );
|
||||
}
|
||||
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -19,7 +19,7 @@
|
||||
WaitingWidget::WaitingWidget( const QString& text, QWidget* parent )
|
||||
: WaitingSpinnerWidget( parent, false, false )
|
||||
{
|
||||
int spnrSize = CalamaresUtils::defaultFontHeight() * 4;
|
||||
int spnrSize = Calamares::defaultFontHeight() * 4;
|
||||
setFixedSize( spnrSize, spnrSize );
|
||||
setInnerRadius( spnrSize / 2 );
|
||||
setLineLength( spnrSize / 2 );
|
||||
@ -51,7 +51,7 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q
|
||||
, d( std::make_unique< Private >( duration, this ) )
|
||||
{
|
||||
// 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
|
||||
setFixedSize( labelHeight, labelHeight );
|
||||
|
@ -19,19 +19,16 @@
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
class CommandList;
|
||||
} // namespace CalamaresUtils
|
||||
namespace Calamares
|
||||
{
|
||||
class CommandList;
|
||||
class GlobalStorage;
|
||||
} // namespace Calamares
|
||||
|
||||
struct ValueCheck : public QPair< QString, CalamaresUtils::CommandList* >
|
||||
struct ValueCheck : public QPair< QString, Calamares::CommandList* >
|
||||
{
|
||||
ValueCheck( const QString& value, CalamaresUtils::CommandList* commands )
|
||||
: QPair< QString, CalamaresUtils::CommandList* >( value, commands )
|
||||
ValueCheck( const QString& value, Calamares::CommandList* 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().
|
||||
|
||||
QString value() const { return first; }
|
||||
CalamaresUtils::CommandList* commands() const { return second; }
|
||||
Calamares::CommandList* commands() const { return second; }
|
||||
};
|
||||
|
||||
class ContextualProcessBinding
|
||||
@ -65,7 +62,7 @@ public:
|
||||
*
|
||||
* 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.
|
||||
Calamares::JobResult run( const QString& value ) const;
|
||||
@ -81,8 +78,7 @@ public:
|
||||
private:
|
||||
QString m_variable;
|
||||
QList< ValueCheck > m_checks;
|
||||
CalamaresUtils::CommandList* m_wildcard = nullptr;
|
||||
Calamares::CommandList* m_wildcard = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
|
||||
ContextualProcessBinding::~ContextualProcessBinding()
|
||||
{
|
||||
m_wildcard = nullptr;
|
||||
@ -31,7 +30,7 @@ ContextualProcessBinding::~ContextualProcessBinding()
|
||||
}
|
||||
|
||||
void
|
||||
ContextualProcessBinding::append( const QString& value, CalamaresUtils::CommandList* commands )
|
||||
ContextualProcessBinding::append( const QString& value, Calamares::CommandList* commands )
|
||||
{
|
||||
m_checks.append( ValueCheck( value, commands ) );
|
||||
if ( value == QString( "*" ) )
|
||||
@ -80,7 +79,6 @@ fetch( QString& value, QStringList& selector, int index, const QVariant& v )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ContextualProcessBinding::fetch( Calamares::GlobalStorage* storage, QString& value ) const
|
||||
{
|
||||
@ -101,26 +99,22 @@ ContextualProcessBinding::fetch( Calamares::GlobalStorage* storage, QString& val
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ContextualProcessJob::ContextualProcessJob( QObject* parent )
|
||||
: Calamares::CppJob( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ContextualProcessJob::~ContextualProcessJob()
|
||||
{
|
||||
qDeleteAll( m_commands );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ContextualProcessJob::prettyName() const
|
||||
{
|
||||
return tr( "Contextual Processes Job" );
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
ContextualProcessJob::exec()
|
||||
{
|
||||
@ -145,12 +139,11 @@ ContextualProcessJob::exec()
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
||||
qint64 timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
||||
bool dontChroot = Calamares::getBool( configurationMap, "dontChroot", false );
|
||||
qint64 timeout = Calamares::getInteger( configurationMap, "timeout", 10 );
|
||||
if ( timeout < 1 )
|
||||
{
|
||||
timeout = 10;
|
||||
@ -183,8 +176,8 @@ ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
continue;
|
||||
}
|
||||
|
||||
CalamaresUtils::CommandList* commands
|
||||
= new CalamaresUtils::CommandList( valueiter.value(), !dontChroot, std::chrono::seconds( timeout ) );
|
||||
Calamares::CommandList* commands
|
||||
= new Calamares::CommandList( valueiter.value(), !dontChroot, std::chrono::seconds( timeout ) );
|
||||
|
||||
binding->append( valueString, commands );
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
QTEST_GUILESS_MAIN( ContextualProcessTests )
|
||||
|
||||
using CommandList = CalamaresUtils::CommandList;
|
||||
using CommandList = Calamares::CommandList;
|
||||
|
||||
ContextualProcessTests::ContextualProcessTests() {}
|
||||
|
||||
@ -38,7 +38,7 @@ ContextualProcessTests::initTestCase()
|
||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||
|
||||
// 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->doChroot() );
|
||||
|
||||
@ -70,7 +70,7 @@ ContextualProcessTests::testProcessListSampleConfig()
|
||||
}
|
||||
|
||||
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( "firmwareType" ), 4 );
|
||||
|
@ -27,22 +27,18 @@ DummyCppJob::DummyCppJob( QObject* parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DummyCppJob::~DummyCppJob() {}
|
||||
|
||||
|
||||
QString
|
||||
DummyCppJob::prettyName() const
|
||||
{
|
||||
return tr( "Dummy C++ Job" );
|
||||
}
|
||||
|
||||
|
||||
static QString variantListToString( const QVariantList& variantList );
|
||||
static QString variantMapToString( const QVariantMap& variantMap );
|
||||
static QString variantHashToString( const QVariantHash& variantHash );
|
||||
|
||||
|
||||
static QString
|
||||
variantToString( const QVariant& variant )
|
||||
{
|
||||
@ -65,7 +61,6 @@ variantToString( const QVariant& variant )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static QString
|
||||
variantListToString( const QVariantList& variantList )
|
||||
{
|
||||
@ -77,7 +72,6 @@ variantListToString( const QVariantList& variantList )
|
||||
return '{' + result.join( ',' ) + '}';
|
||||
}
|
||||
|
||||
|
||||
static QString
|
||||
variantMapToString( const QVariantMap& variantMap )
|
||||
{
|
||||
@ -89,7 +83,6 @@ variantMapToString( const QVariantMap& variantMap )
|
||||
return '[' + result.join( ',' ) + ']';
|
||||
}
|
||||
|
||||
|
||||
static QString
|
||||
variantHashToString( const QVariantHash& variantHash )
|
||||
{
|
||||
@ -101,12 +94,11 @@ variantHashToString( const QVariantHash& variantHash )
|
||||
return '<' + result.join( ',' ) + '>';
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
DummyCppJob::exec()
|
||||
{
|
||||
// Ported from dummypython
|
||||
CalamaresUtils::System::runCommand( CalamaresUtils::System::RunLocation::RunInHost,
|
||||
Calamares::System::runCommand( Calamares::System::RunLocation::RunInHost,
|
||||
QStringList() << "/bin/sh"
|
||||
<< "-c"
|
||||
<< "touch ~/calamares-dummycpp" );
|
||||
@ -141,7 +133,6 @@ DummyCppJob::exec()
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DummyCppJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
|
@ -34,7 +34,6 @@ restartModes()
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
@ -107,7 +106,6 @@ Config::onInstallationFailed( const QString& message, const QString& details )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::doRestart( bool restartAnyway )
|
||||
{
|
||||
@ -120,7 +118,6 @@ Config::doRestart( bool restartAnyway )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::doNotify( bool hasFailed, bool sendAnyway )
|
||||
{
|
||||
@ -176,14 +173,13 @@ Config::doNotify( bool hasFailed, bool sendAnyway )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
RestartMode mode = RestartMode::Never;
|
||||
|
||||
//TODO:3.3 remove deprecated restart settings
|
||||
QString restartMode = CalamaresUtils::getString( configurationMap, "restartNowMode" );
|
||||
QString restartMode = Calamares::getString( configurationMap, "restartNowMode" );
|
||||
if ( restartMode.isEmpty() )
|
||||
{
|
||||
if ( configurationMap.contains( "restartNowEnabled" ) )
|
||||
@ -191,8 +187,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings";
|
||||
}
|
||||
|
||||
bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false );
|
||||
bool restartNowChecked = CalamaresUtils::getBool( configurationMap, "restartNowChecked", false );
|
||||
bool restartNowEnabled = Calamares::getBool( configurationMap, "restartNowEnabled", false );
|
||||
bool restartNowChecked = Calamares::getBool( configurationMap, "restartNowChecked", false );
|
||||
|
||||
if ( !restartNowEnabled )
|
||||
{
|
||||
@ -220,7 +216,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
|
||||
if ( mode != RestartMode::Never )
|
||||
{
|
||||
QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" );
|
||||
QString restartNowCommand = Calamares::getString( configurationMap, "restartNowCommand" );
|
||||
if ( restartNowCommand.isEmpty() )
|
||||
{
|
||||
restartNowCommand = QStringLiteral( "shutdown -r now" );
|
||||
@ -228,5 +224,5 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_restartNowCommand = restartNowCommand;
|
||||
}
|
||||
|
||||
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false );
|
||||
m_notifyOnFinished = Calamares::getBool( configurationMap, "notifyOnFinished", false );
|
||||
}
|
||||
|
@ -35,10 +35,8 @@ ResizeFSJob::ResizeFSJob( QObject* parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ResizeFSJob::~ResizeFSJob() {}
|
||||
|
||||
|
||||
QString
|
||||
ResizeFSJob::prettyName() const
|
||||
{
|
||||
@ -155,7 +153,6 @@ ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m )
|
||||
return last_available;
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
ResizeFSJob::exec()
|
||||
{
|
||||
@ -230,7 +227,6 @@ ResizeFSJob::exec()
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
@ -246,7 +242,7 @@ ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_size = PartitionSize( configurationMap[ "size" ].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 >(); )
|
||||
|
@ -52,7 +52,7 @@ FSResizerTests::testConfigurationRobust()
|
||||
size: 100%
|
||||
atleast: 600MiB
|
||||
)" );
|
||||
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) );
|
||||
j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
|
||||
QVERIFY( j.name().isEmpty() );
|
||||
QCOMPARE( j.size().unit(), SizeUnit::None );
|
||||
QCOMPARE( j.minimumSize().unit(), SizeUnit::None );
|
||||
@ -71,7 +71,7 @@ fs: /
|
||||
size: 100%
|
||||
atleast: 600MiB
|
||||
)" );
|
||||
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) );
|
||||
j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
|
||||
QVERIFY( !j.name().isEmpty() );
|
||||
QCOMPARE( j.name(), QString( "/" ) );
|
||||
QCOMPARE( j.size().unit(), SizeUnit::Percent );
|
||||
@ -86,7 +86,7 @@ dev: /dev/m00
|
||||
size: 72 MiB
|
||||
atleast: 127 %
|
||||
)" );
|
||||
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) );
|
||||
j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
|
||||
QVERIFY( !j.name().isEmpty() );
|
||||
QCOMPARE( j.name(), QString( "/" ) );
|
||||
QCOMPARE( j.size().unit(), SizeUnit::MiB );
|
||||
@ -100,7 +100,7 @@ dev: /dev/m00
|
||||
size: 72 MiB
|
||||
atleast: 127 %
|
||||
)" );
|
||||
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) );
|
||||
j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
|
||||
QVERIFY( !j.name().isEmpty() );
|
||||
QCOMPARE( j.name(), QString( "/dev/m00" ) );
|
||||
QCOMPARE( j.size().unit(), SizeUnit::MiB );
|
||||
@ -115,7 +115,7 @@ fs: /
|
||||
size: 71MiB
|
||||
# atleast: 127%
|
||||
)" );
|
||||
j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) );
|
||||
j.setConfigurationMap( Calamares::YAML::mapToVariant( doc0 ) );
|
||||
QVERIFY( !j.name().isEmpty() );
|
||||
QCOMPARE( j.name(), QString( "/" ) );
|
||||
QCOMPARE( j.size().unit(), SizeUnit::MiB );
|
||||
|
@ -35,7 +35,6 @@ HostInfoJob::HostInfoJob( QObject* parent )
|
||||
|
||||
HostInfoJob::~HostInfoJob() {}
|
||||
|
||||
|
||||
QString
|
||||
HostInfoJob::prettyName() const
|
||||
{
|
||||
@ -172,7 +171,6 @@ hostCPU()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
HostInfoJob::exec()
|
||||
{
|
||||
@ -184,7 +182,7 @@ HostInfoJob::exec()
|
||||
gs->insert( "hostCPU", hostCPU() );
|
||||
|
||||
// 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 )
|
||||
{
|
||||
gs->insert( "hostRAMMiB", ram );
|
||||
|
@ -25,7 +25,6 @@ InitcpioJob::InitcpioJob( QObject* parent )
|
||||
|
||||
InitcpioJob::~InitcpioJob() {}
|
||||
|
||||
|
||||
QString
|
||||
InitcpioJob::prettyName() const
|
||||
{
|
||||
@ -56,7 +55,7 @@ fixPermissions( const QDir& d )
|
||||
Calamares::JobResult
|
||||
InitcpioJob::exec()
|
||||
{
|
||||
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe );
|
||||
Calamares::UMask m( Calamares::UMask::Safe );
|
||||
|
||||
if ( m_unsafe )
|
||||
{
|
||||
@ -64,7 +63,7 @@ InitcpioJob::exec()
|
||||
}
|
||||
else
|
||||
{
|
||||
QDir d( CalamaresUtils::System::instance()->targetPath( "/boot" ) );
|
||||
QDir d( Calamares::System::instance()->targetPath( "/boot" ) );
|
||||
if ( d.exists() )
|
||||
{
|
||||
fixPermissions( d );
|
||||
@ -83,16 +82,16 @@ InitcpioJob::exec()
|
||||
}
|
||||
|
||||
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 */ );
|
||||
}
|
||||
|
||||
void
|
||||
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 >(); )
|
||||
|
@ -21,18 +21,16 @@ InitramfsJob::InitramfsJob( QObject* parent )
|
||||
|
||||
InitramfsJob::~InitramfsJob() {}
|
||||
|
||||
|
||||
QString
|
||||
InitramfsJob::prettyName() const
|
||||
{
|
||||
return tr( "Creating initramfs." );
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
InitramfsJob::exec()
|
||||
{
|
||||
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe );
|
||||
Calamares::UMask m( Calamares::UMask::Safe );
|
||||
|
||||
cDebug() << "Updating initramfs with kernel" << m_kernel;
|
||||
|
||||
@ -45,7 +43,7 @@ InitramfsJob::exec()
|
||||
// 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 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.";
|
||||
// But continue anyway.
|
||||
@ -53,23 +51,22 @@ InitramfsJob::exec()
|
||||
}
|
||||
|
||||
// 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 */ );
|
||||
return r.explainProcess( "update-initramfs", std::chrono::seconds( 10 ) /* fake timeout */ );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InitramfsJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_kernel = CalamaresUtils::getString( configurationMap, "kernel" );
|
||||
m_kernel = Calamares::getString( configurationMap, "kernel" );
|
||||
if ( m_kernel.isEmpty() )
|
||||
{
|
||||
m_kernel = QStringLiteral( "all" );
|
||||
}
|
||||
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" },
|
||||
QString(),
|
||||
QString(),
|
||||
@ -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 >(); )
|
||||
|
@ -34,7 +34,7 @@ InitramfsTests::initTestCase()
|
||||
Logger::setupLogLevel( Logger::LOGDEBUG );
|
||||
|
||||
(void)new Calamares::JobQueue();
|
||||
(void)new CalamaresUtils::System( true );
|
||||
(void)new Calamares::System( true );
|
||||
}
|
||||
|
||||
static const char contents[] = "UMASK=0077\n";
|
||||
@ -51,7 +51,7 @@ InitramfsTests::testCreateTargetFile()
|
||||
{
|
||||
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 ) );
|
||||
QVERIFY( r.failed() );
|
||||
QVERIFY( !r );
|
||||
|
@ -43,7 +43,6 @@ xkbmap_model_args( const QString& model )
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* Returns stringlist with suitable setxkbmap command-line arguments
|
||||
* 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_keyboardLayoutsModel, &KeyboardLayoutModel::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_selectedLayout = m_keyboardLayoutsModel->item( m_keyboardLayoutsModel->currentIndex() ).first;
|
||||
@ -306,7 +308,6 @@ Config::xkbApply()
|
||||
{ m_additionalLayoutInfo.additionalVariant, m_selectedVariant },
|
||||
m_additionalLayoutInfo.groupSwitcher ) );
|
||||
|
||||
|
||||
cDebug() << "xkbmap selection changed to: " << m_selectedLayout << '-' << m_selectedVariant << "(added "
|
||||
<< m_additionalLayoutInfo.additionalLayout << "-" << m_additionalLayoutInfo.additionalVariant
|
||||
<< " since current layout is not ASCII-capable)";
|
||||
@ -319,7 +320,6 @@ Config::xkbApply()
|
||||
m_setxkbmapTimer.disconnect( this );
|
||||
}
|
||||
|
||||
|
||||
KeyboardModelsModel*
|
||||
Config::keyboardModels() const
|
||||
{
|
||||
@ -706,7 +706,7 @@ Config::updateVariants( const QPersistentModelIndex& currentItem, QString curren
|
||||
void
|
||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
using namespace CalamaresUtils;
|
||||
using namespace Calamares;
|
||||
bool isX11 = QGuiApplication::platformName() == "xcb";
|
||||
|
||||
const auto xorgConfDefault = QStringLiteral( "00-keyboard.conf" );
|
||||
|
@ -27,11 +27,9 @@ retranslateKeyboardModels()
|
||||
{
|
||||
s_kbtranslator = new QTranslator;
|
||||
}
|
||||
(void)CalamaresUtils::loadTranslator(
|
||||
CalamaresUtils::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator );
|
||||
(void)Calamares::loadTranslator( Calamares::translatorLocaleName(), QStringLiteral( "kb_" ), s_kbtranslator );
|
||||
}
|
||||
|
||||
|
||||
XKBListModel::XKBListModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
@ -141,7 +139,6 @@ KeyboardModelsModel::KeyboardModelsModel( QObject* parent )
|
||||
setCurrentIndex(); // If pc105 was seen, select it now
|
||||
}
|
||||
|
||||
|
||||
KeyboardLayoutModel::KeyboardLayoutModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
@ -155,7 +152,6 @@ KeyboardLayoutModel::rowCount( const QModelIndex& parent ) const
|
||||
return m_layouts.count();
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
KeyboardLayoutModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
@ -252,7 +248,6 @@ KeyboardLayoutModel::currentIndex() const
|
||||
return m_currentIndex;
|
||||
}
|
||||
|
||||
|
||||
KeyboardVariantsModel::KeyboardVariantsModel( QObject* parent )
|
||||
: XKBListModel( parent )
|
||||
{
|
||||
|
@ -67,8 +67,8 @@ LicenseEntry::LicenseEntry( const QVariantMap& conf )
|
||||
m_prettyVendor = conf.value( "vendor" ).toString();
|
||||
m_url = QUrl( conf[ "url" ].toString() );
|
||||
|
||||
m_required = CalamaresUtils::getBool( conf, "required", false );
|
||||
m_expand = CalamaresUtils::getBool( conf, "expand", false );
|
||||
m_required = Calamares::getBool( conf, "required", false );
|
||||
m_expand = Calamares::getBool( conf, "expand", false );
|
||||
|
||||
bool ok = false;
|
||||
QString typeString = conf.value( "type", "software" ).toString();
|
||||
@ -85,7 +85,6 @@ LicenseEntry::isLocal() const
|
||||
return m_url.isLocalFile();
|
||||
}
|
||||
|
||||
|
||||
LicensePage::LicensePage( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_isNextEnabled( false )
|
||||
@ -94,14 +93,14 @@ LicensePage::LicensePage( QWidget* parent )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
// ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() );
|
||||
CalamaresUtils::unmarginLayout( ui->verticalLayout );
|
||||
// ui->verticalLayout->insertSpacing( 1, Calamares::defaultFontHeight() );
|
||||
Calamares::unmarginLayout( ui->verticalLayout );
|
||||
|
||||
ui->acceptFrame->setStyleSheet( mustAccept );
|
||||
{
|
||||
// The inner frame was unmargined (above), reinstate margins so all are
|
||||
// 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 );
|
||||
}
|
||||
|
||||
@ -172,7 +171,6 @@ LicensePage::retranslate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LicensePage::isNextEnabled() const
|
||||
{
|
||||
|
@ -395,7 +395,6 @@ Config::currentTimezoneName() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
static inline QString
|
||||
localeLabel( const QString& s )
|
||||
{
|
||||
@ -429,7 +428,7 @@ Config::prettyStatus() const
|
||||
static inline void
|
||||
getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLines )
|
||||
{
|
||||
QString localeGenPath = CalamaresUtils::getString( configurationMap, "localeGenPath" );
|
||||
QString localeGenPath = Calamares::getString( configurationMap, "localeGenPath" );
|
||||
if ( localeGenPath.isEmpty() )
|
||||
{
|
||||
localeGenPath = QStringLiteral( "/etc/locale.gen" );
|
||||
@ -440,8 +439,8 @@ getLocaleGenLines( const QVariantMap& configurationMap, QStringList& localeGenLi
|
||||
static inline void
|
||||
getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTimezone )
|
||||
{
|
||||
adjustLiveTimezone = CalamaresUtils::getBool(
|
||||
configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
|
||||
adjustLiveTimezone
|
||||
= Calamares::getBool( configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
|
||||
#ifdef DEBUG_TIMEZONES
|
||||
if ( adjustLiveTimezone )
|
||||
{
|
||||
@ -461,8 +460,8 @@ getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTime
|
||||
static inline void
|
||||
getStartingTimezone( const QVariantMap& configurationMap, Calamares::GeoIP::RegionZonePair& startingTimezone )
|
||||
{
|
||||
QString region = CalamaresUtils::getString( configurationMap, "region" );
|
||||
QString zone = CalamaresUtils::getString( configurationMap, "zone" );
|
||||
QString region = Calamares::getString( configurationMap, "region" );
|
||||
QString zone = Calamares::getString( configurationMap, "zone" );
|
||||
if ( !region.isEmpty() && !zone.isEmpty() )
|
||||
{
|
||||
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" ) );
|
||||
}
|
||||
|
||||
if ( CalamaresUtils::getBool( configurationMap, "useSystemTimezone", false ) )
|
||||
if ( Calamares::getBool( configurationMap, "useSystemTimezone", false ) )
|
||||
{
|
||||
auto systemtz = Calamares::GeoIP::splitTZString( QTimeZone::systemTimeZoneId() );
|
||||
if ( systemtz.isValid() )
|
||||
@ -488,12 +487,12 @@ static inline void
|
||||
getGeoIP( const QVariantMap& configurationMap, std::unique_ptr< Calamares::GeoIP::Handler >& geoip )
|
||||
{
|
||||
bool ok = false;
|
||||
QVariantMap map = CalamaresUtils::getSubMap( configurationMap, "geoip", ok );
|
||||
QVariantMap map = Calamares::getSubMap( configurationMap, "geoip", ok );
|
||||
if ( ok )
|
||||
{
|
||||
QString url = CalamaresUtils::getString( map, "url" );
|
||||
QString style = CalamaresUtils::getString( map, "style" );
|
||||
QString selector = CalamaresUtils::getString( map, "selector" );
|
||||
QString url = Calamares::getString( map, "url" );
|
||||
QString style = Calamares::getString( map, "style" );
|
||||
QString selector = Calamares::getString( map, "selector" );
|
||||
|
||||
geoip = std::make_unique< Calamares::GeoIP::Handler >( style, url, selector );
|
||||
if ( !geoip->isValid() )
|
||||
@ -543,7 +542,6 @@ Config::finalizeGlobalStorage() const
|
||||
updateGSLocation( gs, currentLocation() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::startGeoIP()
|
||||
{
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( LocaleViewStepFactory, registerPlugin< LocaleViewStep >(); )
|
||||
|
||||
LocaleViewStep::LocaleViewStep( QObject* parent )
|
||||
@ -37,12 +36,11 @@ LocaleViewStep::LocaleViewStep( QObject* parent )
|
||||
{
|
||||
QBoxLayout* mainLayout = new QHBoxLayout;
|
||||
m_widget->setLayout( mainLayout );
|
||||
CalamaresUtils::unmarginLayout( mainLayout );
|
||||
Calamares::unmarginLayout( mainLayout );
|
||||
|
||||
emit nextStatusChanged( m_nextEnabled );
|
||||
}
|
||||
|
||||
|
||||
LocaleViewStep::~LocaleViewStep()
|
||||
{
|
||||
if ( m_widget && m_widget->parent() == nullptr )
|
||||
@ -51,7 +49,6 @@ LocaleViewStep::~LocaleViewStep()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LocaleViewStep::setUpPage()
|
||||
{
|
||||
@ -68,63 +65,54 @@ LocaleViewStep::setUpPage()
|
||||
emit nextStatusChanged( m_nextEnabled );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LocaleViewStep::prettyName() const
|
||||
{
|
||||
return tr( "Location" );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LocaleViewStep::prettyStatus() const
|
||||
{
|
||||
return m_config->prettyStatus();
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
LocaleViewStep::widget()
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LocaleViewStep::isNextEnabled() const
|
||||
{
|
||||
return m_nextEnabled;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LocaleViewStep::isBackEnabled() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LocaleViewStep::isAtBeginning() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LocaleViewStep::isAtEnd() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobList
|
||||
LocaleViewStep::jobs() const
|
||||
{
|
||||
return m_config->createJobs();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LocaleViewStep::onActivate()
|
||||
{
|
||||
@ -136,14 +124,12 @@ LocaleViewStep::onActivate()
|
||||
m_actualWidget->onActivate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LocaleViewStep::onLeave()
|
||||
{
|
||||
m_config->finalizeGlobalStorage();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
SetTimezoneJob::SetTimezoneJob( const QString& region, const QString& zone )
|
||||
: Calamares::Job()
|
||||
, m_region( region )
|
||||
@ -27,14 +26,12 @@ SetTimezoneJob::SetTimezoneJob( const QString& region, const QString& zone )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
SetTimezoneJob::prettyName() const
|
||||
{
|
||||
return tr( "Set timezone to %1/%2" ).arg( m_region ).arg( m_zone );
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
SetTimezoneJob::exec()
|
||||
{
|
||||
@ -42,7 +39,7 @@ SetTimezoneJob::exec()
|
||||
// to a running timedated over D-Bus), and we have code that works
|
||||
if ( !Calamares::Settings::instance()->doChroot() )
|
||||
{
|
||||
int ec = CalamaresUtils::System::instance()->targetEnvCall(
|
||||
int ec = Calamares::System::instance()->targetEnvCall(
|
||||
{ "timedatectl", "set-timezone", m_region + '/' + m_zone } );
|
||||
|
||||
if ( !ec )
|
||||
@ -63,9 +60,9 @@ SetTimezoneJob::exec()
|
||||
tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) );
|
||||
|
||||
// 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 )
|
||||
return Calamares::JobResult::error(
|
||||
tr( "Cannot set timezone." ),
|
||||
|
@ -106,19 +106,19 @@ static const char keyfile[] = "/crypto_keyfile.bin";
|
||||
static bool
|
||||
generateTargetKeyfile()
|
||||
{
|
||||
CalamaresUtils::UMask m( CalamaresUtils::UMask::Safe );
|
||||
Calamares::UMask m( Calamares::UMask::Safe );
|
||||
|
||||
// Get the data
|
||||
QByteArray entropy;
|
||||
auto entropySource = CalamaresUtils::getEntropy( 2048, entropy );
|
||||
if ( entropySource != CalamaresUtils::EntropySource::URandom )
|
||||
auto entropySource = Calamares::getEntropy( 2048, entropy );
|
||||
if ( entropySource != Calamares::EntropySource::URandom )
|
||||
{
|
||||
cWarning() << "Could not get entropy from /dev/urandom for LUKS.";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto fileResult = CalamaresUtils::System::instance()->createTargetFile(
|
||||
keyfile, entropy, CalamaresUtils::System::WriteMode::Overwrite );
|
||||
auto fileResult
|
||||
= Calamares::System::instance()->createTargetFile( keyfile, entropy, Calamares::System::WriteMode::Overwrite );
|
||||
entropy.fill( 'A' );
|
||||
if ( !fileResult )
|
||||
{
|
||||
@ -128,7 +128,7 @@ generateTargetKeyfile()
|
||||
|
||||
// Give ample time to check that the file was created correctly;
|
||||
// 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 ) );
|
||||
cDebug() << "In target system after creating LUKS file" << r.getOutput();
|
||||
return true;
|
||||
@ -138,7 +138,7 @@ static bool
|
||||
setupLuks( const LuksDevice& d, const QString& luks2Hash )
|
||||
{
|
||||
// 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 },
|
||||
QString(),
|
||||
QString(),
|
||||
@ -187,8 +187,8 @@ setupLuks( const LuksDevice& d, const QString& luks2Hash )
|
||||
args.insert( 2, "--pbkdf" );
|
||||
args.insert( 3, luks2Hash );
|
||||
}
|
||||
auto r = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
args, QString(), d.passphrase, std::chrono::seconds( 60 ) );
|
||||
auto r
|
||||
= Calamares::System::instance()->targetEnvCommand( args, QString(), d.passphrase, std::chrono::seconds( 60 ) );
|
||||
if ( r.getExitCode() != 0 )
|
||||
{
|
||||
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 value.toLower();
|
||||
}( CalamaresUtils::getString( configurationMap, QStringLiteral( "luks2Hash" ), QString() ) );
|
||||
}( Calamares::getString( configurationMap, QStringLiteral( "luks2Hash" ), QString() ) );
|
||||
}
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( LuksBootKeyFileJobFactory, registerPlugin< LuksBootKeyFileJob >(); )
|
||||
|
@ -29,7 +29,6 @@ LOSHJob::LOSHJob( QObject* parent )
|
||||
|
||||
LOSHJob::~LOSHJob() {}
|
||||
|
||||
|
||||
QString
|
||||
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;
|
||||
// \n between each two lines, and a \n at the end
|
||||
CalamaresUtils::System::instance()->createTargetFile(
|
||||
path, contents.join( '\n' ).append( '\n' ).toUtf8(), CalamaresUtils::System::WriteMode::Overwrite );
|
||||
Calamares::System::instance()->createTargetFile(
|
||||
path, contents.join( '\n' ).append( '\n' ).toUtf8(), Calamares::System::WriteMode::Overwrite );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,7 +80,7 @@ write_openswap_conf( const QString& path, QStringList& contents, const LOSHInfo&
|
||||
Calamares::JobResult
|
||||
LOSHJob::exec()
|
||||
{
|
||||
const auto* sys = CalamaresUtils::System::instance();
|
||||
const auto* sys = Calamares::System::instance();
|
||||
if ( !sys )
|
||||
{
|
||||
return Calamares::JobResult::internalError(
|
||||
@ -116,7 +115,7 @@ LOSHJob::exec()
|
||||
void
|
||||
LOSHJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_configFilePath = CalamaresUtils::getString(
|
||||
m_configFilePath = Calamares::getString(
|
||||
configurationMap, QStringLiteral( "configFilePath" ), QStringLiteral( "/etc/openswap.conf" ) );
|
||||
}
|
||||
|
||||
@ -164,8 +163,7 @@ globalStoragePartitionInfo( Calamares::GlobalStorage* gs, LOSHInfo& info )
|
||||
if ( !btrfsRootSubvolume.isEmpty() )
|
||||
{
|
||||
Calamares::String::removeLeading( btrfsRootSubvolume, '/' );
|
||||
info.keyfile_device_mount_options
|
||||
= QStringLiteral( "--options=subvol=" ) + btrfsRootSubvolume;
|
||||
info.keyfile_device_mount_options = QStringLiteral( "--options=subvol=" ) + btrfsRootSubvolume;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ LOSHTests::initTestCase()
|
||||
cDebug() << "LOSH test started.";
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LOSHTests::testAssignmentExtraction_data()
|
||||
{
|
||||
@ -65,7 +64,6 @@ LOSHTests::testAssignmentExtraction_data()
|
||||
// We look for assignments, but only for single-words
|
||||
QTest::newRow( "comment-space-eq" ) << QStringLiteral( "# Check that a = b" ) << QString();
|
||||
|
||||
|
||||
QTest::newRow( "assignment1" ) << QStringLiteral( "a=1" ) << QStringLiteral( "a" );
|
||||
QTest::newRow( "assignment2" ) << 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 );
|
||||
}
|
||||
|
||||
static CalamaresUtils::System*
|
||||
static Calamares::System*
|
||||
file_setup( const QTemporaryDir& tempRoot )
|
||||
{
|
||||
CalamaresUtils::System* ss = CalamaresUtils::System::instance();
|
||||
Calamares::System* ss = Calamares::System::instance();
|
||||
if ( !ss )
|
||||
{
|
||||
ss = new CalamaresUtils::System( true );
|
||||
ss = new Calamares::System( true );
|
||||
}
|
||||
|
||||
Calamares::GlobalStorage* gs
|
||||
@ -136,7 +134,6 @@ LOSHTests::testLOSHInfo()
|
||||
QCOMPARE( i.replacementFor( QStringLiteral( "duck" ) ), QString() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LOSHTests::testConfigWriting()
|
||||
{
|
||||
@ -199,7 +196,6 @@ LOSHTests::testConfigWriting()
|
||||
QCOMPARE( contents.at( 1 ), QStringLiteral( "swap_device=/dev/zram/0.zram" ) ); // expected line
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LOSHTests::testJob()
|
||||
{
|
||||
@ -245,7 +241,6 @@ LOSHTests::testJob()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( LOSHTests )
|
||||
|
||||
#include "utils/moc-warnings.h"
|
||||
|
@ -27,10 +27,8 @@ MachineIdJob::MachineIdJob( QObject* parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MachineIdJob::~MachineIdJob() {}
|
||||
|
||||
|
||||
QString
|
||||
MachineIdJob::prettyName() const
|
||||
{
|
||||
@ -58,7 +56,7 @@ MachineIdJob::exec()
|
||||
QString target_systemd_machineid_file = QStringLiteral( "/etc/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
|
||||
for ( const auto& entropy_file : m_entropy_files )
|
||||
@ -77,7 +75,7 @@ MachineIdJob::exec()
|
||||
//Create new 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(
|
||||
QObject::tr( "Directory not found" ),
|
||||
@ -131,20 +129,19 @@ MachineIdJob::exec()
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
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" ) )
|
||||
{
|
||||
m_dbus_symlink = CalamaresUtils::getBool( map, "dbus-symlink", false );
|
||||
m_dbus_symlink = Calamares::getBool( map, "dbus-symlink", false );
|
||||
}
|
||||
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*.";
|
||||
}
|
||||
// else it's still false from the constructor
|
||||
@ -152,9 +149,9 @@ MachineIdJob::setConfigurationMap( const QVariantMap& map )
|
||||
// ignore it, though, if dbus is false
|
||||
m_dbus_symlink = m_dbus && m_dbus_symlink;
|
||||
|
||||
m_entropy_copy = CalamaresUtils::getBool( map, "entropy-copy", false );
|
||||
m_entropy_files = CalamaresUtils::getStringList( map, "entropy-files" );
|
||||
if ( CalamaresUtils::getBool( map, "entropy", false ) )
|
||||
m_entropy_copy = Calamares::getBool( map, "entropy-copy", false );
|
||||
m_entropy_files = Calamares::getStringList( map, "entropy-files" );
|
||||
if ( Calamares::getBool( map, "entropy", false ) )
|
||||
{
|
||||
cWarning() << "MachineId:: configuration setting *entropy* is deprecated, use *entropy-files* instead.";
|
||||
m_entropy_files.append( QStringLiteral( "/var/lib/urandom/random-seed" ) );
|
||||
|
@ -104,7 +104,6 @@ MachineIdTests::testConfigEntropyFiles()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MachineIdTests::testCopyFile()
|
||||
{
|
||||
@ -165,7 +164,7 @@ MachineIdTests::testJob()
|
||||
cDebug() << "Temporary files as" << QDir::tempPath();
|
||||
|
||||
// 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->doChroot() );
|
||||
|
||||
|
@ -95,7 +95,7 @@ createNewEntropy( int poolSize, const QString& rootMountPoint, const QString& fi
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
CalamaresUtils::EntropySource source = CalamaresUtils::getEntropy( poolSize, data );
|
||||
Calamares::EntropySource source = Calamares::getEntropy( poolSize, data );
|
||||
entropyFile.write( data );
|
||||
entropyFile.close();
|
||||
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;
|
||||
}
|
||||
if ( source != CalamaresUtils::EntropySource::URandom )
|
||||
if ( source != Calamares::EntropySource::URandom )
|
||||
{
|
||||
cWarning() << "Entropy data for pool is low-quality.";
|
||||
}
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
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
|
||||
runCmd( const QStringList& cmd )
|
||||
{
|
||||
auto r = CalamaresUtils::System::instance()->targetEnvCommand( cmd );
|
||||
auto r = Calamares::System::instance()->targetEnvCommand( cmd );
|
||||
if ( r.getExitCode() )
|
||||
{
|
||||
return r.explainProcess( cmd, std::chrono::seconds( 0 ) );
|
||||
|
@ -42,7 +42,6 @@ Config::retranslate()
|
||||
emit titleLabelChanged( titleLabel() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Config::status() const
|
||||
{
|
||||
@ -64,7 +63,6 @@ Config::status() const
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::setStatus( Status s )
|
||||
{
|
||||
@ -84,7 +82,6 @@ Config::titleLabel() const
|
||||
return m_titleLabel ? m_titleLabel->get() : QString();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::loadGroupList( const QVariantList& groupData )
|
||||
{
|
||||
@ -111,15 +108,14 @@ Config::loadingDone()
|
||||
emit statusReady();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
setRequired( CalamaresUtils::getBool( configurationMap, "required", false ) );
|
||||
setRequired( Calamares::getBool( configurationMap, "required", false ) );
|
||||
|
||||
// Get the translations, if any
|
||||
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
|
||||
// .. table of strings lives in NetInstallViewStep.cpp and moving them
|
||||
// .. around is annoying for translators.
|
||||
|
@ -92,7 +92,6 @@ LoaderQueue::load()
|
||||
QMetaObject::invokeMethod( this, "fetchNext", Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LoaderQueue::fetchNext()
|
||||
{
|
||||
@ -180,16 +179,16 @@ LoaderQueue::dataArrived()
|
||||
QByteArray yamlData = m_reply->readAll();
|
||||
try
|
||||
{
|
||||
YAML::Node groups = YAML::Load( yamlData.constData() );
|
||||
auto groups = ::YAML::Load( yamlData.constData() );
|
||||
|
||||
if ( groups.IsSequence() )
|
||||
{
|
||||
m_config->loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) );
|
||||
m_config->loadGroupList( Calamares::YAML::sequenceToVariant( groups ) );
|
||||
next.done( m_config->statusCode() == Config::Status::Ok );
|
||||
}
|
||||
else if ( groups.IsMap() )
|
||||
{
|
||||
auto map = CalamaresUtils::yamlMapToVariant( groups );
|
||||
auto map = Calamares::YAML::mapToVariant( groups );
|
||||
m_config->loadGroupList( map.value( "groups" ).toList() );
|
||||
next.done( m_config->statusCode() == Config::Status::Ok );
|
||||
}
|
||||
@ -198,9 +197,9 @@ LoaderQueue::dataArrived()
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
|
||||
PackageTreeItem* item = new PackageTreeItem( groupMap, PackageTreeItem::GroupTag { parent } );
|
||||
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" ) )
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ parentCriticality( const QVariantMap& groupData, PackageTreeItem* parent )
|
||||
{
|
||||
if ( groupData.contains( "critical" ) )
|
||||
{
|
||||
return CalamaresUtils::getBool( groupData, "critical", false );
|
||||
return Calamares::getBool( groupData, "critical", false );
|
||||
}
|
||||
return parent ? parent->isCritical() : false;
|
||||
}
|
||||
@ -55,9 +55,9 @@ PackageTreeItem::PackageTreeItem( const QString& packageName, PackageTreeItem* p
|
||||
|
||||
PackageTreeItem::PackageTreeItem( const QVariantMap& groupData, PackageTag&& parent )
|
||||
: m_parentItem( parent.parent )
|
||||
, m_packageName( CalamaresUtils::getString( groupData, "name" ) )
|
||||
, m_packageName( Calamares::getString( groupData, "name" ) )
|
||||
, m_selected( parentCheckState( parent.parent ) )
|
||||
, m_description( CalamaresUtils::getString( groupData, "description" ) )
|
||||
, m_description( Calamares::getString( groupData, "description" ) )
|
||||
, m_isGroup( false )
|
||||
, m_isCritical( parent.parent ? parent.parent->isCritical() : 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 )
|
||||
: m_parentItem( parent.parent )
|
||||
, m_name( CalamaresUtils::getString( groupData, "name" ) )
|
||||
, m_name( Calamares::getString( groupData, "name" ) )
|
||||
, m_selected( parentCheckState( parent.parent ) )
|
||||
, m_description( CalamaresUtils::getString( groupData, "description" ) )
|
||||
, m_preScript( CalamaresUtils::getString( groupData, "pre-install" ) )
|
||||
, m_postScript( CalamaresUtils::getString( groupData, "post-install" ) )
|
||||
, m_source( CalamaresUtils::getString( groupData, "source" ) )
|
||||
, m_description( Calamares::getString( groupData, "description" ) )
|
||||
, m_preScript( Calamares::getString( groupData, "pre-install" ) )
|
||||
, m_postScript( Calamares::getString( groupData, "post-install" ) )
|
||||
, m_source( Calamares::getString( groupData, "source" ) )
|
||||
, m_isGroup( true )
|
||||
, m_isCritical( parentCriticality( groupData, parent.parent ) )
|
||||
, m_isHidden( CalamaresUtils::getBool( groupData, "hidden", false ) )
|
||||
, m_showReadOnly( CalamaresUtils::getBool( groupData, "immutable", false ) )
|
||||
, m_showNoncheckable( CalamaresUtils::getBool( groupData, "noncheckable", false ) )
|
||||
, m_startExpanded( CalamaresUtils::getBool( groupData, "expanded", false ) )
|
||||
, m_isHidden( Calamares::getBool( groupData, "hidden", false ) )
|
||||
, m_showReadOnly( Calamares::getBool( groupData, "immutable", false ) )
|
||||
, m_showNoncheckable( Calamares::getBool( groupData, "noncheckable", false ) )
|
||||
, m_startExpanded( Calamares::getBool( groupData, "expanded", false ) )
|
||||
{
|
||||
}
|
||||
|
||||
@ -151,7 +151,6 @@ PackageTreeItem::parentItem() const
|
||||
return m_parentItem;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PackageTreeItem::hiddenSelected() const
|
||||
{
|
||||
@ -179,7 +178,6 @@ PackageTreeItem::hiddenSelected() const
|
||||
return m_selected != Qt::Unchecked;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PackageTreeItem::setSelected( Qt::CheckState isSelected )
|
||||
{
|
||||
@ -239,7 +237,6 @@ PackageTreeItem::updateSelected()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PackageTreeItem::setChildrenSelected( Qt::CheckState isSelected )
|
||||
{
|
||||
|
@ -131,8 +131,8 @@ static const char doc_with_expanded[] =
|
||||
void
|
||||
ItemTests::testExtendedPackage()
|
||||
{
|
||||
YAML::Node yamldoc = YAML::Load( doc );
|
||||
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc );
|
||||
auto yamldoc = ::YAML::Load( doc );
|
||||
QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
|
||||
|
||||
QCOMPARE( yamlContents.length(), 1 );
|
||||
|
||||
@ -154,12 +154,11 @@ ItemTests::testExtendedPackage()
|
||||
QVERIFY( p == p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ItemTests::testGroup()
|
||||
{
|
||||
YAML::Node yamldoc = YAML::Load( doc );
|
||||
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc );
|
||||
auto yamldoc = ::YAML::Load( doc );
|
||||
QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
|
||||
|
||||
QCOMPARE( yamlContents.length(), 1 );
|
||||
|
||||
@ -209,8 +208,8 @@ ItemTests::testCompare()
|
||||
PackageTreeItem r3( "<root>", nullptr );
|
||||
QVERIFY( r3 == r2 );
|
||||
|
||||
YAML::Node yamldoc = YAML::Load( doc ); // See testGroup()
|
||||
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc );
|
||||
auto yamldoc = ::YAML::Load( doc ); // See testGroup()
|
||||
QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
|
||||
QCOMPARE( yamlContents.length(), 1 );
|
||||
|
||||
PackageTreeItem p3( yamlContents[ 0 ].toMap(), PackageTreeItem::GroupTag { nullptr } );
|
||||
@ -219,10 +218,10 @@ ItemTests::testCompare()
|
||||
QVERIFY( p1 != p3 );
|
||||
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 } );
|
||||
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 } );
|
||||
QVERIFY( p3 == p5 );
|
||||
}
|
||||
@ -257,12 +256,11 @@ ItemTests::recursiveCompare( PackageModel& l, PackageModel& r )
|
||||
return recursiveCompare( l.m_rootItem, r.m_rootItem );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ItemTests::testModel()
|
||||
{
|
||||
YAML::Node yamldoc = YAML::Load( doc ); // See testGroup()
|
||||
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc );
|
||||
auto yamldoc = ::YAML::Load( doc ); // See testGroup()
|
||||
QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
|
||||
QCOMPARE( yamlContents.length(), 1 );
|
||||
|
||||
PackageModel m0( nullptr );
|
||||
@ -275,7 +273,7 @@ ItemTests::testModel()
|
||||
checkAllSelected( m0.m_rootItem );
|
||||
|
||||
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.rowCount(), 1 ); // Group, now the packages expanded but not counted
|
||||
QCOMPARE( m2.rowCount( m2.index( 0, 0 ) ), 3 ); // The packages
|
||||
@ -324,7 +322,7 @@ ItemTests::testExampleFiles()
|
||||
QVERIFY( !contents.isEmpty() );
|
||||
|
||||
YAML::Node yamldoc = YAML::Load( contents.constData() );
|
||||
QVariantList yamlContents = CalamaresUtils::yamlSequenceToVariant( yamldoc );
|
||||
QVariantList yamlContents = Calamares::YAML::sequenceToVariant( yamldoc );
|
||||
|
||||
PackageModel m1( nullptr );
|
||||
m1.setupModelData( yamlContents );
|
||||
@ -388,7 +386,7 @@ ItemTests::testUrlFallback()
|
||||
try
|
||||
{
|
||||
YAML::Node yamldoc = YAML::Load( correctedDocument.toUtf8() );
|
||||
auto map = CalamaresUtils::yamlToVariant( yamldoc ).toMap();
|
||||
auto map = Calamares::YAML::toVariant( yamldoc ).toMap();
|
||||
QVERIFY( map.count() > 0 );
|
||||
c.setConfigurationMap( map );
|
||||
}
|
||||
@ -420,7 +418,6 @@ ItemTests::testUrlFallback()
|
||||
QCOMPARE( c.model()->rowCount(), count );
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( ItemTests )
|
||||
|
||||
#include "utils/moc-warnings.h"
|
||||
|
@ -27,7 +27,7 @@ void
|
||||
NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
bool qmlLabel_ok = false;
|
||||
auto qmlLabel = CalamaresUtils::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
|
||||
auto qmlLabel = Calamares::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
|
||||
|
||||
if ( qmlLabel.contains( "notes" ) )
|
||||
{
|
||||
|
@ -40,7 +40,6 @@ public:
|
||||
|
||||
OEMPage::~OEMPage() {}
|
||||
|
||||
|
||||
OEMViewStep::OEMViewStep( QObject* parent )
|
||||
: Calamares::ViewStep( parent )
|
||||
, 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 );
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
OEMViewStep::widget()
|
||||
{
|
||||
@ -145,7 +143,7 @@ OEMViewStep::jobs() const
|
||||
void
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
@ -223,7 +222,6 @@ Config::updateGlobalStorage() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Config::setPackageChoice( const QString& packageChoice )
|
||||
{
|
||||
@ -312,9 +310,9 @@ fillModel( PackageListModel* model, const QVariantList& items )
|
||||
void
|
||||
Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_mode = packageChooserModeNames().find( CalamaresUtils::getString( configurationMap, "mode" ),
|
||||
m_mode = packageChooserModeNames().find( Calamares::getString( configurationMap, "mode" ),
|
||||
PackageChooserMode::Required );
|
||||
m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ),
|
||||
m_method = PackageChooserMethodNames().find( Calamares::getString( configurationMap, "method" ),
|
||||
PackageChooserMethod::Legacy );
|
||||
|
||||
if ( m_method == PackageChooserMethod::Legacy )
|
||||
@ -326,7 +324,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
for ( int item_n = 0; item_n < m_model->packageCount(); ++item_n )
|
||||
@ -344,7 +342,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
}
|
||||
else
|
||||
{
|
||||
setPackageChoice( CalamaresUtils::getString( configurationMap, "packageChoice" ) );
|
||||
setPackageChoice( Calamares::getString( configurationMap, "packageChoice" ) );
|
||||
if ( m_method != PackageChooserMethod::Legacy )
|
||||
{
|
||||
cWarning() << "Single-selection QML module must use 'Legacy' method.";
|
||||
@ -352,7 +350,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
}
|
||||
|
||||
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.contains( "step" ) )
|
||||
|
@ -179,7 +179,7 @@ getNameAndSummary( const QDomNode& n )
|
||||
PackageItem
|
||||
fromAppData( const QVariantMap& item_map )
|
||||
{
|
||||
QString fileName = CalamaresUtils::getString( item_map, "appdata" );
|
||||
QString fileName = Calamares::getString( item_map, "appdata" );
|
||||
if ( fileName.isEmpty() )
|
||||
{
|
||||
cWarning() << "Can't load AppData without a suitable key.";
|
||||
@ -197,7 +197,7 @@ fromAppData( const QVariantMap& item_map )
|
||||
if ( !componentNode.isNull() && componentNode.tagName() == "component" )
|
||||
{
|
||||
// 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() )
|
||||
{
|
||||
id = getChildText( componentNode, "id" );
|
||||
@ -208,7 +208,7 @@ fromAppData( const QVariantMap& item_map )
|
||||
}
|
||||
|
||||
// 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() )
|
||||
{
|
||||
screenshotPath = getScreenshotPath( componentNode );
|
||||
|
@ -112,7 +112,7 @@ fromComponent( AppStream::Component& component )
|
||||
PackageItem
|
||||
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() )
|
||||
{
|
||||
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() );
|
||||
if ( r.isValid() )
|
||||
{
|
||||
QString id = CalamaresUtils::getString( item_map, "id" );
|
||||
QString screenshotPath = CalamaresUtils::getString( item_map, "screenshot" );
|
||||
QString id = Calamares::getString( item_map, "id" );
|
||||
QString screenshotPath = Calamares::getString( item_map, "screenshot" );
|
||||
if ( !id.isEmpty() )
|
||||
{
|
||||
r.id = id;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user