[PC-BSD Commits] r7658 - pcbsd/current/src-qt4/pc-sysinstaller

svn at pcbsd.org svn at pcbsd.org
Wed Sep 29 10:04:26 PDT 2010


Author: kris
Date: 2010-09-29 10:04:26 -0700 (Wed, 29 Sep 2010)
New Revision: 7658

Modified:
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
   pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui
Log:

Add feature to set a custom hostname for installation, keep it at less than 250 chars, and put basic
check in to ensure its not less than < 2 characters in length



Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp	2010-09-29 16:05:39 UTC (rev 7657)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.cpp	2010-09-29 17:04:26 UTC (rev 7658)
@@ -133,6 +133,7 @@
     connect(radioDVDUSBInstall,SIGNAL(toggled(bool)), this, SLOT(slotChangedInstallSource()));
     connect(radioNetworkInstall,SIGNAL(toggled(bool)), this, SLOT(slotChangedInstallSource()));
     connect(comboSelectNic,SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangedNic()));
+    connect(checkHostname,SIGNAL(clicked()), this, SLOT(slotHostnameClicked()));
 
     // Connect the disk slots
     connectDiskSlots();
@@ -157,6 +158,11 @@
 
 }
 
+// Enable / disable the hostname
+void SysInstaller::slotHostnameClicked()
+{
+  lineHostname->setEnabled(checkHostname->isChecked());
+}
 
 // Load the NICS
 void SysInstaller::loadNics()
@@ -248,6 +254,14 @@
 {
    QString tmp;
 
+   // IF using a custom hostname, do some basic sanity checking of it
+   if ( stackWidget->currentIndex() == 0 && checkHostname->isChecked() && 
+      ( lineHostname->text().isEmpty() || lineHostname->text().length() < 2) )
+   {
+	QMessageBox::critical(this, tr("Invalid Hostname"),
+                                       tr("You must specify a hostname between 2-250 characters!") );
+	return;
+   }
 
    // If we've been called on the NIC page, and using network install
    if ( stackWidget->currentIndex() == 2 && radioNetworkInstall->isChecked() ) {
@@ -602,6 +616,11 @@
     }
   }
 
+  // If we have a custom hostname, add it to the config
+  if ( checkHostname->isChecked() ) {
+      tmpList << "hostname=" + lineHostname->text();
+      summaryList << tr("Using custom hostname:") + " " + lineHostname->text();
+  }
 
   // Check if we are doing net or DVD/usb install
   if ( radioNetworkInstall->isChecked() )

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2010-09-29 16:05:39 UTC (rev 7657)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h	2010-09-29 17:04:26 UTC (rev 7658)
@@ -117,6 +117,9 @@
     // Desktop Packages Slot
     void slotDeskPkgsChanged(QTreeWidgetItem *aItem, int aCol);
 
+    // Grab checked / unchecked status of hostname
+    void slotHostnameClicked();
+
 private:
     void initSteps();
     void initAnteInstall();

Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui	2010-09-29 16:05:39 UTC (rev 7657)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui	2010-09-29 17:04:26 UTC (rev 7658)
@@ -993,7 +993,7 @@
                 </palette>
                </property>
                <property name="currentIndex">
-                <number>2</number>
+                <number>0</number>
                </property>
                <widget class="QWidget" name="aiStep0">
                 <property name="palette">
@@ -1168,7 +1168,7 @@
                   </disabled>
                  </palette>
                 </property>
-                <layout class="QGridLayout" name="gridLayout_10">
+                <layout class="QGridLayout" name="gridLayout_11">
                  <item row="0" column="1">
                   <widget class="QLabel" name="label_8">
                    <property name="palette">
@@ -1729,7 +1729,7 @@
                      <property name="alignment">
                       <set>Qt::AlignCenter</set>
                      </property>
-                     <layout class="QGridLayout" name="gridLayout_11">
+                     <layout class="QGridLayout" name="gridLayout_10">
                       <item row="0" column="0">
                        <widget class="QLabel" name="label_10">
                         <property name="font">
@@ -1797,6 +1797,90 @@
                   </layout>
                  </item>
                  <item row="4" column="0" colspan="3">
+                  <layout class="QHBoxLayout" name="horizontalLayout_14">
+                   <item>
+                    <spacer name="horizontalSpacer_46">
+                     <property name="orientation">
+                      <enum>Qt::Horizontal</enum>
+                     </property>
+                     <property name="sizeType">
+                      <enum>QSizePolicy::Preferred</enum>
+                     </property>
+                     <property name="sizeHint" stdset="0">
+                      <size>
+                       <width>125</width>
+                       <height>20</height>
+                      </size>
+                     </property>
+                    </spacer>
+                   </item>
+                   <item>
+                    <widget class="QGroupBox" name="groupBox_8">
+                     <property name="title">
+                      <string/>
+                     </property>
+                     <property name="checkable">
+                      <bool>false</bool>
+                     </property>
+                     <layout class="QGridLayout" name="gridLayout_31">
+                      <item row="0" column="0" colspan="2">
+                       <widget class="QLabel" name="label_34">
+                        <property name="font">
+                         <font>
+                          <weight>75</weight>
+                          <bold>true</bold>
+                         </font>
+                        </property>
+                        <property name="styleSheet">
+                         <string notr="true">background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0.7, stop:0 rgba(217, 230, 235, 230), stop:1 rgba(255, 255, 255, 255));</string>
+                        </property>
+                        <property name="text">
+                         <string>System Hostname</string>
+                        </property>
+                        <property name="alignment">
+                         <set>Qt::AlignCenter</set>
+                        </property>
+                       </widget>
+                      </item>
+                      <item row="2" column="0">
+                       <widget class="QLineEdit" name="lineHostname">
+                        <property name="enabled">
+                         <bool>false</bool>
+                        </property>
+                        <property name="maxLength">
+                         <number>250</number>
+                        </property>
+                       </widget>
+                      </item>
+                      <item row="1" column="0" colspan="2">
+                       <widget class="QCheckBox" name="checkHostname">
+                        <property name="text">
+                         <string>Custom hostname</string>
+                        </property>
+                       </widget>
+                      </item>
+                     </layout>
+                    </widget>
+                   </item>
+                   <item>
+                    <spacer name="horizontalSpacer_45">
+                     <property name="orientation">
+                      <enum>Qt::Horizontal</enum>
+                     </property>
+                     <property name="sizeType">
+                      <enum>QSizePolicy::Preferred</enum>
+                     </property>
+                     <property name="sizeHint" stdset="0">
+                      <size>
+                       <width>125</width>
+                       <height>20</height>
+                      </size>
+                     </property>
+                    </spacer>
+                   </item>
+                  </layout>
+                 </item>
+                 <item row="5" column="0" colspan="3">
                   <layout class="QVBoxLayout" name="verticalLayout_8">
                    <item>
                     <widget class="QLabel" name="label_2">



More information about the Commits mailing list