Rework PartitionPage appearance, prior addition of boot loader UI
This commit is contained in:
parent
81eca92418
commit
3e3329d4f2
@ -21,6 +21,9 @@
|
||||
// CalaPM
|
||||
#include <core/device.h>
|
||||
|
||||
// KF5
|
||||
#include <KFormat>
|
||||
|
||||
DeviceModel::DeviceModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
@ -59,7 +62,10 @@ DeviceModel::data( const QModelIndex& index, int role ) const
|
||||
if ( device->name().isEmpty() )
|
||||
return device->deviceNode();
|
||||
else
|
||||
return device->name() + " " + device->deviceNode();
|
||||
return tr( "%1 - %2 (%3)" )
|
||||
.arg( device->name() )
|
||||
.arg( KFormat().formatByteSize( device->capacity() ) )
|
||||
.arg( device->deviceNode() );
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -45,12 +45,13 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
, m_core( core )
|
||||
{
|
||||
m_ui->setupUi( this );
|
||||
m_ui->deviceListView->setModel( m_core->deviceModel() );
|
||||
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
|
||||
updateButtons();
|
||||
|
||||
connect( m_ui->deviceListView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
||||
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
|
||||
[ this ]( const QString& /* text */ )
|
||||
{
|
||||
QModelIndex index = m_ui->deviceComboBox->view()->currentIndex();
|
||||
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
||||
PartitionModel* model = m_core->partitionModelForDevice( device );
|
||||
m_ui->partitionTreeView->setModel( model );
|
||||
@ -111,13 +112,13 @@ PartitionPage::updateButtons()
|
||||
m_ui->editButton->setEnabled( edit );
|
||||
m_ui->deleteButton->setEnabled( del );
|
||||
|
||||
m_ui->newPartitionTableButton->setEnabled( m_ui->deviceListView->currentIndex().isValid() );
|
||||
m_ui->newPartitionTableButton->setEnabled( m_ui->deviceComboBox->currentIndex() >= 0 );
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::onNewPartitionTableClicked()
|
||||
{
|
||||
QModelIndex index = m_ui->deviceListView->currentIndex();
|
||||
QModelIndex index = m_ui->deviceComboBox->view()->currentIndex();
|
||||
Q_ASSERT( index.isValid() );
|
||||
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
||||
|
||||
|
@ -13,15 +13,61 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>[Disk preview goes here]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<item>
|
||||
<widget class="QPushButton" name="newPartitionTableButton">
|
||||
@ -66,34 +112,16 @@
|
||||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>deviceComboBox</tabstop>
|
||||
<tabstop>partitionTreeView</tabstop>
|
||||
<tabstop>newPartitionTableButton</tabstop>
|
||||
<tabstop>createButton</tabstop>
|
||||
<tabstop>editButton</tabstop>
|
||||
<tabstop>deleteButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user