[PC-BSD Commits] r5163 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Mon Nov 30 09:58:43 PST 2009


Author: kris
Date: 2009-11-30 09:58:43 -0800 (Mon, 30 Nov 2009)
New Revision: 5163

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/selectnetserver.cpp
   pcbsd/trunk/SysInstaller/selectnetserver.h
   pcbsd/trunk/SysInstaller/selectnetserver.ui
   pcbsd/trunk/SysInstaller/sysinstaller.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
   pcbsd/trunk/SysInstaller/sysinstaller.ui
Log:

Added support for Enabling the NIC, and bringing up a dialog showing available mirrors, or selection of
a user-specified mirror. 



Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-11-30 17:58:43 UTC (rev 5163)
@@ -11,8 +11,11 @@
     else
       Mirrors = "OFF";
 
-    Process p(QStringList() << "enable-net" << IP << NetMask << DNS << Gate << Mirrors);
+    Process p(QStringList() << "enable-net" << Nic << IP << NetMask << DNS << Gate << Mirrors);
     if (p.waitForFinished()) {
+        while (p.canReadLine()) {
+          qDebug() << "Enable Nic: " << p.readLine().simplified();
+        }
     }
 }
 

Modified: pcbsd/trunk/SysInstaller/selectnetserver.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/selectnetserver.cpp	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/selectnetserver.cpp	2009-11-30 17:58:43 UTC (rev 5163)
@@ -10,35 +10,24 @@
 ** destructor.
 *****************************************************************************/
 #include "selectnetserver.h"
+#include "backend.h"
+
+#include <qtimer.h>
 #include <qfile.h>
 #include <qcombobox.h>
 
-void dialogSelectNetServer::programInit()
+void dialogSelectNetServer::dialogInit(QString tmpNic, QString tmpIP, QString tmpNetmask, QString tmpDNS, QString tmpGate)
 {
-    QString tmp;
 
-    // Populate our combo box with the public mirror listing
-    QFile file( "/tmp/mirrors-list.txt" );
-    if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
-        comboMirror->clear();
-        while ( !file.atEnd() ) {
-          tmp = file.readLine(); // line of text excluding '\n'
-          if ( tmp.indexOf("\n") != -1 ) {
-            tmp.truncate(tmp.size() -1 );
-          } 
-          comboMirror->addItem(tmp);
-        }
-      file.close();
-    } else {
-    // No mirrors-list.txt file, so lets disable internet install
-       radioManual->setChecked(true);
-       radioInternet->setEnabled(false);
-       comboMirror->setEnabled(false);
-    }
+   // Save our passed values
+   Nic = tmpNic;
+   IP = tmpIP;
+   Netmask = tmpNetmask;
+   DNS = tmpDNS;
+   Gate = tmpGate;
 
-  
-  // Make sure we have enabled / disabled the right objects based on radio selection
-  radioChangedSlot();
+   // Make sure we have enabled / disabled the right objects based on radio selection
+   radioChangedSlot();
 
    // Connect the radio buttons
    connect(radioInternet, SIGNAL( clicked() ), this, SLOT( radioChangedSlot() ) );
@@ -51,9 +40,54 @@
    connect(lineServer, SIGNAL( textChanged(const QString &) ), this, SLOT(fieldTextChanged( const QString &) ) );
    connect(lineDirectory, SIGNAL( textChanged(const QString &) ), this, SLOT(fieldTextChanged( const QString &) ) );
 
+   // Start our timer to enable the NIC
+   labelStatus->setText(tr("Enabling Networking... Please Wait..."));
+   radioInternet->setEnabled(false);
+   comboMirror->setEnabled(false);
+   radioManual->setEnabled(false);
+   groupNetwork->setEnabled(false);
+   pushSelect->setEnabled(false);
+   pushCancel->setEnabled(false);
+   QTimer::singleShot(500, this, SLOT(slotEnableNic()));
 
 }
 
+// Start the nic enabling 
+void dialogSelectNetServer::slotEnableNic()
+{
+   // Lets enable the NIC, and fetch our mirror listing
+   Scripts::Backend::enableNic(Nic, IP, Netmask, DNS, Gate, true);
+   labelStatus->setText("");
+ 
+   radioInternet->setEnabled(true);
+   comboMirror->setEnabled(false);
+   radioManual->setEnabled(true);
+   groupNetwork->setEnabled(false);
+   pushSelect->setEnabled(true);
+   pushCancel->setEnabled(true);
+   radioChangedSlot();
+
+   QString tmp;
+   // Populate our combo box with the public mirror listing
+   QFile file( "/tmp/mirrors-list.txt" );
+   if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
+     comboMirror->clear();
+     while ( !file.atEnd() ) {
+       tmp = file.readLine(); // line of text excluding '\n'
+       if ( tmp.indexOf("\n") != -1 )
+         tmp.truncate(tmp.size() -1 );
+       comboMirror->addItem(tmp);
+     }
+     file.close();
+   } else {
+     // No mirrors-list.txt file, so lets disable internet install
+     radioManual->setChecked(true);
+     radioInternet->setEnabled(false);
+     comboMirror->setEnabled(false);
+   }
+
+}
+
 // Check if the radio has changed
 void dialogSelectNetServer::radioChangedSlot()
 {
@@ -107,7 +141,7 @@
   {
     tmp = comboMirror->currentText();
     tmp.remove(0, tmp.indexOf("=") + 1);
-    emit saved(true, tmp);
+    emit saved(tmp);
   } else {
 
     if ( comboProto->currentText() == "FTP" )
@@ -122,7 +156,7 @@
 
     tmp = tmp + lineServer->text() + "/" + lineDirectory->text();
 
-    emit saved(false, tmp);
+    emit saved(tmp);
   }
 
   close();

Modified: pcbsd/trunk/SysInstaller/selectnetserver.h
===================================================================
--- pcbsd/trunk/SysInstaller/selectnetserver.h	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/selectnetserver.h	2009-11-30 17:58:43 UTC (rev 5163)
@@ -14,7 +14,7 @@
           setupUi(this);
         }
 
-    void programInit();
+    void dialogInit(QString tmpNic, QString tmpIP, QString tmpNetmask, QString tmpDNS, QString tmpGate);
 
 public slots:
 
@@ -23,12 +23,18 @@
     void fieldTextChanged( const QString &text );
     void saveSlot();
     void cancelSlot();
+    void slotEnableNic();
 
 private:
     void checkValues();
+    QString Nic;
+    QString IP;
+    QString Netmask; 
+    QString DNS;
+    QString Gate;
 
 signals:
-   void saved(bool, QString);
+   void saved(QString);
 
 } ;
 #endif // SELECTNETSERVER_H

Modified: pcbsd/trunk/SysInstaller/selectnetserver.ui
===================================================================
--- pcbsd/trunk/SysInstaller/selectnetserver.ui	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/selectnetserver.ui	2009-11-30 17:58:43 UTC (rev 5163)
@@ -1,120 +1,134 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>dialogSelectNetServer</class>
- <widget class="QDialog" name="dialogSelectNetServer" >
-  <property name="geometry" >
+ <widget class="QDialog" name="dialogSelectNetServer">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>358</width>
-    <height>291</height>
+    <width>353</width>
+    <height>304</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Select Installation Source</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_4" >
-   <item row="0" column="0" >
-    <layout class="QGridLayout" name="gridLayout" >
-     <item row="0" column="0" colspan="2" >
-      <widget class="QRadioButton" name="radioInternet" >
-       <property name="text" >
+  <layout class="QGridLayout" name="gridLayout_4">
+   <item row="1" column="0">
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="1" column="0" colspan="2">
+      <widget class="QRadioButton" name="radioInternet">
+       <property name="text">
         <string>Install from Internet </string>
        </property>
-       <property name="checked" >
+       <property name="checked">
         <bool>true</bool>
        </property>
       </widget>
      </item>
-     <item row="1" column="1" >
-      <widget class="QComboBox" name="comboMirror" >
-       <property name="sizePolicy" >
-        <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
+     <item row="2" column="1">
+      <widget class="QComboBox" name="comboMirror">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
-       <property name="insertPolicy" >
+       <property name="insertPolicy">
         <enum>QComboBox::InsertAlphabetically</enum>
        </property>
-       <property name="sizeAdjustPolicy" >
+       <property name="sizeAdjustPolicy">
         <enum>QComboBox::AdjustToContents</enum>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item row="1" column="0" >
-    <widget class="QRadioButton" name="radioManual" >
-     <property name="text" >
+   <item row="2" column="0">
+    <widget class="QRadioButton" name="radioManual">
+     <property name="text">
       <string>Install from specified server</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <widget class="QGroupBox" name="groupNetwork" >
-     <property name="title" >
+   <item row="3" column="0">
+    <widget class="QGroupBox" name="groupNetwork">
+     <property name="title">
       <string>Local Network Install</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout_3" >
-      <item row="0" column="0" >
-       <layout class="QGridLayout" name="gridLayout_2" >
-        <item row="0" column="0" colspan="2" >
-         <widget class="QLabel" name="label" >
-          <property name="text" >
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0" colspan="2">
+         <widget class="QLabel" name="label">
+          <property name="text">
            <string>Enter the server name</string>
           </property>
          </widget>
         </item>
-        <item row="1" column="0" >
-         <widget class="QComboBox" name="comboProto" >
+        <item row="1" column="0">
+         <widget class="QComboBox" name="comboProto">
           <item>
-           <property name="text" >
+           <property name="text">
             <string>FTP</string>
            </property>
           </item>
           <item>
-           <property name="text" >
+           <property name="text">
             <string>HTTP</string>
            </property>
           </item>
          </widget>
         </item>
-        <item row="1" column="1" >
-         <widget class="QLineEdit" name="lineServer" />
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="lineServer"/>
         </item>
        </layout>
       </item>
-      <item row="1" column="0" >
-       <widget class="QLabel" name="label_2" >
-        <property name="text" >
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
          <string>Enter the directory path</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="0" >
-       <widget class="QLineEdit" name="lineDirectory" />
+      <item row="2" column="0">
+       <widget class="QLineEdit" name="lineDirectory"/>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" >
-    <layout class="QHBoxLayout" name="horizontalLayout" >
+   <item row="4" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QPushButton" name="pushSelect" >
-       <property name="text" >
+      <widget class="QPushButton" name="pushSelect">
+       <property name="text">
         <string>Select</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="pushCancel" >
-       <property name="text" >
+      <widget class="QPushButton" name="pushCancel">
+       <property name="text">
         <string>Cancel</string>
        </property>
       </widget>
      </item>
     </layout>
    </item>
+   <item row="0" column="0">
+    <widget class="QLabel" name="labelStatus">
+     <property name="text">
+      <string/>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>

Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-30 17:58:43 UTC (rev 5163)
@@ -189,8 +189,30 @@
     currentIcon->setPixmap(QPixmap(step.pixmap()));
 }
 
+// Slow which is called when the user is done with choosing networking URLs
+void SysInstaller::slotGotNetworkUrl(QString url)
+{
+   netURL = url;
+   qDebug() << "Using remote URL: " << netURL;
+   proceed(true);
+}
+
 void SysInstaller::slotNext()
 {
+   // If we've been called on the NIC page, and using network install
+   if ( stackWidget->currentIndex() == 2 && radioNetworkInstall->isChecked() ) {
+      dsn = new dialogSelectNetServer();
+      dsn->dialogInit(comboSelectNic->currentText(), \
+                      lineIP->text(), \
+                      lineNetmask->text(), \
+                      lineDNS->text(), \
+                      lineDefaultRouter->text() );
+      connect(dsn, SIGNAL(saved(QString)), this, SLOT(slotGotNetworkUrl(QString)));
+      dsn->setWindowModality(Qt::ApplicationModal);
+      dsn->show();
+      return;
+   }
+
    // If the chosen disk is too small or partition is invalid, don't continue
    if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements())
       return;

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-30 17:58:43 UTC (rev 5163)
@@ -8,6 +8,7 @@
 
 #include "ui_sysinstaller.h"
 #include "dialogFileSystem.h"
+#include "selectnetserver.h"
 
 #include "backend.h"
 
@@ -71,6 +72,9 @@
     void slotDefaultKbChecked(int);
     void slotUpdateKbOnSys();
 
+    // Networking slots
+    void slotGotNetworkUrl(QString url);
+
     // Component slots
 
     // Source slots
@@ -128,6 +132,7 @@
 
     QStackedWidget *stackWidget;
     dialogFileSystem *dfs;
+    dialogSelectNetServer *dsn;
 
     QList<Step> steps;
     QList<Label *> labels;  // just to handle the "Labels" list
@@ -138,6 +143,7 @@
     QStringList savedKeyVariants; // Temp variable to keep key variants in memory
     QList<QStringList> listUsers; // QStringList which keeps our users
     QList<QStringList> listComponents; // QStringList for our available components
+    QString netURL; // Saved network URL when doing remote install
 
 };
 

Modified: pcbsd/trunk/SysInstaller/sysinstaller.ui
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-30 14:28:52 UTC (rev 5162)
+++ pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-30 17:58:43 UTC (rev 5163)
@@ -1247,7 +1247,14 @@
                              </widget>
                             </item>
                             <item row="1" column="1" colspan="2">
-                             <widget class="QLineEdit" name="lineIP"/>
+                             <widget class="QLineEdit" name="lineIP">
+                              <property name="inputMask">
+                               <string>000.000.000.000; </string>
+                              </property>
+                              <property name="alignment">
+                               <set>Qt::AlignCenter</set>
+                              </property>
+                             </widget>
                             </item>
                             <item row="2" column="0">
                              <widget class="QLabel" name="textNetmask">
@@ -1257,7 +1264,14 @@
                              </widget>
                             </item>
                             <item row="2" column="1" colspan="2">
-                             <widget class="QLineEdit" name="lineNetmask"/>
+                             <widget class="QLineEdit" name="lineNetmask">
+                              <property name="inputMask">
+                               <string>000.000.000.000; </string>
+                              </property>
+                              <property name="alignment">
+                               <set>Qt::AlignCenter</set>
+                              </property>
+                             </widget>
                             </item>
                             <item row="3" column="0">
                              <widget class="QLabel" name="textDNS">
@@ -1267,7 +1281,14 @@
                              </widget>
                             </item>
                             <item row="3" column="1" colspan="2">
-                             <widget class="QLineEdit" name="lineDNS"/>
+                             <widget class="QLineEdit" name="lineDNS">
+                              <property name="inputMask">
+                               <string>000.000.000.000; </string>
+                              </property>
+                              <property name="alignment">
+                               <set>Qt::AlignCenter</set>
+                              </property>
+                             </widget>
                             </item>
                             <item row="4" column="0">
                              <widget class="QLabel" name="textDefaultRouter">
@@ -1277,7 +1298,14 @@
                              </widget>
                             </item>
                             <item row="4" column="1" colspan="2">
-                             <widget class="QLineEdit" name="lineDefaultRouter"/>
+                             <widget class="QLineEdit" name="lineDefaultRouter">
+                              <property name="inputMask">
+                               <string>000.000.000.000; </string>
+                              </property>
+                              <property name="alignment">
+                               <set>Qt::AlignCenter</set>
+                              </property>
+                             </widget>
                             </item>
                             <item row="0" column="1" colspan="2">
                              <widget class="QComboBox" name="comboSelectNic"/>



More information about the Commits mailing list