+#endif
+
extern const char* version;
extern const char* revision;
@@ -68,6 +75,9 @@ MainWindow::MainWindow(QWidget *parent)
qDebug("staring local server - %s", qPrintable(serverApp));
localServer_ = new QProcess(this);
+ connect(localServer_, SIGNAL(started()), SLOT(onLocalServerStarted()));
+ connect(localServer_, SIGNAL(error(QProcess::ProcessError)),
+ SLOT(onLocalServerError(QProcess::ProcessError)));
localServer_->setProcessChannelMode(QProcess::ForwardedChannels);
localServer_->start(serverApp, QStringList());
}
@@ -317,6 +327,41 @@ void MainWindow::on_actionHelpAbout_triggered()
delete aboutDialog;
}
+void MainWindow::onLocalServerStarted()
+{
+ // We are only interested in startup errors
+ disconnect(localServer_, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(onLocalServerError(QProcess::ProcessError)));
+}
+
+void MainWindow::onLocalServerError(QProcess::ProcessError error)
+{
+ QMessageBox msgBox(this);
+ msgBox.setIcon(QMessageBox::Warning);
+ msgBox.setTextFormat(Qt::RichText);
+ msgBox.setStyleSheet("messagebox-text-interaction-flags: 5"); // mouse copy
+ QString errorStr = tr("Failed to start the local drone agent - "
+ "error 0x%1, exit code 0x%2.
")
+ .arg(error, 0, 16)
+ .arg(localServer_->exitCode(), 0, 16);
+#ifdef Q_OS_WIN32
+ if (localServer_->exitCode() == STATUS_DLL_NOT_FOUND)
+ errorStr.append(tr("This is most likely because Packet.dll "
+ "was not found - make sure you have "
+ "WinPcap "
+ "installed.
"));
+#endif
+ msgBox.setText(errorStr);
+ msgBox.setInformativeText(tr("Run drone directly for more information."));
+ msgBox.exec();
+
+ QMessageBox::information(this, QString(),
+ tr("If you have remote drone agents running, you can still add "
+ "and connect to them.
"
+ "If you don't want to start the local drone agent at startup, "
+ "provide the -s option to Ostinato on the command line
"));
+}
+
void MainWindow::onNewVersion(QString newVersion)
{
statusBar()->showMessage(QString("New Ostinato version %1 available. "
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 1b37798..eb63079 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -22,6 +22,7 @@ along with this program. If not, see
#include "ui_mainwindow.h"
#include
+#include
class PortsWindow;
class PortStatsWindow;
@@ -59,6 +60,8 @@ public slots:
void on_actionHelpAbout_triggered();
private slots:
+ void onLocalServerStarted();
+ void onLocalServerError(QProcess::ProcessError error);
void onNewVersion(QString version);
};