Check for duplicate NDNx Control Centers
Change-Id: I06d7aa71e1162e19f9fb38cada3c3c766b91cfd3
diff --git a/linux/tray-menu.cpp b/linux/tray-menu.cpp
index b6c405e..3dd006a 100644
--- a/linux/tray-menu.cpp
+++ b/linux/tray-menu.cpp
@@ -30,6 +30,12 @@
QMainWindow(parent),
ui(new Ui::TrayMenu)
{
+ processLookup = new QProcess(this);
+ QStringList arguments;
+ arguments << "-al";
+ connect(processLookup,SIGNAL(finished(int)), this, SLOT(parseProcessLookup()));
+ processLookup->start("ps",arguments);
+
networkManager = new NetworkManager();
QCoreApplication::setOrganizationName("UCLA");
@@ -547,7 +553,18 @@
}
+void TrayMenu::parseProcessLookup()
+{
+ QByteArray stdout = processLookup->readAllStandardOutput();
+ processLookup->deleteLater();
+
+ QString s = QString(stdout);
+ if(s == "")
+ return;
+ else if(s.indexOf("ndnx-control") != s.lastIndexOf("ndnx-control"))
+ qApp->quit();
+}
TrayMenu::~TrayMenu()
{