[Foo2zjs-commits] r77 - trunk/hannah

white at alioth.debian.org white at alioth.debian.org
Fri Sep 28 11:04:07 UTC 2007


Author: white
Date: 2007-09-28 11:04:07 +0000 (Fri, 28 Sep 2007)
New Revision: 77

Modified:
   trunk/hannah/gui.cpp
   trunk/hannah/gui.h
Log:
Add some code to check, if a download is still running to avoid calling the script several times

Modified: trunk/hannah/gui.cpp
===================================================================
--- trunk/hannah/gui.cpp	2007-09-28 09:47:29 UTC (rev 76)
+++ trunk/hannah/gui.cpp	2007-09-28 11:04:07 UTC (rev 77)
@@ -103,6 +103,8 @@
 	buttonGroup->addButton(xerox6115Button, 16);
 	buttonGroup->addButton(xerox6110Button, 17);
 	
+	callProgram = new QProcess;
+	
 	connect(exitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
 
 	connect(allButton, SIGNAL(stateChanged(int)), this, SLOT(setCheckBoxes(int)));
@@ -173,9 +175,20 @@
 	}
 
 	QString program = "/usr/bin/getweb";
-	QProcess *callProgram = new QProcess;
-	callProgram->execute(program, arguments);
 	
-	qDebug()<<callProgram->error();
-
+	switch (callProgram->state()) {
+		case 2:
+			QMessageBox::warning(this, tr("Hannah - Firmware downloader 'getweb'"),
+				tr("There is already a firmware download in progress. \n"
+				    "Refuse to start another one."), QMessageBox::Ok);
+			break;
+		case 1:
+			QMessageBox::warning(this, tr("Hannah - Firmware downloader 'getweb'"),
+				tr("There is already a firmware download in progress. \n"
+				    "Refuse to start another one."), QMessageBox::Ok);
+			break;
+		case 0:
+			callProgram->start(program, arguments);
+			break;
+	}
 };

Modified: trunk/hannah/gui.h
===================================================================
--- trunk/hannah/gui.h	2007-09-28 09:47:29 UTC (rev 76)
+++ trunk/hannah/gui.h	2007-09-28 11:04:07 UTC (rev 77)
@@ -44,6 +44,7 @@
 	QCheckBox *xerox6110Button;
 	QButtonGroup *buttonGroup;
 
+	QProcess *callProgram;
 
 private slots:
 	void callGetweb();




More information about the Foo2zjs-commits mailing list