Merge commit 'afc0c78b4c01ac734b9877b11ae94597c685d804'
Pull in the instance-weight changes and type-improvements, but not the part where special-casing of unsquash is dropped: weights are still per-job, not per-module.
This commit is contained in:
commit
9fe679dca8
@ -73,7 +73,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
emitProgress();
|
emitProgress();
|
||||||
cDebug() << "Starting" << ( anyFailed ? "EMERGENCY JOB" : "job" ) << job->prettyName() << " (there are" << m_jobs.count() << " left)";
|
cDebug() << "Starting" << ( anyFailed ? "EMERGENCY JOB" : "job" ) << job->prettyName() << " (there are"
|
||||||
|
<< m_jobs.count() << " left)";
|
||||||
connect( job.data(), &Job::progress, this, &JobThread::emitProgress );
|
connect( job.data(), &Job::progress, this, &JobThread::emitProgress );
|
||||||
JobResult result = job->exec();
|
JobResult result = job->exec();
|
||||||
if ( !anyFailed && !result )
|
if ( !anyFailed && !result )
|
||||||
@ -113,22 +114,22 @@ private:
|
|||||||
int jobCount = m_jobs.size();
|
int jobCount = m_jobs.size();
|
||||||
QString message = m_jobIndex < jobCount ? m_jobs.at( m_jobIndex )->prettyStatusMessage() : tr( "Done" );
|
QString message = m_jobIndex < jobCount ? m_jobs.at( m_jobIndex )->prettyStatusMessage() : tr( "Done" );
|
||||||
|
|
||||||
qreal cumulativeProgress = 0.0;
|
qreal percent = 1.0; // Pretend we're done, since the if will reset it
|
||||||
for ( auto jobWeight : m_jobWeights.mid( 0, m_jobIndex ) )
|
|
||||||
{
|
|
||||||
cumulativeProgress += jobWeight;
|
|
||||||
}
|
|
||||||
qreal percent
|
|
||||||
= m_jobIndex < jobCount ? cumulativeProgress + ( ( m_jobWeights.at( m_jobIndex ) ) * jobPercent ) : 1.0;
|
|
||||||
|
|
||||||
if ( m_jobIndex < jobCount )
|
if ( m_jobIndex < jobCount )
|
||||||
{
|
{
|
||||||
Logger::CDebug( Logger::LOGVERBOSE ) << "[JOBQUEUE]: Progress for Job[" << m_jobIndex
|
qreal cumulativeProgress = 0.0;
|
||||||
<< "]: " << ( jobPercent * 100 ) << "% completed";
|
for ( auto jobWeight : m_jobWeights.mid( 0, m_jobIndex ) )
|
||||||
Logger::CDebug( Logger::LOGVERBOSE ) << "[JOBQUEUE]: Progress Overall: " << ( cumulativeProgress * 100 )
|
{
|
||||||
<< "% (accumulated) + "
|
cumulativeProgress += jobWeight;
|
||||||
<< ( ( ( m_jobWeights.at( m_jobIndex ) ) * jobPercent ) * 100 )
|
}
|
||||||
<< "% (this job) = " << ( percent * 100 ) << "% (total)";
|
percent = cumulativeProgress + ( ( m_jobWeights.at( m_jobIndex ) ) * jobPercent );
|
||||||
|
|
||||||
|
Logger::CDebug( Logger::LOGVERBOSE )
|
||||||
|
<< "[JOBQUEUE]: Progress for Job[" << m_jobIndex << "]: " << ( jobPercent * 100 ) << "% completed";
|
||||||
|
Logger::CDebug( Logger::LOGVERBOSE )
|
||||||
|
<< "[JOBQUEUE]: Progress Overall: " << ( cumulativeProgress * 100 ) << "% (accumulated) + "
|
||||||
|
<< ( ( ( m_jobWeights.at( m_jobIndex ) ) * jobPercent ) * 100 )
|
||||||
|
<< "% (this job) = " << ( percent * 100 ) << "% (total)";
|
||||||
}
|
}
|
||||||
QMetaObject::invokeMethod(
|
QMetaObject::invokeMethod(
|
||||||
m_queue, "progress", Qt::QueuedConnection, Q_ARG( qreal, percent ), Q_ARG( QString, message ) );
|
m_queue, "progress", Qt::QueuedConnection, Q_ARG( qreal, percent ), Q_ARG( QString, message ) );
|
||||||
|
@ -71,6 +71,24 @@ requireBool( const YAML::Node& config, const char* key, bool d )
|
|||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
InstanceDescription::InstanceDescription( const QVariantMap& m )
|
||||||
|
: module( m.value( "module" ).toString() )
|
||||||
|
, id( m.value( "id" ).toString() )
|
||||||
|
, config( m.value( "config" ).toString() )
|
||||||
|
, weight( m.value( "weight" ).toInt() )
|
||||||
|
{
|
||||||
|
if ( id.isEmpty() )
|
||||||
|
{
|
||||||
|
id = module;
|
||||||
|
}
|
||||||
|
if ( config.isEmpty() )
|
||||||
|
{
|
||||||
|
config = module + QStringLiteral( ".conf" );
|
||||||
|
}
|
||||||
|
|
||||||
|
weight = qBound( 1, weight, 100 );
|
||||||
|
}
|
||||||
|
|
||||||
Settings* Settings::s_instance = nullptr;
|
Settings* Settings::s_instance = nullptr;
|
||||||
|
|
||||||
Settings*
|
Settings*
|
||||||
@ -134,17 +152,7 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QVariantMap instancesVListItemMap = instancesVListItem.toMap();
|
customInstances.append( InstanceDescription( instancesVListItem.toMap() ) );
|
||||||
Settings::InstanceDescription instanceMap;
|
|
||||||
for ( auto it = instancesVListItemMap.constBegin(); it != instancesVListItemMap.constEnd(); ++it )
|
|
||||||
{
|
|
||||||
if ( it.value().type() != QVariant::String )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
instanceMap.insert( it.key(), it.value().toString() );
|
|
||||||
}
|
|
||||||
customInstances.append( instanceMap );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +310,7 @@ Settings::init( bool debugMode )
|
|||||||
cWarning() << "Calamares::Settings already created";
|
cWarning() << "Calamares::Settings already created";
|
||||||
return s_instance;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList settingsFileCandidatesByPriority = settingsFileCandidates( debugMode );
|
QStringList settingsFileCandidatesByPriority = settingsFileCandidates( debugMode );
|
||||||
|
|
||||||
QFileInfo settingsFile;
|
QFileInfo settingsFile;
|
||||||
@ -340,7 +348,7 @@ Settings::init( bool debugMode )
|
|||||||
cError() << "FATAL: no sequence set.";
|
cError() << "FATAL: no sequence set.";
|
||||||
::exit( EXIT_FAILURE );
|
::exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,20 +32,30 @@
|
|||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct DLLEXPORT InstanceDescription
|
||||||
|
{
|
||||||
|
InstanceDescription( const QVariantMap& );
|
||||||
|
|
||||||
|
QString module; ///< Module name (e.g. "welcome")
|
||||||
|
QString id; ///< Id, to distinguish multiple instances (e.g. "one", for "welcome@one")
|
||||||
|
QString config; ///< Config-file name (for multiple instances)
|
||||||
|
int weight;
|
||||||
|
};
|
||||||
|
|
||||||
class DLLEXPORT Settings : public QObject
|
class DLLEXPORT Settings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
explicit Settings( const QString& settingsFilePath, bool debugMode );
|
explicit Settings( const QString& settingsFilePath, bool debugMode );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Settings* instance();
|
static Settings* instance();
|
||||||
/// @brief Find a settings.conf, following @p debugMode
|
/// @brief Find a settings.conf, following @p debugMode
|
||||||
static Settings* init( bool debugMode );
|
static Settings* init( bool debugMode );
|
||||||
/// @brief Explicif filename, debug is always true (for testing)
|
/// @brief Explicif filename, debug is always true (for testing)
|
||||||
static Settings* init( const QString& filename );
|
static Settings* init( const QString& filename );
|
||||||
|
|
||||||
QStringList modulesSearchPaths() const;
|
QStringList modulesSearchPaths() const;
|
||||||
|
|
||||||
using InstanceDescription = QMap< QString, QString >;
|
|
||||||
using InstanceDescriptionList = QList< InstanceDescription >;
|
using InstanceDescriptionList = QList< InstanceDescription >;
|
||||||
InstanceDescriptionList customModuleInstances() const;
|
InstanceDescriptionList customModuleInstances() const;
|
||||||
|
|
||||||
@ -55,7 +65,7 @@ public:
|
|||||||
QString brandingComponentName() const;
|
QString brandingComponentName() const;
|
||||||
|
|
||||||
/** @brief Is this a debugging run?
|
/** @brief Is this a debugging run?
|
||||||
*
|
*
|
||||||
* Returns true if Calamares is in debug mode. In debug mode,
|
* Returns true if Calamares is in debug mode. In debug mode,
|
||||||
* modules and settings are loaded from more locations, to help
|
* modules and settings are loaded from more locations, to help
|
||||||
* development and debugging.
|
* development and debugging.
|
||||||
@ -63,7 +73,7 @@ public:
|
|||||||
bool debugMode() const { return m_debug; }
|
bool debugMode() const { return m_debug; }
|
||||||
|
|
||||||
/** @brief Distinguish "install" from "OEM" modes.
|
/** @brief Distinguish "install" from "OEM" modes.
|
||||||
*
|
*
|
||||||
* Returns true in "install" mode, which is where actions happen
|
* Returns true in "install" mode, which is where actions happen
|
||||||
* in a chroot -- the target system, which exists separately from
|
* in a chroot -- the target system, which exists separately from
|
||||||
* the source system. In "OEM" mode, returns false and most actions
|
* the source system. In "OEM" mode, returns false and most actions
|
||||||
@ -72,13 +82,13 @@ public:
|
|||||||
bool doChroot() const { return m_doChroot; }
|
bool doChroot() const { return m_doChroot; }
|
||||||
|
|
||||||
/** @brief Global setting of prompt-before-install.
|
/** @brief Global setting of prompt-before-install.
|
||||||
*
|
*
|
||||||
* Returns true when the configuration is such that the user
|
* Returns true when the configuration is such that the user
|
||||||
* should be prompted one-last-time before any action is taken
|
* should be prompted one-last-time before any action is taken
|
||||||
* that really affects the machine.
|
* that really affects the machine.
|
||||||
*/
|
*/
|
||||||
bool showPromptBeforeExecution() const { return m_promptInstall; }
|
bool showPromptBeforeExecution() const { return m_promptInstall; }
|
||||||
|
|
||||||
/** @brief Distinguish between "install" and "setup" modes.
|
/** @brief Distinguish between "install" and "setup" modes.
|
||||||
*
|
*
|
||||||
* This influences user-visible strings, for instance using the
|
* This influences user-visible strings, for instance using the
|
||||||
|
@ -129,9 +129,8 @@ ModuleManager::doInit()
|
|||||||
}
|
}
|
||||||
// At this point m_availableDescriptorsByModuleName is filled with
|
// At this point m_availableDescriptorsByModuleName is filled with
|
||||||
// the modules that were found in the search paths.
|
// the modules that were found in the search paths.
|
||||||
cDebug() << "Found"
|
cDebug() << "Found" << m_availableDescriptorsByModuleName.count() << "modules"
|
||||||
<< m_availableDescriptorsByModuleName.count() << "modules"
|
<< m_moduleDirectoriesByModuleName.count() << "names";
|
||||||
<< m_moduleDirectoriesByModuleName.count() << "names";
|
|
||||||
emit initDone();
|
emit initDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +166,7 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
|
|||||||
for ( int i = 0; i < customInstances.count(); ++i )
|
for ( int i = 0; i < customInstances.count(); ++i )
|
||||||
{
|
{
|
||||||
const auto& thisInstance = customInstances[ i ];
|
const auto& thisInstance = customInstances[ i ];
|
||||||
if ( thisInstance.value( "module" ) == m.module() && thisInstance.value( "id" ) == m.id() )
|
if ( thisInstance.module == m.module() && thisInstance.id == m.id() )
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -196,7 +195,7 @@ getConfigFileName( const Settings::InstanceDescriptionList& customInstances,
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return customInstances[ found ].value( "config" );
|
return customInstances[ found ].config;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user