void AiMainWindow::debugFractal (  )  [private, slot]

slot for a fractals debugging script

Definition at line 871 of file aimainwindow.cpp.

00872 {
00873     try
00874     {
00875        m_startedThreads = m_currentThreadsNumber;
00876 
00877        if( (m_config->getImageWidth() == 0 || m_config->getImageHeight() == 0) )
00878        {
00879             QMessageBox::warning(this, tr("Config"), tr("Please, setup a fractal config!"), QMessageBox::Ok) ;
00880             this->complexZone();
00881             return;
00882        }
00883 
00884        if( QMessageBox::Yes != QMessageBox::warning(this, tr("Debug...") , tr("You want really debug this script ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) )
00885        {
00886             return;
00887        }
00888 
00889         //~ create a complex zone
00890         AiZone * zone = new AiZone(this,
00891                                    m_config->getZoneMinX(),
00892                                    m_config->getZoneMinY(),
00893                                    m_config->getZoneWidth(),
00894                                    m_config->getZoneHeight(),
00895                                    m_config->getImageWidth(),
00896                                    m_config->getImageHeight(),
00897                                    0, //# start point
00898                                    m_startedThreads, //# threads numbers
00899                                    m_config->getIterations() ,
00900                                    m_zoom,
00901                                    m_viewX,
00902                                    m_viewY);
00903 
00904         QScriptEngine engine;
00905         {
00906             QScriptValue qs_zone = engine.newQObject( zone );
00907             engine.globalObject().setProperty( "zone" , qs_zone );
00908         }
00909         QScriptEngineDebugger debugger(this);
00910         debugger.attachTo(&engine);
00911         debugger.standardWindow()->setWindowModality(Qt::ApplicationModal);
00912 
00913 
00914         //~ read script file
00915         QString fileName("scripts/" + m_config->item( m_selectedFractalIndex ));
00916         QString script;
00917         {
00918             QFile file( fileName );
00919             file.open(QIODevice::ReadOnly);
00920             script = file.readAll();
00921             file.close();
00922         }
00923 
00924         debugger.action(QScriptEngineDebugger::InterruptAction)->trigger();
00925         engine.evaluate(script, fileName);
00926 
00927         //# UPDATE view
00928 
00929         m_view->view()->clear();
00930         m_view->view()->makeUpdate( zone->image(), true );
00931         this->enabledChilds( true );
00932 
00933         delete zone;
00934     }
00935     catch(const std::exception & exception )
00936     {
00937         QMessageBox::critical(this, tr("Critical Error!"), tr("Please report this problem to adrabi[at]gmail[dot]com =)."));
00938     }
00939 }

 All Classes Namespaces Files Functions Variables Typedefs

Generated on Sat Feb 27 08:33:16 2010 for AiFractals by  doxygen 1.6.1