summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-09-20 17:08:04 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-09-20 17:08:04 -0500
commit71d09ecaccd22e13ca2ac2faac9e2080364d1513 (patch)
tree3c28e0bb8d50117dde6b9de6636a3395d14b9491
parentb0b956ee5375c21ebd0461c6bfc5053e76ace478 (diff)
downloadhorizon-71d09ecaccd22e13ca2ac2faac9e2080364d1513.tar.gz
horizon-71d09ecaccd22e13ca2ac2faac9e2080364d1513.tar.bz2
horizon-71d09ecaccd22e13ca2ac2faac9e2080364d1513.tar.xz
horizon-71d09ecaccd22e13ca2ac2faac9e2080364d1513.zip
Qt UI: Add ability to format from partition page
-rw-r--r--ui/qt5/mountdialog.cc31
-rw-r--r--ui/qt5/mountdialog.hh8
-rw-r--r--ui/qt5/partitionmountpage.cc14
3 files changed, 51 insertions, 2 deletions
diff --git a/ui/qt5/mountdialog.cc b/ui/qt5/mountdialog.cc
index 111bce6..618fdf7 100644
--- a/ui/qt5/mountdialog.cc
+++ b/ui/qt5/mountdialog.cc
@@ -77,6 +77,20 @@ MountDialog::MountDialog(QStringList skipParts, QStringList skipMounts,
pathInput->setWhatsThis(tr("Select where the partition will be mounted."));
pathInput->addItems(pathCandidates);
+ QStringList fsCandidates = {"ext4", "xfs", "jfs", "hfs+", "vfat", "ext3"};
+ formatChoice = new QCheckBox(tr("Format"));
+ formatChoice->setWhatsThis(tr("Erase and format this device with a new file system."));
+
+ formatInput = new QComboBox;
+ formatInput->setEditable(false);
+ formatInput->setWhatsThis(tr("Select the file system this partition will be formatted."));
+ formatInput->addItems(fsCandidates);
+
+ QHBoxLayout *formatLayout = new QHBoxLayout;
+ formatLayout->addWidget(formatChoice);
+ formatLayout->addStretch();
+ formatLayout->addWidget(formatInput);
+
QVBoxLayout *controlLayout = new QVBoxLayout;
controlLayout->addWidget(new QLabel(tr("Partition")));
#ifdef HAS_INSTALL_ENV
@@ -86,6 +100,7 @@ MountDialog::MountDialog(QStringList skipParts, QStringList skipMounts,
#endif /* HAS_INSTALL_ENV */
controlLayout->addWidget(new QLabel(tr("will be mounted on")));
controlLayout->addWidget(pathInput);
+ controlLayout->addLayout(formatLayout);
QHBoxLayout *mainBox = new QHBoxLayout;
mainBox->addLayout(controlLayout);
@@ -120,3 +135,19 @@ QString MountDialog::mountPoint() const {
void MountDialog::setMountPoint(const QString &path) {
pathInput->setCurrentText(path);
}
+
+bool MountDialog::isFormatting() const {
+ return formatChoice->isChecked();
+}
+
+void MountDialog::setFormatting(bool format) {
+ formatChoice->setChecked(format);
+}
+
+QString MountDialog::formatType() const {
+ return formatInput->currentText();
+}
+
+void MountDialog::setFormatType(const QString &formatType) {
+ formatInput->setCurrentText(formatType);
+}
diff --git a/ui/qt5/mountdialog.hh b/ui/qt5/mountdialog.hh
index f701438..b8fdb6a 100644
--- a/ui/qt5/mountdialog.hh
+++ b/ui/qt5/mountdialog.hh
@@ -15,6 +15,7 @@
#include "horizonwizard.hh"
+#include <QCheckBox>
#include <QComboBox>
#include <QDialog>
#ifdef HAS_INSTALL_ENV
@@ -32,6 +33,11 @@ public:
void setPartition(const QString &part);
QString mountPoint() const;
void setMountPoint(const QString &path);
+
+ bool isFormatting() const;
+ void setFormatting(bool format);
+ QString formatType() const;
+ void setFormatType(const QString &formatType);
private:
#ifdef HAS_INSTALL_ENV
QListWidget *partList;
@@ -39,6 +45,8 @@ private:
QLineEdit *partInput;
#endif /* HAS_INSTALL_ENV */
QComboBox *pathInput;
+ QCheckBox *formatChoice;
+ QComboBox *formatInput;
QString path;
};
diff --git a/ui/qt5/partitionmountpage.cc b/ui/qt5/partitionmountpage.cc
index 4bd8c30..f06bab4 100644
--- a/ui/qt5/partitionmountpage.cc
+++ b/ui/qt5/partitionmountpage.cc
@@ -38,10 +38,13 @@ PartitionMountPage::PartitionMountPage(QWidget *parent)
QListWidgetItem *mount = new QListWidgetItem;
QString part = md.partition();
QString path = md.mountPoint();
+ QString fs = md.formatType();
mount->setText(tr("%1 on %2").arg(part).arg(path));
mount->setIcon(QIcon::fromTheme("drive-harddisk"));
mount->setData(Qt::UserRole + 1, part);
mount->setData(Qt::UserRole + 2, path);
+ mount->setData(Qt::UserRole + 3, md.isFormatting());
+ mount->setData(Qt::UserRole + 4, fs);
mountList->addItem(mount);
}
@@ -89,8 +92,15 @@ bool PartitionMountPage::isComplete() const {
QStringList PartitionMountPage::mountLines() const {
QStringList lines;
for(const auto &mount : mountList->findItems("", Qt::MatchContains)) {
- lines << QString("mount %1 %2").arg(mount->data(Qt::UserRole + 1).toString())
- .arg(mount->data(Qt::UserRole + 2).toString());
+ QString part = mount->data(Qt::UserRole + 1).toString();
+ QString path = mount->data(Qt::UserRole + 2).toString();
+ QString fs = mount->data(Qt::UserRole + 4).toString();
+
+ if(mount->data(Qt::UserRole + 3).toBool()) {
+ lines << QString("fs %1 %2").arg(part).arg(fs);
+ }
+
+ lines << QString("mount %1 %2").arg(part).arg(path);
}
return lines;
}