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

Last change on this file since 64 was 64, checked in by Thomas Fuhrmann, 5 years ago

Save config on target and save all locally are now working

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