Use PartResizerWidget in CreatePartitionDialog
This commit is contained in:
parent
38c685dc10
commit
5c9c414988
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <CreatePartitionDialog.h>
|
#include <CreatePartitionDialog.h>
|
||||||
|
|
||||||
|
#include <PartitionSizeController.h>
|
||||||
#include <PartitionInfo.h>
|
#include <PartitionInfo.h>
|
||||||
#include <PMUtils.h>
|
#include <PMUtils.h>
|
||||||
#include <ui_CreatePartitionDialog.h>
|
#include <ui_CreatePartitionDialog.h>
|
||||||
@ -116,7 +117,8 @@ CreatePartitionDialog::createPartition()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionSizeWidget::SectorRange range = m_ui->sizeSpinBox->sectorRange();
|
qint64 first = m_partResizerWidgetPartition->firstSector();
|
||||||
|
qint64 last = m_partResizerWidgetPartition->lastSector();
|
||||||
|
|
||||||
FileSystem::Type fsType = m_role.has( PartitionRole::Extended )
|
FileSystem::Type fsType = m_role.has( PartitionRole::Extended )
|
||||||
? FileSystem::Extended
|
? FileSystem::Extended
|
||||||
@ -125,7 +127,7 @@ CreatePartitionDialog::createPartition()
|
|||||||
m_parent,
|
m_parent,
|
||||||
*m_device,
|
*m_device,
|
||||||
m_role,
|
m_role,
|
||||||
fsType, range.first, range.second );
|
fsType, first, last );
|
||||||
|
|
||||||
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
||||||
PartitionInfo::setFormat( partition, true );
|
PartitionInfo::setFormat( partition, true );
|
||||||
@ -145,10 +147,25 @@ CreatePartitionDialog::updateMountPointUi()
|
|||||||
m_ui->mountPointComboBox->setEnabled( enabled );
|
m_ui->mountPointComboBox->setEnabled( enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CreatePartitionDialog::initPartResizerWidget( Partition* partition )
|
||||||
|
{
|
||||||
|
PartitionSizeController* controller = new PartitionSizeController( this );
|
||||||
|
m_partResizerWidgetPartition.reset( PMUtils::clonePartition( m_device, partition ) );
|
||||||
|
|
||||||
|
qint64 minFirstSector = partition->firstSector() - m_device->partitionTable()->freeSectorsBefore( *partition );
|
||||||
|
qint64 maxLastSector = partition->lastSector() + m_device->partitionTable()->freeSectorsAfter( *partition );
|
||||||
|
m_ui->partResizerWidget->init( *m_device, *m_partResizerWidgetPartition, minFirstSector, maxLastSector );
|
||||||
|
|
||||||
|
controller->init( m_device, m_partResizerWidgetPartition.data() );
|
||||||
|
controller->setPartResizerWidget( m_ui->partResizerWidget );
|
||||||
|
controller->setSpinBox( m_ui->sizeSpinBox );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CreatePartitionDialog::initFromFreeSpace( Partition* freeSpacePartition )
|
CreatePartitionDialog::initFromFreeSpace( Partition* freeSpacePartition )
|
||||||
{
|
{
|
||||||
m_ui->sizeSpinBox->init( m_device, freeSpacePartition );
|
initPartResizerWidget( freeSpacePartition );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -164,7 +181,7 @@ CreatePartitionDialog::initFromPartitionToCreate( Partition* partition )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->sizeSpinBox->init( m_device, partition );
|
initPartResizerWidget( partition );
|
||||||
|
|
||||||
// File System
|
// File System
|
||||||
FileSystem::Type fsType = partition->fileSystem().type();
|
FileSystem::Type fsType = partition->fileSystem().type();
|
||||||
|
@ -49,10 +49,11 @@ private:
|
|||||||
Device* m_device;
|
Device* m_device;
|
||||||
PartitionNode* m_parent;
|
PartitionNode* m_parent;
|
||||||
PartitionRole m_role = PartitionRole( PartitionRole::None );
|
PartitionRole m_role = PartitionRole( PartitionRole::None );
|
||||||
|
QScopedPointer< Partition > m_partResizerWidgetPartition;
|
||||||
|
|
||||||
void initGptPartitionTypeUi();
|
void initGptPartitionTypeUi();
|
||||||
void initMbrPartitionTypeUi();
|
void initMbrPartitionTypeUi();
|
||||||
void initSectorRange( Partition* );
|
void initPartResizerWidget( Partition* );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CREATEPARTITIONDIALOG_H */
|
#endif /* CREATEPARTITIONDIALOG_H */
|
||||||
|
@ -14,9 +14,25 @@
|
|||||||
<string>Create a Partition</string>
|
<string>Create a Partition</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="PartResizerWidget" name="partResizerWidget" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>59</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="partitionTypeLabel">
|
<widget class="QLabel" name="partitionTypeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Partition &Type:</string>
|
<string>Partition &Type:</string>
|
||||||
@ -26,7 +42,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="primaryRadioButton">
|
<widget class="QRadioButton" name="primaryRadioButton">
|
||||||
@ -67,7 +83,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>F&ile System:</string>
|
<string>F&ile System:</string>
|
||||||
@ -77,27 +93,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="fsComboBox"/>
|
<widget class="QComboBox" name="fsComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Si&ze:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>sizeSpinBox</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="PartitionSizeWidget" name="sizeSpinBox">
|
|
||||||
<property name="suffix">
|
|
||||||
<string> MB</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -113,7 +112,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="mountPointLabel">
|
<widget class="QLabel" name="mountPointLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Mount Point:</string>
|
<string>&Mount Point:</string>
|
||||||
@ -123,7 +122,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QComboBox" name="mountPointComboBox">
|
<widget class="QComboBox" name="mountPointComboBox">
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -163,7 +162,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -176,7 +175,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -189,6 +188,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Si&ze:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>sizeSpinBox</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="sizeSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> MB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -205,15 +221,15 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PartitionSizeWidget</class>
|
<class>PartResizerWidget</class>
|
||||||
<extends>QSpinBox</extends>
|
<extends>QWidget</extends>
|
||||||
<header location="global">PartitionSizeWidget.h</header>
|
<header location="global">gui/partresizerwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>primaryRadioButton</tabstop>
|
<tabstop>primaryRadioButton</tabstop>
|
||||||
<tabstop>fsComboBox</tabstop>
|
<tabstop>fsComboBox</tabstop>
|
||||||
<tabstop>sizeSpinBox</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
Loading…
Reference in New Issue
Block a user