Enqueue all partition jobs when leaving the PartitionViewStep

This commit is contained in:
Aurélien Gâteau 2014-07-02 16:06:54 +02:00
parent 4916d0cb88
commit a318ec49fc
7 changed files with 20 additions and 9 deletions

View File

@ -21,7 +21,6 @@
#include <CreatePartitionJob.h> #include <CreatePartitionJob.h>
#include <DeletePartitionJob.h> #include <DeletePartitionJob.h>
#include <DeviceModel.h> #include <DeviceModel.h>
#include <JobQueue.h>
#include <PartitionModel.h> #include <PartitionModel.h>
#include <Typedefs.h> #include <Typedefs.h>
#include <utils/Logger.h> #include <utils/Logger.h>

View File

@ -52,6 +52,11 @@ public:
void deletePartition( Device* device, Partition* partition ); void deletePartition( Device* device, Partition* partition );
QList< Calamares::job_ptr > jobs() const
{
return m_jobs;
}
private: private:
struct DeviceInfo struct DeviceInfo
{ {

View File

@ -31,10 +31,10 @@
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <QPointer> #include <QPointer>
PartitionPage::PartitionPage( QWidget* parent ) PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
: Calamares::AbstractPage( parent ) : Calamares::AbstractPage( parent )
, m_ui( new Ui_PartitionPage ) , m_ui( new Ui_PartitionPage )
, m_core( new PartitionCoreModule( this ) ) , m_core( core )
{ {
m_ui->setupUi( this ); m_ui->setupUi( this );
m_ui->deviceListView->setModel( m_core->deviceModel() ); m_ui->deviceListView->setModel( m_core->deviceModel() );

View File

@ -32,7 +32,7 @@ class PartitionPage : public Calamares::AbstractPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PartitionPage( QWidget* parent = 0 ); explicit PartitionPage( PartitionCoreModule* core, QWidget* parent = 0 );
~PartitionPage(); ~PartitionPage();
Q_SIGNALS: Q_SIGNALS:

View File

@ -16,14 +16,16 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>. * along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "PartitionViewStep.h" #include <PartitionViewStep.h>
#include "PartitionPage.h"
#include <PartitionPage.h>
#include <PartitionCoreModule.h>
#include <JobQueue.h>
PartitionViewStep::PartitionViewStep( QObject* parent ) PartitionViewStep::PartitionViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( new PartitionPage() ) , m_core( new PartitionCoreModule( this ) )
, m_widget( new PartitionPage( m_core ) )
{ {
} }
@ -45,6 +47,7 @@ PartitionViewStep::widget()
void void
PartitionViewStep::next() PartitionViewStep::next()
{ {
Calamares::JobQueue::instance()->enqueue( m_core->jobs() );
emit done(); emit done();
} }

View File

@ -25,6 +25,7 @@
#include "PluginDllMacro.h" #include "PluginDllMacro.h"
class PartitionPage; class PartitionPage;
class PartitionCoreModule;
class PLUGINDLLEXPORT PartitionViewStep : public Calamares::ViewStep class PLUGINDLLEXPORT PartitionViewStep : public Calamares::ViewStep
{ {
@ -48,6 +49,7 @@ public:
bool isAtEnd() const override; bool isAtEnd() const override;
private: private:
PartitionCoreModule* m_core;
PartitionPage* m_widget; PartitionPage* m_widget;
}; };

View File

@ -1,3 +1,4 @@
#include <PartitionCoreModule.h>
#include <PartitionPage.h> #include <PartitionPage.h>
#include <QApplication> #include <QApplication>
@ -6,7 +7,8 @@ int
main( int argc, char* argv[] ) main( int argc, char* argv[] )
{ {
QApplication app( argc, argv ); QApplication app( argc, argv );
PartitionPage page; PartitionCoreModule core;
PartitionPage page( &core );
page.show(); page.show();
return app.exec(); return app.exec();
} }