xml-vym.cpp
changeset 821 4a84d7e444d8
parent 805 fc7a93ff97c3
child 822 c2ce9944148c
     1.1 --- a/xml-vym.cpp	Tue Jan 05 11:23:12 2010 +0000
     1.2 +++ b/xml-vym.cpp	Thu Jan 21 11:56:57 2010 +0000
     1.3 @@ -28,6 +28,7 @@
     1.4  	stateStack.append(StateInit);
     1.5  	htmldata="";
     1.6  	isVymPart=false;
     1.7 +	useProgress=false;
     1.8      return true;
     1.9  }
    1.10  
    1.11 @@ -47,7 +48,8 @@
    1.12      if ( state == StateInit && (eName == "vymmap")  ) 
    1.13  	{
    1.14          state = StateMap;
    1.15 -		branchesTotal=branchesCurrent=0;
    1.16 +		branchesTotal=0;			//FIXME-3 what if we load a .vyp ?
    1.17 +		branchesCounter=0;
    1.18  
    1.19  		if (loadMode==NewMap )
    1.20  		{
    1.21 @@ -64,17 +66,10 @@
    1.22  				branchesTotal=atts.value("branchCount").toInt();
    1.23  				if (branchesTotal>10)
    1.24  				{
    1.25 -					mainWindow->setProgressMinimum (0);
    1.26 +					useProgress=true;
    1.27  					mainWindow->setProgressMaximum (branchesTotal);
    1.28 -					mainWindow->setProgressValue(0);
    1.29  				}
    1.30 -			} else
    1.31 -			{
    1.32 -				mainWindow->setProgressMinimum (0);
    1.33 -				mainWindow->setProgressMaximum (0);
    1.34 -				mainWindow->setProgressValue(0);
    1.35 -			}
    1.36 -
    1.37 +			} 
    1.38  				
    1.39  			if (!atts.value( "backgroundColor").isEmpty() )
    1.40  			{
    1.41 @@ -277,7 +272,7 @@
    1.42      switch ( state ) 
    1.43  	{
    1.44  		case StateMap:
    1.45 -			mainWindow->removeProgressBar();
    1.46 +			mainWindow->removeProgressValue (branchesTotal); //FIXME-2 let mainWindow handle this 
    1.47  			break;
    1.48          case StateMapCenter: 
    1.49  			model->emitDataHasChanged (lastBranch);
    1.50 @@ -356,7 +351,9 @@
    1.51  
    1.52  bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	
    1.53  {
    1.54 -	//mainWindow->setProgressValue (branchesCurrent++);	// FIXME-2 Makes load incredibily slow
    1.55 +	branchesCounter++;
    1.56 +	if (useProgress) 
    1.57 +		mainWindow->addProgressValue ((float)branchesCounter/branchesTotal);	
    1.58  
    1.59  	lastMI=lastBranch;
    1.60