00001
00042 #include "aimenubar.hpp"
00043
00044 using namespace AiFractals;
00045
00046 AiMenuBar::AiMenuBar( QWidget * parent)
00047 :QMenuBar( parent )
00048 {
00049
00050 {
00051 QMenu * fileMenu = this->addMenu( tr("&File") );
00052 fileMenu->setObjectName( "fileMenu" );
00053 {
00054 QAction * fileOpen= new QAction( tr( "&Open" ), this );
00055 fileOpen->setIcon( QIcon( tr(":/png/open") ) );
00056 fileOpen->setShortcut(QKeySequence::New);
00057 fileOpen->setStatusTip( tr("Open Image") );
00058 this->connect( fileOpen, SIGNAL(triggered()), this, SIGNAL(fileOpen()) );
00059
00060 QAction * fileSave= new QAction( tr( "&Save" ), this );
00061 fileSave->setObjectName( "fileSave" );
00062 fileSave->setIcon( QIcon( tr(":/png/save") ) );
00063 fileSave->setShortcut(QKeySequence::Save);
00064 fileSave->setStatusTip( tr("Save Image") );
00065 this->connect( fileSave, SIGNAL(triggered()), this, SIGNAL(fileSave()) );
00066
00067 QAction * fileSaveAs= new QAction( tr( "Save &As" ), this );
00068 fileSaveAs->setObjectName( "fileSaveAs" );
00069 fileSaveAs->setIcon( QIcon( tr(":/png/saveas") ) );
00070 fileSaveAs->setShortcut(QKeySequence::SaveAs);
00071 fileSaveAs->setStatusTip( tr("Save as...") );
00072 this->connect( fileSaveAs, SIGNAL(triggered()), this, SIGNAL(fileSaveAs()) );
00073
00074 QAction * filePrint= new QAction( tr( "&Print" ), this );
00075 filePrint->setObjectName( "filePrint" );
00076 filePrint->setIcon( QIcon( tr(":/png/print") ) );
00077 filePrint->setShortcut(QKeySequence::Print);
00078 filePrint->setStatusTip( tr("Print") );
00079 this->connect( filePrint, SIGNAL(triggered()), this, SIGNAL(filePrint()) );
00080
00081 QAction * fileClear= new QAction( tr( "&Clear" ), this );
00082 fileClear->setObjectName( "fileClear" );
00083 fileClear->setIcon( QIcon( tr(":/png/clear") ) );
00084 fileClear->setStatusTip( tr("Clear") );
00085 this->connect( fileClear, SIGNAL(triggered()), this, SIGNAL(fileClear()) );
00086
00087 QAction * fileQuit= new QAction( tr( "&Quit" ), this );
00088 fileQuit->setIcon( QIcon( tr(":/png/quit") ) );
00089 fileQuit->setShortcut(QKeySequence(tr("Ctrl+Q")));
00090 fileQuit->setStatusTip( tr("Quit") );
00091 this->connect( fileQuit, SIGNAL(triggered()), this, SIGNAL(fileQuit()) );
00092
00093 fileMenu->addAction( fileOpen );
00094 fileMenu->addSeparator();
00095 fileMenu->addAction( fileSave );
00096 fileMenu->addAction( fileSaveAs );
00097 fileMenu->addSeparator();
00098 fileMenu->addAction( filePrint );
00099 fileMenu->addSeparator();
00100 fileMenu->addAction( fileClear );
00101 fileMenu->addSeparator();
00102 fileMenu->addAction( fileQuit );
00103 }
00104 }
00105
00106
00107
00108 {
00109 QMenu * zoomMenu = this->addMenu( tr("&Zoom") );
00110 zoomMenu->setObjectName( "zoomMenu" );
00111 {
00112 QAction * zoomZoomIn= new QAction( tr( "Zoom In" ), this );
00113 zoomZoomIn->setIcon( QIcon( tr(":/png/zoom-in") ) );
00114 zoomZoomIn->setShortcut(QKeySequence::ZoomIn);
00115 zoomZoomIn->setStatusTip( tr("Zoom In") );
00116 this->connect( zoomZoomIn, SIGNAL(triggered()), this, SIGNAL(zoomZoomIn()) );
00117
00118 QAction * zoomZoomOut= new QAction( tr( "Zoom Out" ), this );
00119 zoomZoomOut->setIcon( QIcon( tr(":/png/zoom-out") ) );
00120 zoomZoomOut->setShortcut(QKeySequence::ZoomOut);
00121 zoomZoomOut->setStatusTip( tr("Zoom Out") );
00122 this->connect( zoomZoomOut, SIGNAL(triggered()), this, SIGNAL(zoomZoomOut()) );
00123
00124 QAction * zoomFitInWindow= new QAction( tr( "Fit in window" ), this );
00125 zoomFitInWindow->setIcon( QIcon( tr(":/png/zoom-fit") ) );
00126 zoomFitInWindow->setStatusTip( tr("Fit in window") );
00127 this->connect( zoomFitInWindow, SIGNAL(triggered()), this, SIGNAL(zoomFitInWindow()) );
00128
00129 QAction * zoomFitToWindow= new QAction( tr( "Fit to window" ), this );
00130 zoomFitToWindow->setIcon( QIcon( tr(":/png/fit-zoom") ) );
00131 zoomFitToWindow->setStatusTip( tr("Fit to window") );
00132 this->connect( zoomFitToWindow, SIGNAL(triggered()), this, SIGNAL(zoomFitToWindow()) );
00133
00134 QAction * zoom1600p= new QAction( tr( "Zoom 1600%" ), this );;
00135 zoom1600p->setStatusTip( tr("Zoom 1600%") );
00136 this->connect( zoom1600p, SIGNAL(triggered()), this, SIGNAL(zoom1600p()) );
00137
00138 QAction * zoom800p= new QAction( tr( "Zoom 800%" ), this );
00139 zoom800p->setStatusTip( tr("Zoom 800%") );
00140 this->connect( zoom800p, SIGNAL(triggered()), this, SIGNAL(zoom800p()) );
00141
00142 QAction * zoom400p= new QAction( tr( "Zoom 400%" ), this );
00143 zoom400p->setStatusTip( tr("Zoom 400%") );
00144 this->connect( zoom400p, SIGNAL(triggered()), this, SIGNAL(zoom400p()) );
00145
00146 QAction * zoom200p= new QAction( tr( "Zoom 200%" ), this );
00147 zoom200p->setStatusTip( tr("Zoom 200%") );
00148 this->connect( zoom200p, SIGNAL(triggered()), this, SIGNAL(zoom200p()) );
00149
00150 QAction * zoom100p= new QAction( tr( "Zoom 100%" ), this );
00151 zoom100p->setStatusTip( tr("Zoom 100%") );
00152 this->connect( zoom100p, SIGNAL(triggered()), this, SIGNAL(zoom100p()) );
00153
00154 QAction * zoom50p= new QAction( tr( "Zoom 50%" ), this );
00155 zoom50p->setStatusTip( tr("Zoom 50%") );
00156 this->connect( zoom50p, SIGNAL(triggered()), this, SIGNAL(zoom50p()) );
00157
00158 QAction * zoom25p= new QAction( tr( "Zoom 25%" ), this );
00159 zoom25p->setStatusTip( tr("Zoom 25%") );
00160 this->connect( zoom25p, SIGNAL(triggered()), this, SIGNAL(zoom25p()) );
00161
00162 QAction * zoom12_5p= new QAction( tr( "Zoom 12.5" ), this );
00163 zoom12_5p->setStatusTip( tr("Zoom 12.5%") );
00164 this->connect( zoom12_5p, SIGNAL(triggered()), this, SIGNAL(zoom12_5p()) );
00165
00166 QAction * zoom6_25p= new QAction( tr( "Zoom 6.25" ), this );
00167 zoom6_25p->setStatusTip( tr("Zoom 6.25%") );
00168 this->connect( zoom6_25p, SIGNAL(triggered()), this, SIGNAL(zoom6_25p()) );
00169
00170 zoomMenu->addAction( zoomZoomIn );
00171 zoomMenu->addAction( zoomZoomOut );
00172 zoomMenu->addSeparator();
00173 zoomMenu->addAction( zoomFitInWindow );
00174 zoomMenu->addAction( zoomFitToWindow );
00175 zoomMenu->addSeparator();
00176 zoomMenu->addAction( zoom1600p );
00177 zoomMenu->addAction( zoom800p );
00178 zoomMenu->addAction( zoom400p );
00179 zoomMenu->addAction( zoom200p );
00180 zoomMenu->addAction( zoom100p );
00181 zoomMenu->addAction( zoom50p );
00182 zoomMenu->addAction( zoom25p );
00183 zoomMenu->addAction( zoom12_5p );
00184 zoomMenu->addAction( zoom6_25p );
00185 }
00186 }
00187
00188
00189
00190 {
00191 QMenu * imageMenu = this->addMenu( tr("&Image") );
00192 imageMenu->setObjectName( "imageMenu" );
00193 {
00194 QAction * imageHorizontalMirror= new QAction( tr( "Horizontal Mirror" ), this );
00195 imageHorizontalMirror->setIcon( QIcon( tr(":/png/d+180") ) );
00196 imageHorizontalMirror->setStatusTip( tr("Horizontal Mirror") );
00197 this->connect( imageHorizontalMirror, SIGNAL(triggered()), this, SIGNAL(imageHorizontalMirror()) );
00198
00199 QAction * imageVerticalMirror= new QAction( tr( "Vertical Mirror" ), this );
00200 imageVerticalMirror->setIcon( QIcon( tr(":/png/d-90") ) );
00201 imageVerticalMirror->setStatusTip( tr("Vertical Mirror") );
00202 this->connect( imageVerticalMirror, SIGNAL(triggered()), this, SIGNAL(imageVerticalMirror()) );
00203
00204 QAction * imageRotation90= new QAction( tr( "Rotation 90°" ), this );
00205 imageRotation90->setIcon( QIcon( tr(":/png/d+90") ) );
00206 imageRotation90->setStatusTip( tr("Rotation 90°") );
00207 this->connect( imageRotation90, SIGNAL(triggered()), this, SIGNAL(imageRotation90()) );
00208
00209 QAction * imageRotationNigative90= new QAction( tr( "Rotation -90°" ), this );
00210 imageRotationNigative90->setIcon( QIcon( tr(":/png/d-90") ) );
00211 imageRotationNigative90->setStatusTip( tr("Rotation -90°") );
00212 this->connect( imageRotationNigative90, SIGNAL(triggered()), this, SIGNAL(imageRotationNigative90()) );
00213
00214 QAction * imageRotation180= new QAction( tr( "Rotation 180°" ), this );
00215 imageRotation180->setIcon( QIcon( tr(":/png/d+180") ) );
00216 imageRotation180->setStatusTip( tr("Rotation 180°") );
00217 this->connect( imageRotation180, SIGNAL(triggered()), this, SIGNAL(imageRotation180()) );
00218
00219 imageMenu->addAction( imageHorizontalMirror );
00220 imageMenu->addAction( imageVerticalMirror );
00221 imageMenu->addSeparator();
00222 imageMenu->addAction( imageRotation90 );
00223 imageMenu->addAction( imageRotationNigative90 );
00224 imageMenu->addAction( imageRotation180 );
00225 }
00226 }
00227
00228
00229
00230 {
00231 QMenu * generatorMenu = this->addMenu( tr("&Complex Zone") );
00232 {
00233 QAction * genRun= new QAction( tr( "Run" ), this );
00234 genRun->setIcon( QIcon( tr(":/png/run") ) );
00235 genRun->setStatusTip( tr("Run") );
00236 this->connect( genRun, SIGNAL(triggered()), this, SIGNAL(genRun()) );
00237
00238 QAction * genStop= new QAction( tr( "Stop" ), this );
00239 genStop->setIcon( QIcon( tr(":/png/stop") ) );
00240 genStop->setStatusTip( tr("Stop") );
00241 this->connect( genStop, SIGNAL(triggered()), this, SIGNAL(genStop()) );
00242
00243 QAction * genThreadsNumbers= new QAction( tr( "Threads" ), this );
00244 genThreadsNumbers->setIcon( QIcon( tr(":/png/threads") ) );
00245 genThreadsNumbers->setStatusTip( tr("Threads") );
00246 this->connect( genThreadsNumbers, SIGNAL(triggered()), this, SIGNAL(genThreadsNumbers()) );
00247
00248 QAction * genChooseFractal= new QAction( tr( "Fractals" ), this );
00249 genChooseFractal->setIcon( QIcon( tr(":/png/fractals") ) );
00250 genChooseFractal->setStatusTip( tr("Fractals") );
00251 this->connect( genChooseFractal, SIGNAL(triggered()), this, SIGNAL(genChooseFractal()) );
00252
00253 QAction * complexZone= new QAction( tr( "Zone" ), this );
00254 complexZone->setIcon( QIcon( tr(":/png/complex") ) );
00255 complexZone->setStatusTip( tr("Zone") );
00256 this->connect( complexZone, SIGNAL(triggered()), this, SIGNAL(complexZone()) );
00257
00258 QAction * serialize= new QAction( tr( "Serialize" ), this );
00259 serialize->setIcon( QIcon( tr(":/png/serialize") ) );
00260 serialize->setStatusTip( tr("Serialize") );
00261 this->connect( serialize, SIGNAL(triggered()), this, SIGNAL(serialize()) );
00262
00263 QAction * deserialize= new QAction( tr( "Deserialize" ), this );
00264 deserialize->setIcon( QIcon( tr(":/png/deserialize") ) );
00265 deserialize->setStatusTip( tr("Deserialize") );
00266 this->connect( deserialize, SIGNAL(triggered()), this, SIGNAL(deserialize()) );
00267
00268 generatorMenu->addAction( genRun );
00269 generatorMenu->addAction( genStop );
00270 generatorMenu->addSeparator();
00271 generatorMenu->addAction( genThreadsNumbers );
00272 generatorMenu->addAction( genChooseFractal );
00273 generatorMenu->addSeparator();
00274 generatorMenu->addAction( complexZone );
00275 generatorMenu->addSeparator();
00276 generatorMenu->addAction( serialize );
00277 generatorMenu->addAction( deserialize );
00278
00279 }
00280 }
00281
00282
00283 {
00284 QMenu * helpMenu = this->addMenu( tr("&Help") );
00285 {
00286 QAction * helpHelp = new QAction( tr( "Help" ), this );
00287 helpHelp->setIcon( QIcon( tr(":/png/help") ) );
00288 helpHelp->setStatusTip( tr("Help!") );
00289 this->connect( helpHelp, SIGNAL(triggered()), this, SIGNAL(helpHelp()) );
00290
00291 QAction * helpAbout = new QAction( tr( "About" ), this );
00292 helpAbout->setIcon( QIcon( tr(":/png/about") ) );
00293 helpAbout->setStatusTip( tr("About") );
00294 this->connect( helpAbout, SIGNAL(triggered()), this, SIGNAL(helpAbout()) );
00295
00296 helpMenu->addAction( helpHelp );
00297 helpMenu->addSeparator();
00298 helpMenu->addAction( helpAbout );
00299 }
00300 }
00301
00302 }
00303
00304 void AiMenuBar::enabledChilds(bool e)
00305 {
00306
00307 {
00308 QAction * fileSave = this->findChild< QAction * >( "fileSave");
00309 QAction * fileSaveAs= this->findChild< QAction * >( "fileSaveAs");
00310 QAction * filePrint = this->findChild< QAction * >( "filePrint");
00311 QAction * fileClear = this->findChild< QAction * >( "fileClear");
00312
00313 fileSave->setEnabled ( e );
00314 fileSaveAs->setEnabled ( e );
00315 filePrint->setEnabled ( e );
00316 fileClear->setEnabled ( e );
00317 }
00318
00319
00320 {
00321 QMenu * zoomMenu = this->findChild< QMenu * >( "zoomMenu" ) ;
00322 zoomMenu->setEnabled ( e );
00323 }
00324
00325
00326 {
00327 QMenu * imageMenu = this->findChild< QMenu * >( "imageMenu" ) ;
00328 imageMenu->setEnabled ( e );
00329 }
00330 }