[partition] Initial implementation of VolumeGroupBaseDialog.

This commit is contained in:
Caio 2018-06-04 16:31:58 -03:00
parent f72f7bd8fe
commit d15ce56c97
14 changed files with 580 additions and 1 deletions

View file

@ -0,0 +1,36 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ListPhysicalVolumeWidgetItem.h"
#include <kpmcore/util/capacity.h>
ListPhysicalVolumeWidgetItem::ListPhysicalVolumeWidgetItem( const Partition* partition, bool checked )
: QListWidgetItem(QString("%1 | %2").arg( partition->deviceNode(), Capacity::formatByteSize( partition->capacity() )))
, m_partition(partition)
{
setToolTip( partition->deviceNode() );
setSizeHint( QSize(0, 32) );
setCheckState( checked ? Qt::Checked : Qt::Unchecked );
}
const Partition*
ListPhysicalVolumeWidgetItem::partition() const
{
return m_partition;
}

View file

@ -0,0 +1,37 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LISTPHYSICALVOLUMEWIDGETITEM_H
#define LISTPHYSICALVOLUMEWIDGETITEM_H
#include <kpmcore/core/partition.h>
#include <QListWidgetItem>
class ListPhysicalVolumeWidgetItem : public QListWidgetItem
{
public:
ListPhysicalVolumeWidgetItem( const Partition* partition, bool checked );
const Partition* partition() const;
private:
const Partition* m_partition;
};
#endif // LISTPHYSICALVOLUMEWIDGETITEM_H

View file

@ -30,6 +30,7 @@
#include "gui/CreatePartitionDialog.h"
#include "gui/EditExistingPartitionDialog.h"
#include "gui/ScanningDialog.h"
#include "gui/VolumeGroupBaseDialog.h"
#include "ui_PartitionPage.h"
#include "ui_CreatePartitionTableDialog.h"
@ -99,6 +100,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
connect( m_ui->partitionTreeView, &QAbstractItemView::doubleClicked, this, &PartitionPage::onPartitionViewActivated );
connect( m_ui->revertButton, &QAbstractButton::clicked, this, &PartitionPage::onRevertClicked );
connect( m_ui->newVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onNewVolumeGroupClicked );
connect( m_ui->newPartitionTableButton, &QAbstractButton::clicked, this, &PartitionPage::onNewPartitionTableClicked );
connect( m_ui->createButton, &QAbstractButton::clicked, this, &PartitionPage::onCreateClicked );
connect( m_ui->editButton, &QAbstractButton::clicked, this, &PartitionPage::onEditClicked );
@ -178,6 +180,22 @@ PartitionPage::onNewPartitionTableClicked()
updateBootLoaderIndex();
}
void
PartitionPage::onNewVolumeGroupClicked()
{
QString vgName;
qint32 peSize = 4;
QPointer< VolumeGroupBaseDialog > dlg = new VolumeGroupBaseDialog( vgName, m_core->lvmPVs(), peSize, this );
if ( dlg->exec() == QDialog::Accepted )
{
}
delete dlg;
}
void
PartitionPage::onCreateClicked()
{

View file

@ -50,6 +50,7 @@ private:
PartitionCoreModule* m_core;
void updateButtons();
void onNewPartitionTableClicked();
void onNewVolumeGroupClicked();
void onCreateClicked();
void onEditClicked();
void onDeleteClicked();

View file

@ -88,6 +88,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="newVolumeGroupButton">
<property name="text">
<string>New Volume Group</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -145,7 +152,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Install boot &amp;loader on:</string>
<string>I&amp;nstall boot loader on:</string>
</property>
<property name="buddy">
<cstring>bootLoaderComboBox</cstring>

View file

@ -0,0 +1,42 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "VolumeGroupBaseDialog.h"
#include "ui_VolumeGroupBaseDialog.h"
#include "gui/ListPhysicalVolumeWidgetItem.h"
VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName,
QList< const Partition* > pvList,
qint32& peSize,
QWidget *parent)
: QDialog(parent)
, ui(new Ui::VolumeGroupBaseDialog)
, m_vgName(vgName)
, m_peSize(peSize)
{
ui->setupUi(this);
for ( const Partition* p : pvList )
ui->pvList->addItem( new ListPhysicalVolumeWidgetItem(p, false) );
}
VolumeGroupBaseDialog::~VolumeGroupBaseDialog()
{
delete ui;
}

View file

@ -0,0 +1,48 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VOLUMEGROUPBASEDIALOG_H
#define VOLUMEGROUPBASEDIALOG_H
#include <kpmcore/core/partition.h>
#include <QDialog>
namespace Ui {
class VolumeGroupBaseDialog;
}
class VolumeGroupBaseDialog : public QDialog
{
Q_OBJECT
public:
explicit VolumeGroupBaseDialog(QString& vgName,
QList< const Partition* > pvList,
qint32& peSize,
QWidget* parent = 0);
~VolumeGroupBaseDialog();
private:
Ui::VolumeGroupBaseDialog *ui;
QString &m_vgName;
qint32 &m_peSize;
};
#endif // VOLUMEGROUPBASEDIALOG_H

View file

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VolumeGroupBaseDialog</class>
<widget class="QDialog" name="VolumeGroupBaseDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>611</width>
<height>367</height>
</rect>
</property>
<property name="windowTitle">
<string>VolumeGroupDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="pvListLabel">
<property name="text">
<string>List of Physical Volumes</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="7">
<widget class="QListWidget" name="pvList"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Volume Group Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Volume Group Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Physical Extent Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="spinBox"/>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Total Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Used Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Total Sectors:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Quantity of LVs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_12">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>VolumeGroupBaseDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>VolumeGroupBaseDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>