Rename Volume->VolumeGroup.

This commit is contained in:
Andrius Štikonas 2016-09-04 12:25:43 +01:00
parent 46b2c16131
commit 614503a910
11 changed files with 108 additions and 243 deletions

View File

@ -1,38 +1,38 @@
set(GUI_SRC
gui/applyprogressdetailswidget.cpp
gui/applyprogressdialog.cpp
gui/applyprogressdialogwidget.cpp
gui/createpartitiontabledialog.cpp
gui/createpartitiontablewidget.cpp
gui/volumewidget.cpp
gui/volumedialog.cpp
gui/createvolumedialog.cpp
gui/resizevolumedialog.cpp
gui/devicepropsdialog.cpp
gui/devicepropswidget.cpp
gui/editmountpointdialog.cpp
gui/editmountpointdialogwidget.cpp
gui/editmountoptionsdialog.cpp
gui/editmountoptionsdialogwidget.cpp
gui/filesystemsupportdialog.cpp
gui/filesystemsupportdialogwidget.cpp
gui/formattedspinbox.cpp
gui/infopane.cpp
gui/insertdialog.cpp
gui/listdevices.cpp
gui/listoperations.cpp
gui/applyprogressdetailswidget.cpp
gui/applyprogressdialog.cpp
gui/applyprogressdialogwidget.cpp
gui/createpartitiontabledialog.cpp
gui/createpartitiontablewidget.cpp
gui/createvolumegroupdialog.cpp
gui/devicepropsdialog.cpp
gui/devicepropswidget.cpp
gui/editmountpointdialog.cpp
gui/editmountpointdialogwidget.cpp
gui/editmountoptionsdialog.cpp
gui/editmountoptionsdialogwidget.cpp
gui/filesystemsupportdialog.cpp
gui/filesystemsupportdialogwidget.cpp
gui/formattedspinbox.cpp
gui/infopane.cpp
gui/insertdialog.cpp
gui/listdevices.cpp
gui/listoperations.cpp
gui/listphysicalvolumes.cpp
gui/mainwindow.cpp
gui/newdialog.cpp
gui/partitionmanagerwidget.cpp
gui/partpropsdialog.cpp
gui/parttablewidget.cpp
gui/resizedialog.cpp
gui/scanprogressdialog.cpp
gui/sizedetailswidget.cpp
gui/sizedialogbase.cpp
gui/sizedialogwidget.cpp
gui/smartdialog.cpp
gui/smartdialogwidget.cpp
gui/treelog.cpp
gui/mainwindow.cpp
gui/newdialog.cpp
gui/partitionmanagerwidget.cpp
gui/partpropsdialog.cpp
gui/parttablewidget.cpp
gui/resizedialog.cpp
gui/resizevolumegroupdialog.cpp
gui/scanprogressdialog.cpp
gui/sizedetailswidget.cpp
gui/sizedialogbase.cpp
gui/sizedialogwidget.cpp
gui/smartdialog.cpp
gui/smartdialogwidget.cpp
gui/treelog.cpp
gui/volumegroupdialog.cpp
gui/volumegroupwidget.cpp
)

View File

@ -15,9 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "gui/volumewidget.h"
#include "gui/volumedialog.h"
#include "gui/createvolumedialog.h"
#include "gui/createvolumegroupdialog.h"
#include "gui/volumegroupwidget.h"
#include <core/lvmdevice.h>
#include <fs/lvm2_pv.h>
@ -29,8 +28,8 @@
#include <KLocalizedString>
#include <KSharedConfig>
CreateVolumeDialog::CreateVolumeDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize) :
VolumeDialog(parent, vgname, pvlist),
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize) :
VolumeGroupDialog(parent, vgname, pvlist),
m_PESize(pesize),
m_SystemVGList(LvmDevice::getVGs())
{
@ -47,7 +46,7 @@ CreateVolumeDialog::CreateVolumeDialog(QWidget* parent, QString& vgname, QString
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
void CreateVolumeDialog::setupDialog()
void CreateVolumeGroupDialog::setupDialog()
{
for (const auto &pvpath : FS::lvm2_pv::getFreePV()) {
if (!LvmDevice::s_DirtyPVs.contains(pvpath)) {
@ -56,13 +55,13 @@ void CreateVolumeDialog::setupDialog()
}
}
void CreateVolumeDialog::setupConnections()
void CreateVolumeGroupDialog::setupConnections()
{
connect(&dialogWidget().vgName(), &QLineEdit::textChanged, this, &CreateVolumeDialog::onVGNameChanged);
connect(&dialogWidget().spinPESize(), static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CreateVolumeDialog::onSpinPESizeChanged);
connect(&dialogWidget().vgName(), &QLineEdit::textChanged, this, &CreateVolumeGroupDialog::onVGNameChanged);
connect(&dialogWidget().spinPESize(), static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CreateVolumeGroupDialog::onSpinPESizeChanged);
}
void CreateVolumeDialog::accept()
void CreateVolumeGroupDialog::accept()
{
QString& tname = targetName();
tname = dialogWidget().vgName().text();
@ -75,7 +74,7 @@ void CreateVolumeDialog::accept()
QDialog::accept();
}
void CreateVolumeDialog::onVGNameChanged(const QString& vgname)
void CreateVolumeGroupDialog::onVGNameChanged(const QString& vgname)
{
if (m_SystemVGList.contains(vgname)) {
m_IsValidName = false;
@ -85,7 +84,7 @@ void CreateVolumeDialog::onVGNameChanged(const QString& vgname)
updateOkButtonStatus();
}
void CreateVolumeDialog::onSpinPESizeChanged(int newsize)
void CreateVolumeGroupDialog::onSpinPESizeChanged(int newsize)
{
Q_UNUSED(newsize);
updateOkButtonStatus();

View File

@ -15,18 +15,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(CREATEVOLUMEDIALOG__H)
#if !defined(CREATEVOLUMEGROUPDIALOG__H)
#define CREATEVOLUMEDIALOG__H
#define CREATEVOLUMEGROUPDIALOG__H
#include "gui/volumedialog.h"
#include "gui/volumegroupdialog.h"
class CreateVolumeDialog : public VolumeDialog
class CreateVolumeGroupDialog : public VolumeGroupDialog
{
Q_DISABLE_COPY(CreateVolumeDialog)
Q_DISABLE_COPY(CreateVolumeGroupDialog)
public:
CreateVolumeDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize);
CreateVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& pvlist, qint32& pesize);
protected:
void accept() override;

View File

@ -22,8 +22,8 @@
#include "gui/applyprogressdialog.h"
#include "gui/scanprogressdialog.h"
#include "gui/createpartitiontabledialog.h"
#include "gui/createvolumedialog.h"
#include "gui/resizevolumedialog.h"
#include "gui/createvolumegroupdialog.h"
#include "gui/resizevolumegroupdialog.h"
#include "gui/filesystemsupportdialog.h"
#include "gui/devicepropsdialog.h"
#include "gui/smartdialog.h"
@ -1097,7 +1097,7 @@ void MainWindow::onCreateNewVolumeGroup()
QStringList* pvlist = new QStringList();
qint32 pesize = 4;
// *NOTE*: vgname & pvlist will be modified and validated by the dialog
QPointer<CreateVolumeDialog> dlg = new CreateVolumeDialog(this, *vgname, *pvlist, pesize);
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, *vgname, *pvlist, pesize);
if (dlg->exec() == QDialog::Accepted) {
operationStack().push(new CreateVolumeGroupOperation(*vgname, *pvlist, pesize));
}
@ -1139,16 +1139,16 @@ void MainWindow::onResizeVolumeGroup()
if (pmWidget().selectedDevice()->type() == Device::LVM_Device) {
LvmDevice* tmpDev = dynamic_cast<LvmDevice*>(pmWidget().selectedDevice());
QString* vgname = new QString(tmpDev->name()); // This line only purpose is to make volumeDialog happy
QStringList* pvlist = new QStringList();
// *NOTE*: pvlist will be modified and validated by the dialog
QString* vgName = new QString(tmpDev->name()); // This line only purpose is to make volumeGroupDialog happy
QStringList* pvList = new QStringList();
// *NOTE*: pvList will be modified and validated by the dialog
QPointer<ResizeVolumeDialog> dlg = new ResizeVolumeDialog(this, *vgname, *pvlist, *tmpDev);
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, *vgName, *pvList, *tmpDev);
if (dlg->exec() == QDialog::Accepted) {
operationStack().push(new ResizeVolumeGroupOperation(*tmpDev, *pvlist));
operationStack().push(new ResizeVolumeGroupOperation(*tmpDev, *pvList));
}
delete dlg;
delete pvlist;
delete pvList;
}
}

View File

@ -15,9 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "gui/volumewidget.h"
#include "gui/volumedialog.h"
#include "gui/resizevolumedialog.h"
#include "gui/resizevolumegroupdialog.h"
#include "gui/volumegroupwidget.h"
#include <core/lvmdevice.h>
#include <core/volumemanagerdevice.h>
@ -31,12 +30,12 @@
#include <KLocalizedString>
#include <KSharedConfig>
/** Creates a new ResizeVolumeDialog
/** Creates a new ResizeVolumeGroupDialog
@param parent pointer to the parent widget
@param dev the Device to show properties for
*/
ResizeVolumeDialog::ResizeVolumeDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev) :
VolumeDialog(parent, vgname, partlist),
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev) :
VolumeGroupDialog(parent, vgname, partlist),
m_Device(dev)
{
setWindowTitle(xi18nc("@title:window", "Resize Volume Group"));
@ -48,7 +47,7 @@ ResizeVolumeDialog::ResizeVolumeDialog(QWidget* parent, QString& vgname, QString
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
}
void ResizeVolumeDialog::setupDialog()
void ResizeVolumeGroupDialog::setupDialog()
{
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
dialogWidget().listPV().addPartitionList(device().deviceNodes(), true);
@ -60,15 +59,15 @@ void ResizeVolumeDialog::setupDialog()
}
}
void ResizeVolumeDialog::setupConstraints()
void ResizeVolumeGroupDialog::setupConstraints()
{
dialogWidget().vgName().setEnabled(false);
dialogWidget().spinPESize().setEnabled(false);
dialogWidget().volumeType().setEnabled(false);
VolumeDialog::setupConstraints();
VolumeGroupDialog::setupConstraints();
}
void ResizeVolumeDialog::accept()
void ResizeVolumeGroupDialog::accept()
{
targetPVList() << dialogWidget().listPV().checkedItems();
QDialog::accept();

View File

@ -15,20 +15,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(RESIZEVOLUMEDIALOG__H)
#if !defined(RESIZEVOLUMEGROUPDIALOG__H)
#define RESIZEVOLUMEDIALOG__H
#define RESIZEVOLUMEGROUPDIALOG__H
#include "gui/volumedialog.h"
#include "gui/volumegroupdialog.h"
class VolumeManagerDevice;
class ResizeVolumeDialog : public VolumeDialog
class ResizeVolumeGroupDialog : public VolumeGroupDialog
{
Q_DISABLE_COPY(ResizeVolumeDialog)
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
public:
ResizeVolumeDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev);
ResizeVolumeGroupDialog(QWidget* parent, QString& vgname, QStringList& partlist, VolumeManagerDevice& dev);
protected:
void accept() override;

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "gui/volumedialog.h"
#include "gui/volumewidget.h"
#include "gui/volumegroupdialog.h"
#include "gui/volumegroupwidget.h"
#include <core/partitiontable.h>
#include <core/lvmdevice.h>
@ -31,14 +31,14 @@
#include <QListWidgetItem>
/** Creates a new VolumeDialog
/** Creates a new VolumeGroupDialog
@param parent pointer to the parent widget
@param vgName Volume Group name
@param pvList List of LVM Physical Volumes used to create Volume Group
*/
VolumeDialog::VolumeDialog(QWidget* parent, QString& vgName, QStringList& pvList) :
VolumeGroupDialog::VolumeGroupDialog(QWidget* parent, QString& vgName, QStringList& pvList) :
QDialog(parent),
m_DialogWidget(new VolumeWidget(this)),
m_DialogWidget(new VolumeGroupWidget(this)),
m_TargetName(vgName),
m_TargetPVList(pvList),
m_IsValidSize(false),
@ -64,14 +64,14 @@ VolumeDialog::VolumeDialog(QWidget* parent, QString& vgName, QStringList& pvList
setupConnections();
}
/** Destroys a VolumeDialog */
VolumeDialog::~VolumeDialog()
/** Destroys a VolumeGroupDialog */
VolumeGroupDialog::~VolumeGroupDialog()
{
KConfigGroup kcg(KSharedConfig::openConfig(), "createVolumeDialog");
KConfigGroup kcg(KSharedConfig::openConfig(), "createVolumeGroupDialog");
kcg.writeEntry("Geometry", saveGeometry());
}
void VolumeDialog::setupDialog()
void VolumeGroupDialog::setupDialog()
{
dialogWidget().vgName().setText(targetName());
@ -96,24 +96,24 @@ void VolumeDialog::setupDialog()
resize(dialogWidget().size());
}
void VolumeDialog::setupConnections()
void VolumeGroupDialog::setupConnections()
{
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &VolumeDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &VolumeDialog::reject);
connect(&dialogWidget().volumeType(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &VolumeDialog::onVolumeTypeChanged);
connect(dialogButtonBox, &QDialogButtonBox::accepted, this, &VolumeGroupDialog::accept);
connect(dialogButtonBox, &QDialogButtonBox::rejected, this, &VolumeGroupDialog::reject);
connect(&dialogWidget().volumeType(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &VolumeGroupDialog::onVolumeTypeChanged);
connect(&dialogWidget().listPV().listPhysicalVolumes(), &QListWidget::itemChanged,
this, [=] ( QListWidgetItem*) {
updateSizeInfos();
});
}
void VolumeDialog::setupConstraints()
void VolumeGroupDialog::setupConstraints()
{
updateSizeInfos();
updateOkButtonStatus();
}
void VolumeDialog::updateOkButtonStatus()
void VolumeGroupDialog::updateOkButtonStatus()
{
bool enable = isValidSize();
@ -127,7 +127,7 @@ void VolumeDialog::updateOkButtonStatus()
okButton->setEnabled(enable);
}
void VolumeDialog::updateSectorInfos()
void VolumeGroupDialog::updateSectorInfos()
{
qint32 totalSectors = 0;
// we can't use LvmDevice mothod here because pv that is not in any VG will return 0
@ -138,7 +138,7 @@ void VolumeDialog::updateSectorInfos()
dialogWidget().totalSectors().setText(QString::number(totalSectors));
}
void VolumeDialog::updateSizeInfos()
void VolumeGroupDialog::updateSizeInfos()
{
QStringList checkedPartitions = dialogWidget().listPV().checkedItems();
m_TotalSize = FS::lvm2_pv::getPVSize(checkedPartitions);
@ -150,15 +150,15 @@ void VolumeDialog::updateSizeInfos()
updateOkButtonStatus();
}
void VolumeDialog::updatePartitionList()
void VolumeGroupDialog::updatePartitionList()
{
}
void VolumeDialog::onPartitionListChanged()
void VolumeGroupDialog::onPartitionListChanged()
{
}
void VolumeDialog::onVolumeTypeChanged(int index)
void VolumeGroupDialog::onVolumeTypeChanged(int index)
{
Q_UNUSED(index)
updatePartitionList();

View File

@ -15,25 +15,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(VOLUMEDIALOG__H)
#if !defined(VOLUMEGROUPDIALOG__H)
#define VOLUMEDIALOG__H
#define VOLUMEGROUPDIALOG__H
#include <QDialog>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
class VolumeWidget;
class VolumeGroupWidget;
class Partition;
class VolumeDialog : public QDialog
class VolumeGroupDialog : public QDialog
{
Q_DISABLE_COPY(VolumeDialog)
Q_DISABLE_COPY(VolumeGroupDialog)
public:
VolumeDialog(QWidget* parent, QString& vgName, QStringList& pvList);
~VolumeDialog();
VolumeGroupDialog(QWidget* parent, QString& vgName, QStringList& pvList);
~VolumeGroupDialog();
protected:
virtual void setupDialog();
@ -47,11 +47,11 @@ protected:
virtual void onVolumeTypeChanged(int index);
VolumeWidget& dialogWidget() {
VolumeGroupWidget& dialogWidget() {
Q_ASSERT(m_DialogWidget);
return *m_DialogWidget;
}
const VolumeWidget& dialogWidget() const {
const VolumeGroupWidget& dialogWidget() const {
Q_ASSERT(m_DialogWidget);
return *m_DialogWidget;
}
@ -84,7 +84,7 @@ protected:
virtual void onPartitionListChanged();
protected:
VolumeWidget* m_DialogWidget;
VolumeGroupWidget* m_DialogWidget;
QString& m_TargetName;
QStringList& m_TargetPVList;
bool m_IsValidSize;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VolumeWidgetBase</class>
<widget class="QWidget" name="VolumeWidgetBase">
<class>VolumeGroupWidgetBase</class>
<widget class="QWidget" name="VolumeGroupWidgetBase">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -1,18 +0,0 @@
/*************************************************************************
* Copyright (C) 2016 by Chantara Tith <tith.chantara@gmail.com> *
* *
* This program 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. *
* *
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "gui/volumewidget.h"

View File

@ -1,115 +0,0 @@
/*************************************************************************
* Copyright (C) 2016 by Chantara Tith <tith.chantara@gmail.com> *
* *
* This program 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. *
* *
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(VOLUMEWIDGET__H)
#define VOLUMEWIDGET__H
#include "ui_volumewidgetbase.h"
#include <QWidget>
class VolumeWidget : public QWidget, public Ui::VolumeWidgetBase
{
public:
VolumeWidget(QWidget* parent) :
QWidget(parent), Ui::VolumeWidgetBase()
{
setupUi(this);
}
public:
QLineEdit& vgName() {
Q_ASSERT(m_EditVGName);
return *m_EditVGName;
}
QComboBox& volumeType() {
Q_ASSERT(m_ComboVolumeType);
return *m_ComboVolumeType;
}
QSpinBox& spinPESize() {
Q_ASSERT(m_SpinPESize);
return *m_SpinPESize;
}
ListPhysicalVolumes& listPV() {
Q_ASSERT(m_ListPV);
return *m_ListPV;
}
QLabel& totalSize() {
Q_ASSERT(m_LabelTotalSize);
return *m_LabelTotalSize;
}
QLabel& totalSectors() {
Q_ASSERT(m_LabelTotalSectors);
return *m_LabelTotalSectors;
}
QLabel& totalUsedSize() {
Q_ASSERT(m_LabelTotalUsedSize);
return *m_LabelTotalUsedSize;
}
QLabel& totalLV() {
Q_ASSERT(m_LabelTotalLV);
return *m_LabelTotalLV;
}
QLabel& textVGName() {
Q_ASSERT(m_LabelTextVGName);
return *m_LabelTextVGName;
}
QLabel& textVolumeType() {
Q_ASSERT(m_LabelTextVolumeType);
return *m_LabelTextVolumeType;
}
QLabel& textTotalSize() {
Q_ASSERT(m_LabelTextTotalSize);
return *m_LabelTextTotalSize;
}
QLabel& textTotalSectors() {
Q_ASSERT(m_LabelTextTotalSectors);
return *m_LabelTextTotalSectors;
}
QLabel& textTotalUsedSize() {
Q_ASSERT(m_LabelTextTotalUsedSize);
return *m_LabelTextTotalUsedSize;
}
QLabel& textTotalLV() {
Q_ASSERT(m_LabelTextTotalLV);
return *m_LabelTextTotalLV;
}
QLabel& textTotalPESize() {
Q_ASSERT(m_LabelTextPESize);
return *m_LabelTextPESize;
}
};
#endif