exports.cpp
changeset 741 1b4d1ea6ea8c
parent 740 6dc0a20031f7
child 742 54d44ecd6097
     1.1 --- a/exports.cpp	Wed Feb 04 16:33:16 2009 +0000
     1.2 +++ b/exports.cpp	Fri Mar 06 15:02:58 2009 +0000
     1.3 @@ -143,43 +143,47 @@
     1.4  	QString s;
     1.5  	QString curIndent;
     1.6  	int i;
     1.7 -	TreeItem *ti;
     1.8 -	ti=model->first();
     1.9 +	TreeItem *cur=NULL;
    1.10 +	TreeItem *prev=NULL;
    1.11 +	int d;
    1.12 +
    1.13  	BranchObj *bo;
    1.14 -	while (ti) 
    1.15 +	cur=model->next (cur,prev,d);
    1.16 +	while (cur) 
    1.17  	{
    1.18 -		if (ti->getType()==TreeItem::Branch || ti->getType()==TreeItem::MapCenter)
    1.19 +		if (cur->getType()==TreeItem::Branch || cur->getType()==TreeItem::MapCenter)
    1.20  		{
    1.21 -			bo=(BranchObj*)(ti->getLMO());
    1.22 +			bo=(BranchObj*)(cur->getLMO());
    1.23 +			std::cout << "ExportASCII::  "<<cur->getHeading().toStdString()<<std::endl;
    1.24  
    1.25  			// Make indentstring
    1.26  			curIndent="";
    1.27 -			for (i=0;i<ti->depth()-1;i++) curIndent+= indentPerDepth;
    1.28 +			for (i=0;i<cur->depth()-1;i++) curIndent+= indentPerDepth;
    1.29  
    1.30  			if (!bo->hasHiddenExportParent() )
    1.31  			{
    1.32 -				switch (ti->depth())
    1.33 +				switch (cur->depth())
    1.34  				{
    1.35  					case 0:
    1.36 -						ts << underline (ti->getHeading(),QString("="));
    1.37 +						ts << underline (cur->getHeading(),QString("="));
    1.38  						ts << "\n";
    1.39  						break;
    1.40  					case 1:
    1.41  						ts << "\n";
    1.42 -						ts << (underline (getSectionString(bo) + ti->getHeading(), QString("-") ) );
    1.43 +						ts << (underline (getSectionString(bo) + cur->getHeading(), QString("-") ) );
    1.44  						ts << "\n";
    1.45  						break;
    1.46  					case 2:
    1.47  						ts << "\n";
    1.48 -						ts << (curIndent + "* " + ti->getHeading());
    1.49 +						ts << (curIndent + "* " + cur->getHeading());
    1.50  						ts << "\n";
    1.51  						break;
    1.52  					case 3:
    1.53 -						ts << (curIndent + "- " + ti->getHeading());
    1.54 +						ts << (curIndent + "- " + cur->getHeading());
    1.55  						ts << "\n";
    1.56  						break;
    1.57  					default:
    1.58 -						ts << (curIndent + "- " + ti->getHeading());
    1.59 +						ts << (curIndent + "- " + cur->getHeading());
    1.60  						ts << "\n";
    1.61  						break;
    1.62  				}
    1.63 @@ -193,7 +197,7 @@
    1.64  				}
    1.65  			}
    1.66  		}
    1.67 -		ti=model->next();
    1.68 +		cur=model->next(cur,prev,d);
    1.69  	}
    1.70  	file.close();
    1.71  }
    1.72 @@ -225,10 +229,13 @@
    1.73  	QString curIndent("");
    1.74  	int i;
    1.75  	BranchObj *bo;
    1.76 -	TreeItem *ti=model->first();
    1.77 -	while (ti) 
    1.78 +	TreeItem *cur=NULL;
    1.79 +	TreeItem *prev=NULL;
    1.80 +	int d;
    1.81 +	cur=model->next (cur,prev,d);
    1.82 +	while (cur) 
    1.83  	{
    1.84 -		bo=(BranchObj*)(ti->getLMO());
    1.85 +		bo=(BranchObj*)(cur->getLMO());
    1.86  
    1.87  		if (!bo->hasHiddenExportParent() )
    1.88  		{
    1.89 @@ -242,13 +249,13 @@
    1.90  				ts <<"\"\",";
    1.91  
    1.92  			// Make indentstring
    1.93 -			for (i=0;i<ti->depth();i++) curIndent+= "\"\",";
    1.94 +			for (i=0;i<cur->depth();i++) curIndent+= "\"\",";
    1.95  
    1.96  			// Write heading
    1.97 -			ts << curIndent << "\"" << ti->getHeading()<<"\""<<endl;
    1.98 +			ts << curIndent << "\"" << cur->getHeading()<<"\""<<endl;
    1.99  		}
   1.100  		
   1.101 -		ti=model->next();
   1.102 +		cur=model->next(cur,prev,d);
   1.103  		curIndent="";
   1.104  	}
   1.105  	file.close();
   1.106 @@ -352,14 +359,17 @@
   1.107    // QString curIndent("");
   1.108    // int i;
   1.109    BranchObj *bo;
   1.110 -  TreeItem *ti=model->first();
   1.111 -  while (ti) 
   1.112 +  TreeItem *cur=NULL;
   1.113 +  TreeItem *prev=NULL;
   1.114 +  int d;
   1.115 +  model->next(cur,prev,d);
   1.116 +  while (cur) 
   1.117    {
   1.118 -	bo=(BranchObj*)(ti->getLMO());
   1.119 +	bo=(BranchObj*)(cur->getLMO());
   1.120  
   1.121  	if (!bo->hasHiddenExportParent() )
   1.122  	{
   1.123 -		switch (ti->depth() ) 
   1.124 +		switch (cur->depth() ) 
   1.125  		{
   1.126  			case 0: break;
   1.127  			case 1: 
   1.128 @@ -384,7 +394,7 @@
   1.129  		  ts << ("\n");
   1.130  		}
   1.131  	}
   1.132 -    ti=model->next();
   1.133 +    cur=model->next(cur,prev,d);
   1.134     }
   1.135    file.close();
   1.136  }