From 65685bdeec17bd5da28d0048b20c04707f65f4eb Mon Sep 17 00:00:00 2001
From: tobiglaser <76131623+tobiglaser@users.noreply.github.com>
Date: Tue, 9 Aug 2022 03:50:05 +0200
Subject: [PATCH] doxygen documentation

---
 src/AboutDialog.h            |  9 ++++
 src/ComTypeListWidgetItem.h  | 16 ++++++-
 src/ControlUI.cpp            | 87 ++++++++++++++++++++++++++++++++++++
 src/ControlUI.h              |  4 ++
 src/PanelCommandConfig.h     |  8 ++++
 src/PanelCommandTable.cpp    | 62 +++++++++++++++++++++++++
 src/PanelCommandTable.h      |  9 ++++
 src/PanelCommandTypes.cpp    | 20 ++++++++-
 src/PanelCommandTypes.h      |  4 ++
 src/PanelConfigDefault.cpp   | 10 +++++
 src/PanelConfigDefault.h     |  4 ++
 src/PanelConfigDirection.cpp | 29 ++++++++++++
 src/PanelConfigDirection.h   |  4 ++
 src/PanelConfigGear.cpp      | 29 ++++++++++++
 src/PanelConfigGear.h        |  4 ++
 src/PanelConfigPause.cpp     | 29 ++++++++++++
 src/PanelConfigPause.h       |  4 ++
 src/RoverDialog.h            | 12 +++++
 src/TableCommandModel.cpp    | 31 +++++++++++++
 src/TableCommandModel.h      | 23 ++++++++++
 20 files changed, 396 insertions(+), 2 deletions(-)

diff --git a/src/AboutDialog.h b/src/AboutDialog.h
index 684cc08..a19618e 100644
--- a/src/AboutDialog.h
+++ b/src/AboutDialog.h
@@ -4,6 +4,10 @@
 #include <QTextEdit>
 #include <QPushButton>
 
+/**
+ * @brief Used to display the About Window.
+ *  Use .exec() to display modally.
+ */
 class AboutDialog : public QDialog
 {
 
@@ -20,6 +24,11 @@ private:
         "https://github.com/tobiglaser/java2cpp"};
 
 public:
+    /**
+     * @brief Construct a new About Dialog object
+     *  Sets View and connects the button to the accept slot,
+     *  closing the window.
+     */
     AboutDialog()
     {
         setWindowTitle("About");
diff --git a/src/ComTypeListWidgetItem.h b/src/ComTypeListWidgetItem.h
index c470651..37b9822 100644
--- a/src/ComTypeListWidgetItem.h
+++ b/src/ComTypeListWidgetItem.h
@@ -3,7 +3,11 @@
 
 #include "CommandType.h"
 
-
+/**
+ * @brief An Adapter or Proxy between CommandType and the QListWidget.
+ *  QListWidget can only display QListWidgetItems, but we need to
+ *  remember the according CommandType as well.
+ */
 class ComTypeListWidgetItem : public QListWidgetItem
 {
 
@@ -12,11 +16,21 @@ private:
 
 public:
 
+    /**
+     * @brief Construct a new Com Type List Widget Item object.
+     *  Sets the CommandType* and displays it's name with getName().
+     * @param _cT 
+     */
     ComTypeListWidgetItem(CommandType *_cT)
     {
         cT = _cT;
         if (cT)
             setText(cT->getName().c_str());
     }
+    /**
+     * @brief Get the Command Type object
+     * 
+     * @return CommandType* The saved CommandType.
+     */
     CommandType *getCommandType() { return cT; }
 };
diff --git a/src/ControlUI.cpp b/src/ControlUI.cpp
index 44d5359..1cc4d0c 100644
--- a/src/ControlUI.cpp
+++ b/src/ControlUI.cpp
@@ -12,6 +12,11 @@
 #include "RoverDialog.h"
 #include "AboutDialog.h"
 
+/**
+ * @brief Construct a new ControlUI:: ControlUI object.
+ *  Fill the array of configPanels, set View, control and add a Menubar.
+ * @param parent An overlying widget, if it would exist. In our case none.
+ */
 ControlUI::ControlUI(QWidget *parent)
     : QMainWindow(parent)
 {
@@ -27,6 +32,10 @@ ControlUI::ControlUI(QWidget *parent)
     setController();
 }
 
+/**
+ * @brief Fill the MainWindow with Widgets.
+ * 
+ */
 void ControlUI::setView()
 {
     setWindowTitle("ControlDeveloper");
@@ -52,6 +61,15 @@ void ControlUI::setView()
     }
 }
 
+/**
+ * @brief Add a MenuBar to the MainWindow.
+ *  The Items in the Menus are QActions which could also be
+ *  used in a QToolbar.
+ * 
+ * @attention This Function has been renamed to AddMenuBar
+ *  because the MainWindow already has a setMenuBar() function
+ *  to add one to the GUI.
+ */
 void ControlUI::addMenuBar()
 {
     menuBar = new QMenuBar();
@@ -72,6 +90,11 @@ void ControlUI::addMenuBar()
     mHelp->addAction(aAbout);
 }
 
+/**
+ * @brief Connect the Buttons with the according slots,
+ *  subscribe to the ControlModel and
+ *  and connect the Panels update signals to updateConfigView().
+ */
 void ControlUI::setController()
 {
     ControlModel::getInstance().addControlModelListener(this);
@@ -85,11 +108,26 @@ void ControlUI::setController()
     connect(panelTable, SIGNAL(pleaseUpdateConfig(std::shared_ptr<ICommand>)), this, SLOT(updateConfigView(std::shared_ptr<ICommand>)));
 }
 
+/**
+ * @brief The central starting point for table updates from anywhere in the GUI.
+ *  Simply tells the tablePanel to update the Table.
+ *  This Function has been declared a slot so that it can be connected 
+ *  to the pleaseUpdateTable() signals from other Panels.
+ *  The function can still be called directly.
+ * @param _icom The Command which to update.
+ */
 void ControlUI::updateTableView(std::shared_ptr<ICommand> _icom)
 {
     panelTable->updateTable(_icom);
 }
 
+/**
+ * @brief Used to set the configPanel to the right type and Command.
+ *  This Function has been declared a slot so that it can be connected 
+ *  to the pleaseUpdateConfig() signals from other Panels.
+ *  The function can still be called directly.
+ * @param _icom The Command which will be edited in the configPanel.
+ */
 void ControlUI::updateConfigView(std::shared_ptr<ICommand> _icom)
 {
     if (dynamic_pointer_cast<IGear>(_icom))
@@ -104,17 +142,34 @@ void ControlUI::updateConfigView(std::shared_ptr<ICommand> _icom)
     static_cast<PanelCommandConfig *>(configStack->currentWidget())->update(_icom);
 }
 
+/**
+ * @brief A function of the IControlModelListener interface.
+ *  Appends the message to the TextEdit.
+ *  append() adds the string in a new Line.
+ * @param _message the message to be displayed.
+ */
 void ControlUI::messageUpdated(std::string _message)
 {
     messageArea->append(_message.c_str());
 }
 
+/**
+ * @brief A function of the IControlModelListener interface.
+ *  Calls messageUpdated() to inform of the rover selection.
+ *  Tells the tablePanel to update the selected rover field.
+ */
 void ControlUI::roverUpdated()
 {
     panelTable->updateSelectedRover();
     messageUpdated("A Rover has been selected.");
 }
 
+/**
+ * @brief Called from a QAction in the Menubar.
+ *  Uses a QFileDialog to get a filepath,
+ *  if successful it calls ControlModel.readCommands()
+ *  and calls updateTableView with no specified Command.
+ */
 void ControlUI::onOpen()
 {
     QString filter = "Text Files (*.txt)";
@@ -126,6 +181,12 @@ void ControlUI::onOpen()
     }
 }
 
+/**
+ * @brief Called from a QAction in the Menubar.
+ *  Uses a QFileDialog to get a filepath,
+ *  if successful calls ControlModel.writeCommands()
+ *  to save the list to a file.
+ */
 void ControlUI::onSave()
 {
     QString filter = "Text Files (*.txt)";
@@ -137,23 +198,49 @@ void ControlUI::onSave()
     }
 }
 
+/**
+ * @brief Called from a QAction in the Menubar.
+ *  Opens the RoverDialog which will select a Rover.
+ *  the dialog is displayed with exec() rather than show().
+ *  This way the Dialog is modal, meaning the rest pf the program
+ *  blocks until it is closed.
+ */
 void ControlUI::onRover()
 {
     RoverDialog r(&ControlModel::getInstance());
     r.exec();
 }
 
+/**
+ * @brief Called from a QAction in the Menubar.
+ *  Simply calls QApplication::exit() to exit the application.
+ */
 void ControlUI::onExit()
 {
     QApplication::exit();
 }
 
+/**
+ * @brief Called from a QAction in the Menubar.
+ *  Opens the AboutDialog to display information about the program.
+ *  The dialog is displayed with exec() rather than show().
+ *  This way the Dialog is modal, meaning the rest pf the program
+ *  blocks until it is closed.
+ */
 void ControlUI::onAbout()
 {
     AboutDialog a;
     a.exec();
 }
 
+/**
+ * @brief Destroy the ControlUI:: ControlUI object
+ *  Because QActions can be represented by multiple elements of the GUI
+ *  e.g. MenuBar and ToolBar none of them can reliably take ownership of the Actions.
+ *  Bacause of this we delete them ourselves.
+ *  Likely this doesn't matter much as the ControlUI will live as long as the program
+ *  and the memory is cleared by the OS after that anyway.
+ */
 ControlUI::~ControlUI()
 {
     delete aOpen;
diff --git a/src/ControlUI.h b/src/ControlUI.h
index b0a4063..7a50fa6 100644
--- a/src/ControlUI.h
+++ b/src/ControlUI.h
@@ -15,6 +15,10 @@
 #include "PanelCommandTable.h"
 #include "PanelCommandTypes.h"
 
+/**
+ * @brief Central Element of the GUI.
+ * 
+ */
 class ControlUI : public QMainWindow, IControlModelListener
 {
     Q_OBJECT
diff --git a/src/PanelCommandConfig.h b/src/PanelCommandConfig.h
index 62e099b..c43b85f 100644
--- a/src/PanelCommandConfig.h
+++ b/src/PanelCommandConfig.h
@@ -3,6 +3,10 @@
 #include <memory>
 #include "commandlib.h"
 
+/**
+ * @brief An abstract base class to be able to switch
+ *  between more specific panels for each Command type.
+ */
 class PanelCommandConfig : public QWidget
 {
 
@@ -10,5 +14,9 @@ protected:
     std::shared_ptr<ICommand> command;
 
 public:
+    /**
+     * @brief Should update the parameters displayed in the
+     *  LineEdits according to the selected Command.
+     */
     virtual void update(std::shared_ptr<ICommand>) = 0;
 };
diff --git a/src/PanelCommandTable.cpp b/src/PanelCommandTable.cpp
index 7b84dbc..a5cd7da 100644
--- a/src/PanelCommandTable.cpp
+++ b/src/PanelCommandTable.cpp
@@ -2,6 +2,11 @@
 #include <QBoxLayout>
 #include <QHeaderView>
 
+/**
+ * @brief Construct a new Panel Command Table:: Panel Command Table object
+ *  Remember the ControlModel, set Widgets and connect Buttons.
+ * @param _cM Pointer to the ControlModel
+ */
 PanelCommandTable::PanelCommandTable(ControlModel *_cM)
 {
     cM = _cM;
@@ -9,6 +14,10 @@ PanelCommandTable::PanelCommandTable(ControlModel *_cM)
     setController();
 }
 
+/**
+ * @brief Fill the Widgets and parametrize them.
+ *  Also get the SelectionModel and udate the Rover Label
+ */
 void PanelCommandTable::setView()
 {
     QBoxLayout *vLayout = new QBoxLayout(QBoxLayout::Direction::TopToBottom);
@@ -48,6 +57,10 @@ void PanelCommandTable::setView()
     updateSelectedRover();
 }
 
+/**
+ * @brief Connect the Buttons to the respective slots.
+ *  Connect currentRowChanged() of the SelectionModel to the respective slot.
+ */
 void PanelCommandTable::setController()
 {
     connect(bRemove, SIGNAL(clicked()), this, SLOT(onRemoveButton()));
@@ -58,6 +71,16 @@ void PanelCommandTable::setController()
     connect(lSM,     SIGNAL(currentRowChanged(const QModelIndex, const QModelIndex)), this, SLOT(onSelectionChange(const QModelIndex, const QModelIndex)));
 }
 
+/**
+ * @brief First the currently selected row is fetched.
+ *  Second the selection is then reset in case the selected index
+ *  would no more be valid after the removal.
+ *  Third CommandList.remove() is called, the returned ICommand is not saved.
+ *  Fourth a reasonable new selection is searched.
+ *  Select the first or last element if those were removed
+ *  or select the same row as was already selected.
+ *  The selection is done updateTable().
+ */
 void PanelCommandTable::onRemoveButton()
 {
     int index = lSM->currentIndex().row();
@@ -76,6 +99,11 @@ void PanelCommandTable::onRemoveButton()
     }
 }
 
+/**
+ * @brief Get the current selection, if it is valid call CommandList.moveUp()
+ *  and initialize a tableUpdate by emitting pleaseUpdateTable() with the changed Command.
+ * 
+ */
 void PanelCommandTable::onUpButton()
 {
     int index = lSM->currentIndex().row();
@@ -86,6 +114,11 @@ void PanelCommandTable::onUpButton()
     }
 }
 
+/**
+ * @brief Get the current selection, if it is valid call CommandList.moveDown()
+ *  and initialize a tableUpdate by emitting pleaseUpdateTable() with the changed Command.
+ * 
+ */
 void PanelCommandTable::onDownButton()
 {
     int index = lSM->currentIndex().row();
@@ -96,16 +129,33 @@ void PanelCommandTable::onDownButton()
     }
 }
 
+/**
+ * @brief Tell the ControlModel to start the execution.
+ * 
+ */
 void PanelCommandTable::onStartButton()
 {
     cM->start();
 }
 
+/**
+ * @brief Tell the ControlModel to stop the execution.
+ * 
+ */
 void PanelCommandTable::onStopButton()
 {
     cM->stop();
 }
 
+/**
+ * @brief Tell the tableModel to inform it's listeners of updated data.
+ *  Afterwards check set the either set the selection to the changed Command
+ *  or remove it if no specific Command was changed.
+ *  This also happend when a command is tried to be moved out of bounds of the list
+ *  or the last item is removed.
+ * 
+ * @param _icom the changed Command that should be selected.
+ */
 void PanelCommandTable::updateTable(std::shared_ptr<ICommand> _icom)
 {
     tM->onChange(_icom);
@@ -119,6 +169,11 @@ void PanelCommandTable::updateTable(std::shared_ptr<ICommand> _icom)
     lSM->setCurrentIndex(index, QItemSelectionModel::SelectionFlag::ClearAndSelect | QItemSelectionModel::SelectionFlag::Rows);
 }
 
+/**
+ * @brief Get the selected Rover from the ControlModel.
+ *  Change the roverLabel according to the result.
+ *  With optional.value_or() this could have been a neat one-liner.
+ */
 void PanelCommandTable::updateSelectedRover()
 {
     std::optional<std::string> roverId = cM->getSelectedRoverId();
@@ -132,6 +187,13 @@ void PanelCommandTable::updateSelectedRover()
         lRover->setText("Rover: - ");
 }
 
+/**
+ * @brief From the currently selected row get the ICommand
+ *  and initialize the update of the configPanel.
+ * 
+ * @param current currently selected index
+ * @param previous previously selected index
+ */
 void PanelCommandTable::onSelectionChange(const QModelIndex &current, const QModelIndex &previous)
 {
     int index = current.row() + 1;
diff --git a/src/PanelCommandTable.h b/src/PanelCommandTable.h
index 6d0817c..3e6acd8 100644
--- a/src/PanelCommandTable.h
+++ b/src/PanelCommandTable.h
@@ -8,6 +8,15 @@
 #include "ControlModel.h"
 #include "TableCommandModel.h"
 
+/**
+ * @brief The middle Panel displaying many Buttons to modify the list,
+ *  to start and stop the execution, info about the rover
+ *  and of course the list itself in form of a table.
+ * 
+ *  Because of include loops the ControlUI can not be known by this Panel.
+ *  That is why the signals where introduced as an anonymous way to communicate any changes.
+ *  pleaseUpdateTable() is kind of useless as the table model is managed by this class anyway.
+ */
 class PanelCommandTable : public QWidget
 {
 
diff --git a/src/PanelCommandTypes.cpp b/src/PanelCommandTypes.cpp
index bd73293..2974b82 100644
--- a/src/PanelCommandTypes.cpp
+++ b/src/PanelCommandTypes.cpp
@@ -3,7 +3,11 @@
 #include "PanelCommandTypes.h"
 #include "ComTypeListWidgetItem.h"
 
-
+/**
+ * @brief Construct a new Panel Command Types:: Panel Command Types object.
+ *  set View and Controller.
+ * @param _cM Pointer to the ControlModel.
+ */
 PanelCommandTypes::PanelCommandTypes(ControlModel *_cM)
 {
     cM = _cM;
@@ -11,6 +15,10 @@ PanelCommandTypes::PanelCommandTypes(ControlModel *_cM)
     setController();
 }
 
+/**
+ * @brief Set up and configure all the Widgets
+ * 
+ */
 void PanelCommandTypes::setView()
 {
     QBoxLayout *layout = new QBoxLayout(QBoxLayout::Direction::TopToBottom);
@@ -26,11 +34,21 @@ void PanelCommandTypes::setView()
     }
 }
 
+/**
+ * @brief Connect the Button to the onAddButton callback function.
+ * 
+ */
 void PanelCommandTypes::setController()
 {
     connect(bAdd, SIGNAL(clicked()), this, SLOT(onAddButton()));
 }
 
+/**
+ * @brief Add an ICommand of the selected Type to the CommandList.
+ *  The selected QListWidgetItem is cast to ComTypeListWidgetItem
+ *  to be able to extract the CommandType.
+ *  Emits pleaseUpdateTable() for the new ICommand.
+ */
 void PanelCommandTypes::onAddButton()
 {
     ComTypeListWidgetItem *listItem = dynamic_cast<ComTypeListWidgetItem*>(commandTypeList->currentItem());
diff --git a/src/PanelCommandTypes.h b/src/PanelCommandTypes.h
index 4d05dcb..95cb83a 100644
--- a/src/PanelCommandTypes.h
+++ b/src/PanelCommandTypes.h
@@ -3,6 +3,10 @@
 #include <QPushButton>
 #include "ControlModel.h"
 
+/**
+ * @brief A Panel to select one of the possible CommandTypes
+ *  and add them to the CommandList.
+ */
 class PanelCommandTypes : public QWidget
 {
 
diff --git a/src/PanelConfigDefault.cpp b/src/PanelConfigDefault.cpp
index a820e4e..e6a1bf3 100644
--- a/src/PanelConfigDefault.cpp
+++ b/src/PanelConfigDefault.cpp
@@ -1,10 +1,20 @@
 #include "PanelConfigDefault.h"
 
+/**
+ * @brief Construct a new Panel Config Default:: Panel Config Default object.
+ *  Do nothing
+ * @param _cui Remembers the ControlUI, but never uses it.
+ */
 PanelConfigDefault::PanelConfigDefault(ControlUI *_cui)
 {
     cui = _cui;
 }
 
+/**
+ * @brief Do nothing
+ * 
+ * @param icom irrelevant
+ */
 void PanelConfigDefault::update(std::shared_ptr<ICommand> icom)
 {
 }
\ No newline at end of file
diff --git a/src/PanelConfigDefault.h b/src/PanelConfigDefault.h
index 5efaa07..c0abbf0 100644
--- a/src/PanelConfigDefault.h
+++ b/src/PanelConfigDefault.h
@@ -2,6 +2,10 @@
 #include "PanelCommandConfig.h"
 #include "ControlUI.h"
 
+/**
+ * @brief The ConfigPanel displayed by default.
+ *  It is empty and does nothing.
+ */
 class PanelConfigDefault : public PanelCommandConfig
 {
 
diff --git a/src/PanelConfigDirection.cpp b/src/PanelConfigDirection.cpp
index e0fcfc5..9ce16dd 100644
--- a/src/PanelConfigDirection.cpp
+++ b/src/PanelConfigDirection.cpp
@@ -5,6 +5,11 @@
 #include <QLabel>
 #include <memory>
 
+/**
+ * @brief Construct a new Panel Config Direction:: Panel Config Direction object.
+ *  Remember the ControlUI, setup Widgets and Button
+ * @param _cui a pointer to the ControlUI.
+ */
 PanelConfigDirection::PanelConfigDirection(ControlUI *_cui)
 {
     cui = _cui;
@@ -12,6 +17,12 @@ PanelConfigDirection::PanelConfigDirection(ControlUI *_cui)
     setController();
 }
 
+/**
+ * @brief Fill the Panel with LineEdits for each Variable of the Command.
+ *  A FormLayout is used for simplicity.
+ *  To display text underneath the LineEdit an empty String is displayed
+ *  on the left and an anonymous Label is displayed on the right.
+ */
 void PanelConfigDirection::setView()
 {
     QVBoxLayout *vl = new QVBoxLayout();
@@ -28,11 +39,20 @@ void PanelConfigDirection::setView()
     fl->addRow("", new QLabel("-90 to +90 degree"));
 }
 
+/**
+ * @brief Connect the Button to the onSaveButton slot.
+ * 
+ */
 void PanelConfigDirection::setController()
 {
     connect(bSave, SIGNAL(clicked()), this, SLOT(onSaveButton()));
 }
 
+/**
+ * @brief Remember the Command, extract its values and display them in the LineEdit(s)
+ * 
+ * @param icom The Command to edit.
+ */
 void PanelConfigDirection::update(std::shared_ptr<ICommand> icom)
 {
     command = icom;
@@ -44,6 +64,15 @@ void PanelConfigDirection::update(std::shared_ptr<ICommand> icom)
     }
 }
 
+/**
+ * @brief Extract the numbers from the LineEdit(s)
+ *  and set the according parameter in the Command.
+ *  Afterwards update the ConfigPanel again to display the new correct new values
+ *  and tell the ControlUI to update the Table.
+ *  Here a direct call to updateTableView() is used, but it would be 
+ *  more consistent with the other Panels to emit a signal and connect inside ControlUI.
+ *  That way the Panel would not have to know ControlUI.
+ */
 void PanelConfigDirection::onSaveButton()
 {
     int deg = tDegree->text().toInt();
diff --git a/src/PanelConfigDirection.h b/src/PanelConfigDirection.h
index 797d06c..bb96a31 100644
--- a/src/PanelConfigDirection.h
+++ b/src/PanelConfigDirection.h
@@ -4,6 +4,10 @@
 #include "PanelCommandConfig.h"
 #include "ControlUI.h"
 
+/**
+ * @brief The ConfigPanel specific to a Direction Command.
+ * 
+ */
 class PanelConfigDirection : public PanelCommandConfig
 {
 
diff --git a/src/PanelConfigGear.cpp b/src/PanelConfigGear.cpp
index 27fb2e8..fa9d10e 100644
--- a/src/PanelConfigGear.cpp
+++ b/src/PanelConfigGear.cpp
@@ -5,6 +5,11 @@
 #include <QLabel>
 #include <memory>
 
+/**
+ * @brief Construct a new Panel Config Gear:: Panel Config Gear object.
+ *  Remember the ControlUI, setup Widgets and Button
+ * @param _cui a pointer to the ControlUI.
+ */
 PanelConfigGear::PanelConfigGear(ControlUI *_cui)
 {
     cui = _cui;
@@ -12,6 +17,12 @@ PanelConfigGear::PanelConfigGear(ControlUI *_cui)
     setController();
 }
 
+/**
+ * @brief Fill the Panel with LineEdits for each Variable of the Command.
+ *  A FormLayout is used for simplicity.
+ *  To display text underneath the LineEdit an empty String is displayed
+ *  on the left and an anonymous Label is displayed on the right.
+ */
 void PanelConfigGear::setView()
 {
     QVBoxLayout *vl = new QVBoxLayout();
@@ -31,11 +42,20 @@ void PanelConfigGear::setView()
     fl->addRow("", new QLabel("max 8s"));
 }
 
+/**
+ * @brief Connect the Button to the onSaveButton slot.
+ * 
+ */
 void PanelConfigGear::setController()
 {
     connect(bSave, SIGNAL(clicked()), this, SLOT(onSaveButton()));
 }
 
+/**
+ * @brief Remember the Command, extract its values and display them in the LineEdit(s)
+ * 
+ * @param icom The Command to edit.
+ */
 void PanelConfigGear::update(std::shared_ptr<ICommand> icom)
 {
     command = icom;
@@ -49,6 +69,15 @@ void PanelConfigGear::update(std::shared_ptr<ICommand> icom)
     }
 }
 
+/**
+ * @brief Extract the numbers from the LineEdit(s)
+ *  and set the according parameter in the Command.
+ *  Afterwards update the ConfigPanel again to display the new correct new values
+ *  and tell the ControlUI to update the Table.
+ *  Here a direct call to updateTableView() is used, but it would be 
+ *  more consistent with the other Panels to emit a signal and connect inside ControlUI.
+ *  That way the Panel would not have to know ControlUI.
+ */
 void PanelConfigGear::onSaveButton()
 {
     int speed = tSpeed->text().toInt();
diff --git a/src/PanelConfigGear.h b/src/PanelConfigGear.h
index e99ea08..223fc0e 100644
--- a/src/PanelConfigGear.h
+++ b/src/PanelConfigGear.h
@@ -4,6 +4,10 @@
 #include "PanelCommandConfig.h"
 #include "ControlUI.h"
 
+/**
+ * @brief The ConfigPanel specific to a Gear Command.
+ * 
+ */
 class PanelConfigGear : public PanelCommandConfig
 {
 
diff --git a/src/PanelConfigPause.cpp b/src/PanelConfigPause.cpp
index 8c827f5..7a8e9a6 100644
--- a/src/PanelConfigPause.cpp
+++ b/src/PanelConfigPause.cpp
@@ -5,6 +5,11 @@
 #include <QLabel>
 #include <memory>
 
+/**
+ * @brief Construct a new Panel Config Pause:: Panel Config Pause object.
+ *  Remember the ControlUI, setup Widgets and Button
+ * @param _cui a pointer to the ControlUI.
+ */
 PanelConfigPause::PanelConfigPause(ControlUI *_cui)
 {
     cui = _cui;
@@ -12,6 +17,12 @@ PanelConfigPause::PanelConfigPause(ControlUI *_cui)
     setController();
 }
 
+/**
+ * @brief Fill the Panel with LineEdits for each Variable of the Command.
+ *  A FormLayout is used for simplicity.
+ *  To display text underneath the LineEdit an empty String is displayed
+ *  on the left and an anonymous Label is displayed on the right.
+ */
 void PanelConfigPause::setView()
 {
     QVBoxLayout *vl = new QVBoxLayout();
@@ -28,11 +39,20 @@ void PanelConfigPause::setView()
     fl->addRow("", new QLabel("max 8s"));
 }
 
+/**
+ * @brief Connect the Button to the onSaveButton slot.
+ * 
+ */
 void PanelConfigPause::setController()
 {
     connect(bSave, SIGNAL(clicked()), this, SLOT(onSaveButton()));
 }
 
+/**
+ * @brief Remember the Command, extract its values and display them in the LineEdit(s)
+ * 
+ * @param icom The Command to edit.
+ */
 void PanelConfigPause::update(std::shared_ptr<ICommand> icom)
 {
     command = icom;
@@ -44,6 +64,15 @@ void PanelConfigPause::update(std::shared_ptr<ICommand> icom)
     }
 }
 
+/**
+ * @brief Extract the numbers from the LineEdit(s)
+ *  and set the according parameter in the Command.
+ *  Afterwards update the ConfigPanel again to display the new correct new values
+ *  and tell the ControlUI to update the Table.
+ *  Here a direct call to updateTableView() is used, but it would be 
+ *  more consistent with the other Panels to emit a signal and connect inside ControlUI.
+ *  That way the Panel would not have to know ControlUI.
+ */
 void PanelConfigPause::onSaveButton()
 {
     double dur = tDuration->text().toDouble();
diff --git a/src/PanelConfigPause.h b/src/PanelConfigPause.h
index 7210acf..103e1ec 100644
--- a/src/PanelConfigPause.h
+++ b/src/PanelConfigPause.h
@@ -4,6 +4,10 @@
 #include "PanelCommandConfig.h"
 #include "ControlUI.h"
 
+/**
+ * @brief The ConfigPanel specific to a Pause Command.
+ * 
+ */
 class PanelConfigPause : public PanelCommandConfig
 {
 
diff --git a/src/RoverDialog.h b/src/RoverDialog.h
index 7c10e40..d216f4e 100644
--- a/src/RoverDialog.h
+++ b/src/RoverDialog.h
@@ -5,6 +5,10 @@
 #include <QPushButton>
 #include "ControlModel.h"
 
+/**
+ * @brief A Dialog to select and acknowledge a Rover.
+ *  The Rover is not acively selected.
+ */
 class RoverDialog : public QDialog
 {
 
@@ -13,6 +17,14 @@ private:
     QPushButton *bOk;
 
 public:
+    /**
+     * @brief Construct a new Rover Dialog object
+     *  Will tell the Model to select a Rover,
+     *  then display the RoverID in a LineEdit.
+     *  The Ok button is connected to accept() closing the window on click.
+     * 
+     * @param cM Pointer to the ControlModel
+     */
     RoverDialog(ControlModel * cM)
     {
         cM->setSelectedRover();
diff --git a/src/TableCommandModel.cpp b/src/TableCommandModel.cpp
index 7b97977..59d500e 100644
--- a/src/TableCommandModel.cpp
+++ b/src/TableCommandModel.cpp
@@ -2,6 +2,17 @@
 #include <QModelIndex>
 #include "commandlib.h"
 
+/**
+ * @brief Data() represents the getValueAt() function.
+ *  It considers not only the text, but also alignment, checkability and more.
+ *  See the Qt Documentation for more details.
+ *  The most important thing is that an empty QVariant means "invalid", "none",
+ *  or "I don't want that!". So we return it whenever we don't know any better.
+ * 
+ * @param index the position of the cell/data
+ * @param role the kind of info the view wants
+ * @return QVariant the result can take just about any time. Again QVariant() -> invalid
+ */
 QVariant TableCommandModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
 {
     if (!index.isValid())
@@ -66,6 +77,15 @@ QVariant TableCommandModel::data(const QModelIndex &index, int role = Qt::Displa
     return ret;
 }
 
+/**
+ * @brief The equivalent to getColumnName(int col) and getRowName(int row).
+ *  returns a value depending on the input parameters.
+ *  See Qt documentation for more details about Roles.
+ * @param section 
+ * @param orientation 
+ * @param role 
+ * @return QVariant columnNames from array or invalid in any other case
+ */
 QVariant TableCommandModel::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
 {
     if(orientation == Qt::Horizontal && role == Qt::DisplayRole)
@@ -74,6 +94,17 @@ QVariant TableCommandModel::headerData(int section, Qt::Orientation orientation,
     return QVariant();
 }
 
+/**
+ * @brief This function has been added because not the View initializes an update,
+ *  but the Model.
+ *  fireTableDataChanged() is represented with either
+ *  dataChanged() if only some of the cells need to fetch an update,
+ *  or layoutChanged() if the dimensions of the table have changed.
+ *  These signals are emitted, they are handled outside our concerns.
+ * 
+ * @param _icom the Command around which the table should be updated.
+ *              if nullptr an update is only triggered if the dimensions changed.
+ */
 void TableCommandModel::onChange(std::shared_ptr<ICommand> _icom)
 {
     if (_icom != nullptr)
diff --git a/src/TableCommandModel.h b/src/TableCommandModel.h
index 3b415bb..f4c2de3 100644
--- a/src/TableCommandModel.h
+++ b/src/TableCommandModel.h
@@ -3,6 +3,11 @@
 #include <array>
 #include "CommandListOWN.h"
 
+/**
+ * @brief The Model representing the data displayed in the
+ *  QTableView of PanelCommandTabel.
+ * 
+ */
 class TableCommandModel : public QAbstractTableModel
 {
 private:
@@ -11,11 +16,29 @@ private:
     int rowsBefore = 0;
 
 public:
+    /**
+     * @brief Construct a new Table Command Model object
+     *  Remember the CommandList pointer.
+     * @param _list 
+     */
     TableCommandModel(CommandList *_list) { cL = _list; }
     QVariant data(const QModelIndex &index, int role) const;
     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
 
+    /**
+     * @brief return the fixed width of the Table (3 columns).
+     * 
+     * @param parent default QModelIndex() means invalid
+     * @return int, width of the Table (3 columns).
+     */
     int columnCount(const QModelIndex &parent = QModelIndex()) const { return 3; }
+
+    /**
+     * @brief return the variable amount of rows in the table.
+     *  The number of elements is fetched from the CommandList.
+     * @param parent default QModelIndex() means invalid
+     * @return int, amount of elements in the list.
+     */
     int rowCount(const QModelIndex &parent = QModelIndex()) const { return cL->getSize(); }
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) { return createIndex(row, column, nullptr); }
-- 
GitLab