/* 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); }
KAMenu::KAMenu( QWidget *parent, const char *name ) : KMenuBar( parent, name ), host_id(0), nice_id(0), searchmode_id(0) { config = kapp->getConfig(); file = new QPopupMenu(); CHECK_PTR( file ); file->insertItem( i18n("O&pen in editor"), this, SLOT(slotFileOpen()), CTRL+Key_O ); file->insertItem( i18n("&Open Dir"), this, SLOT(slotFileOpenDir()), CTRL+Key_D ); file->insertItem( i18n("&Download..."), this, SLOT(slotFileGet()), CTRL+Key_G ); file->insertSeparator(); file->insertItem( i18n("&Load List..."), this, SLOT(slotFileLoad()), CTRL+Key_L ); file->insertItem( i18n("&Save List..."), this, SLOT(slotFileSave()), CTRL+Key_S ); file->insertItem( i18n("Expor&t List..."), this, SLOT(slotFileWrite()), CTRL+Key_R ); file->insertSeparator(); file->insertItem( i18n("&Exit"), qApp, SLOT(quit()), CTRL+Key_Q ); /* empty for now * will be filled on request with actual * Config settings */ host = new QPopupMenu(); CHECK_PTR( host ); host->setCheckable( TRUE ); connect ( host, SIGNAL(activated(int)), this, SLOT(slotSettingsHostname(int)) ); searchmode = new QPopupMenu(); CHECK_PTR( searchmode ); searchmode->setCheckable( TRUE ); searchmode->insertItem( i18n("&Exact"), SEARCH_EXACT, SEARCH_EXACT); searchmode->insertItem( i18n("&Substring"), SEARCH_SUBSTR, SEARCH_SUBSTR); searchmode->insertItem( i18n("Substring &case insensitive"), SEARCH_SUBCASE, SEARCH_SUBCASE); searchmode->insertItem( i18n("&Regular expression"), SEARCH_REGEXP, SEARCH_REGEXP); searchmode->insertItem( i18n("Exact, then substring"), SEARCH_EXACT_SUBSTR, SEARCH_EXACT_SUBSTR); searchmode->insertItem( i18n("Exact, then substring case ins."), SEARCH_EXACT_SUBCASE, SEARCH_EXACT_SUBCASE); searchmode->insertItem( i18n("Exact, then regular expression"), SEARCH_EXACT_REGEXP, SEARCH_EXACT_REGEXP); connect ( searchmode, SIGNAL(activated(int)), this, SLOT(slotSettingsSearchmode(int)) ); nicelevel = new QPopupMenu(); CHECK_PTR( nicelevel ); nicelevel->setCheckable( TRUE ); nicelevel->insertItem( i18n("n&ormal"), NICE_NORMAL, NICE_NORMAL); nicelevel->insertItem( i18n("&nice"), NICE_NICE, NICE_NICE); nicelevel->insertItem( i18n("&very nice"), NICE_VERY, NICE_VERY); nicelevel->insertItem( i18n("&even more nice"), NICE_MORE, NICE_MORE); nicelevel->insertItem( i18n("n&icest"), NICE_NICEST, NICE_NICEST); connect ( nicelevel, SIGNAL(activated(int)), this, SLOT(slotSettingsNicelevel(int)) ); settings = new QPopupMenu(); CHECK_PTR( settings ); settings->setCheckable( TRUE ); settings->insertItem( i18n("Show &File discription"), this, SLOT( slotSettingsShowFile() )); settings->setId( 0, 0 ); settings->setItemChecked( 0 , TRUE); settings->insertItem( i18n("Archie&server"), host ); settings->insertItem( i18n("Search&mode"), searchmode ); settings->insertItem( i18n("&Nicelevel"), nicelevel ); settings->insertSeparator(); settings->insertItem( i18n("&All..."), this, SLOT( slotSettingsAll() )); // settings->insertSeparator(); // settings->insertItem( i18n("&Save"), this, SLOT( slotSettingsSave() )); query = new QPopupMenu(); CHECK_PTR( query ); query->insertItem( i18n("for &Filename"), QUERY_FILE, QUERY_FILE); query->insertItem( i18n("for &Path/Location"), QUERY_PATH, QUERY_PATH); query->insertItem( i18n("for &Hostname"), QUERY_HOST, QUERY_HOST); query->insertSeparator(); query->insertItem( i18n("&STOP"), QUERY_STOP, QUERY_STOP); slotQueryRunning(FALSE); // no query on initialisation connect ( query, SIGNAL(activated(int)), this, SLOT(slotQuery(int)) ); // host search and path search doesn't work proper query->setItemEnabled(QUERY_PATH, FALSE); query->setItemEnabled(QUERY_HOST, FALSE); /* query->insertItem( i18n("for &Filename"), this, SLOT( slotQueryFile() )); query->insertItem( i18n("for &Path/Location"), this, SLOT( slotQueryPath() )); query->insertItem( i18n("for &Hostname"), this, SLOT( slotQueryHost() )); */ sort = new QPopupMenu(); CHECK_PTR( sort ); sort->insertItem( i18n("by &Hostname"), SORT_HOST, SORT_HOST); sort->insertItem( i18n("by &Domain"), SORT_DOMAIN, SORT_DOMAIN); sort->insertItem( i18n("by D&ate"), SORT_DATE, SORT_DATE); sort->insertItem( i18n("by &Filesize"), SORT_SIZE, SORT_SIZE); connect ( sort, SIGNAL(activated(int)), this, SLOT(slotSort(int)) ); QString aboutText; aboutText += i18n("KArchie ver. "); aboutText += KARCHIE_VERSION; aboutText += i18n("\n\n" "by Jörg Habenicht <*****@*****.**>\n\n" "based on the work of:\n" " - archie prospero client by\n" " Clifford Neuman and\n" " Brendan Kehoe ([email protected])\n" " - and xarchie by\n" " George Ferguson ([email protected])\n" "(See README files and copyright.h).\n" "My own code is based on the GPL"); help = kapp->getHelpMenu( TRUE, aboutText ); insertItem( i18n("&File"), file); insertItem( i18n("&Settings"), settings); insertItem( i18n("&Query"), query); insertItem( i18n("S&ort"), sort); insertSeparator(); insertItem( i18n("&Help"),help); slotHostlistChanged(); }