diff -r 735c7ea1d2a9 -r 4a84d7e444d8 xml-vym.cpp --- a/xml-vym.cpp Tue Jan 05 11:23:12 2010 +0000 +++ b/xml-vym.cpp Thu Jan 21 11:56:57 2010 +0000 @@ -28,6 +28,7 @@ stateStack.append(StateInit); htmldata=""; isVymPart=false; + useProgress=false; return true; } @@ -47,7 +48,8 @@ if ( state == StateInit && (eName == "vymmap") ) { state = StateMap; - branchesTotal=branchesCurrent=0; + branchesTotal=0; //FIXME-3 what if we load a .vyp ? + branchesCounter=0; if (loadMode==NewMap ) { @@ -64,17 +66,10 @@ branchesTotal=atts.value("branchCount").toInt(); if (branchesTotal>10) { - mainWindow->setProgressMinimum (0); + useProgress=true; mainWindow->setProgressMaximum (branchesTotal); - mainWindow->setProgressValue(0); } - } else - { - mainWindow->setProgressMinimum (0); - mainWindow->setProgressMaximum (0); - mainWindow->setProgressValue(0); - } - + } if (!atts.value( "backgroundColor").isEmpty() ) { @@ -277,7 +272,7 @@ switch ( state ) { case StateMap: - mainWindow->removeProgressBar(); + mainWindow->removeProgressValue (branchesTotal); //FIXME-2 let mainWindow handle this break; case StateMapCenter: model->emitDataHasChanged (lastBranch); @@ -356,7 +351,9 @@ bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a) { - //mainWindow->setProgressValue (branchesCurrent++); // FIXME-2 Makes load incredibily slow + branchesCounter++; + if (useProgress) + mainWindow->addProgressValue ((float)branchesCounter/branchesTotal); lastMI=lastBranch;