e75e632cbd3ca1d144e20932c5e563706c18fc4c
[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 /**
13  * @file
14  */
15
16 namespace loglan {
17 namespace vlp {
18 namespace dialog {
19
20 /**
21  * Program Node List Dialog class
22  * Displays dialog for configuring nodes
23  */
24 class NodeListDialog : public QDialog, private Ui::NodeListDialog {
25         Q_OBJECT
26 private:
27         QList<VLPEntry*> _nodes;
28 public:
29         /**
30          * Class constructor
31          *
32          * @param nodes actual list of nodes to init dialog with
33          * @param parent parent widget for this dialog
34          */
35         NodeListDialog(QList<VLPEntry*> nodes, QWidget * parent = 0);
36
37         /**
38          * Class destuctor
39          */
40         ~NodeListDialog();
41
42         /**
43          * Checks if node with specified id already exists
44          *
45          * @param id ID of the node to search for
46          * @return true if node with specified ID has been found, false otherwise
47          */
48         bool check_id(int id);
49
50         /**
51          * Checks if node with specified address already exists
52          *
53          * @param addr address of the node to search for
54          * @return true if node with specified address has been found, false otherwise
55          */
56         bool check_addr(QString addr);
57
58         QList<VLPEntry*> getNodes();
59
60 private:
61         /**
62          * Removes list of nodes from the list widget
63          */
64         void removeNodes(QList<QListWidgetItem *> selectedNodes);
65
66 private slots:
67         void on_addButton_clicked();
68         void on_deleteButton_clicked();
69         void on_saveButton_clicked();
70         void on_cancelButton_clicked();
71 };
72
73 }
74 }
75 }
76
77 #endif /* _VLP_EDITOR_PROGRAMSTRUCTUREDIALOG_H */