source: flair-src/branches/mavlink/tools/FlairGCS/src/ListWidget.h@ 86

Last change on this file since 86 was 66, checked in by Thomas Fuhrmann, 8 years ago

Add the reset functionality

File size: 3.7 KB
RevLine 
[48]1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
[60]5/*!
6 * \file ListWidget.h
7 * \brief Class displaying a QListWidget on the ground station
8 * \author Thomas Fuhrmann, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2016/07/26
10 * \version 1.0
11 */
[48]12#ifndef LISTWIDGET_H
13#define LISTWIDGET_H
14
15#include "FormLayout.h"
16
17class QListWidget;
18class Layout;
[54]19class QStringList;
[56]20class QListWidgetItem;
21class QPalette;
[66]22class QStringList;
[48]23
[60]24/*! \class ListWidget
25 *
26 * \brief Class displaying a QListWidget on the ground station
27 *
28 */
[48]29class ListWidget : public FormLayout {
30 Q_OBJECT
31
32public:
[60]33 /**
34 * \brief Default constructor
35 *
36 * \param parent The parent widget
37 * \param[in] row The row where to position the widget
38 * \param[in] col The col where to position the widget
39 * \param[in] name The name of the widget
40 */
[48]41 ListWidget(Layout *parent, int row, int col, QString name);
[60]42 /**
43 * \brief Constructor with a list of default items
44 *
45 * \param parent The parent widget
46 * \param[in] row The row where to position the widget
47 * \param[in] col The col where to position the widget
48 * \param[in] name The name of the widget
49 * \param items List of items to display at creation
50 */
51 ListWidget(Layout *parent, int row, int col, QString name,
52 QStringList &items);
53 /**
54 * \brief Destructor
55 */
[48]56 ~ListWidget();
57
58private:
[60]59 /**
60 * \brief Check if the widget is up to date.
61 *
62 * \return True if uptodate, False otherwise.
63 */
64 bool IsUptodate(void);
65 /**
66 * \brief Sets the isUpToDate internal flag.
67 */
68 void SetUptodate(void);
69 /**
70 * \brief Handler to process a new xml file.
71 *
72 * \param[in] dom The dom containing the xml file.
73 */
[48]74 void XmlEvent(QDomElement dom);
[60]75 /**
76 * \brief Reset the widget, load the internal parameters.
77 */
78
[48]79 void Reset(void);
[60]80 /**
81 * \brief Handler to process the loading of the internal xml file.
82 *
83 * \param[in] dom The dom containing the xml file.
84 */
[48]85 void LoadEvent(QDomElement dom);
[60]86 /**
87 * \brief Save the user interface variables state in the internal members.
88 */
[56]89 void ui_to_var(void);
[60]90 /**
91 * \brief Save the user interface variables state in the internal xml file.
92 */
[56]93 void ui_to_xml(void);
[60]94 /**
[64]95 * \brief Removes the row_to_del element from the internal xml file.
96 *
97 * As the order of the elements is important, all the elements after the one
98 * deleted are shifted to occupy the blank space.
99 *
100 * \param[in] row_to_del The row of the element to delete.
101 */
102 void RemoveItemFromXml(int row_to_del);
103 /**
[60]104 * Pointer to the managed QListWidget widget.
105 */
106 QListWidget *listwidget;
107 /**
[66]108 * Store the list of all the items, in order to use the Reset function.
109 */
110 QStringList *internalItemsList;
111 /**
[60]112 * The row of the currently selected item.
113 */
114 int currentItemRow;
115 /**
116 * Flag to know if the widget is up to date.
117 */
118 bool isUpToDate;
119 /**
120 * Redefined color palette.
121 * The highlight item's text appears in red.
122 */
123 QPalette palListRed;
124 /**
125 * Redefined color palette.
126 * The highlight item's text appears in white (default).
127 */
128 QPalette palListDefault;
[48]129
130private slots:
[60]131 /**
132 * \brief Handle the change of the selected item.
133 *
134 * When the selected item has changed, the text of the newly selected item appears in red,
135 * to notify the user to apply the modification.
136 *
137 * \param[in] current_row The row of the currently selected item.
138 */
[56]139 void SelectedItemChanged(int current_row);
[48]140};
141
142#endif // LISTWIDGET_H
Note: See TracBrowser for help on using the repository browser.