QTfrontend/net/tcpBase.cpp
changeset 7794 ab7b94c03bc9
parent 7673 e06b83cbde74
child 8069 bb7671829935
--- a/QTfrontend/net/tcpBase.cpp	Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/net/tcpBase.cpp	Tue Oct 23 06:50:19 2012 +0200
@@ -21,7 +21,7 @@
 
 #include <QMessageBox>
 #include <QList>
-
+#include <QApplication>
 #include <QImage>
 
 #include "hwconsts.h"
@@ -45,10 +45,14 @@
         IPCServer->setMaxPendingConnections(1);
         if (!IPCServer->listen(QHostAddress::LocalHost))
         {
-            QMessageBox::critical(0, tr("Error"),
-                                  tr("Unable to start the server: %1.")
-                                  .arg(IPCServer->errorString()));
-            exit(0); // FIXME - should be graceful exit here
+            QMessageBox deniedMsg(QApplication::activeWindow());
+            deniedMsg.setIcon(QMessageBox::Critical);
+            deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+            deniedMsg.setText(QMessageBox::tr("Unable to start the server: %1.").arg(IPCServer->errorString()));
+            deniedMsg.setWindowModality(Qt::WindowModal);
+            deniedMsg.exec();
+
+            exit(0); // FIXME - should be graceful exit here (lower Critical -> Warning above when implemented)
         }
     }
     ipc_port=IPCServer->serverPort();
@@ -113,9 +117,13 @@
 
 void TCPBase::StartProcessError(QProcess::ProcessError error)
 {
-    QMessageBox::critical(0, tr("Error"),
-                          tr("Unable to run engine: %1 (")
-                          .arg(error) + bindir->absolutePath() + "/hwengine)");
+    QMessageBox deniedMsg(QApplication::activeWindow());
+    deniedMsg.setIcon(QMessageBox::Critical);
+    deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+    deniedMsg.setText(QMessageBox::tr("Unable to run engine at ") + bindir->absolutePath() + "/hwengine\n" +
+                      QMessageBox::tr("Error code: %1").arg(error));
+    deniedMsg.setWindowModality(Qt::WindowModal);
+    deniedMsg.exec();
 
     ClientDisconnect();
 }