summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFabian Schillinger2010-11-01 16:53:24 +0100
committerFabian Schillinger2010-11-01 16:53:24 +0100
commit0d97a7378ffe5f6be408201cd1f5595607ed5f87 (patch)
tree78ccd691a67c2f63f8fa4d1032d4cabfae0e80fa /src/core
parent[PVSGUI] parsing cmdargs fixed (diff)
downloadpvs-0d97a7378ffe5f6be408201cd1f5595607ed5f87.tar.gz
pvs-0d97a7378ffe5f6be408201cd1f5595607ed5f87.tar.xz
pvs-0d97a7378ffe5f6be408201cd1f5595607ed5f87.zip
Process start/stop/view functionality
processWidget - shows a list of processes on one client, allows to start ans stop processes processesDialog - shows every processWidget as a tab processesStartDialog - starts process entered in messageEdit added handling of new pvscommands
Diffstat (limited to 'src/core')
-rw-r--r--src/core/pvsClient.cpp20
-rw-r--r--src/core/pvsClient.h13
-rw-r--r--src/core/pvsConnectionManager.cpp42
3 files changed, 75 insertions, 0 deletions
diff --git a/src/core/pvsClient.cpp b/src/core/pvsClient.cpp
index 0d08b1d..f048b54 100644
--- a/src/core/pvsClient.cpp
+++ b/src/core/pvsClient.cpp
@@ -299,3 +299,23 @@ void PVSClient::vncFinished()
_vncPasswordReceived = false;
}
+QVector<QString> PVSClient::getProcessesVector()
+{
+ return processesVector;
+}
+
+void PVSClient::clearProcessesVector()
+{
+ processesVector.clear();
+}
+
+void PVSClient::processesVectorAdd(QString msg)
+{
+ if (msg.indexOf("<#>") > 0)
+ processesVector.append(msg);
+ else if (msg.indexOf("vector ready") == 0)
+ {
+ emit processVectorReady(true);
+ ConsoleLog writeError("processVectorReady(true)!");
+ }
+}
diff --git a/src/core/pvsClient.h b/src/core/pvsClient.h
index 180995a..e547e12 100644
--- a/src/core/pvsClient.h
+++ b/src/core/pvsClient.h
@@ -15,6 +15,7 @@
#include "src/net/pvsClientConnection.h"
#include "src/gui/frame.h"
#include <QtCore/QThread>
+#include <QVector>
class PVSServer;
class VNCConnection;
@@ -104,6 +105,16 @@ public:
int getClientindex() { return _clientIndex; }
int getConnectionId() { return _pvsClientConnection->getID(); }
+ QVector<QString> getProcessesVector();
+
+
+public slots:
+ void processesVectorAdd(QString msg);
+ void clearProcessesVector();
+
+signals:
+ void processVectorReady( bool );
+
private Q_SLOTS:
void vncFinished();
@@ -124,6 +135,8 @@ private:
QString _vncRwPassword;
int _clientIndex;
bool _vncAllowed, _vncRequested, _vncPasswordReceived, _vncRwPasswordReceived, _vncInitMutex, _vncProject;
+ QVector<QString> processesVector;
+
};
#endif
diff --git a/src/core/pvsConnectionManager.cpp b/src/core/pvsConnectionManager.cpp
index 8a35ca9..d0f1479 100644
--- a/src/core/pvsConnectionManager.cpp
+++ b/src/core/pvsConnectionManager.cpp
@@ -192,6 +192,9 @@ void PVSConnectionManager::onCommand(PVSMsg command)
{
QString message = command.getMessage();
QString ident = command.getIdent();
+
+ PVSClient* tmp = getClientFromConnectionId(command.getSndID());
+
if (ident.compare("VNCSRVRESULT") == 0)
{
int e = string2Int(message);
@@ -218,6 +221,45 @@ void PVSConnectionManager::onCommand(PVSMsg command)
break;
}
}
+ if (ident.compare("PROCESSES") == 0)
+ {
+ QString id = int2String(command.getSndID());
+ if (message.startsWith("START"))
+ {
+ QString msgcontent = message.remove(0,6);
+ if (msgcontent.startsWith("ERROR"))
+ {
+ ConsoleLog writeError("[Client: " + id + ", PROCESS] could not start: " +msgcontent.remove(0,6));
+ }
+ else
+ {
+ //ConsoleLog writeLine(QString("[Client: " + id + ", PROCESS] started: " +msgcontent));
+ }
+ }
+ if (message.startsWith("STOP"))
+ {
+ QString msgcontent = message.remove(0,5);
+ if (msgcontent.startsWith("ERROR"))
+ {
+ ConsoleLog writeError("[Client: " + id + ", PROCESS] could not stop: " +msgcontent.remove(0,6));
+ }
+ else
+ {
+ //ConsoleLog writeLine(QString("[Client: " + id + ", PROCESS] stopped: " +msgcontent));
+ }
+ }
+ if (message.startsWith("SHOW"))
+ {
+ QString msgcontent = message.remove(0,5);
+ if (msgcontent.startsWith("ERROR"))
+ ConsoleLog writeError("[Client: " + id + ", PROCESS] could not show processes: " +msgcontent.remove(0,6));
+ else if (msgcontent.startsWith("clear"))
+ tmp->clearProcessesVector();
+ else if (msgcontent.startsWith("finished"))
+ tmp->processesVectorAdd("vector ready");
+ else tmp->processesVectorAdd(message);
+ }
+ }
}
void PVSConnectionManager::onChat(PVSMsg chatMsg)
{