forked from ic005k/OCAuxiliaryTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlgMountESP.cpp
51 lines (39 loc) · 1.41 KB
/
dlgMountESP.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "dlgMountESP.h"
#include "Method.h"
#include "mainwindow.h"
#include "ui_dlgMountESP.h"
extern MainWindow* mw_one;
extern Method* mymethod;
extern QString strIniFile;
dlgMountESP::dlgMountESP(QWidget* parent)
: QDialog(parent), ui(new Ui::dlgMountESP) {
ui->setupUi(this);
ui->btnMountOpenConfig->setDefault(true);
}
dlgMountESP::~dlgMountESP() { delete ui; }
void dlgMountESP::on_btnMount_clicked() { mountESP(false); }
void dlgMountESP::on_btnMountOpenConfig_clicked() { mountESP(true); }
void dlgMountESP::mountESP(bool openConfig) {
if (ui->listWidget->count() == 0) return;
QSettings Reg(strIniFile, QSettings::IniFormat);
Reg.setValue("mesp", ui->listWidget->currentRow());
QString str = ui->listWidget->currentItem()->text().trimmed();
QStringList strList = str.simplified().split("|");
QString strDisk;
if (strList.count() > 0) strDisk = strList.at(0);
strDisk = strDisk.trimmed();
mymethod->mount_esp_mac(strDisk);
QString str0 = strList.at(1);
QString str1 = str0.toLatin1();
QString str2 = str1.replace("?", "");
QString dirpath = "/Volumes/" + str2.trimmed() + "/EFI/";
qDebug() << dirpath;
QString dir = "file:" + dirpath;
if (openConfig) {
QString strConfig = dirpath + "OC/Config.plist";
QFileInfo fi(strConfig.toLower());
if (fi.exists()) mw_one->openFile(strConfig);
} else if (QDesktopServices::openUrl(QUrl(dir, QUrl::TolerantMode))) {
}
close();
}