void KgpgApp::initActions() { KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(slotFileNew()), actionCollection()); KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(slotFileOpen()), actionCollection()); KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(slotFileSaveAs()), actionCollection()); KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(slotFileQuit()), actionCollection()); KStdAction::cut(TQT_TQOBJECT(this), TQT_SLOT(slotEditCut()), actionCollection()); KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(slotEditCopy()), actionCollection()); KStdAction::paste(TQT_TQOBJECT(this), TQT_SLOT(slotEditPaste()), actionCollection()); KStdAction::selectAll(TQT_TQOBJECT(this), TQT_SLOT(slotSelectAll()), actionCollection()); KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotOptions()), actionCollection(),"kgpg_config"); //KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); //KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureToolbars()), actionCollection()); fileSave = KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(slotFileSave()), actionCollection()); (void) new TDEAction(i18n("&Encrypt File..."), "encrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreEnc()), actionCollection(),"file_encrypt"); (void) new TDEAction(i18n("&Decrypt File..."), "decrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreDec()), actionCollection(),"file_decrypt"); (void) new TDEAction(i18n("&Open Key Manager"), "kgpg", 0,TQT_TQOBJECT(this), TQT_SLOT(slotKeyManager()), actionCollection(),"key_manage"); editUndo = KStdAction::undo(TQT_TQOBJECT(this), TQT_SLOT(slotundo()), actionCollection()); editRedo = KStdAction::redo(TQT_TQOBJECT(this), TQT_SLOT(slotredo()), actionCollection()); //(void) new TDEAction(i18n("&Manage Keys"), "kgpg_manage", CTRL+Key_K,TQT_TQOBJECT(this), TQT_SLOT(slotManageKey()), actionCollection(),"keys_manage"); (void) new TDEAction(i18n("&Generate Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreSignFile()), actionCollection(), "sign_generate"); (void) new TDEAction(i18n("&Verify Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreVerifyFile()), actionCollection(), "sign_verify"); (void) new TDEAction(i18n("&Check MD5 Sum..."), 0,TQT_TQOBJECT(this), TQT_SLOT(slotCheckMd5()), actionCollection(), "sign_check"); KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(slotFilePrint()), actionCollection()); // comment out for now, only confusing //encodingAction=new TDEToggleAction(i18n("&Unicode (utf-8) Encoding"), 0, 0,this, TQT_SLOT(slotSetCharset()),actionCollection(),"charsets"); }
MainWindow::MainWindow(CuteDesigner::Core *core) : QMainWindow(), ui(new Ui::MainWindow), m_core(core) { ui->setupUi(this); // defaultPageActions = ui->menuPage->actions(); // foreach (QAction * action, defaultPageActions) // action->setParent(this); ui->actionExport->setEnabled(m_core->reportCore()->exportModules().size()); // Initialise the global search widget StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker()); // ui->tabs->SetBackgroundPixmap(QPixmap(":/images/sidebar_background.png")); connect(ui->actionRender, SIGNAL(triggered()), core, SLOT(render()), Qt::QueuedConnection); connect(ui->actionRenderStop, SIGNAL(triggered()), core, SLOT(stopRenderer()), Qt::QueuedConnection); connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(slotTabsSwitched(int))); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT(slotOptions())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(m_core, SIGNAL(newReport_after(CuteReport::ReportInterface*)), this, SLOT(slotNewReport_after(CuteReport::ReportInterface*)), Qt::QueuedConnection); connect(m_core, SIGNAL(newPage_after(CuteReport::PageInterface*)), this, SLOT(slotNewPage_after(CuteReport::PageInterface*)), Qt::QueuedConnection); connect(m_core, SIGNAL(loadReport_after(CuteReport::ReportInterface*)), this, SLOT(slotLoadReport_after(CuteReport::ReportInterface*)), Qt::QueuedConnection); // connect(m_core, SIGNAL(newPageActions(QList<CuteReport::PageAction*>)), this, SLOT(slotNewPageActions(QList<CuteReport::PageAction*>)), Qt::QueuedConnection); connect(CuteReport::Log::instance(), SIGNAL(logMessage(CuteReport::LogLevel,QString,QString,QString)), ui->message, SLOT(pushMessage(CuteReport::LogLevel,QString,QString,QString))); connect(m_core->reportCore(), SIGNAL(rendererStarted(CuteReport::ReportInterface*)), ui->message, SLOT(clear())); // reloadSettings(); ui->geometryLabel->hide(); ui->coordinateLabel->hide(); m_updateTabTimer.setInterval(10); m_updateTabTimer.setSingleShot(true); connect(&m_updateTabTimer, SIGNAL(timeout()), this, SLOT(slotUpdateTabs())); }
MainMenubar::MainMenubar (QMainWindow *mw) : QMenuBar (mw, "mainMenubar") { actions.setAutoDelete(FALSE); RcFile rcfile; QPixmap icon(finished); QAction *action = new QAction(this, "actionExit"); action->setMenuText(tr("E&xit")); action->setIconSet(icon); action->setAccel(Qt::CTRL+Qt::Key_Q); action->setStatusTip(tr("Quit Qtstalker (Ctrl+Q)")); action->setToolTip(tr("Quit Qtstalker (Ctrl+Q)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalExit())); actions.replace(Exit, action); icon = configure; action = new QAction(this, "actionOptions"); action->setMenuText(tr("Edit &Preferences")); action->setIconSet(icon); action->setStatusTip(tr("Modify user preferences (Ctrl+0)")); action->setToolTip(tr("Modify user preferences (Ctrl+0)")); connect(action, SIGNAL(activated()), mw, SLOT(slotOptions())); actions.replace(Options, action); icon = nav; bool b; rcfile.loadData(RcFile::ShowSidePanel, b); action = new QAction(this, "actionPanel"); action->setMenuText(tr("Side &Panel")); action->setIconSet(icon); action->setStatusTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToolTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), mw, SLOT(slotHideNav(bool))); actions.replace(SidePanel, action); icon = gridicon; rcfile.loadData(RcFile::Grid, b); action = new QAction(this, "actionGrid"); action->setMenuText(tr("Chart &Grid")); action->setIconSet(icon); action->setStatusTip(tr("Toggle chart grid (Ctrl+2)")); action->setToolTip(tr("Toggle chart grid (Ctrl+2)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalGrid(bool))); actions.replace(Grid, action); icon = scaletoscreen; rcfile.loadData(RcFile::ScaleToScreen, b); action = new QAction(this, "actionScale"); action->setMenuText(tr("&Scale To Screen")); action->setIconSet(icon); action->setStatusTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToolTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalScale(bool))); actions.replace(ScaleToScreen, action); icon = crosshair; rcfile.loadData(RcFile::Crosshairs, b); action = new QAction(this, "actionCrosshairs"); action->setMenuText(tr("Toggle &Crosshairs")); action->setIconSet(icon); action->setStatusTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToolTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalCrosshairs(bool))); actions.replace(Crosshairs, action); icon = co; rcfile.loadData(RcFile::DrawMode, b); action = new QAction(this, "actionDraw"); action->setMenuText(tr("Toggle &Draw Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToolTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalDraw(bool))); actions.replace(DrawMode, action); icon = papertrade; rcfile.loadData(RcFile::PaperTradeMode, b); action = new QAction(this, "actionPaperTrade"); action->setMenuText(tr("Toggle &Trade Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle paper-trade mode")); action->setToolTip(tr("Toggle paper-trade mode")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalPaperTrade(bool))); actions.replace(PaperTrade, action); icon = indicator; action = new QAction(this, "actionNewIndicator"); action->setMenuText(tr("New &Indicator")); action->setIconSet(icon); action->setStatusTip(tr("Add new indicator (Ctrl+7)")); action->setToolTip(tr("Add new indicator (Ctrl+7)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalNewIndicator())); actions.replace(NewIndicator, action); icon = datawindow; action = new QAction(this, "actionDataWindow"); action->setMenuText(tr("&Data Window")); action->setIconSet(icon); action->setAccel(Qt::ALT+Qt::Key_1); action->setStatusTip(tr("Show data window (Alt+1)")); action->setToolTip(tr("Show data window (Alt+1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotDataWindow())); actions.replace(DataWindow, action); icon = quotes; action = new QAction(this, "actionQuote"); action->setMenuText(tr("Load Quotes")); action->setIconSet(icon); action->setStatusTip(tr("Load Quotes (Ctrl+Y)")); action->setToolTip(tr("Load Quotes (Ctrl+Y)")); connect(action, SIGNAL(activated()), mw, SLOT(slotQuotes())); actions.replace(Quotes, action); icon = qtstalker; action = new QAction(this, "actionAbout"); action->setMenuText(tr("&About")); action->setIconSet(icon); action->setStatusTip(tr("About Qtstalker.")); action->setToolTip(tr("About Qtstalker.")); connect(action, SIGNAL(activated()), mw, SLOT(slotAbout())); actions.replace(About, action); icon = help; action = new QAction(this, "actionHelp"); action->setMenuText(tr("&Help")); action->setIconSet(icon); action->setAccel(Qt::Key_F1); action->setStatusTip(tr("Display Help (F1)")); action->setToolTip(tr("Display Help (F1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotHelp())); actions.replace(Help, action); action = new QAction(this, "actionAdvancePaperTrade"); action->setAccel(Qt::CTRL+Qt::Key_Right); connect(action, SIGNAL(activated()), this, SIGNAL(signalAdvancePaperTrade())); actions.replace(AdvancePaperTrade, action); action = new QAction(this, "actionIndicatorSummary"); action->setMenuText(tr("Indicator Summary")); action->setStatusTip(tr("Indicator Summary")); action->setToolTip(tr("Indicator Summary")); connect(action, SIGNAL(activated()), mw, SLOT(slotIndicatorSummary())); actions.replace(IndicatorSummary, action); Q3Accel *a = new Q3Accel(mw); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(Qt::CTRL+Qt::Key_0, Options); a->insertItem(Qt::CTRL+Qt::Key_1, SidePanel); a->insertItem(Qt::CTRL+Qt::Key_2, Grid); a->insertItem(Qt::CTRL+Qt::Key_3, ScaleToScreen); a->insertItem(Qt::CTRL+Qt::Key_4, Crosshairs); a->insertItem(Qt::CTRL+Qt::Key_5, DrawMode); a->insertItem(Qt::CTRL+Qt::Key_7, NewIndicator); a->insertItem(Qt::CTRL+Qt::Key_Y, Quotes); a->insertItem(Qt::CTRL+Qt::Key_Right, AdvancePaperTrade); a->insertItem(Qt::CTRL+Qt::Key_Escape, 8); createMenus(); rcfile.loadData(RcFile::ShowMenuBar, b); if (!b) hide(); }
/* Constructor setups the GUI. */ QucsTranscalc::QucsTranscalc() { QWidget *centralWidget = new QWidget(this); setCentralWidget(centralWidget); // set application icon setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm")); setWindowTitle("Qucs Transcalc " PACKAGE_VERSION); // create file menu QMenu *fileMenu = new QMenu(tr("&File")); QAction *fileLoad = new QAction(tr("&Load"), this); fileLoad->setShortcut(Qt::CTRL+Qt::Key_L); fileMenu->addAction(fileLoad); connect(fileLoad, SIGNAL(activated()), SLOT(slotFileLoad())); QAction *fileSave = new QAction (tr("&Save"), this); fileSave->setShortcut(Qt::CTRL+Qt::Key_S); fileMenu->addAction(fileSave); connect(fileSave, SIGNAL(activated()), SLOT(slotFileSave())); fileMenu->addSeparator(); QAction *fileOption = new QAction (tr("&Options"), this); fileOption->setShortcut(Qt::CTRL+Qt::Key_O); fileMenu->addAction(fileOption); connect(fileOption, SIGNAL(activated()), SLOT(slotOptions())); fileMenu->addSeparator(); QAction *fileQuit = new QAction (tr("&Quit"), this); fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q); fileMenu->addAction(fileQuit); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); // create execute menu QMenu *execMenu = new QMenu(tr("&Execute")); QAction *execCopy = new QAction(tr("&Copy to Clipboard"), this); execCopy->setShortcut(Qt::Key_F2); execMenu->addAction(execCopy); connect(execCopy, SIGNAL(activated()), SLOT(slotCopyToClipBoard())); QAction *execAnalyze = new QAction(tr("&Analyze"), this); execAnalyze->setShortcut(Qt::Key_F3); execMenu->addAction(execAnalyze); connect(execAnalyze, SIGNAL(activated()), SLOT(slotAnalyze())); QAction *execSynthesize = new QAction (tr("&Synthesize"), this); execSynthesize->setShortcut(Qt::Key_F4); execMenu->addAction(execSynthesize); connect(execSynthesize, SIGNAL(activated()), SLOT(slotSynthesize())); // create help menu QMenu *helpMenu = new QMenu(tr("&Help")); QAction *helpHelp = new QAction(tr("&Help"), this); helpHelp->setShortcut(Qt::Key_F1); helpMenu->addAction(helpHelp); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro())); QAction *helpAbout = new QAction(tr("About"), this); helpMenu->addAction(helpAbout); connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout())); // setup menu bar menuBar()->addMenu(fileMenu); menuBar()->addMenu(execMenu); menuBar()->addSeparator(); menuBar()->addMenu(helpMenu); // === left // seletion combo and figure QVBoxLayout *vl = new QVBoxLayout(); // transmission line type choice QGroupBox * lineGroup = new QGroupBox (tr("Transmission Line Type")); tranType = new QComboBox (lineGroup); tranType->insertItem (0, tr("Microstrip Line")); tranType->insertItem (1, tr("Coplanar Waveguide")); tranType->insertItem (2, tr("Grounded Coplanar")); tranType->insertItem (3, tr("Rectangular Waveguide")); tranType->insertItem (4, tr("Coaxial Line")); tranType->insertItem (5, tr("Coupled Microstrip")); connect(tranType, SIGNAL(activated(int)), SLOT(slotSelectType(int))); // setup transmission line picture pix = new QLabel (lineGroup); pix->setPixmap(QPixmap(":/bitmaps/microstrip.png")); QVBoxLayout *vfig = new QVBoxLayout(); vfig->addWidget(tranType); vfig->addWidget(pix); vfig->setSpacing(3); lineGroup->setLayout(vfig); vl->addWidget(lineGroup); // init additional translations setupTranslations (); // set current mode mode = ModeMicrostrip; // === middle QVBoxLayout *vm = new QVBoxLayout(); vm->setSpacing (3); // substrate parameter box QGroupBox * substrate = new QGroupBox (tr("Substrate Parameters")); vm->addWidget(substrate); // Pass the GroupBox > create Grid layout > Add widgets > set layout createPropItems (substrate, TRANS_SUBSTRATE); // component parameter box QGroupBox * component = new QGroupBox (tr("Component Parameters")); vm->addWidget(component); createPropItems (component, TRANS_COMPONENT); // === right QVBoxLayout *vr = new QVBoxLayout(); vr->setSpacing (3); // physical parameter box QGroupBox * physical = new QGroupBox (tr("Physical Parameters")); vr->addWidget(physical); createPropItems (physical, TRANS_PHYSICAL); // analyze/synthesize buttons QHBoxLayout * h2 = new QHBoxLayout(); QPushButton * analyze = new QPushButton (tr("Analyze")); h2->addWidget(analyze); analyze->setToolTip(tr("Derive Electrical Parameters")); connect(analyze, SIGNAL(clicked()), SLOT(slotAnalyze())); QPushButton * synthesize = new QPushButton (tr("Synthesize")); h2->addWidget(synthesize); synthesize->setToolTip(tr("Compute Physical Parameters")); connect(synthesize, SIGNAL(clicked()), SLOT(slotSynthesize())); vr->addLayout(h2); // electrical parameter box QGroupBox * electrical = new QGroupBox (tr("Electrical Parameters")); vr->addWidget(electrical); createPropItems (electrical, TRANS_ELECTRICAL); calculated = new QGroupBox (tr("Calculated Results")); vr->addWidget(calculated); // status line //statBar = new QStatusBar (this); //QLabel * statText = new QLabel ("Ready.", statBar); statusBar()->showMessage (tr("Ready.")); //statBar->setFixedHeight (statText->height ()); //delete statText; QVBoxLayout *vmain = new QVBoxLayout(); QHBoxLayout *hmain = new QHBoxLayout(); hmain->addLayout(vl); hmain->addLayout(vm); hmain->addLayout(vr); vmain->addLayout(hmain); //vmain->addWidget(statBar); centralWidget->setLayout(vmain); // setup calculated result bix createResultItems (calculated); updateSelection (); // instantiate transmission lines TransLineTypes[0].line = new microstrip (); TransLineTypes[0].line->setApplication (this); TransLineTypes[1].line = new coplanar (); TransLineTypes[1].line->setApplication (this); TransLineTypes[2].line = new groundedCoplanar (); TransLineTypes[2].line->setApplication (this); TransLineTypes[3].line = new rectwaveguide (); TransLineTypes[3].line->setApplication (this); TransLineTypes[4].line = new coax (); TransLineTypes[4].line->setApplication (this); TransLineTypes[5].line = new c_microstrip (); TransLineTypes[5].line->setApplication (this); }