Browse Source

majorly cleaning up the file structure

logicp 5 years ago
parent
commit
7613b214c2

+ 0 - 0
argdialog.h → include/argdialog.h


+ 1 - 1
client.hpp → include/client.hpp

@@ -6,7 +6,7 @@
 #include <QPushButton>
 #include <QMessageBox>
 #include <QLineEdit>
-#include <QTimer>
+#include <QUuid>
 #include <QLabel>
 #include <QString>
 #include <QVector>

+ 0 - 0
connection_indicator.h → include/connection_indicator.h


+ 0 - 0
consoledialog.h → include/consoledialog.h


+ 30 - 4
mainwindow.h → include/mainwindow.h

@@ -6,10 +6,34 @@
 #include <QList>
 #include <QListView>
 #include <QListWidgetItem>
-#include <client.hpp>
+#include <QStandardItemModel>
+#include <QStandardItem>
+#include <include/client.hpp>
 #include <headers/ktextedit.hpp>
-#include <argdialog.h>
-#include <consoledialog.h>
+#include <include/argdialog.h>
+#include <include/consoledialog.h>
+#include <QTableView>
+
+namespace ProcessState {
+    static constexpr int READY = 1;
+    static constexpr int PENDING = 2;
+    static constexpr int SUCCEEDED = 3;
+    static constexpr int FAILED = 4;
+}
+
+const QString ProcessNames[4] = { "READY", "PENDING", "SUCCEEDED", "FAILED" };
+
+struct Process {
+    QString name;
+    int state;
+    QString start;
+    QString end;
+    QString id;
+
+    bool operator==(const Process &other) const {
+        return name == other.name && state == other.state;
+    }
+};
 
 namespace Ui {
 class MainWindow;
@@ -28,11 +52,13 @@ private:
     ArgDialog *arg_ui;
     void connectUi();
     void runApp();
-    void updateProcessResult(int mask);
+    void updateProcessResult(QString request_id);
     QString parseMessage(const QString& s, StringVec v);
     int cli_argc;
     char** cli_argv;
     Client* q_client;
+    std::vector<Process> m_processes;
+    QStandardItemModel* m_process_model;
     QList<QString> m_events;
     ConsoleDialog m_console;
 

+ 11 - 14
ky_gui.pro

@@ -26,18 +26,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
 CONFIG += c++17
 
 SOURCES += \
-        argdialog.cpp \
-        consoledialog.cpp \
-        main.cpp \
-        mainwindow.cpp \
-        client.cpp \
-        connection_indicator.cpp
-
+        src/argdialog.cpp \
+        src/consoledialog.cpp \
+        src/main.cpp \
+        src/mainwindow.cpp \
+        src/client.cpp \
+        src/connection_indicator.cpp
 HEADERS += \
-        argdialog.h \
-        consoledialog.h \
-        mainwindow.h \
-        client.hpp \
+        include/argdialog.h \
+        include/consoledialog.h \
+        include/mainwindow.h \
+        include/client.hpp \
         headers/ktextedit.hpp \
         headers/kmessage_codec.hpp \
         headers/json.hpp \
@@ -45,9 +44,7 @@ HEADERS += \
         headers/rapidjson/writer.h \
         headers/rapidjson/stringbuffer.h \
         headers/rapidjson/document.h \
-        connection_indicator.h
-
-
+        include/connection_indicator.h
 
 FORMS += \
         argdialog.ui \

+ 1 - 1
ky_gui.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.11.0, 2020-01-12T01:03:47. -->
+<!-- Written by QtCreator 4.11.0, 2020-01-18T00:40:16. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 203 - 143
mainwindow.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>742</width>
-    <height>872</height>
+    <width>723</width>
+    <height>937</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -30,7 +30,7 @@ background-color: rgb(0, 43, 54);</string>
    <widget class="QLabel" name="label">
     <property name="geometry">
      <rect>
-      <x>290</x>
+      <x>280</x>
       <y>10</y>
       <width>161</width>
       <height>31</height>
@@ -49,15 +49,15 @@ background-color: rgb(0, 43, 54);</string>
    <widget class="QWidget" name="verticalLayoutWidget">
     <property name="geometry">
      <rect>
-      <x>30</x>
+      <x>20</x>
       <y>50</y>
       <width>681</width>
-      <height>750</height>
+      <height>828</height>
      </rect>
     </property>
-    <layout class="QVBoxLayout" name="verticalLayout" stretch="5,0,0,3,1,5">
+    <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0,0,0,0,0">
      <property name="spacing">
-      <number>12</number>
+      <number>4</number>
      </property>
      <item>
       <layout class="QGridLayout" name="gridLayout_2" rowstretch="5" columnstretch="0,0">
@@ -68,28 +68,10 @@ background-color: rgb(0, 43, 54);</string>
         <number>0</number>
        </property>
        <item row="0" column="0">
-        <layout class="QVBoxLayout" name="verticalLayout_2" stretch="2,2,2,1,5,2,2,2">
+        <layout class="QVBoxLayout" name="verticalLayout_2" stretch="2,2,1,0,2,0">
          <property name="spacing">
-          <number>6</number>
+          <number>4</number>
          </property>
-         <item>
-          <widget class="QPushButton" name="connect">
-           <property name="styleSheet">
-            <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
-color: rgb(0, 0, 0);
-background-color: rgb(2, 180, 43);
-font-weight: 700;
-padding: 4px;</string>
-           </property>
-           <property name="text">
-            <string>Connect</string>
-           </property>
-           <property name="icon">
-            <iconset resource="kres.qrc">
-             <normaloff>:/icons/icons/start.png</normaloff>:/icons/icons/start.png</iconset>
-           </property>
-          </widget>
-         </item>
          <item>
           <widget class="QLabel" name="selectProcessTitle">
            <property name="styleSheet">
@@ -128,7 +110,7 @@ font-weight: 700;
          <item>
           <layout class="QHBoxLayout" name="horizontalLayout_2">
            <property name="spacing">
-            <number>6</number>
+            <number>4</number>
            </property>
            <item>
             <widget class="QPushButton" name="addArgs">
@@ -173,45 +155,89 @@ padding: 4px;</string>
           </layout>
          </item>
          <item>
-          <widget class="QLabel" name="messagesTitle">
-           <property name="styleSheet">
-            <string notr="true">font: 75 11pt &quot;Noto Sans&quot;;
+          <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0">
+           <property name="spacing">
+            <number>4</number>
+           </property>
+           <item>
+            <layout class="QVBoxLayout" name="verticalLayout_3">
+             <property name="spacing">
+              <number>4</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="messagesTitle">
+               <property name="styleSheet">
+                <string notr="true">font: 75 11pt &quot;Noto Sans&quot;;
 color: rgb(131, 148, 150);
 font-weight: 700;</string>
-           </property>
-           <property name="text">
-            <string>History</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QTextEdit" name="messages">
-           <property name="toolTip">
-            <string>Messages</string>
-           </property>
-           <property name="toolTipDuration">
-            <number>1</number>
-           </property>
-           <property name="autoFillBackground">
-            <bool>false</bool>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
+               </property>
+               <property name="text">
+                <string>History</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QTextEdit" name="messages">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="toolTip">
+                <string>Messages</string>
+               </property>
+               <property name="toolTipDuration">
+                <number>1</number>
+               </property>
+               <property name="autoFillBackground">
+                <bool>false</bool>
+               </property>
+               <property name="styleSheet">
+                <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
 background-color: rgb(7, 54, 66);
 color: rgb(131, 148, 150);
 font-weight: 700;
 </string>
-           </property>
-           <property name="lineWrapMode">
-            <enum>QTextEdit::WidgetWidth</enum>
-           </property>
-           <property name="readOnly">
-            <bool>true</bool>
-           </property>
-           <property name="placeholderText">
-            <string/>
-           </property>
-          </widget>
+               </property>
+               <property name="lineWrapMode">
+                <enum>QTextEdit::WidgetWidth</enum>
+               </property>
+               <property name="readOnly">
+                <bool>true</bool>
+               </property>
+               <property name="placeholderText">
+                <string notr="true"/>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+           <item>
+            <widget class="QPushButton" name="viewConsole">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="styleSheet">
+              <string notr="true">background-color: rgb(157, 157, 157);
+font: 87 11pt &quot;Noto Sans&quot;;
+color: rgb(0, 0, 0);
+font-weight: 700;
+padding: 4px;</string>
+             </property>
+             <property name="text">
+              <string>Console</string>
+             </property>
+             <property name="icon">
+              <iconset resource="kres.qrc">
+               <normaloff>:/icons/log.png</normaloff>:/icons/log.png</iconset>
+             </property>
+            </widget>
+           </item>
+          </layout>
          </item>
          <item>
           <widget class="QLabel" name="processListTitle">
@@ -229,7 +255,13 @@ font-weight: 700;</string>
           </widget>
          </item>
          <item>
-          <widget class="QListWidget" name="processList">
+          <widget class="QListView" name="processList">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
            <property name="styleSheet">
             <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
 background-color: rgb(7, 54, 66);
@@ -237,6 +269,9 @@ color: rgb(131, 148, 150);
 font-weight: 700;
 </string>
            </property>
+           <property name="spacing">
+            <number>2</number>
+           </property>
           </widget>
          </item>
         </layout>
@@ -260,6 +295,12 @@ font-weight: 700;</string>
      </item>
      <item>
       <widget class="QListWidget" name="eventList">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
        <property name="styleSheet">
         <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
 background-color: rgb(7, 54, 66);
@@ -276,12 +317,18 @@ font-weight: 700;
        <property name="resizeMode">
         <enum>QListView::Adjust</enum>
        </property>
+       <property name="spacing">
+        <number>2</number>
+       </property>
        <property name="modelColumn">
         <number>0</number>
        </property>
        <property name="wordWrap">
         <bool>false</bool>
        </property>
+       <property name="sortingEnabled">
+        <bool>false</bool>
+       </property>
       </widget>
      </item>
      <item>
@@ -290,71 +337,19 @@ font-weight: 700;
         <enum>QLayout::SetMinimumSize</enum>
        </property>
        <property name="spacing">
-        <number>6</number>
+        <number>4</number>
        </property>
        <item row="2" column="0">
-        <layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
-         <item>
-          <widget class="QProgressBar" name="progressBar">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">background-color: rgb(94, 79, 255);
-font: 87 11pt &quot;Noto Sans&quot;;
-color: rgb(0, 0, 0);</string>
-           </property>
-           <property name="value">
-            <number>0</number>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="sendMessage">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="styleSheet">
-            <string notr="true">background-color: rgb(130, 255, 121);
-background-color: rgb(2, 180, 43);
-font: 87 11pt &quot;Noto Sans&quot;;
-color: rgb(0, 0, 0);
-font-weight: 700;
-padding: 4px;</string>
-           </property>
-           <property name="text">
-            <string>Send</string>
-           </property>
-           <property name="icon">
-            <iconset resource="kres.qrc">
-             <normaloff>:/icons/send-button.png</normaloff>:/icons/send-button.png</iconset>
-           </property>
-           <property name="checkable">
-            <bool>false</bool>
-           </property>
-           <property name="autoDefault">
-            <bool>false</bool>
-           </property>
-           <property name="default">
-            <bool>false</bool>
-           </property>
-           <property name="flat">
-            <bool>false</bool>
-           </property>
-          </widget>
-         </item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="spacing">
+          <number>4</number>
+         </property>
         </layout>
        </item>
        <item row="1" column="0">
         <widget class="QTextEdit" name="inputText">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+          <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
@@ -384,34 +379,38 @@ font-weight: 700;</string>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <property name="spacing">
+        <number>4</number>
+       </property>
        <item>
-        <widget class="QPushButton" name="viewConsole">
+        <widget class="QPushButton" name="disconnect">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+          <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
          <property name="styleSheet">
-          <string notr="true">background-color: rgb(157, 157, 157);
-font: 87 11pt &quot;Noto Sans&quot;;
+          <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
 color: rgb(0, 0, 0);
+background-color: rgb(255, 65, 68);
+background-color: rgb(255, 0, 4);
 font-weight: 700;
 padding: 4px;</string>
          </property>
          <property name="text">
-          <string>View Console</string>
+          <string>Disconnect</string>
          </property>
          <property name="icon">
           <iconset resource="kres.qrc">
-           <normaloff>:/icons/log.png</normaloff>:/icons/log.png</iconset>
+           <normaloff>:/icons/disconnect.png</normaloff>:/icons/disconnect.png</iconset>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="tasks">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
@@ -428,30 +427,67 @@ padding: 4px;</string>
          </property>
         </widget>
        </item>
+       <item>
+        <widget class="QPushButton" name="sendMessage">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">background-color: rgb(130, 255, 121);
+background-color: rgb(2, 180, 43);
+font: 87 11pt &quot;Noto Sans&quot;;
+color: rgb(0, 0, 0);
+font-weight: 700;
+padding: 4px;</string>
+         </property>
+         <property name="text">
+          <string>Send</string>
+         </property>
+         <property name="icon">
+          <iconset resource="kres.qrc">
+           <normaloff>:/icons/send-button.png</normaloff>:/icons/send-button.png</iconset>
+         </property>
+         <property name="checkable">
+          <bool>false</bool>
+         </property>
+         <property name="autoDefault">
+          <bool>false</bool>
+         </property>
+         <property name="default">
+          <bool>false</bool>
+         </property>
+         <property name="flat">
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
       </layout>
      </item>
      <item>
-      <widget class="QPushButton" name="disconnect">
+      <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <property name="spacing">
+        <number>4</number>
+       </property>
+      </layout>
+     </item>
+     <item>
+      <widget class="QProgressBar" name="progressBar">
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+        <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
        <property name="styleSheet">
-        <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
-color: rgb(0, 0, 0);
-background-color: rgb(255, 65, 68);
-background-color: rgb(255, 0, 4);
-font-weight: 700;
-padding: 4px;</string>
-       </property>
-       <property name="text">
-        <string>Disconnect</string>
+        <string notr="true">background-color: rgb(94, 79, 255);
+font: 87 11pt &quot;Noto Sans&quot;;
+color: rgb(0, 0, 0);</string>
        </property>
-       <property name="icon">
-        <iconset resource="kres.qrc">
-         <normaloff>:/icons/disconnect.png</normaloff>:/icons/disconnect.png</iconset>
+       <property name="value">
+        <number>0</number>
        </property>
       </widget>
      </item>
@@ -470,13 +506,37 @@ padding: 4px;</string>
      <string/>
     </property>
    </widget>
+   <widget class="QPushButton" name="connect">
+    <property name="geometry">
+     <rect>
+      <x>570</x>
+      <y>0</y>
+      <width>111</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">font: 87 11pt &quot;Noto Sans&quot;;
+color: rgb(0, 0, 0);
+background-color: rgb(2, 180, 43);
+font-weight: 700;
+padding: 4px;</string>
+    </property>
+    <property name="text">
+     <string>Connect</string>
+    </property>
+    <property name="icon">
+     <iconset resource="kres.qrc">
+      <normaloff>:/icons/icons/start.png</normaloff>:/icons/icons/start.png</iconset>
+    </property>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>742</width>
+     <width>723</width>
      <height>23</height>
     </rect>
    </property>
@@ -502,7 +562,7 @@ padding: 4px;</string>
   <customwidget>
    <class>ConnectionIndicator</class>
    <extends>QLabel</extends>
-   <header>connection_indicator.h</header>
+   <header>include/connection_indicator.h</header>
   </customwidget>
  </customwidgets>
  <resources>

+ 2 - 2
argdialog.cpp → src/argdialog.cpp

@@ -1,5 +1,5 @@
-#include "argdialog.h"
-#include "ui_argdialog.h"
+#include <include/argdialog.h>
+#include <ui_argdialog.h>
 #include <algorithm>
 #include <QDebug>
 #include <QStringList>

+ 6 - 4
client.cpp → src/client.cpp

@@ -1,4 +1,4 @@
-#include <client.hpp>
+#include <include/client.hpp>
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <string.h>
@@ -292,9 +292,11 @@ void Client::execute() {
     if (!selected_commands.empty()) {
         executing = true;
         for (const auto& command : selected_commands) {
-            auto message = getAppName(command) + " pending";
-            emit Client::messageReceived(PROCESS_REQUEST_TYPE, message, {});
-            std::string execute_operation = createOperation("Execute", {std::to_string(command)});
+            auto app_name = getAppName(command);
+            auto message = app_name + " pending";
+            auto request_id = QUuid::createUuid().toString(QUuid::StringFormat::WithoutBraces);
+            emit Client::messageReceived(PROCESS_REQUEST_TYPE, message, { QString{command}, app_name, request_id });
+            std::string execute_operation = createOperation("Execute", {std::to_string(command), std::string(request_id.toUtf8().constData())});
             sendEncoded(execute_operation);
         }
     }

+ 1 - 1
connection_indicator.cpp → src/connection_indicator.cpp

@@ -1,4 +1,4 @@
-#include "connection_indicator.h"
+#include <include/connection_indicator.h>
 #include <QDebug>
 
 static const int SIZE = 20;

+ 1 - 1
consoledialog.cpp → src/consoledialog.cpp

@@ -1,4 +1,4 @@
-#include "consoledialog.h"
+#include <include/consoledialog.h>
 #include <QPushButton>
 #include "ui_consoledialog.h"
 

+ 4 - 1
main.cpp → src/main.cpp

@@ -1,9 +1,12 @@
-#include "mainwindow.h"
+#include <include/mainwindow.h>
 #include <QApplication>
 
 int main(int argc, char **argv)
 {
     QApplication a(argc, argv);
+    QFont font("Deja Sans Mono");
+    font.setStyleHint(QFont::Monospace);
+    a.setFont(font);
     MainWindow w(argc, argv);
     w.show();
 

+ 58 - 10
mainwindow.cpp → src/mainwindow.cpp

@@ -1,4 +1,4 @@
-#include "mainwindow.h"
+#include <include/mainwindow.h>
 #include "ui_mainwindow.h"
 #include <QDebug>
 #include <QTextEdit>
@@ -10,6 +10,10 @@
 #include <vector>
 #include <headers/util.hpp>
 
+QString getTime() {
+    return QDateTime::currentDateTime().toString("hh:mm:ss");
+}
+
 /**
  * @brief MainWindow::MainWindow
  * @param argc
@@ -23,11 +27,13 @@ MainWindow::MainWindow(int argc, char** argv, QWidget *parent) :
     cli_argc(argc),
     cli_argv(argv),
     q_client(nullptr) {
+    m_process_model = new QStandardItemModel(this);
     q_client = new Client(this, cli_argc, cli_argv);
     ui->setupUi(this);
     this->setWindowTitle("KYGUI");
     QPushButton *button = this->findChild<QPushButton*>("connect");
     connect(button, &QPushButton::clicked, this, &MainWindow::connectClient);
+    ui->processList->setModel(m_process_model);
 }
 
 /**
@@ -126,6 +132,14 @@ void MainWindow::connectClient() {
 //    QObject::connect(static_cast<KTextEdit*>(ui->inputText), &KTextEdit::textInputEnter, this, &MainWindow::handleInputEnterKey);
     QObject::connect(static_cast<KTextEdit*>(ui->inputText), &KTextEdit::textInputEnter, this, &MainWindow::handleInputEnterKey);
 
+    QObject::connect(ui->processList, &QListView::clicked, this, [this](const QModelIndex &index) {
+        QMessageBox::information(
+            this, tr("Process"),
+            tr(m_processes.at(index.row()).name.toUtf8() + "\n" +
+               "Execution requested at " + m_processes.at(index.row()).start.toUtf8() + "\n" +
+               "Is currently in a state of: " + ProcessNames[m_processes.at(index.row()).state - 1].toUtf8()),
+            tr("Close"));
+    });
 }
 
 void MainWindow::handleInputEnterKey() {
@@ -155,6 +169,24 @@ QString MainWindow::parseMessage(const QString& message, StringVec v) {
     return simplified_message;
 }
 
+QStandardItem* createProcessListItem(Process process) {
+//    QString name{""};
+//    if (process.name.size() < 13) {
+//        auto diff = 13 - process.name.size();
+//        name += process.name;
+//        for (int i = 0; i <= diff; i++) {
+//            name += " ";
+//        }
+//    } else if (process.name.size() > 13) {
+//        name += process.name.left(13);
+//    } else {
+//        name += process.name;
+//    }
+return new QStandardItem(QString("%0 requested for execution. ID: %1\nStatus: %2\nTime: %3   Done: %4").arg(process.name).arg(process.id).arg(ProcessNames[process.state - 1]).arg(process.start).arg(process.end));
+}
+
+
+
 /**
  * @brief MainWindow::updateMessages
  * @param s
@@ -180,7 +212,12 @@ void MainWindow::updateMessages(int t, const QString& message, StringVec v) {
         ui->connect->setChecked(true);
     } else if (t == PROCESS_REQUEST_TYPE) {
         qDebug() << "Updating process list";
-        ui->processList->addItem(message);
+        m_processes.push_back(Process{ .name=v.at(1), .state=ProcessState::PENDING, .start=getTime(), .id=v.at(2) });
+        int row = 0;
+        for (const auto& process : m_processes) {
+            m_process_model->setItem(row, createProcessListItem(process));
+            row++;
+        }
 
         //TODO: We do this because a CommandLinkButton turns transparent by default, except when hovered or checked
         ui->connect->setChecked(true);
@@ -195,17 +232,27 @@ void MainWindow::updateMessages(int t, const QString& message, StringVec v) {
                 if (message == "Process Result") {
                     event_message += "\n";
                     auto mask = std::stoi(v.at(0).toUtf8().constData());
-                    updateProcessResult(mask);
+                    if (v.at(1).length() > 0) {
+                        updateProcessResult(v.at(1));
+                    } else { // new process, from scheduled task
+                        Process new_process{ .name=v.at(1), .state=ProcessState::SUCCEEDED, .start=getTime(), .id="Scheduled task" };
+                        m_processes.push_back(new_process);
+                        m_process_model->setItem(m_process_model->rowCount(), createProcessListItem(new_process));
+                    }
                     event_message += q_client->getAppName(mask);
+                    event_message += ": ";
+                    event_message += v.at(2);
+                } else {
+                    event_message += ": ";
+                    event_message += v.at(1);
                 }
-                event_message += ": ";
-                event_message += v.at(1);
             }
         } else {
             event_message += message;
         }
         m_events.push_front(event_message);
         ui->eventList->clear();
+
         for (const auto& i : m_events) {
             ui->eventList->addItem(i);
         }
@@ -214,11 +261,12 @@ void MainWindow::updateMessages(int t, const QString& message, StringVec v) {
     }
 }
 
-void MainWindow::updateProcessResult(int mask) {
-    auto app_name = q_client->getAppName(mask);
-    for (int i = ui->processList->count() - 1; i >= 0; i--) {
-        if (ui->processList->item(i)->text().contains(app_name)) {
-            ui->processList->item(i)->setText(app_name + " completed");
+void MainWindow::updateProcessResult(QString id) { // We need to start matching processes with a unique identifier
+    for (int i = m_processes.size() - 1; i >= 0; i--) {
+        if (m_processes.at(i).id == id) {
+            m_processes.at(i).end = getTime();
+            m_processes.at(i).state = ProcessState::SUCCEEDED;
+            m_process_model->setItem(i, 0, createProcessListItem(m_processes.at(i)));
             return;
         }
     }