9967ae3f0f32843826b5235bce669b4ec6f7811f
[vlp.git] / src / lgconfig / NodeListDialog.h
1 #ifndef _VLP_LGCONFIG_NODELISTDIALOG_H
2 #define _VLP_LGCONFIG_NODELISTDIALOG_H
3
4 #include <QtGui/QDialog>
5 #include <QtCore/QString>
6 #include <QtCore/QList>
7
8 #include "lgconfig.h" /* VLPEntry */
9
10 #include "ui/dialogs/NodeListDialog.h"
11
12 namespace loglan {
13 namespace vlp {
14 namespace dialog {
15
16 /**
17  * Program Node List Dialog class
18  * Displays dialog for configuring nodes
19  */
20 class NodeListDialog : public QDialog, private Ui::NodeListDialog {
21         Q_OBJECT
22 private:
23         QList<VLPEntry*> _nodes;
24 public:
25         /**
26          * Class constructor
27          *
28          * @param nodes actual list of nodes to init dialog with
29          * @param parent parent widget for this dialog
30          */
31         NodeListDialog(QList<VLPEntry*> nodes, QWidget * parent = 0);
32
33         /**
34          * Class destuctor
35          */
36         ~NodeListDialog();
37
38         /**
39          * Checks if node with specified id already exists
40          *
41          * @param id ID of the node to search for
42          * @return true if node with specified ID has been found, false otherwise
43          */
44         bool check_id(int id);
45
46         /**
47          * Checks if node with specified address already exists
48          *
49          * @param addr address of the node to search for
50          * @return true if node with specified address has been found, false otherwise
51          */
52         bool check_addr(QString addr);
53
54         QList<VLPEntry*> getNodes();
55
56 private:
57         /**
58          * Removes list of nodes from the list widget
59          */
60         void removeNodes(QList<QListWidgetItem *> selectedNodes);
61
62 private slots:
63         void on_addButton_clicked();
64         void on_deleteButton_clicked();
65         void on_saveButton_clicked();
66         void on_cancelButton_clicked();
67 };
68
69 }
70 }
71 }
72
73 #endif /* _VLP_EDITOR_PROGRAMSTRUCTUREDIALOG_H */