summaryrefslogtreecommitdiffstats
path: root/app/procinfo.cpp
diff options
context:
space:
mode:
authorVitaly Wool <vitaly.wool@konsulko.com>2018-11-27 08:49:32 +0100
committerVitaly Wool <vitaly.wool@konsulko.com>2018-11-28 16:51:21 +0100
commitf52f93fa42ffc213653e4772acedfcf849707ce8 (patch)
tree409bb47397fd5fb104cc53d2df868898f0eef714 /app/procinfo.cpp
parent49364e7ea0df798a48c7b671821f63401b6c7798 (diff)
Initial commit
Add Task Manager GUI. Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com> Change-Id: I56d9a34df38fb441b598d150e88c905db95346aa
Diffstat (limited to 'app/procinfo.cpp')
-rw-r--r--app/procinfo.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/app/procinfo.cpp b/app/procinfo.cpp
new file mode 100644
index 0000000..76a0df3
--- /dev/null
+++ b/app/procinfo.cpp
@@ -0,0 +1,75 @@
+#include "procinfo.h"
+#include <QJsonObject>
+#include <QString>
+
+ProcInfo::ProcInfo(const QJsonObject& obj)
+{
+ m_cmd = obj["cmd"].toString();
+ m_tid = obj["tid"].toInt();
+ m_euid = obj["euid"].toInt();
+ m_scpu = obj["scpu"].toDouble();
+ m_ucpu = obj["ucpu"].toDouble();
+ m_resident_memory = obj["resident_mem"].toDouble();
+ m_state = obj["state"].toString();
+}
+
+bool ProcInfo::operator==(const ProcInfo& o)
+{
+ // TODO: re-implement
+ if (&o == this)
+ return true;
+ return m_tid == o.m_tid;
+}
+
+QString ProcInfo::cmd() const
+{
+ return m_cmd;
+}
+
+int ProcInfo::tid() const
+{
+ return m_tid;
+}
+
+int ProcInfo::euid() const
+{
+ return m_euid;
+}
+
+double ProcInfo::scpu() const
+{
+ return m_scpu;
+}
+
+double ProcInfo::ucpu() const
+{
+ return m_ucpu;
+}
+
+double ProcInfo::resident_memory() const
+{
+ return m_resident_memory;
+}
+
+QString ProcInfo::state() const
+{
+ return m_state;
+}
+
+/*
+ * TODO: either it's a member operator that take one parameter (see above), either it's a global function which take two parameters.
+bool operator==(const ProcInfo &obj) {
+ ProcInfo obj2(jobj);
+ if(this.m_cmd == obj.m_cmd &&
+ this.m_tid == obj.m_tid &&
+ this.m_euid == obj.m_euid &&
+ this.m_scpu == obj.m_scpu &&
+ this.m_ucpu == obj.m_ucpu &&
+ this.m_resident_memory == obj.m_resident_memory &&
+ this.m_state == obj.m_state) {
+ return true;
+ } else {
+ return false;
+ }
+}
+*/