Index: branches/mavlink/tools/FlairGCS/src/ListWidget.cpp
===================================================================
--- branches/mavlink/tools/FlairGCS/src/ListWidget.cpp	(revision 59)
+++ branches/mavlink/tools/FlairGCS/src/ListWidget.cpp	(revision 60)
@@ -15,23 +15,21 @@
 
 ListWidget::ListWidget(Layout *parent, int row, int col, QString name)
-    : FormLayout(parent, row, col, name, "ListWidget") {
+    : currentItemRow(-1), isUpToDate(true),
+      FormLayout(parent, row, col, name, "ListWidget") {
   listwidget = new QListWidget();
+  // construct the object in 2 times, to have the label above the list
   object_layout->addRow(new QLabel(name));
   object_layout->addRow(listwidget);
-
-  list_red_pal.setColor(QPalette::HighlightedText, QColor(255, 0, 0));
-  list_black_pal.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
-
-  current_item_row = -1;
-  is_up_to_date = true;
-
+  // modify the color palette to have the selected item text in red
+  palListRed.setColor(QPalette::HighlightedText, QColor(255, 0, 0));
+  palListDefault.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
   connect(listwidget, SIGNAL(currentRowChanged(int)), this,
           SLOT(SelectedItemChanged(int)));
-
-  // to avoid duplicates when adding items 
+  // to avoid duplicates when adding items
   SetIsExpandable(true);
 }
 
-ListWidget::ListWidget(Layout *parent, int row, int col, QString name, QStringList& items)
+ListWidget::ListWidget(Layout *parent, int row, int col, QString name,
+                       QStringList &items)
     : ListWidget(parent, row, col, name) {
   if (!items.isEmpty()) {
@@ -40,16 +38,16 @@
 }
 
-ListWidget::~ListWidget() { delete listwidget; }
+ListWidget::~ListWidget() {
+  if (listwidget) {
+    delete listwidget;
+  }
+}
 
-//received from the UAV / FlairCore
 void ListWidget::XmlEvent(QDomElement dom) {
-  is_up_to_date = false;
-  // if (dom.attribute("value") != "") {
-  //   int new_row = dom.attribute("value");
-  //   listwidget->setCurrentRow(new_row);
-  // }
+  isUpToDate = false;
   if (dom.attribute("item") != "") {
     QString item = dom.attribute("item");
-    QListWidgetItem* widget_item = new QListWidgetItem(item);
+    QListWidgetItem *widget_item = new QListWidgetItem(item);
+    // new item, so the text is red
     widget_item->setForeground(Qt::red);
     listwidget->addItem(widget_item);
@@ -57,7 +55,7 @@
   if (dom.attribute("delete") != "") {
     int row_to_del = dom.attribute("delete").toInt();
-    QListWidgetItem* item_to_del = listwidget->takeItem(row_to_del);
+    QListWidgetItem *item_to_del = listwidget->takeItem(row_to_del);
     if (item_to_del) {
-      delete item_to_del; 
+      delete item_to_del;
     }
   }
@@ -67,18 +65,21 @@
   ui_to_var();
   ui_to_xml();
-  listwidget->setPalette(list_black_pal);
-  is_up_to_date = true;
+  listwidget->setPalette(palListDefault);
+  isUpToDate = true;
 }
 
-void ListWidget::ui_to_var(void) { current_item_row = listwidget->currentRow(); }
+void ListWidget::ui_to_var(void) {
+  currentItemRow = listwidget->currentRow();
+}
 
 void ListWidget::ui_to_xml(void) {
   SetValue(QString::number(listwidget->currentRow()));
-  //add the list of items
-  for(int count = 0; count < listwidget->count(); count++) {
+  // add the list of items
+  for (int count = 0; count < listwidget->count(); count++) {
     std::string item;
     std::ostringstream item_prop;
     item_prop << "item" << count;
-    SetAttribute(QString::fromStdString(item_prop.str()), listwidget->item(count)->text());
+    SetAttribute(QString::fromStdString(item_prop.str()),
+                 listwidget->item(count)->text());
     listwidget->item(count)->setForeground(Qt::black);
   }
@@ -86,38 +87,31 @@
 
 void ListWidget::Reset(void) {
-  if (current_item_row != -1) {
-    listwidget->setCurrentRow(current_item_row);
+  if (currentItemRow != -1) {
+    listwidget->setCurrentRow(currentItemRow);
   }
 }
 
 void ListWidget::LoadEvent(QDomElement dom) {
-  std::cout << "In LoadEvent" << std::endl;
-  // Parse the item list    
-  // QStringList items;
-  // int count = 0;
-  // while (dom.hasAttribute("item" + QString::number(count))) {
-  //   QString item = dom.attribute("item" + QString::number(count));
-  //   std::cout << "Item" << count << " : " << item.toStdString() << std::endl;
-  //   items.append(item);
-  //   count++;
-  // }
-
-  // listwidget->addItems(items);
-
-  // if (listwidget->isEnabled() == true) {
-    // listwidget->setCurrentIndex((dom.attribute("value")).toInt());
-  // }
+  std::cout << "FlairGCS LoadEvent" << std::endl;
+  if (listwidget->isEnabled() == true) {
+    std::cout << "FlairGCS LoadEvent loading" << std::endl;
+    listwidget->clear();
+    QStringList items;
+    int count = 0;
+    while (dom.hasAttribute("item" + QString::number(count))) {
+      listwidget->addItem(dom.attribute("item" + QString::number(count)));
+      count++;
+    }
+  }
 }
 
 void ListWidget::SelectedItemChanged(int current_row) {
-  if (current_row != current_item_row) {
-    is_up_to_date = false;
-    listwidget->setPalette(list_red_pal);
+  if (current_row != currentItemRow) {
+    isUpToDate = false;
+    listwidget->setPalette(palListRed);
   } else {
-    listwidget->setPalette(list_black_pal);
+    listwidget->setPalette(palListDefault);
   }
 }
 
-bool ListWidget::IsUptodate(void) {
-  return is_up_to_date;
-}
+bool ListWidget::IsUptodate(void) { return isUpToDate; }
Index: branches/mavlink/tools/FlairGCS/src/ListWidget.h
===================================================================
--- branches/mavlink/tools/FlairGCS/src/ListWidget.h	(revision 59)
+++ branches/mavlink/tools/FlairGCS/src/ListWidget.h	(revision 60)
@@ -3,4 +3,11 @@
 // CECILL-C License, Version 1.0.
 // %flair:license}
+/*!
+ * \file ListWidget.h
+ * \brief Class displaying a QListWidget on the ground station
+ * \author Thomas Fuhrmann, Copyright Heudiasyc UMR UTC/CNRS 7253
+ * \date 2016/07/26
+ * \version 1.0
+ */
 #ifndef LISTWIDGET_H
 #define LISTWIDGET_H
@@ -14,28 +21,106 @@
 class QPalette;
 
+/*! \class ListWidget
+ *
+ * \brief Class displaying a QListWidget on the ground station
+ *
+ */
 class ListWidget : public FormLayout {
   Q_OBJECT
 
 public:
+  /**
+   * \brief      Default constructor
+   *
+   * \param      parent  The parent widget
+   * \param[in]  row     The row where to position the widget
+   * \param[in]  col     The col where to position the widget
+   * \param[in]  name    The name of the widget
+   */
   ListWidget(Layout *parent, int row, int col, QString name);
-  ListWidget(Layout *parent, int row, int col, QString name, QStringList& items);
+  /**
+   * \brief      Constructor with a list of default items
+   *
+   * \param      parent  The parent widget
+   * \param[in]  row     The row where to position the widget
+   * \param[in]  col     The col where to position the widget
+   * \param[in]  name    The name of the widget
+   * \param      items   List of items to display at creation
+   */
+  ListWidget(Layout *parent, int row, int col, QString name,
+             QStringList &items);
+  /**
+   * \brief      Destructor
+   */
   ~ListWidget();
 
 private:
-  QListWidget* listwidget;
-  int current_item_row;
-  bool is_up_to_date;
-  QPalette list_red_pal;
-  QPalette list_black_pal;
+  /**
+   * \brief      Check if the widget is up to date.
+   *
+   * \return     True if uptodate, False otherwise.
+   */
+  bool IsUptodate(void);
+  /**
+   * \brief      Sets the isUpToDate internal flag.
+   */
+  void SetUptodate(void);
+  /**
+   * \brief      Handler to process a new xml file.
+   *
+   * \param[in]  dom   The dom containing the xml file.
+   */
   void XmlEvent(QDomElement dom);
-  void SetUptodate(void);
+  /**
+   * \brief      Reset the widget, load the internal parameters.
+   */
+
   void Reset(void);
+  /**
+   * \brief      Handler to process the loading of the internal xml file.
+   *
+   * \param[in]  dom   The dom containing the xml file.
+   */
   void LoadEvent(QDomElement dom);
-  bool IsUptodate(void);
-
+  /**
+   * \brief      Save the user interface variables state in the internal members.
+   */
   void ui_to_var(void);
+  /**
+   * \brief      Save the user interface variables state in the internal xml file.
+   */
   void ui_to_xml(void);
+  /**
+   * Pointer to the managed QListWidget widget.
+   */
+  QListWidget *listwidget;
+  /**
+   * The row of the currently selected item.
+   */
+  int currentItemRow;
+  /**
+   * Flag to know if the widget is up to date.
+   */
+  bool isUpToDate;
+  /**
+   * Redefined color palette.
+   * The highlight item's text appears in red.
+   */
+  QPalette palListRed;
+  /**
+   * Redefined color palette.
+   * The highlight item's text appears in white (default).
+   */
+  QPalette palListDefault;
 
 private slots:
+  /**
+   * \brief      Handle the change of the selected item.
+   * 
+   * When the selected item has changed, the text of the newly selected item appears in red,
+   * to notify the user to apply the modification.
+   *
+   * \param[in]  current_row  The row of the currently selected item.
+   */
   void SelectedItemChanged(int current_row);
 };
