@@ -18,16 +18,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
1818 connect (guihandler,SIGNAL (autoScroll ()),this ,SLOT (autoScroll ()));
1919 connect (process,SIGNAL (finished (int ,QProcess::ExitStatus)),guihandler,SLOT (done (int ,QProcess::ExitStatus)));
2020 osPath = " " ;
21- on_refreshDevs_clicked ();
2221 QProcess removeFiles;
23- removeFiles.start (" sh removeFiles.sh " );
22+ removeFiles.start (" rm devID.txt currStep.txt cmdOut.txt path.txt file.iso file.img.dmg file.img " );
2423 removeFiles.waitForFinished ();
2524 QStringList itemsToAdd;
2625 itemsToAdd << " 1. Ubuntu 16.04 (64-Bit)" ;
2726 itemsToAdd << " 2. Debian 8.6.0 (64-Bit, Internet Installer)" ;
2827 itemsToAdd << " 3. Ubuntu 16.04 (32-Bit)" ;
2928 itemsToAdd << " 4. Debian 8.6.0 (32-Bit, Internet Installer)" ;
3029 ui->osSelector ->addItems (itemsToAdd);
30+ on_refreshDevs_clicked ();
3131}
3232MainWindow::~MainWindow () {
3333 delete ui;
@@ -46,31 +46,20 @@ void MainWindow::done(int exitCode, QProcess::ExitStatus exitStatus) {
4646 ui->startStop ->setText (" Quit" );
4747 if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
4848 ui->plainTextEdit ->appendPlainText (" \n\n An Error Has Occured. Error Code: " + QString::number (exitCode));
49+ ui->plainTextEdit ->appendPlainText (" Application Might Not Be In /Applications Or In Your Desktop Or Documents Folder?" );
4950 }
5051 else {
5152 ui->log ->setText (" Process Finished." );
5253 ui->plainTextEdit ->appendPlainText (" \n Process Finished." );
5354 }
5455}
5556void MainWindow::on_openISO_clicked () {
56- QProcess getUsername;
57- getUsername.start (" sh findUsername.sh" );
58- getUsername.waitForFinished ();
59- QFile file (" username.txt" );
60- file.open (QIODevice::ReadOnly);
61- QTextStream in (&file);
62- QString filePath = QFileDialog::getOpenFileName (this ,tr (" Select An Operating System File" )," /Users/" + in.readLine () + " /Downloads" ," ISO (*.iso)" );
57+ QString filePath = QFileDialog::getOpenFileName (this ,tr (" Select An Operating System File" ),QDir::homePath () + " /Downloads" ," ISO (*.iso)" );
6358 if (filePath != " " ) osPath = filePath;
6459 ui->pathReadOut ->setText (osPath);
6560}
6661void MainWindow::on_openIMG_clicked () {
67- QProcess getUsername;
68- getUsername.start (" sh findUsername.sh" );
69- getUsername.waitForFinished ();
70- QFile file (" username.txt" );
71- file.open (QIODevice::ReadOnly);
72- QTextStream in (&file);
73- QString filePath = QFileDialog::getOpenFileName (this ,tr (" Select An Operating System File" )," /Users/" + in.readLine () + " /Downloads" ," IMG (*.img)" );
62+ QString filePath = QFileDialog::getOpenFileName (this ,tr (" Select An Operating System File" ),QDir::homePath () + " /Downloads" ," IMG (*.img)" );
7463 if (filePath != " " ) osPath = filePath;
7564 ui->pathReadOut ->setText (osPath);
7665}
@@ -79,12 +68,9 @@ void MainWindow::on_startStop_clicked() {
7968 close ();
8069 return ;
8170 }
82- if (ui->devID ->currentText ().split (" :" )[0 ] == " ERROR" ) {
83- ui->plainTextEdit ->appendPlainText (" Cannot Start. Please See Error Above." );
84- return ;
85- }
86- if (ui->devID ->currentText () == " No External Devices Found" ) {
87- ui->plainTextEdit ->appendPlainText (" Please Put A USB Drive Into The Computer Or Enable The Use Of Internal Drives And Refresh The Device List." );
71+ if (ui->devID ->currentText ().contains (" ERROR" )) {
72+ ui->plainTextEdit ->appendPlainText (" Please Put A USB Drive Into The Computer And Refresh The Device List." );
73+ ui->plainTextEdit ->appendPlainText (" If You Got An Error Saying Something Is Not Right, Do Not Continue, And Email The Developer." );
8874 return ;
8975 }
9076 if (osPath == " " ) {
@@ -96,6 +82,7 @@ void MainWindow::on_startStop_clicked() {
9682 msgBox.setText (" You have selected an internal device for use.\n To abort, click cancel in the authorization prompt after closing this message.\n To continue, just close this message." );
9783 msgBox.exec ();
9884 }
85+
9986 hasStarted = true ;
10087 ui->log ->setText (" Starting..." );
10188 ui->startStop ->setText (" Cancel" );
@@ -135,21 +122,19 @@ void MainWindow::on_refreshDevs_clicked() {
135122 QProcess getDevs;
136123 getDevs.start (" sh findDevs.sh" );
137124 getDevs.waitForFinished ();
138- QFile file (" connectedDevs.txt" );
139- file.open (QIODevice::ReadOnly);
140- QTextStream in (&file);
141- QString allDevs = in.readAll (), currLine = " " ;
142- file.close ();
125+ QByteArray output = getDevs.readAll ();
126+ QString allDevs = QTextStream (&output).readAll ();
127+ getDevs.close ();
143128 if (allDevs.length () < 3 ) {
144129 ui->plainTextEdit ->clear ();
145130 ui->plainTextEdit ->appendPlainText (" \n Could Not Find Any Connected Devices." );
146- ui->plainTextEdit ->appendPlainText (" Either this application is not in /Applications (or directly in your Documents or Desktop folder) or something is seriously wrong." );
147- ui->plainTextEdit ->appendPlainText (" Cannot Continue. Please Correct This Problem And Try Again." );
131+ ui->plainTextEdit ->appendPlainText (" Something Is Not Right. Cannot Continue." );
148132 ui->devID ->clear ();
149133 ui->devID ->addItem (" ERROR: Could Not Find Devices. See Below." );
150134 return ;
151135 }
152136 QStringList devs;
137+ QString currLine = " " ;
153138 for (int i = 0 ; i < allDevs.length (); ++i) {
154139 QString c = allDevs.at (i);
155140 if (c != " :" ) {
@@ -170,8 +155,11 @@ void MainWindow::on_refreshDevs_clicked() {
170155 }
171156 }
172157 }
173- if (!ui->allowNonExtern ->isChecked () && devs.isEmpty ()) {
174- devs << " No External Devices Found" ;
158+ if (devs.isEmpty ()) {
159+ if (ui->allowNonExtern ->isChecked ())
160+ devs << " ERROR: Failed To Read Devices." ;
161+ else
162+ devs << " ERROR: No External Devices Found." ;
175163 }
176164 ui->devID ->clear ();
177165 ui->devID ->addItems (devs);
@@ -200,27 +188,23 @@ void MainWindow::on_downloadOS_clicked() {
200188 ui->plainTextEdit ->appendPlainText (" Failed To Open URL." );
201189 break ;
202190 case 2 :
203- if (!QDesktopServices::openUrl (QUrl (QString (" http://gensho .acc.umu.se/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso" ))))
191+ if (!QDesktopServices::openUrl (QUrl (QString (" http://saimei .acc.umu.se/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso" ))))
204192 ui->plainTextEdit ->appendPlainText (" Failed To Open URL." );
205193 break ;
206194 case 3 :
207195 if (!QDesktopServices::openUrl (QUrl (QString (" http://mirrors.mit.edu/ubuntu-releases/16.04/ubuntu-16.04-desktop-i386.iso" ))))
208196 ui->plainTextEdit ->appendPlainText (" Failed To Open URL." );
209197 break ;
210198 case 4 :
211- if (!QDesktopServices::openUrl (QUrl (QString (" http://gensho .acc.umu.se/debian-cd/8.6.0/i386/iso-cd/debian-8.6.0-i386-netinst.iso" ))))
199+ if (!QDesktopServices::openUrl (QUrl (QString (" http://saimei .acc.umu.se/debian-cd/8.6.0/i386/iso-cd/debian-8.6.0-i386-netinst.iso" ))))
212200 ui->plainTextEdit ->appendPlainText (" Failed To Open URL." );
213201 break ;
214202 }
215203}
216- void MainWindow::on_allowNonExtern_clicked () {
217- on_refreshDevs_clicked ();
218- }
204+ void MainWindow::on_allowNonExtern_clicked () { on_refreshDevs_clicked (); }
219205void MainWindow::on_actionSelectISO_triggered () { if (!hasStarted) on_openISO_clicked (); }
220206void MainWindow::on_actionSelectIMG_triggered () { if (!hasStarted) on_openIMG_clicked (); }
221- void MainWindow::on_actionContact_triggered () {
222- QMessageBox::about (this ," Contact" ," Email: contact@etcg.pw\n Website: http://www.etcg.pw" );
223- }
207+ void MainWindow::on_actionContact_triggered () { QMessageBox::about (this ," Contact" ," Email: contact@etcg.pw\n Website: http://www.etcg.pw" ); }
224208void MainWindow::on_actionCopyright_triggered () {
225209 QFile copyNotice (" ../Resources/copyrightNotice.txt" ),
226210 copy (" ../Resources/COPYING" ),
0 commit comments