[PC-BSD Commits] r18938 - pcbsd/current/src-qt4/EasyPBI
svn at pcbsd.org
svn at pcbsd.org
Fri Sep 7 11:29:13 PDT 2012
Author: kenmoore
Date: 2012-09-07 18:29:12 +0000 (Fri, 07 Sep 2012)
New Revision: 18938
Modified:
pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
Log:
Fix a bug with EasyPBI crashing when you try to download the ports tree without an internet connection. Thanks to Josh Smith for finding this bug.
Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp 2012-09-07 18:26:15 UTC (rev 18937)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp 2012-09-07 18:29:12 UTC (rev 18938)
@@ -310,15 +310,15 @@
if(ret != QMessageBox::Yes){return;}
}
}
- //Change to the 'Modules' Tab for download status
- ui->tabWidget->setCurrentIndex(0);
-
- //Start the Download
+
+ //Begin creating the network variables
QNetworkReply *currentDL;
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ //Start the download
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*)) );
currentDL = manager->get(QNetworkRequest(QUrl("ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz")));
-
+ //Update the status
+ ui->tabWidget->setCurrentIndex(0);
ui->status_bar->setText(tr("Downloading the FreeBSD ports tree: Please Wait."));
//Make the Progress Bar visible and start updating
@@ -333,7 +333,7 @@
//See if the Download was successful
qDebug() << "Ports download completion code:" << reply->error();
if( reply->error() != QNetworkReply::NoError){
- QMessageBox::warning(this, tr("Download Failed"),tr("Downloading the FreeBSD ports tree failed. Please try again."));
+ QMessageBox::warning(this, tr("Download Failed"),tr("Downloading the FreeBSD ports tree failed. Please check your internet connection and try again."));
return;
}
//Download Succesful, save it to file
@@ -372,7 +372,10 @@
void MainWindow::updateProgress(qint64 bytesReceived, qint64 bytesTotal){
//Determine the percentage
- int percent = (bytesReceived*100)/bytesTotal;
+ int percent = 0;
+ if(bytesTotal != 0){
+ percent = (bytesReceived*100)/bytesTotal;
+ }
//Update the progress bar
ui->progressBar->setValue(percent);
ui->progressBar->update();
More information about the Commits
mailing list