vymmodel.cpp
changeset 807 f9f7922989d8
parent 804 14f2b1b15242
child 808 b163492fda17
     1.1 --- a/vymmodel.cpp	Tue Nov 17 08:24:59 2009 +0000
     1.2 +++ b/vymmodel.cpp	Wed Nov 25 10:58:21 2009 +0000
     1.3 @@ -53,7 +53,7 @@
     1.4  
     1.5  VymModel::VymModel()
     1.6  {
     1.7 -//    cout << "Const VymModel\n";
     1.8 +    //cout << "Const VymModel\n";
     1.9  	init();
    1.10  	rootItem->setModel (this);
    1.11  }
    1.12 @@ -61,7 +61,7 @@
    1.13  
    1.14  VymModel::~VymModel() 
    1.15  {
    1.16 -    cout << "Destr VymModel\n";
    1.17 +    //cout << "Destr VymModel\n";
    1.18  	autosaveTimer->stop();
    1.19  	fileChangedTimer->stop();
    1.20  	clear();
    1.21 @@ -3233,6 +3233,21 @@
    1.22  			deleteChildren();
    1.23  		}	
    1.24  	/////////////////////////////////////////////////////////////////////
    1.25 +	} else if (com=="exportAO")
    1.26 +	{
    1.27 +		QString fname="";
    1.28 +		ok=true;
    1.29 +		if (parser.parCount()>=1)
    1.30 +			// Hey, we even have a filename
    1.31 +			fname=parser.parString(ok,0); 
    1.32 +		if (!ok)
    1.33 +		{
    1.34 +			parser.setError (Aborted,"Could not read filename");
    1.35 +		} else
    1.36 +		{
    1.37 +				exportAO (fname,false);
    1.38 +		}
    1.39 +	/////////////////////////////////////////////////////////////////////
    1.40  	} else if (com=="exportASCII")
    1.41  	{
    1.42  		QString fname="";
    1.43 @@ -3982,7 +3997,7 @@
    1.44  	return returnValue;
    1.45  }
    1.46  
    1.47 -void VymModel::runScript (QString script)
    1.48 +QVariant VymModel::runScript (const QString &script)
    1.49  {
    1.50  	parser.setScript (script);
    1.51  	parser.runScript();
    1.52 @@ -3995,6 +4010,7 @@
    1.53  		if (!noErr)	//FIXME-3 need dialog box here
    1.54  			cout << "VM::runScript aborted:\n"<<errMsg.toStdString()<<endl;
    1.55  	}	
    1.56 +	return r;
    1.57  }
    1.58  
    1.59  void VymModel::setExportMode (bool b)
    1.60 @@ -4077,6 +4093,30 @@
    1.61  	setExportMode (false);
    1.62  }
    1.63  
    1.64 +void VymModel::exportAO (QString fname,bool askName)
    1.65 +{
    1.66 +	ExportAO ex;
    1.67 +	ex.setModel (this);
    1.68 +	if (fname=="") 
    1.69 +		ex.setFile (mapName+".txt");	
    1.70 +	else
    1.71 +		ex.setFile (fname);
    1.72 +
    1.73 +	if (askName)
    1.74 +	{
    1.75 +		//ex.addFilter ("TXT (*.txt)");
    1.76 +		ex.setDir(lastImageDir);
    1.77 +		//ex.setCaption(vymName+ " -" +tr("Export as A&O report")+" "+tr("(still experimental)"));
    1.78 +		ex.execDialog() ; 
    1.79 +	} 
    1.80 +	if (!ex.canceled())
    1.81 +	{
    1.82 +		setExportMode(true);
    1.83 +		ex.doExport();
    1.84 +		setExportMode(false);
    1.85 +	}
    1.86 +}
    1.87 +
    1.88  void VymModel::exportASCII(QString fname,bool askName)
    1.89  {
    1.90  	ExportASCII ex;