Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 qucs_init.cpp 00003 --------------- 00004 begin : Sat May 1 2004 00005 copyright : (C) 2004 by Michael Margraf 00006 email : michael.margraf@alumni.tu-berlin.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifdef HAVE_CONFIG_H 00019 # include <config.h> 00020 #endif 00021 00022 #include "main.h" 00023 #include "qucs.h" 00024 #include "octave_window.h" 00025 00026 #include <QAction> 00027 #include <QShortcut> 00028 #include <QMenu> 00029 #include <QMenuBar> 00030 #include <QToolBar> 00031 #include <QLabel> 00032 #include <QTimer> 00033 #include <QStatusBar> 00034 #include <QDockWidget> 00035 #include <QMessageBox> 00036 #include <QApplication> 00037 00041 void QucsApp::initActions() 00042 { 00043 activeAction = 0; // no active action 00044 00045 // note: first argument of QAction() for backward compatibility Qt < 3.2 00046 00047 fileNew = new QAction(QIcon((":/bitmaps/filenew.png")), tr("&New"), this); 00048 fileNew->setShortcut(Qt::CTRL+Qt::Key_N); 00049 fileNew->setStatusTip(tr("Creates a new document")); 00050 fileNew->setWhatsThis( 00051 tr("New\n\nCreates a new schematic or data display document")); 00052 connect(fileNew, SIGNAL(triggered()), SLOT(slotFileNew())); 00053 00054 textNew = new QAction(QIcon((":/bitmaps/textnew.png")), tr("New &Text"), this); 00055 textNew->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_V); 00056 textNew->setStatusTip(tr("Creates a new text document")); 00057 textNew->setWhatsThis(tr("New Text\n\nCreates a new text document")); 00058 connect(textNew, SIGNAL(triggered()), SLOT(slotTextNew())); 00059 00060 fileOpen = new QAction(QIcon((":/bitmaps/fileopen.png")), tr("&Open..."), this); 00061 fileOpen->setShortcut(Qt::CTRL+Qt::Key_O); 00062 fileOpen->setStatusTip(tr("Opens an existing document")); 00063 fileOpen->setWhatsThis(tr("Open File\n\nOpens an existing document")); 00064 connect(fileOpen, SIGNAL(triggered()), SLOT(slotFileOpen())); 00065 00066 fileSave = new QAction(QIcon((":/bitmaps/filesave.png")), tr("&Save"), this); 00067 fileSave->setShortcut(Qt::CTRL+Qt::Key_S); 00068 fileSave->setStatusTip(tr("Saves the current document")); 00069 fileSave->setWhatsThis(tr("Save File\n\nSaves the current document")); 00070 connect(fileSave, SIGNAL(triggered()), SLOT(slotFileSave())); 00071 00072 fileSaveAs = new QAction(tr("Save as..."), this); 00073 fileSaveAs->setShortcut(Qt::CTRL+Qt::Key_Minus); 00074 fileSaveAs->setStatusTip( 00075 tr("Saves the current document under a new filename")); 00076 fileSaveAs->setWhatsThis( 00077 tr("Save As\n\nSaves the current document under a new filename")); 00078 connect(fileSaveAs, SIGNAL(triggered()), SLOT(slotFileSaveAs())); 00079 00080 fileSaveAll = new QAction(QIcon((":/bitmaps/filesaveall.png")), tr("Save &All"), this); 00081 fileSaveAll->setShortcut(Qt::CTRL+Qt::Key_Plus); 00082 fileSaveAll->setStatusTip(tr("Saves all open documents")); 00083 fileSaveAll->setWhatsThis(tr("Save All Files\n\nSaves all open documents")); 00084 connect(fileSaveAll, SIGNAL(triggered()), SLOT(slotFileSaveAll())); 00085 00086 fileClose = new QAction(QIcon((":/bitmaps/fileclose.png")), tr("&Close"), this); 00087 fileClose->setShortcut(Qt::CTRL+Qt::Key_W); 00088 fileClose->setStatusTip(tr("Closes the current document")); 00089 fileClose->setWhatsThis(tr("Close File\n\nCloses the current document")); 00090 connect(fileClose, SIGNAL(triggered()), SLOT(slotFileClose())); 00091 00092 for (int i = 0; i < MaxRecentFiles; ++i) { 00093 fileRecentAction[i] = new QAction(this); 00094 fileRecentAction[i]->setVisible(false); 00095 connect(fileRecentAction[i], SIGNAL(triggered()), SLOT(slotOpenRecent())); 00096 } 00097 00098 fileClearRecent = new QAction(tr("Clear Recent"), this); 00099 connect(fileClearRecent, SIGNAL(triggered()), SLOT(slotClearRecentFiles())); 00100 00101 fileExamples = new QAction(tr("&Examples"), this); 00102 fileExamples->setStatusTip(tr("Opens a file explorer with example documents")); 00103 fileExamples->setWhatsThis( 00104 tr("Examples\n\nOpens a file explorer with example documents")); 00105 connect(fileExamples, SIGNAL(triggered()), SLOT(slotFileExamples())); 00106 00107 00108 symEdit = new QAction(tr("&Edit Circuit Symbol"), this); 00109 symEdit->setShortcut(Qt::Key_F9); 00110 symEdit->setStatusTip(tr("Edits the symbol for this schematic")); 00111 symEdit->setWhatsThis( 00112 tr("Edit Circuit Symbol\n\nEdits the symbol for this schematic")); 00113 connect(symEdit, SIGNAL(triggered()), SLOT(slotSymbolEdit())); 00114 00115 fileSettings = new QAction(tr("&Document Settings..."), this); 00116 fileSettings->setShortcut(Qt::CTRL+Qt::Key_Period); 00117 fileSettings->setStatusTip(tr("Document Settings")); 00118 fileSettings->setWhatsThis(tr("Settings\n\nSets properties of the file")); 00119 connect(fileSettings, SIGNAL(triggered()), SLOT(slotFileSettings())); 00120 00121 filePrint = new QAction(QIcon((":/bitmaps/fileprint.png")), tr("&Print..."), this); 00122 filePrint->setShortcut(Qt::CTRL+Qt::Key_P); 00123 filePrint->setStatusTip(tr("Prints the current document")); 00124 filePrint->setWhatsThis(tr("Print File\n\nPrints the current document")); 00125 connect(filePrint, SIGNAL(triggered()), SLOT(slotFilePrint())); 00126 00127 filePrintFit = new QAction(tr("Print Fit to Page..."), this); 00128 filePrintFit->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_P); 00129 filePrintFit->setStatusTip(tr("Print Fit to Page")); 00130 filePrintFit->setWhatsThis( 00131 tr("Print Fit to Page\n\n" 00132 "Print and fit content to the page size")); 00133 connect(filePrintFit, SIGNAL(triggered()), SLOT(slotFilePrintFit())); 00134 00135 fileQuit = new QAction(tr("E&xit"), this); 00136 fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q); 00137 fileQuit->setStatusTip(tr("Quits the application")); 00138 fileQuit->setWhatsThis(tr("Exit\n\nQuits the application")); 00139 connect(fileQuit, SIGNAL(triggered()), SLOT(slotFileQuit())); 00140 00141 applSettings = new QAction(tr("Application Settings..."), this); 00142 applSettings->setShortcut(Qt::CTRL+Qt::Key_Comma); 00143 applSettings->setStatusTip(tr("Application Settings")); 00144 applSettings->setWhatsThis( 00145 tr("Qucs Settings\n\nSets properties of the application")); 00146 connect(applSettings, SIGNAL(triggered()), SLOT(slotApplSettings())); 00147 00148 refreshSchPath = new QAction(tr("Refresh Search Path..."), this); 00149 //refreshSchPath->setShortcut(Qt::CTRL+Qt::Key_Comma); 00150 refreshSchPath->setStatusTip(tr("Refresh Search Path")); 00151 refreshSchPath->setWhatsThis( 00152 tr("Refresh Path\n\nRechecks the list of paths for subcircuit files.")); 00153 connect(refreshSchPath, SIGNAL(triggered()), SLOT(slotRefreshSchPath())); 00154 00155 alignTop = new QAction(tr("Align top"), this); 00156 alignTop->setShortcut(Qt::CTRL+Qt::Key_T); 00157 alignTop->setStatusTip(tr("Align top selected elements")); 00158 alignTop->setWhatsThis( 00159 tr("Align top\n\nAlign selected elements to their upper edge")); 00160 connect(alignTop, SIGNAL(triggered()), SLOT(slotAlignTop())); 00161 00162 alignBottom = new QAction(tr("Align bottom"), this); 00163 alignBottom->setStatusTip(tr("Align bottom selected elements")); 00164 alignBottom->setWhatsThis( 00165 tr("Align bottom\n\nAlign selected elements to their lower edge")); 00166 connect(alignBottom, SIGNAL(triggered()), SLOT(slotAlignBottom())); 00167 00168 alignLeft = new QAction(tr("Align left"), this); 00169 alignLeft->setStatusTip(tr("Align left selected elements")); 00170 alignLeft->setWhatsThis( 00171 tr("Align left\n\nAlign selected elements to their left edge")); 00172 connect(alignLeft, SIGNAL(triggered()), SLOT(slotAlignLeft())); 00173 00174 alignRight = new QAction(tr("Align right"), this); 00175 alignRight->setStatusTip(tr("Align right selected elements")); 00176 alignRight->setWhatsThis( 00177 tr("Align right\n\nAlign selected elements to their right edge")); 00178 connect(alignRight, SIGNAL(triggered()), SLOT(slotAlignRight())); 00179 00180 distrHor = new QAction(tr("Distribute horizontally"), this); 00181 distrHor->setStatusTip(tr("Distribute equally horizontally")); 00182 distrHor->setWhatsThis( 00183 tr("Distribute horizontally\n\n" 00184 "Distribute horizontally selected elements")); 00185 connect(distrHor, SIGNAL(triggered()), SLOT(slotDistribHoriz())); 00186 00187 distrVert = new QAction(tr("Distribute vertically"), this); 00188 distrVert->setStatusTip(tr("Distribute equally vertically")); 00189 distrVert->setWhatsThis( 00190 tr("Distribute vertically\n\n" 00191 "Distribute vertically selected elements")); 00192 connect(distrVert, SIGNAL(triggered()), SLOT(slotDistribVert())); 00193 00194 centerHor = new QAction(tr("Center horizontally"), this); 00195 centerHor->setStatusTip(tr("Center horizontally selected elements")); 00196 centerHor->setWhatsThis( 00197 tr("Center horizontally\n\nCenter horizontally selected elements")); 00198 connect(centerHor, SIGNAL(triggered()), SLOT(slotCenterHorizontal())); 00199 00200 centerVert = new QAction(tr("Center vertically"), this); 00201 centerVert->setStatusTip(tr("Center vertically selected elements")); 00202 centerVert->setWhatsThis( 00203 tr("Center vertically\n\nCenter vertically selected elements")); 00204 connect(centerVert, SIGNAL(triggered()), SLOT(slotCenterVertical())); 00205 00206 onGrid = new QAction(tr("Set on Grid"), this); 00207 onGrid->setShortcut(Qt::CTRL+Qt::Key_U); 00208 onGrid->setStatusTip(tr("Sets selected elements on grid")); 00209 onGrid->setWhatsThis( 00210 tr("Set on Grid\n\nSets selected elements on grid")); 00211 onGrid->setCheckable(true); 00212 connect(onGrid, SIGNAL(toggled(bool)), SLOT(slotOnGrid(bool))); 00213 00214 moveText = new QAction(tr("Move Component Text"), this); 00215 moveText->setShortcut(Qt::CTRL+Qt::Key_K); 00216 moveText->setStatusTip(tr("Moves the property text of components")); 00217 moveText->setWhatsThis( 00218 tr("Move Component Text\n\nMoves the property text of components")); 00219 moveText->setCheckable(true); 00220 connect(moveText, SIGNAL(toggled(bool)), SLOT(slotMoveText(bool))); 00221 00222 changeProps = new QAction(tr("Replace..."), this); 00223 changeProps->setShortcut(Qt::Key_F7); 00224 changeProps->setStatusTip(tr("Replace component properties or VHDL code")); 00225 changeProps->setWhatsThis( 00226 tr("Replace\n\nChange component properties\nor\ntext in VHDL code")); 00227 connect(changeProps, SIGNAL(triggered()), SLOT(slotChangeProps())); 00228 00229 editCut = new QAction(QIcon((":/bitmaps/editcut.png")), tr("Cu&t"), this); 00230 editCut->setShortcut(Qt::CTRL+Qt::Key_X); 00231 editCut->setStatusTip( 00232 tr("Cuts out the selection and puts it into the clipboard")); 00233 editCut->setWhatsThis( 00234 tr("Cut\n\nCuts out the selection and puts it into the clipboard")); 00235 connect(editCut, SIGNAL(triggered()), SLOT(slotEditCut())); 00236 00237 editCopy = new QAction(QIcon((":/bitmaps/editcopy.png")), tr("&Copy"), this); 00238 editCopy->setShortcut(Qt::CTRL+Qt::Key_C); 00239 editCopy->setStatusTip( 00240 tr("Copies the selection into the clipboard")); 00241 editCopy->setWhatsThis( 00242 tr("Copy\n\nCopies the selection into the clipboard")); 00243 connect(editCopy, SIGNAL(triggered()), SLOT(slotEditCopy())); 00244 00245 editPaste = new QAction(QIcon((":/bitmaps/editpaste.png")), tr("&Paste"), this); 00246 editPaste->setShortcut(Qt::CTRL+Qt::Key_V); 00247 editPaste->setStatusTip( 00248 tr("Pastes the clipboard contents to the cursor position")); 00249 editPaste->setWhatsThis( 00250 tr("Paste\n\nPastes the clipboard contents to the cursor position")); 00251 editPaste->setCheckable(true); 00252 connect(editPaste, SIGNAL(toggled(bool)), SLOT(slotEditPaste(bool))); 00253 00254 editDelete = new QAction(QIcon((":/bitmaps/editdelete.png")), tr("&Delete"), this); 00255 editDelete->setShortcut(Qt::Key_Delete); 00256 editDelete->setStatusTip(tr("Deletes the selected components")); 00257 editDelete->setWhatsThis(tr("Delete\n\nDeletes the selected components")); 00258 editDelete->setCheckable(true); 00259 connect(editDelete, SIGNAL(toggled(bool)), SLOT(slotEditDelete(bool))); 00260 00261 editFind = new QAction(tr("Find..."), this); 00262 editFind->setShortcut(Qt::CTRL+Qt::Key_F); 00263 editFind->setStatusTip(tr("Find a piece of text")); 00264 editFind->setWhatsThis(tr("Find\n\nSearches for a piece of text")); 00265 connect(editFind, SIGNAL(triggered()), SLOT(slotEditFind())); 00266 00267 // to ease usage with notebooks, backspace can also be used to delete 00268 // currently not supported 00269 //mainAccel->connectItem(mainAccel->insertItem(Qt::Key_Backspace), 00270 // editDelete, SLOT(toggle()) ); 00271 00272 exportAsImage = new QAction(tr("Export as image..."),this); 00273 connect(exportAsImage,SIGNAL(triggered()),SLOT(slotSaveSchematicToGraphicsFile())); 00274 exportAsImage->setStatusTip(tr("Exports the current document to an image file")); 00275 exportAsImage->setWhatsThis(tr("Export as image\n\nExports the current document to an image file")); 00276 00277 // cursor left/right/up/down to move marker on a graph 00278 cursorLeft = new QShortcut(QKeySequence(Qt::Key_Left), this); 00279 connect(cursorLeft, SIGNAL(activated()), SLOT(slotCursorLeft())); 00280 00281 cursorRight = new QShortcut(QKeySequence(Qt::Key_Right), this); 00282 connect(cursorRight, SIGNAL(activated()), SLOT(slotCursorRight())); 00283 00284 cursorUp = new QShortcut(QKeySequence(Qt::Key_Up), this); 00285 connect(cursorUp, SIGNAL(activated()), SLOT(slotCursorUp())); 00286 00287 cursorDown = new QShortcut(QKeySequence(Qt::Key_Down), this); 00288 connect(cursorDown, SIGNAL(activated()), SLOT(slotCursorDown())); 00289 00290 undo = new QAction(QIcon((":/bitmaps/undo.png")), tr("&Undo"), this); 00291 undo->setShortcut(Qt::CTRL+Qt::Key_Z); 00292 undo->setStatusTip(tr("Undoes the last command")); 00293 undo->setWhatsThis(tr("Undo\n\nMakes the last action undone")); 00294 connect(undo, SIGNAL(triggered()), SLOT(slotEditUndo())); 00295 00296 redo = new QAction(QIcon((":/bitmaps/redo.png")), tr("&Redo"), this); 00297 redo->setShortcut(Qt::CTRL+Qt::Key_Y); 00298 redo->setStatusTip(tr("Redoes the last command")); 00299 redo->setWhatsThis(tr("Redo\n\nRepeats the last action once more")); 00300 connect(redo, SIGNAL(triggered()), SLOT(slotEditRedo())); 00301 00302 projNew = new QAction(tr("&New Project..."), this); 00303 projNew->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_N); 00304 projNew->setStatusTip(tr("Creates a new project")); 00305 projNew->setWhatsThis(tr("New Project\n\nCreates a new project")); 00306 connect(projNew, SIGNAL(triggered()), SLOT(slotButtonProjNew())); 00307 00308 projOpen = new QAction(tr("&Open Project..."), this); 00309 projOpen->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_O); 00310 projOpen->setStatusTip(tr("Opens an existing project")); 00311 projOpen->setWhatsThis(tr("Open Project\n\nOpens an existing project")); 00312 connect(projOpen, SIGNAL(triggered()), SLOT(slotMenuProjOpen())); 00313 00314 projDel = new QAction(tr("&Delete Project..."), this); 00315 projDel->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_D); 00316 projDel->setStatusTip(tr("Deletes an existing project")); 00317 projDel->setWhatsThis(tr("Delete Project\n\nDeletes an existing project")); 00318 connect(projDel, SIGNAL(triggered()), SLOT(slotMenuProjDel())); 00319 00320 projClose = new QAction(tr("&Close Project"), this); 00321 projClose->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_W); 00322 projClose->setStatusTip(tr("Closes the current project")); 00323 projClose->setWhatsThis(tr("Close Project\n\nCloses the current project")); 00324 connect(projClose, SIGNAL(triggered()), SLOT(slotMenuProjClose())); 00325 00326 addToProj = new QAction(tr("&Add Files to Project..."), this); 00327 addToProj->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_A); 00328 addToProj->setStatusTip(tr("Copies files to project directory")); 00329 addToProj->setWhatsThis( 00330 tr("Add Files to Project\n\nCopies files to project directory")); 00331 connect(addToProj, SIGNAL(triggered()), SLOT(slotAddToProject())); 00332 00333 createLib = new QAction(tr("Create &Library..."), this); 00334 createLib->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_L); 00335 createLib->setStatusTip(tr("Create Library from Subcircuits")); 00336 createLib->setWhatsThis( 00337 tr("Create Library\n\nCreate Library from Subcircuits")); 00338 connect(createLib, SIGNAL(triggered()), SLOT(slotCreateLib())); 00339 00340 createPkg = new QAction(tr("Create &Package..."), this); 00341 createPkg->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_Z); 00342 createPkg->setStatusTip(tr("Create compressed Package from Projects")); 00343 createPkg->setWhatsThis( 00344 tr("Create Package\n\nCreate compressed Package from complete Projects")); 00345 connect(createPkg, SIGNAL(triggered()), SLOT(slotCreatePackage())); 00346 00347 extractPkg = new QAction(tr("E&xtract Package..."), this); 00348 extractPkg->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_X); 00349 extractPkg->setStatusTip(tr("Install Content of a Package")); 00350 extractPkg->setWhatsThis( 00351 tr("Extract Package\n\nInstall Content of a Package")); 00352 connect(extractPkg, SIGNAL(triggered()), SLOT(slotExtractPackage())); 00353 00354 importData = new QAction(tr("&Import/Export Data..."), this); 00355 importData->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_I); 00356 importData->setStatusTip(tr("Convert data file")); 00357 importData->setWhatsThis( 00358 tr("Import/Export Data\n\nConvert data file to various file formats")); 00359 connect(importData, SIGNAL(triggered()), SLOT(slotImportData())); 00360 00361 graph2csv = new QAction(tr("Export to &CSV..."), this); 00362 graph2csv->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_C); 00363 graph2csv->setStatusTip(tr("Convert graph data to CSV file")); 00364 graph2csv->setWhatsThis( 00365 tr("Export to CSV\n\nConvert graph data to CSV file")); 00366 connect(graph2csv, SIGNAL(triggered()), SLOT(slotExportGraphAsCsv())); 00367 00368 buildModule = new QAction(tr("Build Verilog-A module..."), this); 00369 buildModule->setStatusTip(tr("Run admsXml and C++ compiler")); 00370 buildModule->setWhatsThis(tr("Build Verilog-A module\nRuns amdsXml and C++ compiler")); 00371 connect(buildModule, SIGNAL(triggered()), SLOT(slotBuildModule())); 00372 00373 loadModule = new QAction(tr("Load Verilog-A module..."), this); 00374 loadModule->setStatusTip(tr("Select Verilog-A symbols to be loaded")); 00375 loadModule->setWhatsThis(tr("Load Verilog-A module\nLet the user select and load symbols")); 00376 connect(loadModule, SIGNAL(triggered()), SLOT(slotLoadModule())); 00377 00378 magAll = new QAction(QIcon((":/bitmaps/viewmagfit.png")), tr("View All"), this); 00379 magAll->setShortcut(Qt::Key_0); 00380 magAll->setStatusTip(tr("Show the whole page")); 00381 magAll->setWhatsThis(tr("View All\n\nShows the whole page content")); 00382 connect(magAll, SIGNAL(triggered()), SLOT(slotShowAll())); 00383 00384 magOne = new QAction(QIcon((":/bitmaps/viewmag1.png")), tr("View 1:1"), this); 00385 magOne->setShortcut(Qt::Key_1); 00386 magOne->setStatusTip(tr("Views without magnification")); 00387 magOne->setWhatsThis(tr("View 1:1\n\nShows the page content without magnification")); 00388 connect(magOne, SIGNAL(triggered()), SLOT(slotShowOne())); 00389 00390 magPlus = new QAction(QIcon((":/bitmaps/viewmag+.png")), tr("Zoom in"), this); 00391 magPlus->setShortcut(Qt::Key_Plus); 00392 magPlus->setStatusTip(tr("Zooms into the current view")); 00393 magPlus->setWhatsThis(tr("Zoom in\n\nZooms the current view")); 00394 magPlus->setCheckable(true); 00395 connect(magPlus, SIGNAL(toggled(bool)), SLOT(slotZoomIn(bool))); 00396 00397 magMinus = new QAction(QIcon((":/bitmaps/viewmag-.png")), tr("Zoom out"), this); 00398 magMinus->setShortcut(Qt::Key_Minus); 00399 magMinus->setStatusTip(tr("Zooms out the current view")); 00400 magMinus->setWhatsThis(tr("Zoom out\n\nZooms out the current view")); 00401 connect(magMinus, SIGNAL(triggered()), SLOT(slotZoomOut())); 00402 00403 QAction *escape = new QAction(this); 00404 escape->setShortcut(Qt::Key_Escape); 00405 connect(escape, SIGNAL(triggered()), SLOT(slotEscape())); 00406 this->addAction(escape); 00407 00408 select = new QAction(QIcon((":/bitmaps/pointer.png")), tr("Select"), this); 00409 select->setStatusTip(tr("Activate select mode")); 00410 select->setWhatsThis(tr("Select\n\nActivates select mode")); 00411 select->setCheckable(true); 00412 connect(select, SIGNAL(toggled(bool)), SLOT(slotSelect(bool))); 00413 00414 selectAll = new QAction(tr("Select All"), this); 00415 selectAll->setShortcut(Qt::CTRL+Qt::Key_A); 00416 selectAll->setStatusTip(tr("Selects all elements")); 00417 selectAll->setWhatsThis( 00418 tr("Select All\n\nSelects all elements of the document")); 00419 connect(selectAll, SIGNAL(triggered()), SLOT(slotSelectAll())); 00420 00421 selectMarker = new QAction(tr("Select Markers"), this); 00422 selectMarker->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_M); 00423 selectMarker->setStatusTip(tr("Selects all markers")); 00424 selectMarker->setWhatsThis( 00425 tr("Select Markers\n\nSelects all diagram markers of the document")); 00426 connect(selectMarker, SIGNAL(triggered()), SLOT(slotSelectMarker())); 00427 00428 editRotate = new QAction(QIcon((":/bitmaps/rotate_ccw.png")), tr("Rotate"), this); 00429 editRotate->setShortcut(Qt::CTRL+Qt::Key_R); 00430 editRotate->setStatusTip(tr("Rotates the selected component by 90\x00B0")); 00431 editRotate->setWhatsThis( 00432 tr("Rotate\n\nRotates the selected component by 90\x00B0 counter-clockwise")); 00433 editRotate->setCheckable(true); 00434 connect(editRotate, SIGNAL(toggled(bool)), SLOT(slotEditRotate(bool))); 00435 00436 editMirror = new QAction(QIcon((":/bitmaps/mirror.png")), tr("Mirror about X Axis"), this); 00437 editMirror->setShortcut(Qt::CTRL+Qt::Key_J); 00438 editMirror->setStatusTip(tr("Mirrors the selected item about X Axis")); 00439 editMirror->setWhatsThis( 00440 tr("Mirror about X Axis\n\nMirrors the selected item about X Axis")); 00441 editMirror->setCheckable(true); 00442 connect(editMirror, SIGNAL(toggled(bool)), SLOT(slotEditMirrorX(bool))); 00443 00444 editMirrorY = new QAction(QIcon((":/bitmaps/mirrory.png")), tr("Mirror about Y Axis"), this); 00445 editMirrorY->setShortcut(Qt::CTRL+Qt::Key_M); 00446 editMirrorY->setStatusTip(tr("Mirrors the selected item about Y Axis")); 00447 editMirrorY->setWhatsThis( 00448 tr("Mirror about Y Axis\n\nMirrors the selected item about Y Axis")); 00449 editMirrorY->setCheckable(true); 00450 connect(editMirrorY, SIGNAL(toggled(bool)), SLOT(slotEditMirrorY(bool))); 00451 00452 intoH = new QAction(QIcon((":/bitmaps/bottom.png")), tr("Go into Subcircuit"), this); 00453 intoH->setShortcut(Qt::CTRL+Qt::Key_I); 00454 intoH->setStatusTip(tr("Goes inside the selected subcircuit")); 00455 intoH->setWhatsThis( 00456 tr("Go into Subcircuit\n\nGoes inside the selected subcircuit")); 00457 connect(intoH, SIGNAL(triggered()), SLOT(slotIntoHierarchy())); 00458 00459 popH = new QAction(QIcon((":/bitmaps/top.png")), tr("Pop out"), this); 00460 popH->setShortcut(Qt::CTRL+Qt::Key_H); 00461 popH->setStatusTip(tr("Pop outside subcircuit")); 00462 popH->setWhatsThis( 00463 tr("Pop out\n\nGoes up one hierarchy level, i.e. leaves subcircuit")); 00464 connect(popH, SIGNAL(triggered()), SLOT(slotPopHierarchy())); 00465 popH->setEnabled(false); // only enabled if useful !!!! 00466 00467 editActivate = new QAction(QIcon((":/bitmaps/deactiv.png")), tr("Deactivate/Activate"), this); 00468 editActivate->setShortcut(Qt::CTRL+Qt::Key_D); 00469 editActivate->setStatusTip(tr("Deactivate/Activate selected components")); 00470 editActivate->setWhatsThis( 00471 tr("Deactivate/Activate\n\nDeactivate/Activate the selected components")); 00472 editActivate->setCheckable(true); 00473 connect(editActivate, SIGNAL(toggled(bool)), SLOT(slotEditActivate(bool))); 00474 00475 insEquation = new QAction(QIcon((":/bitmaps/equation.png")), tr("Insert Equation"), this); 00476 insEquation->setShortcut(Qt::CTRL+Qt::Key_Less); 00477 insEquation->setStatusTip(tr("Inserts an equation")); 00478 insEquation->setWhatsThis( 00479 tr("Insert Equation\n\nInserts a user defined equation")); 00480 insEquation->setCheckable(true); 00481 connect(insEquation, SIGNAL(toggled(bool)), SLOT(slotInsertEquation(bool))); 00482 00483 insGround = new QAction(QIcon((":/bitmaps/ground.png")), tr("Insert Ground"), this); 00484 insGround->setShortcut(Qt::CTRL+Qt::Key_G); 00485 insGround->setStatusTip(tr("Inserts a ground symbol")); 00486 insGround->setWhatsThis(tr("Insert Ground\n\nInserts a ground symbol")); 00487 insGround->setCheckable(true); 00488 connect(insGround, SIGNAL(toggled(bool)), SLOT(slotInsertGround(bool))); 00489 00490 insPort = new QAction(QIcon((":/bitmaps/port.png")), tr("Insert Port"), this); 00491 insPort->setStatusTip(tr("Inserts a port symbol")); 00492 insPort->setWhatsThis(tr("Insert Port\n\nInserts a port symbol")); 00493 insPort->setCheckable(true); 00494 connect(insPort, SIGNAL(toggled(bool)), SLOT(slotInsertPort(bool))); 00495 00496 insWire = new QAction(QIcon((":/bitmaps/wire.png")), tr("Wire"), this); 00497 insWire->setShortcut(Qt::CTRL+Qt::Key_E); 00498 insWire->setStatusTip(tr("Inserts a wire")); 00499 insWire->setWhatsThis(tr("Wire\n\nInserts a wire")); 00500 insWire->setCheckable(true); 00501 connect(insWire, SIGNAL(toggled(bool)), SLOT(slotSetWire(bool))); 00502 00503 insLabel = new QAction(QIcon((":/bitmaps/nodename.png")), tr("Wire Label"), this); 00504 insLabel->setShortcut(Qt::CTRL+Qt::Key_L); 00505 insLabel->setStatusTip(tr("Inserts a wire or pin label")); 00506 insLabel->setWhatsThis(tr("Wire Label\n\nInserts a wire or pin label")); 00507 insLabel->setCheckable(true); 00508 connect(insLabel, SIGNAL(toggled(bool)), SLOT(slotInsertLabel(bool))); 00509 00510 insEntity = new QAction(tr("VHDL entity"), this); 00511 insEntity->setShortcut(Qt::CTRL+Qt::Key_Space); 00512 insEntity->setStatusTip(tr("Inserts skeleton of VHDL entity")); 00513 insEntity->setWhatsThis( 00514 tr("VHDL entity\n\nInserts the skeleton of a VHDL entity")); 00515 connect(insEntity, SIGNAL(triggered()), SLOT(slotInsertEntity())); 00516 00517 callEditor = new QAction(tr("Text Editor"), this); 00518 callEditor->setShortcut(Qt::CTRL+Qt::Key_1); 00519 callEditor->setStatusTip(tr("Starts the Qucs text editor")); 00520 callEditor->setWhatsThis(tr("Text editor\n\nStarts the Qucs text editor")); 00521 connect(callEditor, SIGNAL(triggered()), SLOT(slotCallEditor())); 00522 00523 callFilter = new QAction(tr("Filter synthesis"), this); 00524 callFilter->setShortcut(Qt::CTRL+Qt::Key_2); 00525 callFilter->setStatusTip(tr("Starts QucsFilter")); 00526 callFilter->setWhatsThis(tr("Filter synthesis\n\nStarts QucsFilter")); 00527 connect(callFilter, SIGNAL(triggered()), SLOT(slotCallFilter())); 00528 00529 callActiveFilter = new QAction(tr("Active filter synthesis"),this); 00530 callActiveFilter->setShortcut(Qt::CTRL+Qt::Key_3); 00531 callActiveFilter->setStatusTip(tr("Starts QucsActiveFilter")); 00532 callActiveFilter->setWhatsThis(tr("Active filter synthesis\n\nStarts QucsActiveFilter")); 00533 connect(callActiveFilter, SIGNAL(triggered()), SLOT(slotCallActiveFilter())); 00534 00535 callLine = new QAction(tr("Line calculation"), this); 00536 callLine->setShortcut(Qt::CTRL+Qt::Key_4); 00537 callLine->setStatusTip(tr("Starts QucsTrans")); 00538 callLine->setWhatsThis( 00539 tr("Line calculation\n\nStarts transmission line calculator")); 00540 connect(callLine, SIGNAL(triggered()), SLOT(slotCallLine())); 00541 00542 callLib = new QAction(tr("Component Library"), this); 00543 callLib->setShortcut(Qt::CTRL+Qt::Key_5); 00544 callLib->setStatusTip(tr("Starts QucsLib")); 00545 callLib->setWhatsThis( 00546 tr("Component Library\n\nStarts component library program")); 00547 connect(callLib, SIGNAL(triggered()), SLOT(slotCallLibrary())); 00548 00549 callMatch = new QAction(tr("Matching Circuit"), this); 00550 callMatch->setShortcut(Qt::CTRL+Qt::Key_6); 00551 callMatch->setStatusTip(tr("Creates Matching Circuit")); 00552 callMatch->setWhatsThis( 00553 tr("Matching Circuit\n\nDialog for Creating Matching Circuit")); 00554 connect(callMatch, SIGNAL(triggered()), SLOT(slotCallMatch())); 00555 00556 callAtt = new QAction(tr("Attenuator synthesis"), this); 00557 callAtt->setShortcut(Qt::CTRL+Qt::Key_7); 00558 callAtt->setStatusTip(tr("Starts QucsAttenuator")); 00559 callAtt->setWhatsThis( 00560 tr("Attenuator synthesis\n\nStarts attenuator calculation program")); 00561 connect(callAtt, SIGNAL(triggered()), SLOT(slotCallAtt())); 00562 00563 callRes = new QAction(tr("Resistor color codes"), this); 00564 callRes->setShortcut(Qt::CTRL+Qt::Key_8); 00565 callRes->setStatusTip(tr("Starts Qucs resistor color codes")); 00566 callRes->setWhatsThis( 00567 tr("Resistor color codes\n\nStarts standard resistor color code computation program")); 00568 connect(callRes, SIGNAL(triggered()), SLOT(slotCallRes())); 00569 00570 simulate = new QAction(QIcon((":/bitmaps/gear.png")), tr("Simulate"), this); 00571 simulate->setShortcut(Qt::Key_F2); 00572 simulate->setStatusTip(tr("Simulates the current schematic")); 00573 simulate->setWhatsThis(tr("Simulate\n\nSimulates the current schematic")); 00574 connect(simulate, SIGNAL(triggered()), SLOT(slotSimulate())); 00575 00576 dpl_sch = new QAction(QIcon((":/bitmaps/rebuild.png")), tr("View Data Display/Schematic"), this); 00577 dpl_sch->setShortcut(Qt::Key_F4); 00578 dpl_sch->setStatusTip(tr("Changes to data display or schematic page")); 00579 dpl_sch->setWhatsThis( 00580 tr("View Data Display/Schematic\n\n")+ 00581 tr("Changes to data display or schematic page")); 00582 connect(dpl_sch, SIGNAL(triggered()), SLOT(slotToPage())); 00583 00584 dcbias = new QAction(tr("Calculate DC bias"), this); 00585 dcbias->setShortcut(Qt::Key_F8); 00586 dcbias->setStatusTip(tr("Calculates DC bias and shows it")); 00587 dcbias->setWhatsThis( 00588 tr("Calculate DC bias\n\nCalculates DC bias and shows it")); 00589 connect(dcbias, SIGNAL(triggered()), SLOT(slotDCbias())); 00590 00591 setMarker = new QAction(QIcon((":/bitmaps/marker.png")), tr("Set Marker on Graph"), this); 00592 setMarker->setShortcut(Qt::CTRL+Qt::Key_B); 00593 setMarker->setStatusTip(tr("Sets a marker on a diagram's graph")); 00594 setMarker->setWhatsThis( 00595 tr("Set Marker\n\nSets a marker on a diagram's graph")); 00596 setMarker->setCheckable(true); 00597 connect(setMarker, SIGNAL(toggled(bool)), SLOT(slotSetMarker(bool))); 00598 00599 showMsg = new QAction(tr("Show Last Messages"), this); 00600 showMsg->setShortcut(Qt::Key_F5); 00601 showMsg->setStatusTip(tr("Shows last simulation messages")); 00602 showMsg->setWhatsThis( 00603 tr("Show Last Messages\n\nShows the messages of the last simulation")); 00604 connect(showMsg, SIGNAL(triggered()), SLOT(slotShowLastMsg())); 00605 00606 showNet = new QAction(tr("Show Last Netlist"), this); 00607 showNet->setShortcut(Qt::Key_F6); 00608 showNet->setStatusTip(tr("Shows last simulation netlist")); 00609 showNet->setWhatsThis( 00610 tr("Show Last Netlist\n\nShows the netlist of the last simulation")); 00611 connect(showNet, SIGNAL(triggered()), SLOT(slotShowLastNetlist())); 00612 00613 viewToolBar = new QAction(tr("Tool&bar"), this); 00614 viewToolBar->setCheckable(true); 00615 viewToolBar->setStatusTip(tr("Enables/disables the toolbar")); 00616 viewToolBar->setWhatsThis(tr("Toolbar\n\nEnables/disables the toolbar")); 00617 connect(viewToolBar, SIGNAL(toggled(bool)), SLOT(slotViewToolBar(bool))); 00618 00619 viewStatusBar = new QAction(tr("&Statusbar"), this); 00620 viewStatusBar->setCheckable(true); 00621 viewStatusBar->setStatusTip(tr("Enables/disables the statusbar")); 00622 viewStatusBar->setWhatsThis( 00623 tr("Statusbar\n\nEnables/disables the statusbar")); 00624 connect(viewStatusBar, SIGNAL(toggled(bool)), SLOT(slotViewStatusBar(bool))); 00625 00626 viewBrowseDock = new QAction(tr("&Dock Window"), this); 00627 viewBrowseDock->setCheckable(true); 00628 viewBrowseDock->setStatusTip(tr("Enables/disables the browse dock window")); 00629 viewBrowseDock->setWhatsThis( 00630 tr("Browse Window\n\nEnables/disables the browse dock window")); 00631 connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotViewBrowseDock(bool))); 00632 00633 viewOctaveDock = new QAction(tr("&Octave Window"), this); 00634 viewOctaveDock->setCheckable(true); 00635 viewOctaveDock->setStatusTip(tr("Shows/hides the Octave dock window")); 00636 viewOctaveDock->setWhatsThis( 00637 tr("Octave Window\n\nShows/hides the Octave dock window")); 00638 connect(viewOctaveDock, SIGNAL(toggled(bool)), SLOT(slotViewOctaveDock(bool))); 00639 00640 helpIndex = new QAction(tr("Help Index..."), this); 00641 helpIndex->setShortcut(Qt::Key_F1); 00642 helpIndex->setStatusTip(tr("Index of Qucs Help")); 00643 helpIndex->setWhatsThis(tr("Help Index\n\nIndex of intern Qucs help")); 00644 connect(helpIndex, SIGNAL(triggered()), SLOT(slotHelpIndex())); 00645 00646 helpGetStart = new QAction(tr("Getting Started..."), this); 00647 helpGetStart->setStatusTip(tr("Getting Started with Qucs")); 00648 helpGetStart->setWhatsThis( 00649 tr("Getting Started\n\nShort introduction into Qucs")); 00650 connect(helpGetStart, SIGNAL(triggered()), SLOT(slotGettingStarted())); 00651 00652 helpAboutApp = new QAction(tr("&About Qucs..."), this); 00653 helpAboutApp->setStatusTip(tr("About the application")); 00654 helpAboutApp->setWhatsThis(tr("About\n\nAbout the application")); 00655 connect(helpAboutApp, SIGNAL(triggered()), SLOT(slotHelpAbout())); 00656 00657 helpAboutQt = new QAction(tr("About Qt..."), this); 00658 helpAboutQt->setStatusTip(tr("About Qt")); 00659 helpAboutQt->setWhatsThis(tr("About Qt\n\nAbout Qt by Trolltech")); 00660 connect(helpAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); 00661 } 00662 00663 // ---------------------------------------------------------- 00664 void QucsApp::initMenuBar() 00665 { 00666 fileMenu = new QMenu(tr("&File")); // menuBar entry fileMenu 00667 fileMenu->addAction(fileNew); 00668 fileMenu->addAction(textNew); 00669 fileMenu->addAction(fileOpen); 00670 fileMenu->addAction(fileClose); 00671 00672 recentFilesMenu = new QMenu(tr("Open Recent"),fileMenu); 00673 fileMenu->addMenu(recentFilesMenu); 00674 for (int i = 0; i < MaxRecentFiles; ++i) { 00675 recentFilesMenu->addAction(fileRecentAction[i]); 00676 } 00677 recentFilesMenu->insertSeparator(); 00678 recentFilesMenu->addAction(fileClearRecent); 00679 00680 fileMenu->insertSeparator(); 00681 fileMenu->addAction(fileSave); 00682 fileMenu->addAction(fileSaveAll); 00683 fileMenu->addAction(fileSaveAs); 00684 fileMenu->addAction(exportAsImage); 00685 fileMenu->addAction(filePrint); 00686 fileMenu->addAction(filePrintFit); 00687 fileMenu->insertSeparator(); 00688 fileMenu->addAction(fileExamples); 00689 fileMenu->insertSeparator(); 00690 fileMenu->addAction(fileSettings); 00691 fileMenu->addAction(symEdit); 00692 fileMenu->insertSeparator(); 00693 fileMenu->addAction(applSettings); 00694 fileMenu->addAction(refreshSchPath); 00695 fileMenu->insertSeparator(); 00696 fileMenu->addAction(fileQuit); 00697 00698 editMenu = new QMenu(tr("&Edit")); // menuBar entry editMenu 00699 editMenu->addAction(undo); 00700 editMenu->addAction(redo); 00701 editMenu->insertSeparator(); 00702 editMenu->addAction(editCut); 00703 editMenu->addAction(editCopy); 00704 editMenu->addAction(editPaste); 00705 editMenu->addAction(editDelete); 00706 editMenu->insertSeparator(); 00707 editMenu->addAction(select); 00708 editMenu->addAction(selectAll); 00709 editMenu->addAction(selectMarker); 00710 editMenu->addAction(editFind); 00711 editMenu->addAction(changeProps); 00712 editMenu->addAction(editRotate); 00713 editMenu->addAction(editMirror); 00714 editMenu->addAction(editMirrorY); 00715 editMenu->addAction(editActivate); 00716 editMenu->insertSeparator(); 00717 editMenu->addAction(intoH); 00718 editMenu->addAction(popH); 00719 00720 00721 00722 alignMenu = new QMenu(tr("P&ositioning")); // menuBar entry alignMenu 00723 alignMenu->addAction(moveText); 00724 alignMenu->addAction(onGrid); 00725 alignMenu->insertSeparator(); 00726 alignMenu->addAction(centerHor); 00727 alignMenu->addAction(centerVert); 00728 alignMenu->insertSeparator(); 00729 alignMenu->addAction(alignTop); 00730 alignMenu->addAction(alignBottom); 00731 alignMenu->addAction(alignLeft); 00732 alignMenu->addAction(alignRight); 00733 alignMenu->insertSeparator(); 00734 alignMenu->addAction(distrHor); 00735 alignMenu->addAction(distrVert); 00736 00737 00738 00739 insMenu = new QMenu(tr("&Insert")); // menuBar entry insMenu 00740 insMenu->addAction(insWire); 00741 insMenu->addAction(insLabel); 00742 insMenu->addAction(insEquation); 00743 insMenu->addAction(insGround); 00744 insMenu->addAction(insPort); 00745 insMenu->addAction(setMarker); 00746 insMenu->addAction(insEntity); 00747 00748 00749 projMenu = new QMenu(tr("&Project")); // menuBar entry projMenu 00750 projMenu->addAction(projNew); 00751 projMenu->addAction(projOpen); 00752 projMenu->addAction(addToProj); 00753 projMenu->addAction(projClose); 00754 projMenu->addAction(projDel); 00755 projMenu->insertSeparator(); 00756 projMenu->addAction(createLib); 00757 projMenu->addAction(createPkg); 00758 projMenu->addAction(extractPkg); 00759 projMenu->insertSeparator(); 00760 projMenu->addAction(importData); 00761 projMenu->addAction(graph2csv); 00762 projMenu->insertSeparator(); 00763 // TODO only enable if document is VA file 00764 projMenu->addAction(buildModule); 00765 projMenu->addAction(loadModule); 00766 00767 toolMenu = new QMenu(tr("&Tools")); // menuBar entry toolMenu 00768 toolMenu->addAction(callEditor); 00769 toolMenu->addAction(callFilter); 00770 toolMenu->addAction(callActiveFilter); 00771 toolMenu->addAction(callLine); 00772 toolMenu->addAction(callLib); 00773 toolMenu->addAction(callMatch); 00774 toolMenu->addAction(callAtt); 00775 toolMenu->addAction(callRes); 00776 00777 00778 00779 simMenu = new QMenu(tr("&Simulation")); // menuBar entry simMenu 00780 simMenu->addAction(simulate); 00781 simMenu->addAction(dpl_sch); 00782 simMenu->addAction(dcbias); 00783 simMenu->addAction(showMsg); 00784 simMenu->addAction(showNet); 00785 00786 00787 viewMenu = new QMenu(tr("&View")); // menuBar entry viewMenu 00788 viewMenu->addAction(magAll); 00789 viewMenu->addAction(magOne); 00790 viewMenu->addAction(magPlus); 00791 viewMenu->addAction(magMinus); 00792 viewMenu->insertSeparator(); 00793 viewMenu->setCheckable(true); 00794 viewMenu->addAction(viewToolBar); 00795 viewMenu->addAction(viewStatusBar); 00796 viewMenu->addAction(viewBrowseDock); 00797 viewMenu->addAction(viewOctaveDock); 00798 00799 00800 helpMenu = new QMenu(tr("&Help")); // menuBar entry helpMenu 00801 helpMenu->addAction(helpIndex); 00802 helpMenu->addAction(helpGetStart); 00803 helpMenu->insertSeparator(); 00804 00805 00806 00807 //Fill submenu's with filenames of PDF documents 00808 QDir TechnicalDir = QDir(QucsSettings.DocDir.replace('\\','/')); 00809 00810 if(TechnicalDir.cd("technical")) 00811 { 00812 helpTechnical = new QMenu(tr("&Technical Papers")); 00813 helpMenu->addMenu(helpTechnical); 00814 TechnicalDir.setFilter(QDir::Files); 00815 QStringList entries = TechnicalDir.entryList(); 00816 for(int i=0;i<entries.size();i++) 00817 { 00818 QAction* helpTechnicalActions = new QAction(entries[i], this); 00819 helpTechnicalActions->setObjectName ( entries[i] ); 00820 helpTechnicalActions->setStatusTip(tr("Open ")+entries[i]); 00821 helpTechnicalActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i])); 00822 connect(helpTechnicalActions, SIGNAL(triggered()), SLOT(slotHelpTechnical())); 00823 helpTechnical->addAction(helpTechnicalActions); 00824 } 00825 00826 } 00827 00828 //Fill submenu's with filenames of PDF documents 00829 QDir ReportDir = QDir(QucsSettings.DocDir.replace('\\','/')); 00830 if(ReportDir.cd("report")) 00831 { 00832 helpReport = new QMenu(tr("Technical &Reports")); 00833 helpMenu->addMenu(helpReport); 00834 ReportDir.setFilter(QDir::Files); 00835 QStringList entries = ReportDir.entryList(); 00836 for(int i=0;i<entries.size();i++) 00837 { 00838 QAction* helpReportActions = new QAction(entries[i], this); 00839 helpReportActions->setObjectName ( entries[i] ); 00840 helpReportActions->setStatusTip(tr("Open ")+entries[i]); 00841 helpReportActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i])); 00842 connect(helpReportActions, SIGNAL(triggered()), SLOT(slotHelpReport())); 00843 helpReport->addAction(helpReportActions); 00844 } 00845 } 00846 00847 //Fill submenu's with filenames of PDF documents 00848 QDir TutorialDir = QDir(QucsSettings.DocDir.replace('\\','/')); 00849 if(TutorialDir.cd("tutorial")) 00850 { 00851 helpTutorial = new QMenu(tr("T&utorials")); 00852 helpMenu->addMenu(helpTutorial); 00853 TutorialDir.setFilter(QDir::Files); 00854 QStringList entries = TutorialDir.entryList(); 00855 for(int i=0;i<entries.size();i++) 00856 { 00857 QAction* helpTutorialActions = new QAction(entries[i], this); 00858 helpTutorialActions->setObjectName ( entries[i] ); 00859 helpTutorialActions->setStatusTip(tr("Open ")+entries[i]); 00860 helpTutorialActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i])); 00861 connect(helpTutorialActions, SIGNAL(triggered()), SLOT(slotHelpTutorial())); 00862 helpTutorial->addAction(helpTutorialActions); 00863 } 00864 } 00865 00866 00867 helpMenu->insertSeparator(); 00868 helpMenu->addAction(helpAboutApp); 00869 helpMenu->addAction(helpAboutQt); 00870 00871 00872 menuBar()->addMenu(fileMenu); 00873 menuBar()->addMenu(editMenu); 00874 menuBar()->addMenu(alignMenu); 00875 menuBar()->addMenu(insMenu); 00876 menuBar()->addMenu(projMenu); 00877 menuBar()->addMenu(toolMenu); 00878 menuBar()->addMenu(simMenu); 00879 menuBar()->addMenu(viewMenu); 00880 menuBar()->insertSeparator(); 00881 menuBar()->addMenu(helpMenu); 00882 00883 } 00884 00885 // ---------------------------------------------------------- 00886 void QucsApp::initToolBar() 00887 { 00888 fileToolbar = new QToolBar(tr("File")); 00889 this->addToolBar(fileToolbar); 00890 fileToolbar->addAction(fileNew); 00891 fileToolbar->addAction(textNew); 00892 fileToolbar->addAction(fileOpen); 00893 fileToolbar->addAction(fileSave); 00894 fileToolbar->addAction(fileSaveAll); 00895 fileToolbar->addAction(fileClose); 00896 fileToolbar->addAction(filePrint); 00897 00898 00899 00900 editToolbar = new QToolBar(tr("Edit")); 00901 this->addToolBar(editToolbar); 00902 editToolbar->addAction(editCut); 00903 editToolbar->addAction(editCopy); 00904 editToolbar->addAction(editPaste); 00905 editToolbar->addAction(editDelete); 00906 editToolbar->addAction(undo); 00907 editToolbar->addAction(redo); 00908 00909 00910 00911 viewToolbar = new QToolBar(tr("View")); 00912 this->addToolBar(viewToolbar); 00913 viewToolbar->addAction(magAll); 00914 viewToolbar->addAction(magOne); 00915 viewToolbar->addAction(magPlus); 00916 viewToolbar->addAction(magMinus); 00917 00918 00919 workToolbar = new QToolBar(tr("Work")); 00920 this->addToolBar(workToolbar); 00921 workToolbar->addAction(select); 00922 workToolbar->addAction(editActivate); 00923 workToolbar->addAction(editMirror); 00924 workToolbar->addAction(editMirrorY); 00925 workToolbar->addAction(editRotate); 00926 workToolbar->addAction(intoH); 00927 workToolbar->addAction(popH); 00928 workToolbar->addAction(insWire); 00929 workToolbar->addAction(insLabel); 00930 workToolbar->addAction(insEquation); 00931 workToolbar->addAction(insGround); 00932 workToolbar->addAction(insPort); 00933 workToolbar->addAction(simulate); 00934 workToolbar->addAction(dpl_sch); 00935 workToolbar->addAction(setMarker); 00936 workToolbar->addSeparator(); // <<<======================= 00937 00938 } 00939 00940 // ---------------------------------------------------------- 00941 void QucsApp::initStatusBar() 00942 { 00943 // To reserve enough space, insert the longest text and rewrite it afterwards. 00944 WarningLabel = new QLabel(tr("no warnings"), statusBar()); 00945 statusBar()->addWidget(WarningLabel, 0, true); 00946 00947 PositionLabel = new QLabel("0 : 0", statusBar()); 00948 PositionLabel->setAlignment(Qt::AlignRight); 00949 statusBar()->addWidget(PositionLabel, 0, true); 00950 00951 statusBar()->message(tr("Ready."), 2000); 00952 } 00953 00954 // ---------------------------------------------------------- 00955 void QucsApp::slotShowWarnings() 00956 { 00957 static int ResultState = 0; 00958 00959 if(ResultState == 0) { 00960 QFont f = WarningLabel->font(); 00961 f.setWeight(QFont::DemiBold); 00962 WarningLabel->setFont(f); 00963 WarningLabel->setText(tr("Warnings in last simulation! Press F5")); 00964 } 00965 00966 ResultState++; 00967 if(ResultState & 1) 00968 WarningLabel->setPaletteForegroundColor(Qt::red); 00969 else 00970 WarningLabel->setPaletteForegroundColor(Qt::black); 00971 00972 if(ResultState < 9) 00973 QTimer::singleShot(500, this, SLOT(slotShowWarnings())); 00974 else 00975 ResultState = 0; 00976 } 00977 00978 // ---------------------------------------------------------- 00979 void QucsApp::slotResetWarnings() 00980 { 00981 QFont f = WarningLabel->font(); // reset warning label 00982 f.setWeight(QFont::Normal); 00983 WarningLabel->setFont(f); 00984 WarningLabel->setPaletteForegroundColor(Qt::black); 00985 WarningLabel->setText(tr("no warnings")); 00986 } 00987 00988 // ---------------------------------------------------------- 00989 void QucsApp::printCursorPosition(int x, int y) 00990 { 00991 PositionLabel->setText(QString::number(x)+" : "+QString::number(y)); 00992 PositionLabel->setMinimumWidth(PositionLabel->width()); 00993 } 00994 00995 // -------------------------------------------------------------- 00996 // called by document, update undo state 00997 void QucsApp::slotUpdateUndo(bool isEnabled) 00998 { 00999 undo->setEnabled(isEnabled); 01000 } 01001 01002 // -------------------------------------------------------------- 01003 // called by document, update redo state 01004 void QucsApp::slotUpdateRedo(bool isEnabled) 01005 { 01006 redo->setEnabled(isEnabled); 01007 } 01008 01009 // ---------------------------------------------------------- 01010 // turn Toolbar on or off 01011 void QucsApp::slotViewToolBar(bool toggle) 01012 { 01013 fileToolbar->setVisible(toggle); 01014 editToolbar->setVisible(toggle); 01015 viewToolbar->setVisible(toggle); 01016 workToolbar->setVisible(toggle); 01017 } 01018 01019 // ---------------------------------------------------------- 01020 // turn Statusbar on or off 01021 void QucsApp::slotViewStatusBar(bool toggle) 01022 { 01023 statusBar()->setVisible(toggle); 01024 } 01025 01026 // ---------------------------------------------------------- 01027 // turn Brwose Dock Window on or off 01028 void QucsApp::slotViewBrowseDock(bool toggle) 01029 { 01030 dock->setVisible(toggle); 01031 } 01032 01033 // ---------------------------------------------------------- 01034 void QucsApp::slotToggleDock(bool on) 01035 { 01036 viewBrowseDock->blockSignals(true); 01037 viewBrowseDock->setChecked(on); 01038 viewBrowseDock->blockSignals(false); 01039 } 01040 01041 // ---------------------------------------------------------- 01042 // turn Octave Dock Window on or off 01043 void QucsApp::slotViewOctaveDock(bool toggle) 01044 { 01045 octDock->setVisible(toggle); 01046 if (toggle) { 01047 octave->startOctave(); 01048 } 01049 } 01050 01051 // ---------------------------------------------------------- 01052 void QucsApp::slotToggleOctave(bool on) 01053 { 01054 viewOctaveDock->blockSignals(true); 01055 viewOctaveDock->setChecked(on); 01056 viewOctaveDock->blockSignals(false); 01057 } 01058