Add PartitionPreview widget to AlongsidePage.

This commit is contained in:
Teo Mrnjavac 2015-04-28 17:42:11 +02:00
parent 0d0e3bf7bc
commit 4b73d9579f
2 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* *
* 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
@ -27,6 +27,7 @@
#include "core/PartitionInfo.h" #include "core/PartitionInfo.h"
#include "core/PartitionIterator.h" #include "core/PartitionIterator.h"
#include "gui/PartitionSplitterWidget.h" #include "gui/PartitionSplitterWidget.h"
#include "gui/PartitionPreview.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
@ -60,6 +61,10 @@ AlongsidePage::AlongsidePage( QWidget* parent )
partitionsComboLayout->addStretch(); partitionsComboLayout->addStretch();
m_previewWidget = new PartitionPreview;
m_previewWidget->setLabelsVisible( true );
mainLayout->addWidget( m_previewWidget );
QLabel* allocateSpaceLabel = new QLabel(); QLabel* allocateSpaceLabel = new QLabel();
mainLayout->addWidget( allocateSpaceLabel ); mainLayout->addWidget( allocateSpaceLabel );
@ -138,6 +143,14 @@ AlongsidePage::init( PartitionCoreModule* core , const OsproberEntryList& osprob
} }
} }
Device* deviceBefore = m_core->createImmutableDeviceCopy( dev );
PartitionModel* partitionModelBefore = new PartitionModel;
partitionModelBefore->init( deviceBefore );
deviceBefore->setParent( partitionModelBefore );
partitionModelBefore->setParent( m_previewWidget );
m_previewWidget->setModel( partitionModelBefore );
m_splitterWidget->init( allPartitionItems ); m_splitterWidget->init( allPartitionItems );
m_splitterWidget->setSplitPartition( candidate->partitionPath(), m_splitterWidget->setSplitPartition( candidate->partitionPath(),

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* *
* 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
@ -28,6 +28,7 @@ class QLabel;
class PartitionCoreModule; class PartitionCoreModule;
class PartitionSplitterWidget; class PartitionSplitterWidget;
class Partition; class Partition;
class PartitionPreview;
class Device; class Device;
class AlongsidePage : public QWidget class AlongsidePage : public QWidget
@ -50,6 +51,7 @@ private:
QComboBox* m_partitionsComboBox; QComboBox* m_partitionsComboBox;
PartitionSplitterWidget* m_splitterWidget; PartitionSplitterWidget* m_splitterWidget;
PartitionPreview* m_previewWidget;
QLabel* m_sizeLabel; QLabel* m_sizeLabel;
PartitionCoreModule* m_core; PartitionCoreModule* m_core;