Merge branch 'master' of https://github.com/calamares/calamares into development
This commit is contained in:
commit
746d7f6af7
@ -48,11 +48,11 @@ windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
|
|||||||
}
|
}
|
||||||
if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Pixies )
|
if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Pixies )
|
||||||
{
|
{
|
||||||
return u.value();
|
return static_cast< int >( u.value() );
|
||||||
}
|
}
|
||||||
if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Fonties )
|
if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Fonties )
|
||||||
{
|
{
|
||||||
return u.value() * CalamaresUtils::defaultFontHeight();
|
return static_cast< int >( u.value() * CalamaresUtils::defaultFontHeight() );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,10 @@ ProgressTreeView::setModel( QAbstractItemModel* model )
|
|||||||
QTreeView::setModel( model );
|
QTreeView::setModel( model );
|
||||||
expandAll();
|
expandAll();
|
||||||
|
|
||||||
connect( Calamares::ViewManager::instance(),
|
connect(
|
||||||
&Calamares::ViewManager::currentStepChanged,
|
Calamares::ViewManager::instance(),
|
||||||
this,
|
&Calamares::ViewManager::currentStepChanged,
|
||||||
[this]() { viewport()->update(); },
|
this,
|
||||||
Qt::UniqueConnection );
|
[this]() { viewport()->update(); },
|
||||||
|
Qt::UniqueConnection );
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ static CommandLine
|
|||||||
get_variant_object( const QVariantMap& m )
|
get_variant_object( const QVariantMap& m )
|
||||||
{
|
{
|
||||||
QString command = CalamaresUtils::getString( m, "command" );
|
QString command = CalamaresUtils::getString( m, "command" );
|
||||||
int timeout = CalamaresUtils::getInteger( m, "timeout", -1 );
|
qint64 timeout = CalamaresUtils::getInteger( m, "timeout", -1 );
|
||||||
|
|
||||||
if ( !command.isEmpty() )
|
if ( !command.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifndef UTILS_PLUGINFACTORY_H
|
#ifndef UTILS_PLUGINFACTORY_H
|
||||||
#define UTILS_PLUGINFACTORY_H
|
#define UTILS_PLUGINFACTORY_H
|
||||||
|
|
||||||
#include <KF5/KCoreAddons/KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
|
||||||
#define CalamaresPluginFactory_iid "io.calamares.PluginFactory"
|
#define CalamaresPluginFactory_iid "io.calamares.PluginFactory"
|
||||||
|
|
||||||
@ -102,6 +102,6 @@ public:
|
|||||||
K_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY( name, CalamaresPluginFactory, pluginRegistrations )
|
K_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY( name, CalamaresPluginFactory, pluginRegistrations )
|
||||||
|
|
||||||
|
|
||||||
// Q_DECLARE_INTERFACE( Calamares::PluginFactory, CalamaresPluginFactory_iid )
|
Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,7 +87,7 @@ const QStringList Branding::s_styleEntryStrings =
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
|
|
||||||
const NamedEnumTable<Branding::WindowDimensionUnit>&
|
const NamedEnumTable< Branding::WindowDimensionUnit >&
|
||||||
Branding::WindowDimension::suffixes()
|
Branding::WindowDimension::suffixes()
|
||||||
{
|
{
|
||||||
using Unit = Branding::WindowDimensionUnit;
|
using Unit = Branding::WindowDimensionUnit;
|
||||||
@ -110,16 +110,23 @@ Branding::WindowDimension::suffixes()
|
|||||||
* the @p transform function, which may change strings.
|
* the @p transform function, which may change strings.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
loadStrings( QMap<QString, QString>& map, const YAML::Node& doc, const std::string& key, const std::function< QString(const QString&) >& transform )
|
loadStrings( QMap< QString, QString >& map,
|
||||||
|
const YAML::Node& doc,
|
||||||
|
const std::string& key,
|
||||||
|
const std::function< QString( const QString& ) >& transform )
|
||||||
{
|
{
|
||||||
if ( !doc[ key ].IsMap() )
|
if ( !doc[ key ].IsMap() )
|
||||||
throw YAML::Exception( YAML::Mark(), std::string("Branding configuration is not a map: ") + key );
|
{
|
||||||
|
throw YAML::Exception( YAML::Mark(), std::string( "Branding configuration is not a map: " ) + key );
|
||||||
|
}
|
||||||
|
|
||||||
const auto& config = CalamaresUtils::yamlMapToVariant( doc[ key ] ).toMap();
|
const auto& config = CalamaresUtils::yamlMapToVariant( doc[ key ] ).toMap();
|
||||||
|
|
||||||
map.clear();
|
map.clear();
|
||||||
for ( auto it = config.constBegin(); it != config.constEnd(); ++it )
|
for ( auto it = config.constBegin(); it != config.constEnd(); ++it )
|
||||||
|
{
|
||||||
map.insert( it.key(), transform( it.value().toString() ) );
|
map.insert( it.key(), transform( it.value().toString() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Load the @p map with strings from @p config
|
/** @brief Load the @p map with strings from @p config
|
||||||
@ -129,8 +136,7 @@ loadStrings( QMap<QString, QString>& map, const YAML::Node& doc, const std::stri
|
|||||||
* documentation for details.
|
* documentation for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Branding::Branding( const QString& brandingFilePath,
|
Branding::Branding( const QString& brandingFilePath, QObject* parent )
|
||||||
QObject* parent )
|
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_descriptorPath( brandingFilePath )
|
, m_descriptorPath( brandingFilePath )
|
||||||
, m_slideshowAPI( 1 )
|
, m_slideshowAPI( 1 )
|
||||||
@ -141,7 +147,9 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
|
|
||||||
QDir componentDir( componentDirectory() );
|
QDir componentDir( componentDirectory() );
|
||||||
if ( !componentDir.exists() )
|
if ( !componentDir.exists() )
|
||||||
|
{
|
||||||
bail( "Bad component directory path." );
|
bail( "Bad component directory path." );
|
||||||
|
}
|
||||||
|
|
||||||
QFile file( brandingFilePath );
|
QFile file( brandingFilePath );
|
||||||
if ( file.exists() && file.open( QFile::ReadOnly | QFile::Text ) )
|
if ( file.exists() && file.open( QFile::ReadOnly | QFile::Text ) )
|
||||||
@ -153,8 +161,7 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
YAML::Node doc = YAML::Load( ba.constData() );
|
YAML::Node doc = YAML::Load( ba.constData() );
|
||||||
Q_ASSERT( doc.IsMap() );
|
Q_ASSERT( doc.IsMap() );
|
||||||
|
|
||||||
m_componentName = QString::fromStdString( doc[ "componentName" ]
|
m_componentName = QString::fromStdString( doc[ "componentName" ].as< std::string >() );
|
||||||
.as< std::string >() );
|
|
||||||
if ( m_componentName != componentDir.dirName() )
|
if ( m_componentName != componentDir.dirName() )
|
||||||
bail( "The branding component name should match the name of the "
|
bail( "The branding component name should match the name of the "
|
||||||
"component directory." );
|
"component directory." );
|
||||||
@ -165,8 +172,7 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
// Copy the os-release information into a QHash for use by KMacroExpander.
|
// Copy the os-release information into a QHash for use by KMacroExpander.
|
||||||
KOSRelease relInfo;
|
KOSRelease relInfo;
|
||||||
|
|
||||||
QHash< QString, QString > relMap{
|
QHash< QString, QString > relMap { std::initializer_list< std::pair< QString, QString > > {
|
||||||
std::initializer_list< std::pair< QString, QString > > {
|
|
||||||
{ QStringLiteral( "NAME" ), relInfo.name() },
|
{ QStringLiteral( "NAME" ), relInfo.name() },
|
||||||
{ QStringLiteral( "VERSION" ), relInfo.version() },
|
{ QStringLiteral( "VERSION" ), relInfo.version() },
|
||||||
{ QStringLiteral( "ID" ), relInfo.id() },
|
{ QStringLiteral( "ID" ), relInfo.id() },
|
||||||
@ -182,9 +188,10 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
{ QStringLiteral( "BUILD_ID" ), relInfo.buildId() },
|
{ QStringLiteral( "BUILD_ID" ), relInfo.buildId() },
|
||||||
{ QStringLiteral( "VARIANT" ), relInfo.variant() },
|
{ QStringLiteral( "VARIANT" ), relInfo.variant() },
|
||||||
{ QStringLiteral( "VARIANT_ID" ), relInfo.variantId() },
|
{ QStringLiteral( "VARIANT_ID" ), relInfo.variantId() },
|
||||||
{ QStringLiteral( "LOGO" ), relInfo.logo() }
|
{ QStringLiteral( "LOGO" ), relInfo.logo() } } };
|
||||||
} };
|
auto expand = [&]( const QString& s ) -> QString {
|
||||||
auto expand = [&]( const QString& s ) -> QString { return KMacroExpander::expandMacros( s, relMap, QLatin1Char( '@' ) ); };
|
return KMacroExpander::expandMacros( s, relMap, QLatin1Char( '@' ) );
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
auto expand = []( const QString& s ) -> QString { return s; };
|
auto expand = []( const QString& s ) -> QString { return s; };
|
||||||
#endif
|
#endif
|
||||||
@ -192,26 +199,23 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
|
|
||||||
// Massage the strings, images and style sections.
|
// Massage the strings, images and style sections.
|
||||||
loadStrings( m_strings, doc, "strings", expand );
|
loadStrings( m_strings, doc, "strings", expand );
|
||||||
loadStrings( m_images, doc, "images",
|
loadStrings( m_images, doc, "images", [&]( const QString& s ) -> QString {
|
||||||
[&]( const QString& s ) -> QString
|
// See also image()
|
||||||
|
const QString imageName( expand( s ) );
|
||||||
|
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
||||||
|
if ( !imageFi.exists() )
|
||||||
{
|
{
|
||||||
// See also image()
|
const auto icon = QIcon::fromTheme( imageName );
|
||||||
const QString imageName( expand( s ) );
|
// Not found, bail out with the filename used
|
||||||
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
if ( icon.isNull() )
|
||||||
if ( !imageFi.exists() )
|
|
||||||
{
|
{
|
||||||
const auto icon = QIcon::fromTheme( imageName );
|
bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
||||||
// Not found, bail out with the filename used
|
|
||||||
if ( icon.isNull() )
|
|
||||||
bail( QString( "Image file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
|
||||||
return imageName; // Not turned into a path
|
|
||||||
}
|
}
|
||||||
return imageFi.absoluteFilePath();
|
return imageName; // Not turned into a path
|
||||||
}
|
}
|
||||||
);
|
return imageFi.absoluteFilePath();
|
||||||
loadStrings( m_style, doc, "style",
|
} );
|
||||||
[]( const QString& s ) -> QString { return s; }
|
loadStrings( m_style, doc, "style", []( const QString& s ) -> QString { return s; } );
|
||||||
);
|
|
||||||
|
|
||||||
if ( doc[ "slideshow" ].IsSequence() )
|
if ( doc[ "slideshow" ].IsSequence() )
|
||||||
{
|
{
|
||||||
@ -222,8 +226,7 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
QString pathString = slideShowPictures[ i ];
|
QString pathString = slideShowPictures[ i ];
|
||||||
QFileInfo imageFi( componentDir.absoluteFilePath( pathString ) );
|
QFileInfo imageFi( componentDir.absoluteFilePath( pathString ) );
|
||||||
if ( !imageFi.exists() )
|
if ( !imageFi.exists() )
|
||||||
bail( QString( "Slideshow file %1 does not exist." )
|
bail( QString( "Slideshow file %1 does not exist." ).arg( imageFi.absoluteFilePath() ) );
|
||||||
.arg( imageFi.absoluteFilePath() ) );
|
|
||||||
|
|
||||||
slideShowPictures[ i ] = imageFi.absoluteFilePath();
|
slideShowPictures[ i ] = imageFi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
@ -232,19 +235,19 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
}
|
}
|
||||||
else if ( doc[ "slideshow" ].IsScalar() )
|
else if ( doc[ "slideshow" ].IsScalar() )
|
||||||
{
|
{
|
||||||
QString slideshowPath = QString::fromStdString( doc[ "slideshow" ]
|
QString slideshowPath = QString::fromStdString( doc[ "slideshow" ].as< std::string >() );
|
||||||
.as< std::string >() );
|
|
||||||
QFileInfo slideshowFi( componentDir.absoluteFilePath( slideshowPath ) );
|
QFileInfo slideshowFi( componentDir.absoluteFilePath( slideshowPath ) );
|
||||||
if ( !slideshowFi.exists() ||
|
if ( !slideshowFi.exists() || !slideshowFi.fileName().toLower().endsWith( ".qml" ) )
|
||||||
!slideshowFi.fileName().toLower().endsWith( ".qml" ) )
|
|
||||||
bail( QString( "Slideshow file %1 does not exist or is not a valid QML file." )
|
bail( QString( "Slideshow file %1 does not exist or is not a valid QML file." )
|
||||||
.arg( slideshowFi.absoluteFilePath() ) );
|
.arg( slideshowFi.absoluteFilePath() ) );
|
||||||
m_slideshowPath = slideshowFi.absoluteFilePath();
|
m_slideshowPath = slideshowFi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
bail( "Syntax error in slideshow sequence." );
|
bail( "Syntax error in slideshow sequence." );
|
||||||
|
}
|
||||||
|
|
||||||
int api = doc[ "slideshowAPI" ].IsScalar() ? doc[ "slideshowAPI" ].as<int>() : -1;
|
int api = doc[ "slideshowAPI" ].IsScalar() ? doc[ "slideshowAPI" ].as< int >() : -1;
|
||||||
if ( ( api < 1 ) || ( api > 2 ) )
|
if ( ( api < 1 ) || ( api > 2 ) )
|
||||||
{
|
{
|
||||||
cWarning() << "Invalid or missing *slideshowAPI* in branding file.";
|
cWarning() << "Invalid or missing *slideshowAPI* in branding file.";
|
||||||
@ -260,11 +263,11 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
|
|
||||||
QDir translationsDir( componentDir.filePath( "lang" ) );
|
QDir translationsDir( componentDir.filePath( "lang" ) );
|
||||||
if ( !translationsDir.exists() )
|
if ( !translationsDir.exists() )
|
||||||
|
{
|
||||||
cWarning() << "the branding component" << componentDir.absolutePath() << "does not ship translations.";
|
cWarning() << "the branding component" << componentDir.absolutePath() << "does not ship translations.";
|
||||||
|
}
|
||||||
m_translationsPathPrefix = translationsDir.absolutePath();
|
m_translationsPathPrefix = translationsDir.absolutePath();
|
||||||
m_translationsPathPrefix.append( QString( "%1calamares-%2" )
|
m_translationsPathPrefix.append( QString( "%1calamares-%2" ).arg( QDir::separator() ).arg( m_componentName ) );
|
||||||
.arg( QDir::separator() )
|
|
||||||
.arg( m_componentName ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -286,7 +289,7 @@ Branding::Branding( const QString& brandingFilePath,
|
|||||||
QString
|
QString
|
||||||
Branding::componentDirectory() const
|
Branding::componentDirectory() const
|
||||||
{
|
{
|
||||||
QFileInfo fi ( m_descriptorPath );
|
QFileInfo fi( m_descriptorPath );
|
||||||
return fi.absoluteDir().absolutePath();
|
return fi.absoluteDir().absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +328,7 @@ Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto icon = QIcon::fromTheme(path);
|
auto icon = QIcon::fromTheme( path );
|
||||||
|
|
||||||
Q_ASSERT( !icon.isNull() );
|
Q_ASSERT( !icon.isNull() );
|
||||||
return icon.pixmap( size );
|
return icon.pixmap( size );
|
||||||
@ -333,7 +336,7 @@ Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
Branding::image(const QString& imageName, const QSize& size) const
|
Branding::image( const QString& imageName, const QSize& size ) const
|
||||||
{
|
{
|
||||||
QDir componentDir( componentDirectory() );
|
QDir componentDir( componentDirectory() );
|
||||||
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
QFileInfo imageFi( componentDir.absoluteFilePath( imageName ) );
|
||||||
@ -342,7 +345,9 @@ Branding::image(const QString& imageName, const QSize& size) const
|
|||||||
const auto icon = QIcon::fromTheme( imageName );
|
const auto icon = QIcon::fromTheme( imageName );
|
||||||
// Not found, bail out with the filename used
|
// Not found, bail out with the filename used
|
||||||
if ( icon.isNull() )
|
if ( icon.isNull() )
|
||||||
|
{
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
|
}
|
||||||
return icon.pixmap( size );
|
return icon.pixmap( size );
|
||||||
}
|
}
|
||||||
return ImageRegistry::instance()->pixmap( imageFi.absoluteFilePath(), size );
|
return ImageRegistry::instance()->pixmap( imageFi.absoluteFilePath(), size );
|
||||||
@ -360,7 +365,9 @@ Branding::stylesheet() const
|
|||||||
return stylesheetFile.readAll();
|
return stylesheetFile.readAll();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cWarning() << "The branding component" << fi.absoluteDir().absolutePath() << "does not ship stylesheet.qss.";
|
cWarning() << "The branding component" << fi.absoluteDir().absolutePath() << "does not ship stylesheet.qss.";
|
||||||
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +376,9 @@ Branding::setGlobals( GlobalStorage* globalStorage ) const
|
|||||||
{
|
{
|
||||||
QVariantMap brandingMap;
|
QVariantMap brandingMap;
|
||||||
for ( const QString& key : s_stringEntryStrings )
|
for ( const QString& key : s_stringEntryStrings )
|
||||||
|
{
|
||||||
brandingMap.insert( key, m_strings.value( key ) );
|
brandingMap.insert( key, m_strings.value( key ) );
|
||||||
|
}
|
||||||
globalStorage->insert( "branding", brandingMap );
|
globalStorage->insert( "branding", brandingMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,15 +393,17 @@ Branding::WindowDimension::isValid() const
|
|||||||
static inline QString
|
static inline QString
|
||||||
getString( const YAML::Node& doc, const char* key )
|
getString( const YAML::Node& doc, const char* key )
|
||||||
{
|
{
|
||||||
if ( doc[key] )
|
if ( doc[ key ] )
|
||||||
return QString::fromStdString( doc[key].as< std::string >() );
|
{
|
||||||
|
return QString::fromStdString( doc[ key ].as< std::string >() );
|
||||||
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Branding::initSimpleSettings( const YAML::Node& doc )
|
Branding::initSimpleSettings( const YAML::Node& doc )
|
||||||
{
|
{
|
||||||
static const NamedEnumTable< WindowExpansion > expansionNames{
|
static const NamedEnumTable< WindowExpansion > expansionNames {
|
||||||
{ QStringLiteral( "normal" ), WindowExpansion::Normal },
|
{ QStringLiteral( "normal" ), WindowExpansion::Normal },
|
||||||
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
|
{ QStringLiteral( "fullscreen" ), WindowExpansion::Fullscreen },
|
||||||
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
|
{ QStringLiteral( "noexpand" ), WindowExpansion::Fixed }
|
||||||
@ -403,7 +414,10 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
|||||||
m_welcomeExpandingLogo = doc[ "welcomeExpandingLogo" ].as< bool >( true );
|
m_welcomeExpandingLogo = doc[ "welcomeExpandingLogo" ].as< bool >( true );
|
||||||
m_windowExpansion = expansionNames.find( getString( doc, "windowExpanding" ), ok );
|
m_windowExpansion = expansionNames.find( getString( doc, "windowExpanding" ), ok );
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
cWarning() << "Branding module-setting *windowExpanding* interpreted as" << expansionNames.find( m_windowExpansion, ok );
|
{
|
||||||
|
cWarning() << "Branding module-setting *windowExpanding* interpreted as"
|
||||||
|
<< expansionNames.find( m_windowExpansion, ok );
|
||||||
|
}
|
||||||
|
|
||||||
QString windowSize = getString( doc, "windowSize" );
|
QString windowSize = getString( doc, "windowSize" );
|
||||||
if ( !windowSize.isEmpty() )
|
if ( !windowSize.isEmpty() )
|
||||||
@ -411,24 +425,26 @@ Branding::initSimpleSettings( const YAML::Node& doc )
|
|||||||
auto l = windowSize.split( ',' );
|
auto l = windowSize.split( ',' );
|
||||||
if ( l.count() == 2 )
|
if ( l.count() == 2 )
|
||||||
{
|
{
|
||||||
m_windowWidth = WindowDimension( l[0] );
|
m_windowWidth = WindowDimension( l[ 0 ] );
|
||||||
m_windowHeight = WindowDimension( l[1] );
|
m_windowHeight = WindowDimension( l[ 1 ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !m_windowWidth.isValid() )
|
if ( !m_windowWidth.isValid() )
|
||||||
|
{
|
||||||
m_windowWidth = WindowDimension( CalamaresUtils::windowPreferredWidth, WindowDimensionUnit::Pixies );
|
m_windowWidth = WindowDimension( CalamaresUtils::windowPreferredWidth, WindowDimensionUnit::Pixies );
|
||||||
|
}
|
||||||
if ( !m_windowHeight.isValid() )
|
if ( !m_windowHeight.isValid() )
|
||||||
|
{
|
||||||
m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies );
|
m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[[noreturn]] void
|
[[noreturn]] void
|
||||||
Branding::bail( const QString& message )
|
Branding::bail( const QString& message )
|
||||||
{
|
{
|
||||||
cError() << "FATAL in"
|
cError() << "FATAL in" << m_descriptorPath << "\n" + message;
|
||||||
<< m_descriptorPath
|
|
||||||
<< "\n" + message;
|
|
||||||
::exit( EXIT_FAILURE );
|
::exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Calamares
|
||||||
|
@ -73,10 +73,14 @@ ViewStep::setModuleInstanceKey( const QString& instanceKey )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { Q_UNUSED( configurationMap ) }
|
ViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
|
{
|
||||||
|
Q_UNUSED( configurationMap )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RequirementsList ViewStep::checkRequirements()
|
RequirementsList
|
||||||
|
ViewStep::checkRequirements()
|
||||||
{
|
{
|
||||||
return RequirementsList();
|
return RequirementsList();
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ void
|
|||||||
ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
||||||
int timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
qint64 timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
||||||
if ( timeout < 1 )
|
if ( timeout < 1 )
|
||||||
{
|
{
|
||||||
timeout = 10;
|
timeout = 10;
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
#
|
#
|
||||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2019 Dominic Hayes <ferenosdev@outlook.com>
|
|
||||||
# Copyright 2014-2018, Philip Müller <philm@manjaro.org>
|
# Copyright 2014-2018, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
||||||
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
# Copyright 2017, Bernhard Landauer <oberon@manjaro.org>
|
# Copyright 2017, Bernhard Landauer <oberon@manjaro.org>
|
||||||
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
# Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||||
|
# Copyright 2019, Dominic Hayes <ferenosdev@outlook.com>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -117,14 +117,11 @@ class DisplayManager(metaclass=abc.ABCMeta):
|
|||||||
in the target system.
|
in the target system.
|
||||||
"""
|
"""
|
||||||
if self.executable is None:
|
if self.executable is None:
|
||||||
return True
|
return False
|
||||||
|
|
||||||
bin_path = "{!s}/usr/bin/{!s}".format(self.root_mount_point, self.executable)
|
bin_path = "{!s}/usr/bin/{!s}".format(self.root_mount_point, self.executable)
|
||||||
sbin_path = "{!s}/usr/sbin/{!s}".format(self.root_mount_point, self.executable)
|
sbin_path = "{!s}/usr/sbin/{!s}".format(self.root_mount_point, self.executable)
|
||||||
return (
|
return os.path.exists(bin_path) or os.path.exists(sbin_path)
|
||||||
os.path.exists(bin_path)
|
|
||||||
or os.path.exists(sbin_path)
|
|
||||||
)
|
|
||||||
|
|
||||||
# The four abstract methods below are called in the order listed here.
|
# The four abstract methods below are called in the order listed here.
|
||||||
# They must all be implemented by subclasses, but not all of them
|
# They must all be implemented by subclasses, but not all of them
|
||||||
@ -251,10 +248,33 @@ class DMmdm(DisplayManager):
|
|||||||
class DMgdm(DisplayManager):
|
class DMgdm(DisplayManager):
|
||||||
name = "gdm"
|
name = "gdm"
|
||||||
executable = "gdm"
|
executable = "gdm"
|
||||||
|
config = None # Set by have_dm()
|
||||||
|
|
||||||
|
def have_dm(self):
|
||||||
|
"""
|
||||||
|
GDM exists with different executable names, so search
|
||||||
|
for one of them and use it.
|
||||||
|
"""
|
||||||
|
for executable, config in (
|
||||||
|
( "gdm", "etc/gdm/custom.conf" ),
|
||||||
|
( "gdm3", "etc/gdm3/daemon.conf" )
|
||||||
|
):
|
||||||
|
bin_path = "{!s}/usr/bin/{!s}".format(self.root_mount_point, executable)
|
||||||
|
sbin_path = "{!s}/usr/sbin/{!s}".format(self.root_mount_point, executable)
|
||||||
|
if os.path.exists(bin_path) or os.path.exists(sbin_path):
|
||||||
|
# Keep the found-executable name around for later
|
||||||
|
self.executable = executable
|
||||||
|
self.config = config
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
def set_autologin(self, username, do_autologin, default_desktop_environment):
|
||||||
|
if self.config is None:
|
||||||
|
raise ValueError( "No config file for GDM has been set." )
|
||||||
|
|
||||||
# Systems with GDM as Desktop Manager
|
# Systems with GDM as Desktop Manager
|
||||||
gdm_conf_path = os.path.join(self.root_mount_point, "etc/gdm/custom.conf")
|
gdm_conf_path = os.path.join(self.root_mount_point, self.config)
|
||||||
|
|
||||||
if os.path.exists(gdm_conf_path):
|
if os.path.exists(gdm_conf_path):
|
||||||
with open(gdm_conf_path, 'r') as gdm_conf:
|
with open(gdm_conf_path, 'r') as gdm_conf:
|
||||||
|
@ -69,7 +69,7 @@ void
|
|||||||
ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
ShellProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
bool dontChroot = CalamaresUtils::getBool( configurationMap, "dontChroot", false );
|
||||||
int timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
qint64 timeout = CalamaresUtils::getInteger( configurationMap, "timeout", 10 );
|
||||||
if ( timeout < 1 )
|
if ( timeout < 1 )
|
||||||
{
|
{
|
||||||
timeout = 10;
|
timeout = 10;
|
||||||
|
Loading…
Reference in New Issue
Block a user