Permalink
Browse files

Add the network scan button to the LpWizard as well.

  • Loading branch information...
1 parent c4cd122 commit f15ae5d5b647a1cca29d554749d6eb74e613c40b Ken Moore committed Oct 25, 2013
@@ -7,6 +7,7 @@ LPWizard::LPWizard(QWidget *parent) : QWizard(parent), ui(new Ui::LPWizard){
cancelled = true; //Make sure this is always set by default
connect(this,SIGNAL(accepted()), this,SLOT(slotFinished()) );
connect(this,SIGNAL(rejected()),this,SLOT(slotCancelled()) );
+ connect(ui->push_scanNetwork, SIGNAL(clicked()), this, SLOT(scanNetwork()) );
}
LPWizard::~LPWizard(){
@@ -56,3 +57,27 @@ void LPWizard::slotCancelled(){
cancelled = true; //just to make sure
this->close();
}
+
+void LPWizard::scanNetwork(){
+ QStringList targs = LPGUtils::scanNetworkSSH(); // <name>:::<address>:::<port>
+ if(targs.isEmpty()){
+ QMessageBox::warning(this,tr("No Network Targets"), tr("We could not find any systems on the local network with SSH availability (port 22)") );
+ return;
+ }
+ //Ask the user to select a target
+ QStringList targets;
+ for(int i=0; i<targs.length(); i++){
+ targets << targs[i].section(":::",0,0);
+ }
+ bool ok;
+ QString target = QInputDialog::getItem(this, tr("Select Replication Target"), tr("Hostname:"), targets, 0, false, &ok);
+ if(!ok || target.isEmpty() ){ return; } //cancelled
+ //Now look for that target in the list of info
+ for(int i=0; i<targs.length(); i++){
+ if(targs[i].startsWith(target+":::")){
+ ui->lineHostName->setText(targs[i].section(":::",1,1));
+ ui->spinPort->setValue( targs[i].section(":::",2,2).toInt() );
+ break;
+ }
+ }
+}
@@ -4,8 +4,11 @@
#include <QWizard>
#include <QString>
#include <QDebug>
+#include <QMessageBox>
+#include <QInputDialog>
#include "LPBackend.h"
+#include "LPGUtils.h"
namespace Ui{
class LPWizard;
@@ -30,6 +33,7 @@ class LPWizard : public QWizard{
private slots:
void slotFinished();
void slotCancelled();
+ void scanNetwork();
};
#endif
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>474</width>
- <height>381</height>
+ <width>469</width>
+ <height>411</height>
</rect>
</property>
<property name="windowTitle">
@@ -425,7 +425,44 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="4" column="0">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="push_scanNetwork">
+ <property name="text">
+ <string>Scan Network</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="6" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Frequency</string>
@@ -499,7 +536,7 @@
</layout>
</widget>
</item>
- <item row="0" column="0">
+ <item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_9">
@@ -513,7 +550,7 @@
</item>
</layout>
</item>
- <item row="1" column="0">
+ <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_10">
@@ -527,7 +564,7 @@
</item>
</layout>
</item>
- <item row="2" column="0">
+ <item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
@@ -583,7 +620,7 @@
</item>
</layout>
</item>
- <item row="3" column="0">
+ <item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_14">

0 comments on commit f15ae5d

Please sign in to comment.