mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-26 17:05:36 -04:00
Generalized code path for Phase switching. Also load install modules.
This commit is contained in:
parent
6348e72974
commit
8d28a2ea5d
5 changed files with 86 additions and 53 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "viewpages/ViewStep.h"
|
||||
#include "InstallationViewStep.h"
|
||||
#include "JobQueue.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBoxLayout>
|
||||
|
@ -112,6 +113,31 @@ ViewManager::insertViewStep( int before, ViewStep* step)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::onInstallationFailed( const QString& message, const QString& details )
|
||||
{
|
||||
QString text = tr(
|
||||
"<p><b>Installation Failed</b></p>"
|
||||
"<p>%1</p>"
|
||||
).arg( message );
|
||||
|
||||
if ( !details.isEmpty() )
|
||||
{
|
||||
text += tr(
|
||||
"<p>%1</p>"
|
||||
).arg( details );
|
||||
}
|
||||
|
||||
QMessageBox::critical(
|
||||
QApplication::activeWindow(),
|
||||
tr( "Error" ),
|
||||
text,
|
||||
QMessageBox::Close
|
||||
);
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
|
||||
QList< ViewStep* >
|
||||
ViewManager::prepareSteps() const
|
||||
{
|
||||
|
@ -155,7 +181,7 @@ ViewManager::next()
|
|||
emit currentStepChanged();
|
||||
if ( installing )
|
||||
{
|
||||
startInstallation();
|
||||
emit phaseChangeRequested( Calamares::Install );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -191,40 +217,4 @@ ViewManager::back()
|
|||
m_back->setEnabled( false );
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::startInstallation()
|
||||
{
|
||||
JobQueue* queue = JobQueue::instance();
|
||||
for( ViewStep* step : m_prepareSteps )
|
||||
{
|
||||
queue->enqueue( step->jobs() );
|
||||
}
|
||||
connect( queue, &JobQueue::failed, this, &ViewManager::onInstallationFailed );
|
||||
queue->start();
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::onInstallationFailed( const QString& message, const QString& details )
|
||||
{
|
||||
QString text = tr(
|
||||
"<p><b>Installation Failed</b></p>"
|
||||
"<p>%1</p>"
|
||||
).arg( message );
|
||||
|
||||
if ( !details.isEmpty() )
|
||||
{
|
||||
text += tr(
|
||||
"<p>%1</p>"
|
||||
).arg( details );
|
||||
}
|
||||
|
||||
QMessageBox::critical(
|
||||
QApplication::activeWindow(),
|
||||
tr( "Error" ),
|
||||
text,
|
||||
QMessageBox::Close
|
||||
);
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue