00001
00042 #include "aitoolbar.hpp"
00043
00044 using namespace AiFractals;
00045
00046 AiToolBar::AiToolBar(QWidget * parent )
00047 :QToolBar( parent )
00048 {
00049
00050 {
00051 QToolButton * fileOpen= new QToolButton( this );
00052 fileOpen->setIcon( QIcon( tr(":/png/open") ) );
00053 fileOpen->setToolTip( tr("Open Image") );
00054 this->connect( fileOpen, SIGNAL(clicked(bool)), this, SIGNAL(fileOpen()) );
00055
00056 QToolButton * fileSave= new QToolButton( this );
00057 fileSave->setObjectName( "fileSave" );
00058 fileSave->setIcon( QIcon( tr(":/png/save") ) );
00059 fileSave->setToolTip( tr("Save Image") );
00060 this->connect( fileSave, SIGNAL(clicked(bool)), this, SIGNAL(fileSave()) );
00061
00062 QToolButton * fileClear= new QToolButton( this );
00063 fileClear->setObjectName( "fileClear" );
00064 fileClear->setIcon( QIcon( tr(":/png/clear") ) );
00065 fileClear->setToolTip( tr("Clear") );
00066 this->connect( fileClear, SIGNAL(clicked(bool)), this, SIGNAL(fileClear()) );
00067
00068 this->addWidget( fileOpen );
00069 this->addWidget( fileSave );
00070 this->addWidget( fileClear );
00071 this->addSeparator();
00072 }
00073
00074
00075 {
00076 QToolButton * zoomIn= new QToolButton( this );
00077 zoomIn->setObjectName( "zoomIn" );
00078 zoomIn->setIcon( QIcon( tr(":/png/zoom-in") ) );
00079 zoomIn->setToolTip( tr("Zoom in") );
00080 this->connect( zoomIn, SIGNAL(clicked(bool)), this, SIGNAL(zoomIn()) );
00081
00082 QToolButton * zoomOut= new QToolButton( this );
00083 zoomOut->setObjectName( "zoomOut" );
00084 zoomOut->setIcon( QIcon( tr(":/png/zoom-out") ) );
00085 zoomOut->setToolTip( tr("Zoom Out") );
00086 this->connect( zoomOut, SIGNAL(clicked(bool)), this, SIGNAL(zoomOut()) );
00087
00088 this->addWidget( zoomIn );
00089 this->addWidget( zoomOut );
00090 this->addSeparator();
00091 }
00092
00093
00094 {
00095 QToolButton * mirrorH= new QToolButton( this );
00096 mirrorH->setObjectName( "mirrorH" );
00097 mirrorH->setIcon( QIcon( tr(":/png/d+180") ) );
00098 mirrorH->setToolTip( tr("Horizontal Mirror") );
00099 this->connect( mirrorH, SIGNAL(clicked(bool)), this, SIGNAL(mirrorH()) );
00100
00101 QToolButton * mirrorV= new QToolButton( this );
00102 mirrorV->setObjectName( "mirrorV" );
00103 mirrorV->setIcon( QIcon( tr(":/png/d-90") ) );
00104 mirrorV->setToolTip( tr("Virtical Mirror") );
00105 this->connect( mirrorV, SIGNAL(clicked(bool)), this, SIGNAL(mirrorV()) );
00106
00107 this->addWidget( mirrorH );
00108 this->addWidget( mirrorV );
00109 this->addSeparator();
00110 }
00111
00112
00113 {
00114 QToolButton * complexZone= new QToolButton( this );
00115 complexZone->setIcon( QIcon( tr(":/png/complex") ) );
00116 complexZone->setToolTip( tr("Complex Zone") );
00117 this->connect( complexZone, SIGNAL(clicked(bool)), this, SIGNAL(complexZone()) );
00118
00119 QToolButton * complexRun= new QToolButton( this );
00120 complexRun->setIcon( QIcon( tr(":/png/run") ) );
00121 complexRun->setToolTip( tr("Run") );
00122 this->connect( complexRun, SIGNAL(clicked(bool)), this, SIGNAL(complexRun()) );
00123
00124 QToolButton * complexStop= new QToolButton( this );
00125 complexStop->setIcon( QIcon( tr(":/png/stop") ) );
00126 complexStop->setToolTip( tr("Stop") );
00127 this->connect( complexStop, SIGNAL(clicked(bool)), this, SIGNAL(complexStop()) );
00128
00129 this->addWidget( complexZone );
00130 this->addWidget( complexRun );
00131 this->addWidget( complexStop );
00132 this->addSeparator();
00133 }
00134
00135
00136 {
00137 QToolButton * helpAbout= new QToolButton( this );
00138 helpAbout->setIcon( QIcon( tr(":/png/about") ) );
00139 helpAbout->setToolTip( tr("About!") );
00140 this->connect( helpAbout, SIGNAL(clicked(bool)), this, SIGNAL(helpAbout()) );
00141
00142 this->addWidget( helpAbout );
00143 this->addSeparator();
00144 }
00145
00146
00147 {
00148 QToolButton * toolbox= new QToolButton( this );
00149 toolbox->setIcon( QIcon( tr(":/png/toolbox") ) );
00150 toolbox->setToolTip( tr("Show/Hide Toolbox") );
00151 toolbox->setCheckable(true);
00152 this->connect( toolbox, SIGNAL(clicked(bool)), this, SIGNAL(toolbox(bool)) );
00153 this->connect( this, SIGNAL(chkToolbox(bool)), toolbox, SLOT(setChecked(bool) ) );
00154
00155 QToolButton * undo= new QToolButton( this );
00156 undo->setIcon( QIcon( tr(":/png/undo") ) );
00157 undo->setToolTip( tr("Undo") );
00158 this->connect( undo, SIGNAL(clicked()), this, SIGNAL(undo()) );
00159
00160 this->addWidget( toolbox );
00161 this->addWidget( undo );
00162 }
00163
00164 }
00165
00166 void AiToolBar::checkedToolbox(bool checked)
00167 {
00168 emit chkToolbox( checked );
00169 }
00170
00171 void AiToolBar::enabledChilds(bool e)
00172 {
00173
00174 {
00175 QToolButton * fileSave = this->findChild< QToolButton * >( "fileSave" ) ;
00176 QToolButton * fileClear = this->findChild< QToolButton * >( "fileClear" ) ;
00177 fileSave->setEnabled( e );
00178 fileClear->setEnabled( e );
00179 }
00180
00181
00182 {
00183 QToolButton * zoomIn = this->findChild< QToolButton * >( "zoomIn" ) ;
00184 QToolButton * zoomOut = this->findChild< QToolButton * >( "zoomOut" ) ;
00185 zoomIn->setEnabled( e );
00186 zoomOut->setEnabled( e );
00187 }
00188
00189
00190 {
00191 QToolButton * mirrorH = this->findChild< QToolButton * >( "mirrorH" ) ;
00192 QToolButton * mirrorV = this->findChild< QToolButton * >( "mirrorV" ) ;
00193 mirrorH->setEnabled( e );
00194 mirrorV->setEnabled( e );
00195 }
00196 }