Permalink
Browse files

Add ability to get pkg status from pkgng output, will display progress

bar of current / total to go.
  • Loading branch information...
1 parent 9788f38 commit 2c1e079f1913ae0e172cbf14c80433c70afcc767 @kmoore134 kmoore134 committed Jun 28, 2013
Showing with 21 additions and 4 deletions.
  1. +21 −4 src-qt4/pc-pkgmanager/mainWin.cpp
@@ -265,6 +265,8 @@ void mainWin::startPkgProcess() {
void mainWin::slotReadPkgOutput() {
QString line, tmp, cur, tot, fname;
+ int curItem, totItem;
+ bool ok;
while (uProc->canReadLine()) {
line = uProc->readLine().simplified();
@@ -377,13 +379,28 @@ void mainWin::slotReadPkgOutput() {
dPackages = false;
curUpdate = 0;
progressUpdate->setValue(0);
+ progressUpdate->setRange(0, 0);
+ progressUpdate->setValue(0);
+ continue;
}
if ( uPackages ) {
- if ( line.indexOf("Upgrading") == 0 || line.indexOf("Reinstalling") == 0 ) {
- textStatus->setText(line);
- curUpdate++;
- progressUpdate->setValue(curUpdate);
+ if ( line.indexOf("[") == 0 ) {
+ tmp=line.section("]", 1, 1);
+ textStatus->setText(tmp);
+ tmp=line.section("/", 0, 0).replace("[", "");
+ tmp.toInt(&ok);
+ if (ok) {
+ curItem=tmp.toInt(&ok);
+ tmp=line.section("/", 1, 1).section("]", 0, 0);
+ tmp.toInt(&ok);
+ if (ok) {
+ totItem=tmp.toInt(&ok);
+ progressUpdate->setRange(0, totItem);
+ progressUpdate->setValue(curItem);
+ }
+
+ }
}
continue;
}

0 comments on commit 2c1e079

Please sign in to comment.