mainwindow.cpp
changeset 447 72afe12da1c8
parent 445 0796c5592f00
child 450 beb875135811
     1.1 --- a/mainwindow.cpp	Tue Apr 10 13:22:51 2007 +0000
     1.2 +++ b/mainwindow.cpp	Tue Apr 10 13:22:52 2007 +0000
     1.3 @@ -3634,10 +3634,25 @@
     1.4      if (action)
     1.5  	{
     1.6          i=action->data().toInt();
     1.7 -		QString m=settings.value(QString("/macros/macro-%1").arg(i) ).toString();
     1.8 +		QString mDir (settings.value ("macros/macroDir").toString() );
     1.9 +
    1.10 +		QString fn=mDir + QString("/macro-%1.vys").arg(i+1);
    1.11 +		QFile f (fn);
    1.12 +		if ( !f.open( QIODevice::ReadOnly ) )
    1.13 +		{
    1.14 +			QMessageBox::warning(0, 
    1.15 +				tr("Warning"),
    1.16 +				tr("Couldn't find a macro at  %1.\n").arg(fn)+
    1.17 +				tr("Please use Settings->")+tr("Set directory for vym macros"));
    1.18 +			return;
    1.19 +		}	
    1.20 +
    1.21 +		QTextStream ts( &f );
    1.22 +		QString m= ts.read();
    1.23 +
    1.24  		if (! m.isEmpty())
    1.25  		{
    1.26 -			cout <<"Main::callMacro  m="<<m.ascii()<<endl;
    1.27 +			//cout <<"Main::callMacro  m="<<m.ascii()<<endl;
    1.28  			currentMapEditor()->runScript (m);
    1.29  		}	
    1.30  	}