QTfrontend/net/tcpBase.cpp
changeset 7794 ab7b94c03bc9
parent 7673 e06b83cbde74
child 8069 bb7671829935
equal deleted inserted replaced
7793:3c21da93db9f 7794:ab7b94c03bc9
    19 
    19 
    20 #include "tcpBase.h"
    20 #include "tcpBase.h"
    21 
    21 
    22 #include <QMessageBox>
    22 #include <QMessageBox>
    23 #include <QList>
    23 #include <QList>
    24 
    24 #include <QApplication>
    25 #include <QImage>
    25 #include <QImage>
    26 
    26 
    27 #include "hwconsts.h"
    27 #include "hwconsts.h"
    28 
    28 
    29 QList<TCPBase*> srvsList;
    29 QList<TCPBase*> srvsList;
    43     {
    43     {
    44         IPCServer = new QTcpServer(0);
    44         IPCServer = new QTcpServer(0);
    45         IPCServer->setMaxPendingConnections(1);
    45         IPCServer->setMaxPendingConnections(1);
    46         if (!IPCServer->listen(QHostAddress::LocalHost))
    46         if (!IPCServer->listen(QHostAddress::LocalHost))
    47         {
    47         {
    48             QMessageBox::critical(0, tr("Error"),
    48             QMessageBox deniedMsg(QApplication::activeWindow());
    49                                   tr("Unable to start the server: %1.")
    49             deniedMsg.setIcon(QMessageBox::Critical);
    50                                   .arg(IPCServer->errorString()));
    50             deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
    51             exit(0); // FIXME - should be graceful exit here
    51             deniedMsg.setText(QMessageBox::tr("Unable to start the server: %1.").arg(IPCServer->errorString()));
       
    52             deniedMsg.setWindowModality(Qt::WindowModal);
       
    53             deniedMsg.exec();
       
    54 
       
    55             exit(0); // FIXME - should be graceful exit here (lower Critical -> Warning above when implemented)
    52         }
    56         }
    53     }
    57     }
    54     ipc_port=IPCServer->serverPort();
    58     ipc_port=IPCServer->serverPort();
    55 }
    59 }
    56 
    60 
   111     onClientRead();
   115     onClientRead();
   112 }
   116 }
   113 
   117 
   114 void TCPBase::StartProcessError(QProcess::ProcessError error)
   118 void TCPBase::StartProcessError(QProcess::ProcessError error)
   115 {
   119 {
   116     QMessageBox::critical(0, tr("Error"),
   120     QMessageBox deniedMsg(QApplication::activeWindow());
   117                           tr("Unable to run engine: %1 (")
   121     deniedMsg.setIcon(QMessageBox::Critical);
   118                           .arg(error) + bindir->absolutePath() + "/hwengine)");
   122     deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
       
   123     deniedMsg.setText(QMessageBox::tr("Unable to run engine at ") + bindir->absolutePath() + "/hwengine\n" +
       
   124                       QMessageBox::tr("Error code: %1").arg(error));
       
   125     deniedMsg.setWindowModality(Qt::WindowModal);
       
   126     deniedMsg.exec();
   119 
   127 
   120     ClientDisconnect();
   128     ClientDisconnect();
   121 }
   129 }
   122 
   130 
   123 void TCPBase::tcpServerReady()
   131 void TCPBase::tcpServerReady()