00001
00042 #include "aiconfig.hpp"
00043
00044 using namespace AiFractals;
00045
00046 AiConfig::AiConfig(QWidget * parent )
00047 :QDialog( parent )
00048 {
00049
00050
00051 m_tabs = new QTabWidget(this);
00052 m_tabs->setTabPosition(QTabWidget::West);
00053
00054 AiConfigTools * tools = new AiConfigTools(m_tabs) ;
00055 AiConfigFractals * fractals = new AiConfigFractals(m_tabs);
00056 AiConfigZone * zone = new AiConfigZone(m_tabs);
00057 AiConfigGenerator * generator = new AiConfigGenerator(m_tabs);
00058
00059
00060 tools->setObjectName( "tools" );
00061 fractals->setObjectName( "fractals" );
00062 zone->setObjectName( "zone" );
00063 generator->setObjectName( "generator" );
00064
00065 this->connect( tools, SIGNAL(zoomIn()), this, SIGNAL(zoomIn()) );
00066 this->connect( tools, SIGNAL(zoomOut()), this, SIGNAL(zoomOut()) );
00067 this->connect( tools, SIGNAL(zoomArea(bool)), this, SIGNAL(zoomArea(bool)) );
00068 this->connect( tools, SIGNAL(horizontalMirror()), this, SIGNAL(horizontalMirror()) );
00069 this->connect( tools, SIGNAL(verticalMirror()), this, SIGNAL(verticalMirror()) );
00070 this->connect( tools, SIGNAL(clear()), this, SIGNAL(clear()) );
00071 this->connect( tools, SIGNAL(rotation(int)), this, SIGNAL(rotation(int)) );
00072
00073 this->connect( fractals, SIGNAL(refreshItems()),this,SIGNAL(refreshItems()));
00074 this->connect( fractals, SIGNAL(debugFractal()),this,SIGNAL(debugFractal()));
00075 this->connect( fractals, SIGNAL(currentIndexChanged(int)),this,SIGNAL(currentIndexChanged(int)));
00076
00077 this->connect( generator, SIGNAL(currentThreads(int)), this, SIGNAL(currentThreads(int)) );
00078 this->connect( generator, SIGNAL(firstCompositionMode(int)), this, SIGNAL(firstCompositionMode(int)) );
00079 this->connect( generator, SIGNAL(othersCompositionMode(int)), this, SIGNAL(othersCompositionMode(int)) );
00080 this->connect( generator, SIGNAL(runGenerator()), this, SIGNAL(runGenerator()) );
00081 this->connect( generator, SIGNAL(stopGenerator()), this, SIGNAL(stopGenerator()) );
00082
00083
00084 m_tabs->addTab( tools, tr("Tools") );
00085
00086
00087 m_tabs->addTab( fractals , tr("Fractals") );
00088
00089
00090 m_tabs->addTab( zone , tr("Complex Zone") );
00091
00092
00093 m_tabs->addTab( generator , tr("Generator") );
00094
00095 QHBoxLayout * layout = new QHBoxLayout();
00096 layout->addWidget( m_tabs );
00097 this->setLayout( layout );
00098 }
00099
00100 void AiConfig::closeEvent(QCloseEvent *event)
00101 {
00102 emit closed();
00103 }
00104
00105 void AiConfig::activeTab(int id)
00106 {
00107 m_tabs->setCurrentIndex( id );
00108 }
00109
00110 void AiConfig::enabledChilds(bool e)
00111 {
00112 QWidget *tools = m_tabs->findChild< QWidget * >( "tools" );
00113 tools->setEnabled( e );
00114 }
00115
00116 void AiConfig::addItems(const QStringList & items)
00117 {
00118 AiConfigFractals * fractals = m_tabs->findChild< AiConfigFractals * >( "fractals" );
00119 fractals->addItems( items );
00120 }
00121
00122 const QString AiConfig::item(const int index )
00123 {
00124 AiConfigFractals * fractals = m_tabs->findChild< AiConfigFractals * >( "fractals" );
00125 return fractals->item( index );
00126 }
00127
00128 const double AiConfig::getZoneWidth() const
00129 {
00130 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00131 return zone->getZoneWidth();
00132 }
00133
00134 void AiConfig::setZoneWidth( double w )
00135 {
00136 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00137 zone->setZoneWidth( w );
00138 }
00139
00140 const double AiConfig::getZoneHeight() const
00141 {
00142 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00143 return zone->getZoneHeight();
00144 }
00145
00146 void AiConfig::setZoneHeight( double h )
00147 {
00148 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00149 zone->setZoneHeight( h );
00150 }
00151
00152 const double AiConfig::getZoneMinX() const
00153 {
00154 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00155 return zone->getZoneMinX();
00156 }
00157
00158 void AiConfig::setZoneMinX( double x )
00159 {
00160 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00161 zone->setZoneMinX( x );
00162 }
00163
00164 const double AiConfig::getZoneMinY() const
00165 {
00166 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00167 return zone->getZoneMinY();
00168 }
00169
00170 void AiConfig::setZoneMinY( double y )
00171 {
00172 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00173 zone->setZoneMinY( y );
00174 }
00175
00176 const int AiConfig::getImageWidth() const
00177 {
00178 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00179 return zone->getImageWidth();
00180 }
00181
00182 void AiConfig::setImageWidth( int w )
00183 {
00184 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00185 zone->setImageWidth( w );
00186 }
00187
00188 const int AiConfig::getImageHeight() const
00189 {
00190 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00191 return zone->getImageHeight();
00192 }
00193
00194 void AiConfig::setImageHeight( int h )
00195 {
00196 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00197 zone->setImageHeight( h );
00198 }
00199
00200 const int AiConfig::getIterations() const
00201 {
00202 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00203 return zone->getIterations();
00204 }
00205
00206 void AiConfig::setIterations( int i )
00207 {
00208 AiConfigZone * zone = m_tabs->findChild< AiConfigZone * >( "zone" );
00209 zone->setIterations( i );
00210 }
00211
00212 void AiConfig::setThreadsNumber(int n)
00213 {
00214 AiConfigGenerator * generator = this->findChild< AiConfigGenerator * >( "generator" );
00215 generator->setThreadsNumber( n );
00216 }
00217
00218
00219 void AiConfig::disableZoomArea()
00220 {
00221 AiConfigTools *tools = m_tabs->findChild< AiConfigTools * >( "tools" );
00222 tools->disableZoomArea();
00223 }
00224
00225 AiConfig::~AiConfig()
00226 {
00227 if( m_tabs != NULL )
00228 {
00229 delete m_tabs;
00230 }
00231 }