Esempio n. 1
0
Dialog::Dialog(BooL & rec, char & lang) : QDialog(0, 0, TRUE), _rec(rec), _lang(lang) {
  Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
  Q3HBox * htab;
  
  vbox->setMargin(5);
  
  // recursive checkbox
  if (rec) {
    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);
    
    rec_cb = new QCheckBox("Do recursively", htab);
  }
  else
    rec_cb = 0;

  // langs + cancel buttons
  
  htab = new Q3HBox(this);
  htab->setMargin(5);
  vbox->addWidget(htab);
  
  QPushButton * cpp = new QPushButton("&C++", htab);
  new QLabel(htab);
  QPushButton * java = new QPushButton("&Java", htab);
  new QLabel(htab);
  QPushButton * idl = new QPushButton("&Idl", htab);
  new QLabel(htab);
  QPushButton * php = new QPushButton("P&hp", htab);
  new QLabel(htab);
  QPushButton * python = new QPushButton("P&ython", htab);
  new QLabel(htab);
  QPushButton * cancel = new QPushButton("&Cancel", htab);
  new QLabel(htab);
  QSize bs(cancel->sizeHint());
  
  cpp->setFixedSize(bs);
  java->setFixedSize(bs);
  
  connect(cpp, SIGNAL(clicked()), this, SLOT(accept_cpp()));
  connect(java, SIGNAL(clicked()), this, SLOT(accept_java()));
  connect(idl, SIGNAL(clicked()), this, SLOT(accept_idl()));
  connect(php, SIGNAL(clicked()), this, SLOT(accept_php()));
  connect(python, SIGNAL(clicked()), this, SLOT(accept_python()));
  connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));

  // help
  
  htab = new Q3HBox(this);
  htab->setMargin(5);
  vbox->addWidget(htab);
  
  new QLabel(htab);
  new QLabel("Warning : reset the declarations/definitions to\n"
	     "their default value from the 'generation settings'", htab);
  new QLabel(htab);
}
Esempio n. 2
0
void ComponentDialog::init_l_tab(Q3VBox *& page, Q3ComboBox *& stereotypefilter,
                                 void (ComponentDialog::* filteractivated)(const QString & st),
                                 const char * slt,
                                 const char * add_slt, const char * remove_slt,
                                 Q3ListBox *& lb_available, Q3ListBox *& lb,
                                 const Q3ValueList<BrowserClass *> & cls,
                                 const char * lbl)
{
    bool visit = !hasOkButton();
    Q3HBox * hbox;
    Q3VBox * vbox;
    QPushButton * button;

    page = new Q3VBox(this);

    if (!visit) {
        hbox = new Q3HBox(page);
        hbox->setMargin(5);
        new QLabel(TR("Stereotype filtering  "), hbox);
        stereotypefilter = new Q3ComboBox(TRUE, hbox);
        stereotypefilter->setAutoCompletion(completion());
        stereotypefilter->insertItem("");
        stereotypefilter->insertStringList(BrowserClass::default_stereotypes());
        stereotypefilter->insertStringList(ProfiledStereotypes::defaults(UmlComponent));
        stereotypefilter->setCurrentItem(0);
        QSizePolicy sp = stereotypefilter->sizePolicy();
        sp.setHorData(QSizePolicy::Expanding);
        stereotypefilter->setSizePolicy(sp);
        connect(stereotypefilter, SIGNAL(activated(const QString &)),
                this, slt);

        hbox = new Q3HBox(page);
        vbox = new Q3VBox(hbox);
        vbox->setMargin(5);
        (new QLabel(TR("Available classes"), vbox))->setAlignment(Qt::AlignCenter);
        lb_available = new Q3ListBox(vbox);
        lb_available->setSelectionMode(Q3ListBox::Multi);

        vbox = new Q3VBox(hbox);
        vbox->setMargin(5);
        (new QLabel("", vbox))->setScaledContents(TRUE);
        button = new QPushButton(vbox);
        button->setPixmap(*rightPixmap);
        connect(button, SIGNAL(clicked()), this, add_slt);
        (new QLabel("", vbox))->setScaledContents(TRUE);
        button = new QPushButton(vbox);
        button->setPixmap(*leftPixmap);
        connect(button, SIGNAL(clicked()), this, remove_slt);
        (new QLabel("", vbox))->setScaledContents(TRUE);
        vbox = new Q3VBox(hbox);
    }
Esempio n. 3
0
/**
 * @brief Sets up the about tab.
 */
void AboutDialog::setupAboutTab()
{
    Q3HBox* aboutTab = new Q3HBox(this);
    aboutTab->setMargin(15);

    QLabel *label = new QLabel(
        tr("<p><nobr>This is a password managing tool for Unix, Windows and "
            "MacOS X</nobr> written in C++<br> using the Qt library.</p>"
            "<p><b>Thanks to:</b>"
            "<ul><li>Trolltech for the Qt library</li>"
            "<li>OpenSSL team for the OpenSSL library</li>"
            "<li>Gtk+ artists for the nice stock icons</li>"
            "</ul></p>"
            "<p><b>Homepage:</b> <tt>http://qpamat.berlios.de</tt></p>"), aboutTab);
    label->setAlignment(Qt::AlignTop);

    m_tabWidget->addTab(aboutTab, tr("&About"));

}
Esempio n. 4
0
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
  // set application icon
  ///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Filter " PACKAGE_VERSION);

  all = new Q3VBoxLayout(this);

  // --------  create menubar  -------------------
  Q3PopupMenu *fileMenu = new Q3PopupMenu();
  fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);

  Q3PopupMenu *helpMenu = new Q3PopupMenu();
  helpMenu->insertItem(
                tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0);
  helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

  QMenuBar *bar = new QMenuBar(this);
  bar->insertItem(tr("&File"), fileMenu);
  bar->insertSeparator ();
  bar->insertItem(tr("&Help"), helpMenu);
  all->addWidget(bar);

  // reserve space for menubar
  all->addSpacing (bar->height() + 2);

  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp1 = new Q3GridLayout(Tab1,12,6,5,5);

  FilterName = new QComboBox(FALSE, Tab1);
  gp1->addWidget(FilterName,0,0);
  TformName = new QComboBox(FALSE, Tab1);
  gp1->addWidget(TformName,0,1);

  OrderBox = new QCheckBox(tr("Specify order"), Tab1);
  gp1->addWidget(OrderBox,1,0);
  Q3HBox *h1 = new Q3HBox(Tab1);
  h1->setSpacing (5);
  OrderCombo = new QComboBox(FALSE, h1);
  OrderCombo->setEnabled(TRUE);
  SubOrderCombo = new QComboBox(FALSE, h1);
  SubOrderCombo->setEnabled(FALSE);
  SubOrderCombo->insertItem( tr( "b" ) );
  SubOrderCombo->insertItem( tr( "c" ) );
  gp1->addWidget(h1,1,1);

  CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1);
  gp1->addWidget(CutoffLabel,2,0);
  EnterCutoff = new QLineEdit(Tab1);
  gp1->addWidget(EnterCutoff,2,1);
  CutoffCombo = new QComboBox(Tab1);
  CutoffCombo->insertItem( tr( "Hz" ) );
  CutoffCombo->insertItem( tr( "kHz" ) );
  CutoffCombo->insertItem( tr( "MHz" ) );
  CutoffCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(CutoffCombo,2,2);

  RippleLabel = new QLabel(tr("Ripple"),Tab1);
  gp1->addWidget(RippleLabel,3,0);
  EnterRipple = new QLineEdit(Tab1);
  gp1->addWidget(EnterRipple,3,1);
  RippleUnitLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(RippleUnitLabel,3,2);

  AngleLabel = new QLabel(tr("Angle"),Tab1);
  gp1->addWidget(AngleLabel,3,3);
  EnterAngle = new QLineEdit(Tab1);
  gp1->addWidget(EnterAngle,3,4);
  AngleUnitLabel = new QLabel(tr("°"),Tab1);
  gp1->addWidget(AngleUnitLabel,3,5);

  ZinLabel = new QLabel(tr("Zin"),Tab1);
  gp1->addWidget(ZinLabel,7,0);
  EnterZin = new QLineEdit(Tab1);
  gp1->addWidget(EnterZin,7,1);
  OhmLabel = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel,7,2);

  ZoutLabel = new QLabel(tr("Zout"),Tab1);
  ZoutLabel->setEnabled(false);
  gp1->addWidget(ZoutLabel,7,3);
  EnterZout = new QLineEdit(Tab1);
  gp1->addWidget(EnterZout,7,4);
  OhmLabel_2 = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel_2,7,5);

  StopbandLabel = new QLabel(tr("Stopband corner"),Tab1);
  gp1->addWidget(StopbandLabel,5,0);
  EnterStopband = new QLineEdit(Tab1);
  gp1->addWidget(EnterStopband,5,1);
  StopbandCombo = new QComboBox(FALSE, Tab1);
  StopbandCombo->insertItem( tr( "Hz" ) );
  StopbandCombo->insertItem( tr( "kHz" ) );
  StopbandCombo->insertItem( tr( "MHz" ) );
  StopbandCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(StopbandCombo,5,2);

  BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1);
  BandwidthLabel->setEnabled(FALSE);
  gp1->addWidget(BandwidthLabel,4,0);
  EnterBandwidth = new QLineEdit(Tab1);
  gp1->addWidget(EnterBandwidth,4,1);
  BandwidthCombo = new QComboBox(FALSE, Tab1);
  BandwidthCombo->setEnabled(FALSE);
  BandwidthCombo->insertItem( tr( "Hz" ) );
  BandwidthCombo->insertItem( tr( "kHz" ) );
  BandwidthCombo->insertItem( tr( "MHz" ) );
  BandwidthCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(BandwidthCombo,4,2);

  AttenuationLabel = new QLabel(tr("Attenuation"),Tab1);
  gp1->addWidget(AttenuationLabel,6,0);
  EnterAttenuation = new QLineEdit(Tab1);
  gp1->addWidget(EnterAttenuation,6,1);
  dBLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(dBLabel,6,2);

  DualBox = new QCheckBox(tr("dual"),Tab1);
  gp1->addMultiCellWidget(DualBox,8,8,0,2);
  CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1);
  CauerPoleBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2);
  OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1);
  OptimizeCauerBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2);
  EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1);
  EqualInductorBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5);
  UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1);
  UseCrossBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(UseCrossBox,9,9,3,5);

  Cboxes = new Q3VButtonGroup(tr("Optimize C"),Tab1);
  Cmin = new QRadioButton(tr("Cmin"),Cboxes);
  Cmax = new QRadioButton(tr("Cmax"),Cboxes);
  NoC = new QRadioButton(tr("noC"),Cboxes);
  gp1->addMultiCellWidget(Cboxes,11,11,0,2);

  Lboxes = new Q3VButtonGroup(tr("Optimize L"),Tab1);
  Lmin = new QRadioButton(tr("Lmin"),Lboxes);
  Lmax = new QRadioButton(tr("Lmax"),Lboxes);
  NoL = new QRadioButton(tr("noL"),Lboxes);
  gp1->addMultiCellWidget(Lboxes,11,11,3,5);

  t->addTab(Tab1, tr("LC Filters"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  t->addTab(Tab2, tr("Microstrip Filters"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  t->addTab(Tab3, tr("Active Filters"));

  // reserve space for vertical resizing
  all->addStretch();

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  cancelButton = new QPushButton(tr("Exit"),Butts);
  okButton = new QPushButton(tr("Calculate"),Butts);
  okButton->setEnabled(FALSE);

  // signals and slots connections
  connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
  connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
}
Esempio n. 5
0
Dialog::Dialog() : QDialog(0, 0, TRUE)
{
    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
    Q3VGroupBox * gbox;
    Q3HButtonGroup * bg;
    Q3HBox * htab;

    vbox->setMargin(5);

    gbox = new Q3VGroupBox("Filters" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 1 : ", htab);
    filter1_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with1_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with1_rb->setChecked(TRUE);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("", htab);
    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    and12_rb = new QRadioButton("and", bg);
    new QRadioButton("or", bg);
    and12_rb->setChecked(TRUE);

    new QLabel("", htab);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 2 : ", htab);
    filter2_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with2_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with2_rb->setChecked(TRUE);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("", htab);
    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    and23_rb = new QRadioButton("and", bg);
    new QRadioButton("or", bg);
    and23_rb->setChecked(TRUE);

    new QLabel("", htab);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 3 : ", htab);
    filter3_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with3_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with3_rb->setChecked(TRUE);

    //
    //

    gbox = new Q3VGroupBox("Stereotype" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    any_rb = new QRadioButton("any", bg);
    is_rb = new QRadioButton("is", bg);
    isnot_rb = new QRadioButton("is not", bg);
    any_rb->setChecked(TRUE);
    stereotype_le = new QLineEdit(htab);

    //
    //

    gbox = new Q3VGroupBox("Targets" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    artifact_cb = new QCheckBox("artifact", htab);
    class_cb = new QCheckBox("class", htab);
    operation_cb = new QCheckBox("operation", htab);
    attribute_cb = new QCheckBox("attribute", htab);
    relation_cb = new QCheckBox("relation", htab);

    //
    //

    gbox = new Q3VGroupBox("Languages" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    cpp_cb = new QCheckBox("C++", htab);
    java_cb = new QCheckBox("Java", htab);
    php_cb = new QCheckBox("Php", htab);
    python_cb = new QCheckBox("Python", htab);
    idl_cb = new QCheckBox("Idl", htab);

    //
    //

    Q3Grid * grid = new Q3Grid(2, this);
    vbox->addWidget(grid);
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel("current : ", grid);
    current_le  = new LineEdit(grid);

    new QLabel("new : ", grid);
    new_le  = new LineEdit(grid);

    //
    //

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel(htab);
    QPushButton * replace = new QPushButton("Replace", htab);
    new QLabel(htab);
    QPushButton * quit = new QPushButton("Quit", htab);
    new QLabel(htab);

    QSize bs(replace->sizeHint());

    quit->setFixedSize(bs);

    connect(replace, SIGNAL(clicked()), this, SLOT(do_replace()));
    connect(quit, SIGNAL(clicked()), this, SLOT(reject()));

}
Esempio n. 6
0
Dialog::Dialog(WrapperStr & path, WrapperStr & encoding, WrapperStr & nomodel, WrapperStr & genview, WrapperStr & uml20, WrapperStr & pk, WrapperStr & vis, WrapperStr & primitivetype, WrapperStr & genextension, WrapperStr & geneclipse, WrapperStr & commentexporter, WrapperStr & linefeed, Language & lang)
    : QDialog(0, 0, TRUE), _path(path), _encoding(encoding), _nomodel(nomodel), _genview(genview), _uml20(uml20), _pk(pk), _vis(vis), _primitivetype(primitivetype), _genextension(genextension), _geneclipse(geneclipse), _commentexporter(commentexporter), _linefeed(linefeed), _lang(lang)
{
    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
    Q3HBox * htab;

    vbox->setMargin(5);

    // get xmi pathname

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel("generated \nXMI file : ", htab);

    ed = new QLineEdit(htab);
    ed->setText(_path);

    new QLabel(" ", htab);

    SmallPushButton * br = new SmallPushButton("browse", htab);

    connect(br, SIGNAL(clicked()), this, SLOT(browse()));

    // to choose encoding

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel("Encoding : ", htab);

    QString charset = getenv("BOUML_CHARSET");
    int index = 0;

    while ((index = charset.find('_')) != -1) {
        charset[index] = '-';
        index += 1;
    }

    encoding_cb = new QComboBox(TRUE, htab);
    htab->setStretchFactor(encoding_cb, 1000);

    if (_encoding.isEmpty())
        _encoding = "UTF-8";

    encoding_cb->insertItem(QString(_encoding));

    if (!charset.isEmpty() && (_encoding != (const char *) charset))
        encoding_cb->insertItem(charset);

    if (_encoding != "UTF-8")
        encoding_cb->insertItem("UTF-8");

#ifdef WIN32

    if ((_encoding != "windows-1252") && (charset != "windows-1252"))
        encoding_cb->insertItem("windows-1252");

    if ((_encoding != "ISO-8859-1") && (charset != "ISO-8859-1"))
        encoding_cb->insertItem("ISO-8859-1");

#else

    if ((_encoding != "ISO-8859-1") && (charset != "ISO-8859-1"))
        encoding_cb->insertItem("ISO-8859-1");

    if ((_encoding != "windows-1252") && (charset != "windows-1252"))
        encoding_cb->insertItem("windows-1252");

#endif

    // uml 2.0 or uml2.1

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    Q3ButtonGroup * bg = new Q3ButtonGroup(2, Qt::Horizontal, "Uml", htab);

    uml20_rb = new QRadioButton("uml 2.0", bg);
    uml21_rb = new QRadioButton("uml 2.1", bg);

    if (uml20 == "yes")
        uml20_rb->setChecked(TRUE);
    else
        uml21_rb->setChecked(TRUE);

    // generate model

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    nomodel_cb = new QCheckBox("Don't generate model level", htab);

    if (_nomodel == "yes")
        nomodel_cb->setChecked(TRUE);

    // generate view checkbox

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    genview_cb = new QCheckBox("Generate views as package (not compatible with profile generation)", htab);

    if (_genview == "yes")
        genview_cb->setChecked(TRUE);

    // generate pk_ prefix

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    pk_cb = new QCheckBox("Generate 'pk_' prefix for parameter direction", htab);

    if (_pk == "yes")
        pk_cb->setChecked(TRUE);

    // generate vis_ prefix

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    vis_cb = new QCheckBox("Generate 'vis_' prefix for visibility", htab);

    if (_vis == "yes")
        vis_cb->setChecked(TRUE);

    // use PrimitiveType rather than DataType

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    primitivetype_cb = new QCheckBox("Use PrimitiveType rather than DataType", htab);

    if (_primitivetype == "yes")
        primitivetype_cb->setChecked(TRUE);

    // generate extension

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    genextension_cb = new QCheckBox("Generate extensions", htab);

    if (_genextension == "yes")
        genextension_cb->setChecked(TRUE);

    // generate for Eclipse

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    geneclipse_cb = new QCheckBox("Generate for Eclipse (aggregation set on other relation side)", htab);

    if (_geneclipse == "yes")
        geneclipse_cb->setChecked(TRUE);

    // comment exporter

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    commentexporter_cb = new QCheckBox("Comment exporter indication (needed to import in some tools like Rsa)", htab);

    if (_commentexporter == "yes")
        commentexporter_cb->setChecked(TRUE);

    // generate &#10; rather than linefeed

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    linefeed_cb = new QCheckBox("Generate lf and cr characters in string rather than '&&#10;' and '&&#13;'", htab);

    if (_linefeed == "yes")
        linefeed_cb->setChecked(TRUE);

    // uml , c++, java, cancel buttons

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel(htab);
    QPushButton * uml = new QPushButton("&Uml", htab);
    new QLabel(htab);
    QPushButton * cpp = new QPushButton("&C++", htab);
    new QLabel(htab);
    QPushButton * java = new QPushButton("&Java", htab);
    new QLabel(htab);
    QPushButton * cancel = new QPushButton("&Cancel", htab);
    new QLabel(htab);
    QSize bs(cancel->sizeHint());

    uml->setFixedSize(bs);
    cpp->setFixedSize(bs);
    java->setFixedSize(bs);

    connect(uml, SIGNAL(clicked()), this, SLOT(accept_uml()));
    connect(cpp, SIGNAL(clicked()), this, SLOT(accept_cpp()));
    connect(java, SIGNAL(clicked()), this, SLOT(accept_java()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));

    // help

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel(htab);
    new QLabel("Remark : to help Eclipse to import the generated file,\n"
               "choose Uml 2.1 and name the file with the extension '.xmi'", htab);
    new QLabel(htab);
}
Esempio n. 7
0
QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent, const char *name)
			: QDialog(parent, name, TRUE, Qt::WDestructiveClose)
{
  App = parent;
  setCaption(tr("Edit Qucs Properties"));

  all = new Q3VBoxLayout(this); // to provide the neccessary size
  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp = new Q3GridLayout(Tab1,5,2,5,5);

  QLabel *l1 = new QLabel(tr("Font (set after reload):"), Tab1);
  gp->addWidget(l1,0,0);
  FontButton = new QPushButton(Tab1);
  connect(FontButton, SIGNAL(clicked()), SLOT(slotFontDialog()));
  gp->addWidget(FontButton,0,1);

  QLabel *l2 = new QLabel(tr("Document Background Color:"), Tab1);
  gp->addWidget(l2,1,0);
  BGColorButton = new QPushButton("      ", Tab1);
  connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog()));
  gp->addWidget(BGColorButton,1,1);

  val200 = new QIntValidator(0, 200, this);
  QLabel *l3 = new QLabel(tr("maximum undo operations:"), Tab1);
  gp->addWidget(l3,2,0);
  undoNumEdit = new QLineEdit(Tab1);
  undoNumEdit->setValidator(val200);
  gp->addWidget(undoNumEdit,2,1);

  QLabel *l4 = new QLabel(tr("text editor:"), Tab1);
  gp->addWidget(l4,3,0);
  editorEdit = new QLineEdit(Tab1);
  gp->addWidget(editorEdit,3,1);


  t->addTab(Tab1, tr("Settings"));

  // ...........................................................
/*  QWidget *Tab2 = new QWidget(t);
  QGridLayout *gp2 = new QGridLayout(Tab2,3,2,5,5);
  Check_GridOn = new QCheckBox(tr("show Grid"),Tab2);

  QLabel *l3 = new QLabel(tr("horizontal Grid:"), Tab2);
  gp2->addWidget(l3,1,0);
  Input_GridX = new QLineEdit(Tab2);
  gp2->addWidget(Input_GridX,1,1);

  QLabel *l4 = new QLabel(tr("vertical Grid:"), Tab2);
  gp2->addWidget(l4,2,0);
  Input_GridY = new QLineEdit(Tab2);
  gp2->addWidget(Input_GridY,2,1);

  t->addTab(Tab2, tr("Grid"));
*/
  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(5);
  Butts->setMargin(5);
  all->addWidget(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
  connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
  QPushButton *DefaultButt = new QPushButton(tr("Default Values"), Butts);
  connect(DefaultButt, SIGNAL(clicked()), SLOT(slotDefaultValues()));

  OkButt->setDefault(true);

  // ...........................................................
  // fill the fields with the Qucs-Properties

  Font  = QucsSettings.font;
  FontButton->setText(Font.toString());
  BGColorButton->setPaletteBackgroundColor(
	App->view->viewport()->paletteBackgroundColor());
  undoNumEdit->setText(QString::number(QucsSettings.maxUndo));
  editorEdit->setText(QucsSettings.Editor);
}
Esempio n. 8
0
OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
			: QDialog(d_, 0, TRUE, Qt::WDestructiveClose)
{
  Comp = c_;
  Doc  = d_;
  changed = false;
  setCaption(tr("Edit Optimization Properties"));

  Expr.setPattern("[\\w_]+");
  Validator = new QRegExpValidator(Expr, this);
  numVal = new QDoubleValidator(this);
  intVal = new QIntValidator(this);

  all = new Q3VBoxLayout(this); // to provide the neccessary size
  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp1 = new Q3GridLayout(Tab1,3,2,3,3);

  gp1->addWidget(new QLabel(tr("Name:"), Tab1), 0,0);
  NameEdit = new QLineEdit(Tab1);
  NameEdit->setValidator(Validator);
  gp1->addWidget(NameEdit,0,1);

  gp1->addWidget(new QLabel(tr("Simulation:"), Tab1), 1,0);
  SimEdit = new QComboBox(Tab1);
  SimEdit->setEditable(true);
  gp1->addWidget(SimEdit,1,1);

  t->addTab(Tab1, tr("General"));

  // ...........................................................
  QWidget *Tab4 = new QWidget(t);
  Q3GridLayout *gp4 = new Q3GridLayout(Tab4,11,2,3,3);

  gp4->addWidget(new QLabel(tr("Method:"), Tab4), 0,0);
  MethodCombo = new QComboBox(Tab4);
  MethodCombo->insertItem("DE/best/1/exp");
  MethodCombo->insertItem("DE/rand/1/exp");
  MethodCombo->insertItem("DE/rand-to-best/1/exp");
  MethodCombo->insertItem("DE/best/2/exp");
  MethodCombo->insertItem("DE/rand/1/exp");
  MethodCombo->insertItem("DE/best/1/bin");
  MethodCombo->insertItem("DE/rand/1/bin");
  MethodCombo->insertItem("DE/rand-to-best/1/bin");
  MethodCombo->insertItem("DE/best/2/bin");
  MethodCombo->insertItem("DE/rand/2/bin");
  gp4->addWidget(MethodCombo,0,1);

  gp4->addWidget(new QLabel(tr("Maximum number of iterations:"), Tab4), 1,0);
  IterEdit = new QLineEdit(Tab4);
  IterEdit->setValidator(intVal);
  gp4->addWidget(IterEdit,1,1);

  gp4->addWidget(new QLabel(tr("Output refresh cycle:"), Tab4), 2,0);
  RefreshEdit = new QLineEdit(Tab4);
  RefreshEdit->setValidator(intVal);
  gp4->addWidget(RefreshEdit,2,1);

  gp4->addWidget(new QLabel(tr("Number of parents:"), Tab4), 3,0);
  ParentsEdit = new QLineEdit(Tab4);
  ParentsEdit->setValidator(intVal);
  gp4->addWidget(ParentsEdit,3,1);

  gp4->addWidget(new QLabel(tr("Constant F:"), Tab4), 4,0);
  ConstEdit = new QLineEdit(Tab4);
  ConstEdit->setValidator(new QDoubleValidator(0.0,2.0,20,ConstEdit));
  gp4->addWidget(ConstEdit,4,1);

  gp4->addWidget(new QLabel(tr("Crossing over factor:"), Tab4), 5,0);
  CrossEdit = new QLineEdit(Tab4);
  CrossEdit->setValidator(new QDoubleValidator(0.0,1.0,20,CrossEdit));
  gp4->addWidget(CrossEdit,5,1);

  gp4->addWidget(new QLabel(tr("Pseudo random number seed:"), Tab4), 6,0);
  SeedEdit = new QLineEdit(Tab4);
  SeedEdit->setValidator(numVal);
  gp4->addWidget(SeedEdit,6,1);

  gp4->addWidget(new QLabel(tr("Minimum cost variance:"), Tab4), 7,0);
  CostVarEdit = new QLineEdit(Tab4);
  CostVarEdit->setValidator(numVal);
  gp4->addWidget(CostVarEdit,7,1);

  gp4->addWidget(new QLabel(tr("Cost objectives:"), Tab4), 8,0);
  CostObjEdit = new QLineEdit(Tab4);
  CostObjEdit->setValidator(numVal);
  gp4->addWidget(CostObjEdit,8,1);

  gp4->addWidget(new QLabel(tr("Cost constraints:"), Tab4), 9,0);
  CostConEdit = new QLineEdit(Tab4);
  CostConEdit->setValidator(numVal);
  gp4->addWidget(CostConEdit,9,1);

  t->addTab(Tab4, tr("Algorithm"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  Q3GridLayout *gp2 = new Q3GridLayout(Tab2,5,3,3,3);

  VarList = new Q3ListView(Tab2);
  VarList->addColumn(tr("Name"));
  VarList->addColumn(tr("active"));
  VarList->addColumn(tr("initial"));
  VarList->addColumn(tr("min"));
  VarList->addColumn(tr("max"));
  VarList->addColumn(tr("Type"));
  VarList->setSorting(-1);   // no sorting
  gp2->addMultiCellWidget(VarList,0,0,0,2);
  connect(VarList, SIGNAL(selectionChanged(Q3ListViewItem*)),
                   SLOT(slotEditVariable(Q3ListViewItem*)));

  Q3HBox *VarLine = new Q3HBox(Tab2);
  VarLine->setSpacing(3);
  gp2->addMultiCellWidget(VarLine, 1,1,0,2);

  new QLabel(tr("Name:"), VarLine);
  VarNameEdit = new QLineEdit(VarLine);
  VarNameEdit->setValidator(Validator);
  connect(VarNameEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarName(const QString&)));
  VarActiveCheck = new QCheckBox(tr("active"), VarLine);
  VarActiveCheck->setChecked(true);
  connect(VarActiveCheck, SIGNAL(toggled(bool)),
          SLOT(slotChangeVarActive(bool)));

  gp2->addWidget(new QLabel(tr("initial:"), Tab2), 2,0);
  gp2->addWidget(new QLabel(tr("min:"), Tab2), 2,1);
  gp2->addWidget(new QLabel(tr("max:"), Tab2), 2,2);
  VarInitEdit = new QLineEdit(Tab2);
  VarInitEdit->setValidator(numVal);
  gp2->addWidget(VarInitEdit,3,0);
  connect(VarInitEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarInit(const QString&)));
  VarMinEdit = new QLineEdit(Tab2);
  VarMinEdit->setValidator(numVal);
  gp2->addWidget(VarMinEdit,3,1);
  connect(VarMinEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarMin(const QString&)));
  VarMaxEdit = new QLineEdit(Tab2);
  VarMaxEdit->setValidator(numVal);
  gp2->addWidget(VarMaxEdit,3,2);
  connect(VarMaxEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeVarMax(const QString&)));

  Q3HBox *VarButtons = new Q3HBox(Tab2);
  VarButtons->setSpacing(3);
  gp2->addMultiCellWidget(VarButtons, 4,4,0,2);

  new QLabel(tr("Type:"), VarButtons);
  VarTypeCombo = new QComboBox(VarButtons);
  VarTypeCombo->insertItem(tr("linear double"));
  VarTypeCombo->insertItem(tr("logarithmic double"));
  VarTypeCombo->insertItem(tr("linear integer"));
  VarTypeCombo->insertItem(tr("logarithmic integer"));
  connect(VarTypeCombo, SIGNAL(activated(const QString&)),
          SLOT(slotChangeVarType(const QString&)));

  VarButtons->setStretchFactor(new QWidget(VarButtons), 10);
  QPushButton *AddVar_Butt = new QPushButton(tr("Add"), VarButtons);
  connect(AddVar_Butt, SIGNAL(clicked()), SLOT(slotAddVariable()));
  QPushButton *DelVar_Butt = new QPushButton(tr("Delete"), VarButtons);
  connect(DelVar_Butt, SIGNAL(clicked()), SLOT(slotDeleteVariable()));

  t->addTab(Tab2, tr("Variables"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  Q3GridLayout *gp3 = new Q3GridLayout(Tab3,4,3,3,3);

  GoalList = new Q3ListView(Tab3);
  GoalList->addColumn(tr("Name"));
  GoalList->addColumn(tr("Type"));
  GoalList->addColumn(tr("Value"));
  GoalList->setSorting(-1);   // no sorting
  gp3->addMultiCellWidget(GoalList,0,0,0,2);
  connect(GoalList, SIGNAL(selectionChanged(Q3ListViewItem*)),
                    SLOT(slotEditGoal(Q3ListViewItem*)));

  gp3->addWidget(new QLabel(tr("Name:"), Tab3), 1,0);
  GoalNameEdit = new QLineEdit(Tab3);
  GoalNameEdit->setValidator(Validator);
  gp3->addWidget(GoalNameEdit,1,1);
  connect(GoalNameEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeGoalName(const QString&)));

  gp3->addWidget(new QLabel(tr("Value:"), Tab3), 2,0);
  GoalNumEdit = new QLineEdit(Tab3);
  GoalNumEdit->setValidator(numVal);
  gp3->addWidget(GoalNumEdit,2,1);
  connect(GoalNumEdit, SIGNAL(textChanged(const QString&)),
          SLOT(slotChangeGoalNum(const QString&)));

  GoalTypeCombo = new QComboBox(Tab3);
  GoalTypeCombo->insertItem(tr("minimize"));
  GoalTypeCombo->insertItem(tr("maximize"));
  GoalTypeCombo->insertItem(tr("less"));
  GoalTypeCombo->insertItem(tr("greater"));
  GoalTypeCombo->insertItem(tr("equal"));
  GoalTypeCombo->insertItem(tr("monitor"));
  gp3->addWidget(GoalTypeCombo,2,2);
  connect(GoalTypeCombo, SIGNAL(activated(const QString&)),
          SLOT(slotChangeGoalType(const QString&)));

  Q3HBox *GoalButtons = new Q3HBox(Tab3);
  GoalButtons->setSpacing(3);
  gp3->addMultiCellWidget(GoalButtons, 3,3,0,2);

  GoalButtons->setStretchFactor(new QWidget(GoalButtons),5);
  QPushButton *AddGoal_Butt = new QPushButton(tr("Add"), GoalButtons);
  connect(AddGoal_Butt, SIGNAL(clicked()), SLOT(slotAddGoal()));
  QPushButton *DelGoal_Butt = new QPushButton(tr("Delete"), GoalButtons);
  connect(DelGoal_Butt, SIGNAL(clicked()), SLOT(slotDeleteGoal()));

  t->addTab(Tab3, tr("Goals"));

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
  connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel()));

  OkButt->setFocus();

  // ...........................................................

  Component *pc;
  for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next())
    if(pc != Comp)
      if(pc->Model[0] == '.' && pc->Model != ".Opt")
        SimEdit->insertItem(pc->Name);

  Property *pp;
  pp = Comp->Props.at(0);
  if(!pp->Value.isEmpty())
    SimEdit->setCurrentText(pp->Value);

  pp = Comp->Props.at(1);
  if(!pp->Value.isEmpty()) {
    MethodCombo->setCurrentItem(pp->Value.section('|',0,0).toInt()-1);
    IterEdit->setText(pp->Value.section('|',1,1));
    RefreshEdit->setText(pp->Value.section('|',2,2));
    ParentsEdit->setText(pp->Value.section('|',3,3));
    ConstEdit->setText(pp->Value.section('|',4,4));
    CrossEdit->setText(pp->Value.section('|',5,5));
    SeedEdit->setText(pp->Value.section('|',6,6));
    CostVarEdit->setText(pp->Value.section('|',7,7));
    CostObjEdit->setText(pp->Value.section('|',8,8));
    CostConEdit->setText(pp->Value.section('|',9,9));
  }

  NameEdit->setText(Comp->Name);

  for(pp = Comp->Props.at(2); pp != 0; pp = Comp->Props.next()) {
    if(pp->Name == "Var") {
      new Q3ListViewItem(VarList, pp->Value.section('|',0,0),
        pp->Value.section('|',1,1) == "yes" ? tr("yes") : tr("no"),
	pp->Value.section('|',2,2),
        pp->Value.section('|',3,3), pp->Value.section('|',4,4),
        ((pp->Value.section('|',5,5)=="LIN_DOUBLE")?tr("linear double") :
        ((pp->Value.section('|',5,5)=="LOG_DOUBLE")?tr("logarithmic double") :
        ((pp->Value.section('|',5,5)=="LIN_INT")?tr("linear integer") :
	 tr("logarithmic integer")))));
    }
    if(pp->Name == "Goal") {
      new Q3ListViewItem(GoalList, pp->Value.section('|',0,0),
        ((pp->Value.section('|',1,1) == "MIN") ? tr("minimize") :
        ((pp->Value.section('|',1,1) == "MAX") ? tr("maximize") :
        ((pp->Value.section('|',1,1) == "LE") ? tr("less") :
        ((pp->Value.section('|',1,1) == "GE") ? tr("greater") :
        ((pp->Value.section('|',1,1) == "EQ") ? tr("equal") :
	 tr("monitor")))))),
	pp->Value.section('|',2,2));
    }
  }

  resize(300, 250);
}