Commit 4b17c2e0e6013f3c83d6a392190fc7a3100acf75

show a message if hooq fails to start listening
  
397397 m_interpreter,
398398 SLOT(run(QTcpSocket*))
399399 );
400 m_hooqPlayer->start(applicationPath(), m_arguments, m_hooqPlayInjector);
400
401 try
402 {
403 m_hooqPlayer->start(applicationPath(), m_arguments, m_hooqPlayInjector);
404 }
405 catch(Hooq::RemoteConnectionException e)
406 {
407 QMessageBox::critical(this, tr("Could not attach to process"), tr("Failed to open a socket: %1 (error number %2)").arg(e.errorString()).arg(static_cast<int>(e.serverError())));
408 }
401409}
402410
403411void MainWindow::logException(const QString& exception, const QStringList& backtrace)
  
3131namespace Hooq
3232{
3333
34RemoteConnectionException::RemoteConnectionException(QAbstractSocket::SocketError serverError, const QString& errorString)
35: m_serverError(serverError)
36, m_errorString(errorString)
37{
38}
39
40QAbstractSocket::SocketError RemoteConnectionException::serverError() const
41{
42 return m_serverError;
43}
44
45QString RemoteConnectionException::errorString() const
46{
47 return m_errorString;
48}
49
3450RemoteConnection::RemoteConnection(QObject* parent)
3551: QObject(parent)
3652, m_localServer(0)
6464 SLOT(acceptConnection())
6565 );
6666
67 m_localServer->listen(QHostAddress::LocalHost, Communication::serverPort());
67 if(!m_localServer->listen(QHostAddress::LocalHost, Communication::serverPort()))
68 {
69 throw RemoteConnectionException(m_localServer->serverError(), m_localServer->errorString());
70 }
6871
6972 injector->startAndAttach(application, arguments);
7073}
  
2121
2222#include "InjectorImport.h"
2323
24#include <QAbstractSocket>
2425#include <QObject>
2526
2627class QTcpServer;
3030namespace Hooq
3131{
3232class Injector;
33
34class HOOQ_INJECTOR_EXPORT RemoteConnectionException
35{
36 public:
37 RemoteConnectionException(QAbstractSocket::SocketError serverError, const QString& errorString);
38 QAbstractSocket::SocketError serverError() const;
39 QString errorString() const;
40 private:
41 QAbstractSocket::SocketError m_serverError;
42 QString m_errorString;
43};
3344
3445class HOOQ_INJECTOR_EXPORT RemoteConnection : public QObject
3546{