mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-25 16:38:21 -04:00
Rework PartitionPage appearance, prior addition of boot loader UI
This commit is contained in:
parent
81eca92418
commit
3e3329d4f2
3 changed files with 70 additions and 35 deletions
|
@ -21,6 +21,9 @@
|
||||||
// CalaPM
|
// CalaPM
|
||||||
#include <core/device.h>
|
#include <core/device.h>
|
||||||
|
|
||||||
|
// KF5
|
||||||
|
#include <KFormat>
|
||||||
|
|
||||||
DeviceModel::DeviceModel( QObject* parent )
|
DeviceModel::DeviceModel( QObject* parent )
|
||||||
: QAbstractListModel( parent )
|
: QAbstractListModel( parent )
|
||||||
{
|
{
|
||||||
|
@ -59,7 +62,10 @@ DeviceModel::data( const QModelIndex& index, int role ) const
|
||||||
if ( device->name().isEmpty() )
|
if ( device->name().isEmpty() )
|
||||||
return device->deviceNode();
|
return device->deviceNode();
|
||||||
else
|
else
|
||||||
return device->name() + " " + device->deviceNode();
|
return tr( "%1 - %2 (%3)" )
|
||||||
|
.arg( device->name() )
|
||||||
|
.arg( KFormat().formatByteSize( device->capacity() ) )
|
||||||
|
.arg( device->deviceNode() );
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,13 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||||
, m_core( core )
|
, m_core( core )
|
||||||
{
|
{
|
||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
m_ui->deviceListView->setModel( m_core->deviceModel() );
|
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|
||||||
connect( m_ui->deviceListView->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
|
||||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
[ this ]( const QString& /* text */ )
|
||||||
{
|
{
|
||||||
|
QModelIndex index = m_ui->deviceComboBox->view()->currentIndex();
|
||||||
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
||||||
PartitionModel* model = m_core->partitionModelForDevice( device );
|
PartitionModel* model = m_core->partitionModelForDevice( device );
|
||||||
m_ui->partitionTreeView->setModel( model );
|
m_ui->partitionTreeView->setModel( model );
|
||||||
|
@ -111,13 +112,13 @@ PartitionPage::updateButtons()
|
||||||
m_ui->editButton->setEnabled( edit );
|
m_ui->editButton->setEnabled( edit );
|
||||||
m_ui->deleteButton->setEnabled( del );
|
m_ui->deleteButton->setEnabled( del );
|
||||||
|
|
||||||
m_ui->newPartitionTableButton->setEnabled( m_ui->deviceListView->currentIndex().isValid() );
|
m_ui->newPartitionTableButton->setEnabled( m_ui->deviceComboBox->currentIndex() >= 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PartitionPage::onNewPartitionTableClicked()
|
PartitionPage::onNewPartitionTableClicked()
|
||||||
{
|
{
|
||||||
QModelIndex index = m_ui->deviceListView->currentIndex();
|
QModelIndex index = m_ui->deviceComboBox->view()->currentIndex();
|
||||||
Q_ASSERT( index.isValid() );
|
Q_ASSERT( index.isValid() );
|
||||||
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,61 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disk:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>deviceComboBox</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="deviceComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>[Disk preview goes here]</string>
|
<string>[Disk preview goes here]</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item>
|
||||||
|
<widget class="QTreeView" name="partitionTreeView">
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="headerStretchLastSection">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="newPartitionTableButton">
|
<widget class="QPushButton" name="newPartitionTableButton">
|
||||||
|
@ -66,34 +112,16 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" rowspan="3">
|
|
||||||
<widget class="QListView" name="deviceListView">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QTreeView" name="partitionTreeView">
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="allColumnsShowFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="headerStretchLastSection">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>deviceComboBox</tabstop>
|
||||||
|
<tabstop>partitionTreeView</tabstop>
|
||||||
|
<tabstop>newPartitionTableButton</tabstop>
|
||||||
|
<tabstop>createButton</tabstop>
|
||||||
|
<tabstop>editButton</tabstop>
|
||||||
|
<tabstop>deleteButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue