diff --git a/groundStation/gui/MicroCART/mainwindow.cpp b/groundStation/gui/MicroCART/mainwindow.cpp index f68d25ea7502ba478c7f6440ddca8700f3bbf987..01f6bd1cbb9231961a6cc64c0b2f4008ecebe6c9 100644 --- a/groundStation/gui/MicroCART/mainwindow.cpp +++ b/groundStation/gui/MicroCART/mainwindow.cpp @@ -325,3 +325,36 @@ void MainWindow::on_pbActualToWaypoint_clicked() setpointList->appendRow(new QStandardItem(str)); } + +void MainWindow::on_pbMoveUp_clicked() +{ + if (findChild<QListView *>("setpointList")->currentIndex().isValid()) { + int current = findChild<QListView *>("setpointList")->currentIndex().row(); + if (current > 0) { + setpointList->insertRow(current - 1, setpointList->takeItem(current)); + } + } +} + +void MainWindow::on_pbMoveDown_clicked() +{ + if (findChild<QListView *>("setpointList")->currentIndex().isValid()) { + int current = findChild<QListView *>("setpointList")->currentIndex().row(); + if (current < (setpointList->rowCount() - 1)) { + setpointList->insertRow(current - 1, setpointList->takeItem(current)); + } + } +} + +void MainWindow::on_pbInsertSetpoint_clicked() +{ + int current = 0; + if (findChild<QListView *>("setpointList")->currentIndex().isValid()) { + current = findChild<QListView *>("setpointList")->currentIndex().row(); + } + + QString str("[" + findChild<QLineEdit *>("xActual")->text() + ", "+ + findChild<QLineEdit *>("yActual")->text() + ", " + + findChild<QLineEdit *>("zActual")->text() + "]"); + setpointList->insertRow(current, new QStandardItem(str)); +} diff --git a/groundStation/gui/MicroCART/mainwindow.h b/groundStation/gui/MicroCART/mainwindow.h index 5c5c38fe38f222c5b1f8cbcd9ec949062db0a7ce..1e65d517480bb8ec8013f6be7ff1ded6f425d579 100644 --- a/groundStation/gui/MicroCART/mainwindow.h +++ b/groundStation/gui/MicroCART/mainwindow.h @@ -59,6 +59,12 @@ private slots: void on_pbActualToWaypoint_clicked(); + void on_pbMoveUp_clicked(); + + void on_pbMoveDown_clicked(); + + void on_pbInsertSetpoint_clicked(); + private: Ui::MainWindow *ui; pid_t backendPid; diff --git a/groundStation/gui/MicroCART/mainwindow.ui b/groundStation/gui/MicroCART/mainwindow.ui index 2476c75d595f5fb78a492e9a5799c070c79f5162..829e4f0726064b51fa3d65781def6ccb79ab34b0 100644 --- a/groundStation/gui/MicroCART/mainwindow.ui +++ b/groundStation/gui/MicroCART/mainwindow.ui @@ -660,7 +660,7 @@ <item> <widget class="QPushButton" name="pbInsertSetpoint"> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="text"> <string>Insert</string> @@ -719,13 +719,13 @@ <set>QAbstractItemView::NoEditTriggers</set> </property> <property name="dragEnabled"> - <bool>true</bool> + <bool>false</bool> </property> <property name="dragDropOverwriteMode"> <bool>false</bool> </property> <property name="dragDropMode"> - <enum>QAbstractItemView::InternalMove</enum> + <enum>QAbstractItemView::NoDragDrop</enum> </property> <property name="defaultDropAction"> <enum>Qt::MoveAction</enum> @@ -739,6 +739,24 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QPushButton" name="pbMoveUp"> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbMoveDown"> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + </item> + </layout> + </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item>