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

svn at pcbsd.org svn at pcbsd.org
Wed Jan 6 10:28:52 PST 2010


Author: kris
Date: 2010-01-06 10:28:52 -0800 (Wed, 06 Jan 2010)
New Revision: 5793

Modified:
   pcbsd/trunk/SysInstaller/sys-installwidget.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Updated sysinstaller, now we can display progress from downloads / fetch processes



Modified: pcbsd/trunk/SysInstaller/sys-installwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-installwidget.cpp	2010-01-06 13:52:31 UTC (rev 5792)
+++ pcbsd/trunk/SysInstaller/sys-installwidget.cpp	2010-01-06 18:28:52 UTC (rev 5793)
@@ -10,6 +10,7 @@
   backButton->setEnabled(false);
   progressBarInstall->setValue(0); 
   installFoundCounter = false;
+  installFoundFetchOutput = false;
 
   // Start our process to begin the install
   QString program = PCSYSINSTALL;
@@ -99,18 +100,54 @@
 // Slot which reads the output of the installer
 void SysInstaller::slotReadInstallerOutput()
 {
-  QString tmp;
-  int range;
+  QString tmp, line;
+  int range, progress;
   bool ok;
-   while ( installProc->canReadLine() )
-   {
+
+
+  while ( installProc->canReadLine() )
+  {
      tmp = installProc->readLine();
      tmp = tmp.simplified();
-     tmp.truncate(60);
 
-     // Watch for our COUNT value
-     if ( ! installFoundCounter )
+     //qDebug() << tmp;
+     tmp.truncate(70);
+
+     // Check if we are doing Fetch Output
+     if ( installFoundFetchOutput )
      {
+       if ( tmp.indexOf("SIZE: ") != -1 ) {
+
+          // Get the total range first
+          line = tmp;
+          tmp = tmp.remove(0, tmp.indexOf(":") + 2 );
+          tmp.truncate(tmp.indexOf(" ")); 
+          range = tmp.toInt(&ok);
+          if ( ok )
+             progressBarInstall->setRange(0, range);
+
+          // Now get the current progress
+          tmp = line;
+          tmp = tmp.remove(0, tmp.indexOf(":") + 2 );
+          tmp = tmp.remove(0, tmp.indexOf(":") + 2 );
+          range = tmp.toInt(&ok);
+          if ( ok )
+             progressBarInstall->setValue(range);
+           
+
+        } else {
+          installFoundFetchOutput = false;
+        }
+     } else if ( ! installFoundCounter ) {
+
+        // Check if we've found fetch output to update the progress bar with
+        if ( tmp.indexOf("FETCH: ") != -1 ) {
+          installFoundFetchOutput = true;
+          fetchDownloadFile = tmp.remove(0, tmp.indexOf(" "));
+          labelInstallStatus->setText(tr("Downloading:") + " " + fetchDownloadFile);
+          break;
+        }
+
         if ( tmp.indexOf("INSTALLCOUNT: ") != -1 ) {
           tmp = tmp.remove(0, tmp.indexOf(":") + 1 ); 
           range = tmp.toInt(&ok);
@@ -128,5 +165,5 @@
        labelInstallStatus->setText(tmp);
      }
 
-   } // end of while loop
+  } // end of while loop
 }

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2010-01-06 13:52:31 UTC (rev 5792)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2010-01-06 18:28:52 UTC (rev 5793)
@@ -174,6 +174,8 @@
     QStringList updatePartitions;
     QProcess *installProc;
     bool installFoundCounter;
+    bool installFoundFetchOutput;
+    QString fetchDownloadFile;
 
 };
 



More information about the Commits mailing list