namespace vlp {
namespace dialog {
-NodeListDialog::NodeListDialog(QList<VLPEntry*> *nodes, QWidget * parent)
+NodeListDialog::NodeListDialog(QList<VLPEntry*> nodes, QWidget * parent)
: QDialog(parent)
{
setupUi(this);
bool NodeListDialog::check_id(int id)
{
- QListIterator<VLPEntry *> nodesIterator(*_nodes);
+ QListIterator<VLPEntry *> nodesIterator(_nodes);
VLPEntry *node = NULL;
while (nodesIterator.hasNext()) {
bool NodeListDialog::check_addr(QString addr)
{
- QListIterator<VLPEntry *> nodesIterator(*_nodes);
+ QListIterator<VLPEntry *> nodesIterator(_nodes);
VLPEntry *node = NULL;
while (nodesIterator.hasNext()) {
return true;
}
+QList<VLPEntry*> NodeListDialog::getNodes()
+{
+ return _nodes;
+}
+
void NodeListDialog::on_addButton_clicked()
{
dialog::AddNodeDialog dialog(this);
QListWidgetItem * listWidgetItem = new QListWidgetItem;
listWidgetItem->setText(info);
nodeList->addItem(listWidgetItem);
- _nodes->append(vlpEntry);
+ _nodes.append(vlpEntry);
}
else {
QMessageBox::warning(this,
void NodeListDialog::removeNodes(QList<QListWidgetItem *> selectedNodes)
{
- QListIterator<VLPEntry *> nodesIterator(*_nodes);
+ QListIterator<VLPEntry *> nodesIterator(_nodes);
fprintf(stderr, " > Removing nodes\n");
for (auto selectedItem : selectedNodes) {
fprintf(stderr, " - removed\n");
int row = nodeList->row(selectedItem);
delete nodeList->takeItem(row);
- _nodes->removeOne(node);
+ _nodes.removeOne(node);
}
}
}
class NodeListDialog : public QDialog, private Ui::NodeListDialog {
Q_OBJECT
private:
- QList<VLPEntry*> *_nodes;
+ 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);
+ NodeListDialog(QList<VLPEntry*> nodes, QWidget * parent = 0);
/**
* Class destuctor
*/
bool check_addr(QString addr);
+ QList<VLPEntry*> getNodes();
+
private:
/**
* Removes list of nodes from the list widget
#include <QtGui/QApplication>
-#include <QtGui/QMainWindow>
-#include <Qt3Support/q3multilineedit.h>
-#include <QtGui/QDialog>
-#include <QtGui/QButtonGroup>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <Qt3Support/Q3ListBox>
-#include <QtGui/QPushButton>
-#include <QtGui/QRadioButton>
#include <QtCore/QList>
-#include <QtCore/qfile.h>
-#include <QtGui/qcombobox.h>
-#include <QtGui/QToolTip>
-#include <QtGui/QFont>
-#include <QtGui/QPixmap>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
QInstall::QInstall()
{
setupUi(this);
-
- Nodes.clear();
}
void QInstall::on_actionConfigure_triggered()
{
- dialog::NodeListDialog dialog(&Nodes, this);
+ dialog::NodeListDialog dialog(nodes, this);
if (dialog.exec()) {
- if (!Nodes.isEmpty()) {
+ nodes = dialog.getNodes();
+
+ if (!nodes.isEmpty()) {
VLPEntry *pom;
int i;
char pomstr[255];
- QListIterator<VLPEntry *> nodesIterator(Nodes);
+ QListIterator<VLPEntry *> nodesIterator(nodes);
while (nodesIterator.hasNext()) {
pom = nodesIterator.next();
- i = Nodes.indexOf(pom);
+ i = nodes.indexOf(pom);
sprintf(pomstr, "%s.cfg", pom->addr);
);
std::vector<std::string> hosts;
- for (auto node : Nodes) {
+ for (auto node : nodes) {
if (pom != node) {
hosts.push_back(node->addr);
}
// config_setting_set_string(setting, pom->homedir);
- pom = Nodes.at(i);
+ pom = nodes.at(i);
}
}
}
#define _VLP_LGCONFIG_H
#include <QtGui/QMainWindow>
-#include <QtGui/QPushButton>
#include <QtCore/QList>
-#include <QtGui/QMenuBar>
-
-#include <Qt3Support/Q3ListBox>
#include "ui/VLPConfigWindow.h"
class QInstall: public QMainWindow, private Ui::VLPConfigWindow {
Q_OBJECT
public:
- QList<VLPEntry*> Nodes;
+ QList<VLPEntry*> nodes;
/**
* Class constructor