Move ListNode dialog layout code into separate ui file
[vlp.git] / src / lgconfig / NodeListDialog.h
diff --git a/src/lgconfig/NodeListDialog.h b/src/lgconfig/NodeListDialog.h
new file mode 100644 (file)
index 0000000..65f48b6
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef _VLP_LGCONFIG_NODELISTDIALOG_H
+#define _VLP_LGCONFIG_NODELISTDIALOG_H
+
+#include <QtGui/QDialog>
+#include <QtCore/QString>
+#include <QtCore/QList>
+
+#include "lgconfig.h" /* VLPEntry */
+
+#include "ui/dialogs/NodeListDialog.h"
+
+namespace loglan {
+namespace vlp {
+namespace dialog {
+
+/**
+ * Program Node List Dialog class
+ * Displays dialog for configuring nodes
+ */
+class NodeListDialog : public QDialog, private Ui::NodeListDialog {
+       Q_OBJECT
+private:
+       QList<VLPEntry*> *_nodes;
+public:
+       /**
+        * Class constructor
+        *
+        * @param nodes actual list of nodes to init dialog with
+        * @param parent parent widget for this dialog
+        */
+       NodeListDialog(QList<VLPEntry*> *nodes, QWidget * parent = 0);
+
+       /**
+        * Class destuctor
+        */
+       ~NodeListDialog();
+
+       /**
+        * Checks if node with specified id already exists
+        *
+        * @param id ID of the node to search for
+        * @return true if node with specified ID has been found, false otherwise
+        */
+       bool check_id(int id);
+
+       /**
+        * Checks if node with specified address already exists
+        *
+        * @param addr address of the node to search for
+        * @return true if node with specified address has been found, false otherwise
+        */
+       bool check_addr(QString addr);
+
+private:
+       /**
+        * Removes list of nodes from the list widget
+        */
+       void removeNodes(QList<QListWidgetItem *> selectedNodes);
+
+private slots:
+       void on_addButton_clicked();
+       void on_deleteButton_clicked();
+       void on_saveButton_clicked();
+       void on_cancelButton_clicked();
+};
+
+}
+}
+}
+
+#endif /* _VLP_EDITOR_PROGRAMSTRUCTUREDIALOG_H */