Esempio n. 1
0
/* Constructor setups the GUI. */
QucsLib::QucsLib()
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Library Tool " PACKAGE_VERSION);

  QMenuBar * menuBar = new QMenuBar (this);

  // create file menu
  QPopupMenu * fileMenu = new QPopupMenu ();
  QAction * manageLib =
    new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this);
  manageLib->addTo (fileMenu);
  connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib()));

  fileMenu->insertSeparator();

  QAction * fileQuit =
    new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this);
  fileQuit->addTo (fileMenu);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  // create help menu
  QPopupMenu * helpMenu = new QPopupMenu ();
  QAction * helpHelp =
    new QAction (tr("Help"), tr("&Help"), Key_F1, this);
  helpHelp->addTo (helpMenu);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp()));
  QAction * helpAbout =
    new QAction (tr("About"), tr("About"), 0, helpMenu);
  helpAbout->addTo (helpMenu);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout()));

  // setup menu bar
  menuBar->insertItem (tr("&File"), fileMenu);
  menuBar->insertSeparator ();
  menuBar->insertItem (tr("&Help"), helpMenu);

  // main box
  QVBoxLayout * all = new QVBoxLayout (this);
  all->setSpacing (0);
  all->setMargin (0);

  // reserve space for menubar
  QWidget * Space = new QWidget (this);
  Space->setFixedSize(5, menuBar->height() + 2);
  all->addWidget (Space);

  // main layout
  QHBox * h = new QHBox (this);
  h->setSpacing (5);
  h->setMargin (3);
  all->addWidget (h);

  // library and component choice
  QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h);
  Library = new QComboBox (LibGroup);
  connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int)));
  CompList = new QListBox(LibGroup);
  connect(CompList, SIGNAL(highlighted(QListBoxItem*)),
	SLOT(slotShowComponent(QListBoxItem*)));

  QHBox * h1 = new QHBox (LibGroup);
  QPushButton * SearchButton = new QPushButton (tr("Search..."), h1);
  connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent()));
  h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder


  // component display
  QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h);
  CompDescr = new QTextEdit(CompGroup);
  CompDescr->setTextFormat(Qt::PlainText);
  CompDescr->setReadOnly(true);
  CompDescr->setWordWrap(QTextEdit::NoWrap);

  Symbol = new SymbolWidget (CompGroup);

  QHBox * h2 = new QHBox (CompGroup);
  QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2);
  connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard()));
  QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2);
  connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel()));

  // ......................................................
  putLibrariesIntoCombobox();
}
Esempio n. 2
0
/* 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);
}