From 1a97b8ec7348ec9ad185f00247a3611b9b816ec5 Mon Sep 17 00:00:00 2001
From: Jake <j@kedrahos.com>
Date: Tue, 11 Apr 2017 17:10:27 -0500
Subject: [PATCH] Began adding env variables

---
 groundStation/gui/MicroCART/mainwindow.cpp    | 10 ++++++-
 groundStation/gui/MicroCART/mainwindow.h      |  2 ++
 groundStation/gui/MicroCART/mainwindow.ui     | 28 +++++++++++++++++--
 groundStation/gui/MicroCART/trackerworker.cpp |  2 +-
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/groundStation/gui/MicroCART/mainwindow.cpp b/groundStation/gui/MicroCART/mainwindow.cpp
index 0e3863a50..cbeab62ea 100644
--- a/groundStation/gui/MicroCART/mainwindow.cpp
+++ b/groundStation/gui/MicroCART/mainwindow.cpp
@@ -5,6 +5,7 @@
 #include <QThread>
 #include <QTimer>
 #include <QRegExp>
+#include <QProcessEnvironment>
 
 #include "wrappers.h"
 #include "trackerworker.h"
@@ -21,6 +22,9 @@ MainWindow::MainWindow(QWidget *parent) :
 {
     ui->setupUi(this);
 
+    /* Set up environment variables */
+    findChild<QLineEdit *>("socketPath")->setText(QProcessEnvironment::systemEnvironment().value("UCART_SOCKET"));
+
     /* Create a thread for workers */
     QThread* workerThread = new QThread(this);
 
@@ -257,7 +261,7 @@ void MainWindow::on_pbNextSetpoint_clicked()
 void MainWindow::sendSelectedSetpoint()
 {
     if (findChild<QListView *>("setpointList")->currentIndex().isValid()) {
-        QRegExp regex("\[(.*), (.*), (.*)\]");
+        QRegExp regex("\\[(.*), (.*), (.*)\\]");
         int row = findChild<QListView *>("setpointList")->currentIndex().row();
 
         regex.indexIn(setpointList->item(row)->text());
@@ -282,3 +286,7 @@ void MainWindow::on_pbDeleteSetpoint_clicked()
         setpointList->removeRow(findChild<QListView *>("setpointList")->currentIndex().row());
     }
 }
+
+void MainWindow::on_socketPath_returnPressed()
+{
+}
diff --git a/groundStation/gui/MicroCART/mainwindow.h b/groundStation/gui/MicroCART/mainwindow.h
index 5fc16ea4a..95dc0261e 100644
--- a/groundStation/gui/MicroCART/mainwindow.h
+++ b/groundStation/gui/MicroCART/mainwindow.h
@@ -56,6 +56,8 @@ private slots:
 
     void on_pbDeleteSetpoint_clicked();
 
+    void on_socketPath_returnPressed();
+
 private:
     Ui::MainWindow *ui;
     pid_t backendPid;
diff --git a/groundStation/gui/MicroCART/mainwindow.ui b/groundStation/gui/MicroCART/mainwindow.ui
index bb89570dd..5ba411f84 100644
--- a/groundStation/gui/MicroCART/mainwindow.ui
+++ b/groundStation/gui/MicroCART/mainwindow.ui
@@ -18,24 +18,45 @@
     <item>
      <widget class="QTabWidget" name="tabWidget">
       <property name="currentIndex">
-       <number>0</number>
+       <number>2</number>
       </property>
       <widget class="QWidget" name="backend">
        <attribute name="title">
         <string>Backend</string>
        </attribute>
        <layout class="QVBoxLayout" name="verticalLayout">
+        <item>
+         <layout class="QFormLayout" name="formLayout_3">
+          <item row="0" column="0">
+           <widget class="QLabel" name="socketPathLabel">
+            <property name="text">
+             <string>UCART_SOCKET_PATH</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLineEdit" name="socketPath"/>
+          </item>
+         </layout>
+        </item>
         <item>
          <layout class="QHBoxLayout" name="horizontalLayout_8">
           <item>
            <widget class="QPushButton" name="chooseBackend">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
             <property name="text">
              <string>Choose Backend</string>
             </property>
            </widget>
           </item>
           <item>
-           <widget class="QLineEdit" name="backendPath_2"/>
+           <widget class="QLineEdit" name="backendPath_2">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
+           </widget>
           </item>
          </layout>
         </item>
@@ -591,6 +612,9 @@
               <property name="dragEnabled">
                <bool>true</bool>
               </property>
+              <property name="dragDropOverwriteMode">
+               <bool>false</bool>
+              </property>
               <property name="dragDropMode">
                <enum>QAbstractItemView::InternalMove</enum>
               </property>
diff --git a/groundStation/gui/MicroCART/trackerworker.cpp b/groundStation/gui/MicroCART/trackerworker.cpp
index f5d3cda28..9a6830a77 100644
--- a/groundStation/gui/MicroCART/trackerworker.cpp
+++ b/groundStation/gui/MicroCART/trackerworker.cpp
@@ -32,6 +32,6 @@ void TrackerWorker::process()
         struct frontend_tracker_data td;
         frontend_track(conn, &td);
 
-        emit finished(td.height, td.lateral, td.longitudinal, td.pitch, td.roll, td.yaw);
+        emit finished(td.longitudinal, td.lateral, td.height, td.pitch, td.roll, td.yaw);
     }
 }
-- 
GitLab