Moved connect dialog layout code into separate ui file
[vlp.git] / src / kernel / kernel.cpp
index 2052fed9a47536a9de7512e551592b34ecf9ed77..578498c4774bbb3a65c6482a1470efcb955d998e 100644 (file)
@@ -69,6 +69,7 @@
 #include "lock.h"
 #include "options.h"
 #include "kill_interpreter_dialog.h"
+#include "connect_dialog.h"
 
 /* File resides in top directory (where are Makefiles)*/
 #include "../../config.h"
@@ -462,30 +463,16 @@ void QKernel::RunNetModule()
  */
 void QKernel::on_actionConnect_triggered()
 {
-       QDialog d(this, Qt::Dialog);
-       QLabel lab("IP Address:", &d);
-       QLineEdit ed("", &d);
-       QPushButton ob("", &d);
-       QPushButton cb("", &d);
        MESSAGE m;
 
-       ob.setGeometry(30, 60, 80, 30);
-       ob.setText("Ok");
-       ob.setDefault(TRUE);
-       lab.setGeometry(10, 10, 60, 30);
-       lab.setText("Address");
-       ed.setGeometry(70, 10, 140, 30);
-       cb.setGeometry(130, 60, 80, 30);
-       cb.setText("Cancel");
-       d.resize(240, 100);
-
-       connect(&ob, SIGNAL(clicked()), &d, SLOT(accept()));
-       connect(&cb, SIGNAL(clicked()), &d, SLOT(reject()));
-       if (d.exec()) {
+       ConnectDialog dialog(this);
+       dialog.setWindowTitle("IP Address:");
+
+       if (dialog.exec()) {
                m.msg_type = MSG_NET;
                m.param.pword[0] = NET_CONNECT_TO;
-               strcpy(m.param.pstr, ed.text().toAscii().data());
-               write(net_sock, &m, sizeof(MESSAGE)); 
+               strcpy(m.param.pstr, dialog.getAddress().toStdString().c_str());
+               write(net_sock, &m, sizeof(MESSAGE));
        }
 }