summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/main.qml25
-rw-r--r--app/taskmanager.cpp25
-rw-r--r--app/taskmanager.h3
3 files changed, 53 insertions, 0 deletions
diff --git a/app/main.qml b/app/main.qml
index 58f63a6..a76aaa8 100644
--- a/app/main.qml
+++ b/app/main.qml
@@ -1,6 +1,7 @@
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
+import QtQuick.Controls 2.0 as NewControls
import QtQuick.Layouts 1.1
import TaskManager 1.0
@@ -40,6 +41,10 @@ Window {
Component.onCompleted: {
taskmgr.open(bindingAddress);
}
+
+ onShowProcessInfo: {
+ infoPopup.infoText = info_;
+ }
}
ListModel {
@@ -60,10 +65,30 @@ Window {
id: buttonRowLayout
spacing: 6
+ NewControls.Popup {
+ id: infoPopup
+ x: 200
+ y: 200
+ width: 300
+ height: 200
+ modal: true
+ focus: true
+ closePolicy: NewControls.Popup.CloseOnPressOutsideParent
+ property var infoText: "Getting extra information for process"
+ function doOpen(tid) {
+ taskmgr.getExtraInfo(tid)
+ infoPopup.open()
+ }
+ contentItem: Text {
+ text: infoPopup.infoText
+ }
+ }
+
Button {
id: infoButton
text: "Info"
enabled: tableView.currentRow != -1
+ onClicked: infoPopup.doOpen(libraryModel.get(tableView.currentRow).tid)
}
Button {
diff --git a/app/taskmanager.cpp b/app/taskmanager.cpp
index 3b0d1e7..ece6d83 100644
--- a/app/taskmanager.cpp
+++ b/app/taskmanager.cpp
@@ -33,6 +33,10 @@ void TaskManager::kill(int tid) {
callService("kill_process", QJsonValue(tid));
}
+void TaskManager::getExtraInfo(int tid) {
+ callService("get_extra_info", QJsonValue(tid));
+}
+
void TaskManager::query() {
callService("get_process_list",
QJsonValue(QJsonObject({{"processes", QJsonValue()}})));
@@ -63,6 +67,10 @@ void TaskManager::ProcessResponse(Message *message)
QJsonArray processes = message->replyData()["processes"].toArray();
ProcessResponseTasklist(processes);
}
+ if (QString::compare(msgType, "extraInfo") == 0) {
+ QJsonObject info = message->replyData()["info"].toObject();
+ ProcessResponseExtraInfo(info);
+ }
// more response types to follow
}
@@ -119,3 +127,20 @@ void TaskManager::ProcessResponseTasklist(QJsonArray& processes)
}
m_procinfos = procs;
}
+
+void TaskManager::ProcessResponseExtraInfo(QJsonObject &info)
+{
+ QString infoString;
+
+ if (info.size() == 0) {
+ // this is not a valid process list response
+ QTextStream(&infoString) << "procces is not available";
+ } else {
+ infoString = "Task : " + info["cmd"].toString() + "\n"
+ + "Exec start : " + info["exec_start"].toString() + "\n"
+ + "Exec runtime : " + info["vruntime"].toString() + "\n"
+ + "Prio : " + info["prio"].toString();
+ }
+
+ emit showProcessInfo(infoString);
+}
diff --git a/app/taskmanager.h b/app/taskmanager.h
index a874c22..0bd53d5 100644
--- a/app/taskmanager.h
+++ b/app/taskmanager.h
@@ -20,12 +20,14 @@ public:
Q_INVOKABLE void open(const QUrl& url);
Q_INVOKABLE void kill(int tid);
+ Q_INVOKABLE void getExtraInfo(int tid);
QTimer *timer;
signals:
void updateProcess(const QString& cmd_, int tid_, int euid_, double scpu_, double ucpu_, double resident_memory_, const QString& state_);
void addProcess(const QString& cmd_, int tid_, int euid_, double scpu_, double ucpu_, double resident_memory_, const QString& state_);
void removeProcess(int tid_);
+ void showProcessInfo(const QString info_);
private slots:
void query();
@@ -39,6 +41,7 @@ private:
void ProcessResponse(Message *message);
void ProcessResponseTasklist(QJsonArray& processes);
+ void ProcessResponseExtraInfo(QJsonObject& info);
};
#endif // TASKMANAGER_H