mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 02:45:44 -05:00
InstallationViewStep is now ExecutionViewStep.
It also uses JobQueue directly.
This commit is contained in:
parent
f836019f49
commit
4f84e9ad14
2 changed files with 51 additions and 23 deletions
|
@ -17,14 +17,17 @@
|
||||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <InstallationViewStep.h>
|
#include <ExecutionViewStep.h>
|
||||||
|
|
||||||
#include "JobQueue.h"
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
#include "modulesystem/ModuleManager.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
#include "ViewManager.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -37,7 +40,7 @@
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
InstallationViewStep::InstallationViewStep( QObject* parent )
|
ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
||||||
: ViewStep( parent )
|
: ViewStep( parent )
|
||||||
, m_widget( new QWidget )
|
, m_widget( new QWidget )
|
||||||
{
|
{
|
||||||
|
@ -62,65 +65,68 @@ InstallationViewStep::InstallationViewStep( QObject* parent )
|
||||||
innerLayout->addWidget( m_label );
|
innerLayout->addWidget( m_label );
|
||||||
|
|
||||||
cDebug() << "QML import paths:" << m_slideShow->engine()->importPathList();
|
cDebug() << "QML import paths:" << m_slideShow->engine()->importPathList();
|
||||||
|
|
||||||
|
connect( JobQueue::instance(), &JobQueue::progress,
|
||||||
|
this, &ExecutionViewStep::updateFromJobQueue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
InstallationViewStep::prettyName() const
|
ExecutionViewStep::prettyName() const
|
||||||
{
|
{
|
||||||
return tr( "Install" );
|
return tr( "Install" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget*
|
QWidget*
|
||||||
InstallationViewStep::widget()
|
ExecutionViewStep::widget()
|
||||||
{
|
{
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallationViewStep::next()
|
ExecutionViewStep::next()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallationViewStep::back()
|
ExecutionViewStep::back()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstallationViewStep::isNextEnabled() const
|
ExecutionViewStep::isNextEnabled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstallationViewStep::isBackEnabled() const
|
ExecutionViewStep::isBackEnabled() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstallationViewStep::isAtBeginning() const
|
ExecutionViewStep::isAtBeginning() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstallationViewStep::isAtEnd() const
|
ExecutionViewStep::isAtEnd() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallationViewStep::onActivate()
|
ExecutionViewStep::onActivate()
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE_WIDGET( m_widget,
|
CALAMARES_RETRANSLATE_WIDGET( m_widget,
|
||||||
if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() )
|
if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() )
|
||||||
|
@ -128,20 +134,36 @@ InstallationViewStep::onActivate()
|
||||||
->slideshowPath() ) );
|
->slideshowPath() ) );
|
||||||
)
|
)
|
||||||
|
|
||||||
connect( JobQueue::instance(), &JobQueue::progress,
|
|
||||||
this, &InstallationViewStep::updateFromJobQueue );
|
JobQueue* queue = JobQueue::instance();
|
||||||
|
foreach ( const QString& instanceKey, m_jobInstanceKeys )
|
||||||
|
{
|
||||||
|
Calamares::Module* module = Calamares::ModuleManager::instance()
|
||||||
|
->moduleInstance( instanceKey );
|
||||||
|
if ( module )
|
||||||
|
queue->enqueue( module->jobs() );
|
||||||
|
}
|
||||||
|
|
||||||
|
queue->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList< Calamares::job_ptr >
|
QList< Calamares::job_ptr >
|
||||||
InstallationViewStep::jobs() const
|
ExecutionViewStep::jobs() const
|
||||||
{
|
{
|
||||||
return QList< Calamares::job_ptr >();
|
return QList< Calamares::job_ptr >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InstallationViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
ExecutionViewStep::appendJobModuleInstanceKey( const QString& instanceKey )
|
||||||
|
{
|
||||||
|
m_jobInstanceKeys.append( instanceKey );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
||||||
{
|
{
|
||||||
m_progressBar->setValue( percent * m_progressBar->maximum() );
|
m_progressBar->setValue( percent * m_progressBar->maximum() );
|
||||||
m_label->setText( message );
|
m_label->setText( message );
|
|
@ -17,11 +17,13 @@
|
||||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INSTALLATIONVIEWSTEP_H
|
#ifndef EXECUTIONVIEWSTEP_H
|
||||||
#define INSTALLATIONVIEWSTEP_H
|
#define EXECUTIONVIEWSTEP_H
|
||||||
|
|
||||||
#include <viewpages/ViewStep.h>
|
#include <viewpages/ViewStep.h>
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
class QQuickWidget;
|
class QQuickWidget;
|
||||||
|
@ -29,11 +31,11 @@ class QQuickWidget;
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
class InstallationViewStep : public ViewStep
|
class ExecutionViewStep : public ViewStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit InstallationViewStep( QObject* parent = nullptr );
|
explicit ExecutionViewStep( QObject* parent = nullptr );
|
||||||
|
|
||||||
QString prettyName() const override;
|
QString prettyName() const override;
|
||||||
|
|
||||||
|
@ -50,7 +52,9 @@ public:
|
||||||
|
|
||||||
void onActivate() override;
|
void onActivate() override;
|
||||||
|
|
||||||
QList< Calamares::job_ptr > jobs() const override;
|
QList< job_ptr > jobs() const override;
|
||||||
|
|
||||||
|
void appendJobModuleInstanceKey( const QString& instanceKey );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* m_widget;
|
QWidget* m_widget;
|
||||||
|
@ -58,9 +62,11 @@ private:
|
||||||
QLabel* m_label;
|
QLabel* m_label;
|
||||||
QQuickWidget* m_slideShow;
|
QQuickWidget* m_slideShow;
|
||||||
|
|
||||||
|
QStringList m_jobInstanceKeys;
|
||||||
|
|
||||||
void updateFromJobQueue( qreal percent, const QString& message );
|
void updateFromJobQueue( qreal percent, const QString& message );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* INSTALLATIONVIEWSTEP_H */
|
#endif /* EXECUTIONVIEWSTEP_H */
|
Loading…
Add table
Reference in a new issue