Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:pcbsd/pcbsd

  • Loading branch information...
commit a4ac142bb968f471838b2864b9b8bdcc3b7210ba 2 parents feb0fb0 + 7369d56
@kmoore134 kmoore134 authored
View
10 src-qt4/EasyPBI/mainGUI.cpp
@@ -1373,8 +1373,10 @@ void MainGUI::on_push_build_start_clicked(){
//Remove known "bad" packages (ones that routinely cause failures)
QDir cDir( settings->value("cachedir") );
QStringList filters = settings->list("skippkgs");
- QStringList badFiles = cDir.entryList(filters, QDir::Files | QDir:: NoDotAndDotDot);
- for(int i=0; i<badFiles.length(); i++){ cDir.remove(badFiles[i]); }
+ if(!filters.isEmpty()){
+ QStringList badFiles = cDir.entryList(filters, QDir::Files | QDir:: NoDotAndDotDot);
+ for(int i=0; i<badFiles.length(); i++){ cDir.remove(badFiles[i]); }
+ }
}
if( settings->check("usesignature") && QFile::exists(settings->value("sigfile")) ){ cmd += " --sign " + settings->value("sigfile"); }
@@ -1417,7 +1419,7 @@ void MainGUI::on_push_build_start_clicked(){
ui->check_build_32->setEnabled(FALSE);
ui->push_build_start->setEnabled(FALSE); //disable the button so they do not start more than 1 build at a time
ui->text_build_log->clear(); //clear the display in case this is not the first run
- ui->line_build_module->setText(currentModule->path());
+ ui->line_build_module->setText( currentModule->path().replace(QDir::homePath(), "~") );
ui->line_build_outputdir->setText(settings->value("pbidir"));
//Setup Process connections
p = new QProcess(this);
@@ -1457,6 +1459,8 @@ void MainGUI::slotUpdatePBIBuild(){
QString tmp = p->readAllStandardOutput();
if( tmp.startsWith("\n") ){tmp.remove(0,0);} //remove newline at the beginning (too much whitespace in log)
if( tmp.endsWith("\n") ){tmp.chop(1);} //remove newline at the end (already accounted for by appending)
+ //clear the display if it is starting a new port compilation (prevent the log getting too large)
+ if(tmp.toLower().startsWith("compiling port: ")){ ui->text_build_log->clear(); }
if(!tmp.isEmpty()){ ui->text_build_log->append( tmp ); }
//qDebug() << "Update output: " << tmp;
}
View
6 src-qt4/pc-mounttray/fsDialog.cpp
@@ -29,12 +29,12 @@ void FSDialog::generateUI(){
//Get the data for this item
QString name = fsList[i].section("::",0,0);
QString filesystem = fsList[i].section("::",1,1);
- int totalK = fsList[i].section("::",2,2).toInt();
- int usedK = fsList[i].section("::",3,3).toInt();
+ double totalK = fsList[i].section("::",2,2).toDouble();
+ double usedK = fsList[i].section("::",3,3).toDouble();
int percent = fsList[i].section("::",4,4).toInt();
//Create item for the data
QStringList text; //column text
- text << name << filesystem.toUpper() << FSWatcher::intToDisplay(usedK)+"/"+FSWatcher::intToDisplay(totalK) << QString::number(percent)+"%";
+ text << name << filesystem.toUpper() << FSWatcher::doubleToDisplay(usedK)+"/"+FSWatcher::doubleToDisplay(totalK) << QString::number(percent)+"%";
QTreeWidgetItem *tmp = new QTreeWidgetItem(text);
//set the item background based upon urgency
View
38 src-qt4/pc-mounttray/fsWatcher.cpp
@@ -34,8 +34,8 @@ QStringList FSWatcher::getFSmountpoints(){
//second line contains the data
QString avail = tmp[1].section(" ",0,0,QString::SectionSkipEmpty);
QString used = tmp[1].section(" ",1,1,QString::SectionSkipEmpty);
- int iUsed = displayToInt(used);
- int iTotal = displayToInt(avail) + iUsed;
+ double iUsed = floor(displayToDouble(used));
+ double iTotal = floor(displayToDouble(avail)) + iUsed;
int percent = calculatePercentage(iUsed, iTotal);
//qDebug() << "Percent calc: tot:"<<iTotal<<"used"<<iUsed<<"percent"<<percent;
//format the output string and add it in
@@ -59,8 +59,8 @@ QStringList FSWatcher::getFSmountpoints(){
QString total = dfout[i].section(" ",2,2,QString::SectionSkipEmpty).simplified();
QString used = dfout[i].section(" ",3,3,QString::SectionSkipEmpty).simplified();
//Calculate the percent
- int iUsed = displayToInt(used);
- int iTotal = displayToInt(total);
+ double iUsed = displayToDouble(used);
+ double iTotal = displayToDouble(total);
int percent = calculatePercentage(iUsed, iTotal);
//qDebug() << "df Item:" << dfout[i];
//qDebug() << " - Detected:" << name << fs << iTotal << iUsed << percent;
@@ -75,28 +75,38 @@ QStringList FSWatcher::getFSmountpoints(){
}
-int FSWatcher::displayToInt(QString entry){
+int FSWatcher::displayToDouble(QString entry){
//split the number from the size label
//qDebug() << "Display to Int conversion:" << entry;
QString units = entry.right(1); //last character
entry.chop(1); //remove the unit
double num = entry.toDouble();
//qDebug() << "initial number:" << num << "units:" << units;
- if(units=="K"){} //Kilobytes (no change)
- else if(units=="M"){ num=num*1024; } //Megabytes to K
- else if(units=="G"){ num=num*1048576; } //Gigabytes to K
- else{ num=0; } //smaller than a KB
+ QStringList unitL; unitL << "K" << "M" << "G" << "T" << "P" << "E" << "Z" << "Y";
+ bool ok = false;
+ for(int i=0; i< unitL.length(); i++){
+ if(units == unitL[i]){ num = num*pow(1024.0,i); ok = true; break;}
+ }
+ if(!ok){num=0; }
//qDebug() << "number:" << num;
return num;
}
-QString FSWatcher::intToDisplay(int K){
+QString FSWatcher::doubleToDisplay(double K){
QString num;
//qDebug() << "Int to Display:" << K;
double kdb = K; //using pure integers causes errors with large numbers
- if( K > 1048576 ){ num = QString::number( int((kdb*100)/1048576)/100.0 ) +"G"; }
- else if(K > 1024){ num = QString::number( int((kdb*100)/1024)/100.0 ) +"M"; }
- else{ num = QString::number(K) +"K"; }
+ QStringList units; units << "K" << "M" << "G" << "T" << "P" << "E" << "Z" << "Y";
+ int i=0;
+ while( (kdb > 1000) && (i < 8) ){
+ kdb = kdb/1024;
+ i++;
+ }
+ if(i<8){
+ num = QString::number( int((kdb*100))/100.0) + units[i];
+ }else{
+ num = "??";
+ }
//qDebug() << "Display:" << num;
return num;
@@ -133,7 +143,7 @@ void FSWatcher::checkFS(){
}
//===== Calculate Percentages =====
-int FSWatcher::calculatePercentage(int used, int total){
+int FSWatcher::calculatePercentage(double used, double total){
double U = used;
double T = total;
double result = (U/T)*100.0;
View
7 src-qt4/pc-mounttray/fsWatcher.h
@@ -11,6 +11,7 @@
#include <QDebug>
#include <QTime>
+#include <math.h>
class FSWatcher : public QObject
{
@@ -24,15 +25,15 @@ class FSWatcher : public QObject
void stop();
static QStringList getFSmountpoints();
- static QString intToDisplay(int);
- static int displayToInt(QString);
+ static QString doubleToDisplay(double);
+ static int displayToDouble(QString);
private:
QTimer *timer;
QStringList oldBadDevs;
static QStringList runCMD(QString);
- static int calculatePercentage(int,int);
+ static int calculatePercentage(double,double);
public slots:
void checkFS(); //function in a timer loop
Please sign in to comment.
Something went wrong with that request. Please try again.