/**
 * @brief Creates a new instance of a AboutDialog object.
 *
 * @param parent the parent widget
 * @param name the name of the widget
 */
AboutDialog::AboutDialog(QWidget* parent, const char* name = 0)
    : QDialog(parent, name)
{
    m_mainLayout = new QVBoxLayout(this, 10, 6);
    setCaption(tr("About QPaMaT"));

    // the top of the dialog
    Q3HBox* titleBox = new Q3HBox(this);
    QLabel* titleIcon = new QLabel(titleBox);
    titleIcon->setPixmap(QPixmap(":/images/qpamat_48.png"));
    QLabel* titleText = new QLabel(tr("<p><b><big>QPaMaT %1</big></b></p>").arg(VERSION_STRING),
        titleBox);
    QWidget* filler = new QWidget(titleBox);
    titleText->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    filler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    titleBox->setSpacing(15);

    // the tab
    m_tabWidget = new QTabWidget(this);
    setupAboutTab();
    setupLicenseTab();

    // the ok Button
    QDialogButtonBox *dialogButtons = new QDialogButtonBox(QDialogButtonBox::Close,
            Qt::Horizontal, this);

    // main layout
    m_mainLayout->addWidget(titleBox);
    m_mainLayout->addWidget(m_tabWidget);
    m_mainLayout->setStretchFactor(m_tabWidget, 5);
    m_mainLayout->addWidget(dialogButtons);

    connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), SLOT(accept()));

}
// -------------------------------------------------------------------------------------------------
TriggerWidget::TriggerWidget(QWidget* parent, const char* name)
throw ()
    : QWidget(parent, name)
{
    Q3VBoxLayout* boxLayout = new Q3VBoxLayout(this, 0, 0);

    Q3HBox* hbox = new Q3HBox(this);
    hbox->setSpacing(2);

    // create the checkboxes with their labels
    for (int i = 0; i < NUMBER_OF_BITS_PER_BYTE; i++) {
        Q3VBox* box = new Q3VBox(hbox);
        box->setSpacing(2);

        m_labels[i] = new QLabel(QString::number(i+1), box);
        m_labels[i]->setAlignment(Qt::AlignHCenter);

        m_checkboxes[i] = new QCheckBox(box);
        m_checkboxes[i]->setTristate(true);
        m_checkboxes[i]->setNoChange();


        connect(m_checkboxes[i], SIGNAL(stateChanged(int)), SLOT(valueChangedHandler()));
    }

    boxLayout->addWidget(hbox);
    boxLayout->addStretch(5);
}
Beispiel #3
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);
}
void tst_Q3HBox::setStretchFactor()
{
    Q3HBox box;

    int stretch1 = 500;
    QPushButton *b1 = new QPushButton(QString("Strech %1").arg(stretch1), &box);
    QVERIFY(box.setStretchFactor(b1, stretch1));

    int stretch2 = 1;
    QPushButton *b2 = new QPushButton(QString("Strech %1").arg(stretch2), &box);
    QVERIFY(box.setStretchFactor(b2, stretch2));
}
Beispiel #5
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);
    }
Beispiel #6
0
/** No descriptions */
void SliderSpin::initWidget()
{
  Q3HBox* hb = new Q3HBox(this);
  mpTitleLabel = new QLabel(hb);
  mpSlider = new QSlider(0,10,1,1,Qt::Horizontal,hb);
  mpSpinBox = new QSpinBox(0,10,1,hb);
  hb->setSpacing(5);
  hb->setStretchFactor(mpSlider,1);
  mpSlider->setTracking(false);
  connect(mpSlider,SIGNAL(valueChanged(int)),
          this,SLOT(slotValueChanged(int)));
  connect(mpSlider,SIGNAL(sliderMoved(int)),
          this,SLOT(slotSliderMoved(int)));
  connect(mpSpinBox,SIGNAL(valueChanged(int)),
          this,SLOT(slotSpinValueChanged(int)));
}
/**
 * @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"));

}
Beispiel #8
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() ) );
}
Beispiel #9
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()));

}
Beispiel #10
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);
}
Beispiel #11
0
// The address book is not practical enough yet to be of much use
// Leave all this code commented until it gets improved
address_book::address_book (QWidget *parent) : QWidget(parent)
{
  m_is_modified = false;
  Q3BoxLayout* top_layout = new Q3VBoxLayout (this);
  top_layout->setMargin (4);
  top_layout->setSpacing (4);
  Q3HBox* hb = new Q3HBox (this);
  hb->setSpacing (6);
  top_layout->addWidget (hb);

  Q3VBox* box_left = new Q3VBox (hb);
  Q3VBox* box_right = new Q3VBox (hb);

  // left pane: search criteria and results
  Q3GroupBox* search_box = new Q3GroupBox (3, Qt::Horizontal, tr("Search"), box_left);
  Q3VBox* labels_box = new Q3VBox(search_box);
  Q3VBox* fields_box = new Q3VBox(search_box);
  m_email_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Address"), labels_box);

  m_name_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Name"), labels_box);

  m_nick_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Alias"), labels_box);

  QPushButton* button_search = new QPushButton (tr("Search"), search_box);
  connect (button_search, SIGNAL(clicked()), this, SLOT(search()));

  Q3GroupBox* result_box = new Q3GroupBox (1, Qt::Vertical, tr("Results"), box_left);
  m_result_list_w = new Q3ListView (result_box);
  m_result_list_w->addColumn (tr("Email address"));
  m_result_list_w->addColumn (tr("# msgs"), 50);
  connect(m_result_list_w, SIGNAL(selectionChanged()),
	  this, SLOT(address_selected()));

  // right pane: properties of the selected address
  Q3GroupBox* prop_box = new Q3GroupBox (tr("Properties"), box_right);
  Q3GridLayout *grid_layout = new Q3GridLayout (prop_box, 6, 2);
  grid_layout->setSpacing (4);
  // set a marging big enough for the QGroupBox title not being overwritten
  grid_layout->setMargin (15);
  int g_row = 0;		// grid row

  m_email_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Address:"), prop_box),g_row,0);
  grid_layout->addWidget (m_email_w, g_row, 1);

  g_row++;
  m_name_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Name:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_name_w, g_row, 1);

  g_row++;
  m_nick_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Alias:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_nick_w, g_row, 1);

  g_row++;
  m_notes_w = new Q3MultiLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Notes:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_notes_w, g_row, 1);

  g_row++;
  m_invalid_w = new QCheckBox (prop_box);
  grid_layout->addWidget (new QLabel (tr("Invalid:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_invalid_w, g_row, 1);

  g_row++;
  QPushButton* button_aliases = new QPushButton(tr("Other addresses..."), prop_box);
  grid_layout->addWidget (button_aliases, 5, 1);
  connect (button_aliases, SIGNAL(clicked()), this, SLOT(aliases()));

  // buttons at the bottom of the window
  Q3HBox* buttons_box = new Q3HBox (this);
  buttons_box->setSpacing (4);
  top_layout->addWidget (buttons_box);

  new Q3HBox (buttons_box);	// takes the left space
  QPushButton* b1 = new QPushButton (tr("New"), buttons_box);
  connect (b1, SIGNAL(clicked()), this, SLOT(new_address()));
  QPushButton* b2 = new QPushButton (tr("Apply"), buttons_box);
  connect (b2, SIGNAL(clicked()), this, SLOT(apply()));
  QPushButton* b3 = new QPushButton (tr("OK"), buttons_box);
  connect (b3, SIGNAL(clicked()), this, SLOT(OK()));
  QPushButton* b4 = new QPushButton (tr("Cancel"), buttons_box);
  connect (b4, SIGNAL(clicked()), this, SLOT(cancel()));
}
Beispiel #12
0
int main( int argc, char ** argv )
{
	// Register custom message handler if desired
	bool handler_registered = FALSE;
	MyMessageOutput * mymsghandler = NULL;
	for(int i = 1; i < argc; i++)
	{
		QString arg(argv[i]);
		QString opt("-msg_handler");
		if(arg.startsWith(opt))
		{
			// Extract handler type
			QString handler = arg.section("=",1,1);
			if(handler.isEmpty())
			{
				qWarning("Option '-msg_handler' is not complete. Use default handler.");
				handler_registered = TRUE;
				break;
			}
			if(handler == "console")
			{
				handler_registered = TRUE;
				break;
			}
			if(!handler.endsWith(".txt"))
			{
				qWarning("File '%s' does not end with '.txt'. Use default handler.",handler.ascii());
				handler_registered = TRUE;
				break;
			}
			QFileInfo hfinfo(handler);
			if(hfinfo.exists())
			{
				if(!hfinfo.isWritable())
				{
					qWarning("Cannot write to '%s'. Use default handler",handler.ascii());
					handler_registered = TRUE;
					break;
				}
			}
			else
			{
				QString path = hfinfo.dirPath();
				QFileInfo hfdinfo(path);
				if(!hfdinfo.isWritable())
				{
					qWarning("Cannot create file in dir '%s'. Use default handler",path.ascii());
					handler_registered = TRUE;
					break;
				}

			}
			mymsghandler = new MyMessageOutput(handler);
			handler_registered = TRUE;
			break;
		}
	}
	if(!handler_registered)
	{
		mymsghandler = new MyMessageOutput(QString("debuglog.txt"));
		handler_registered = TRUE;
	}

#ifdef Q_WS_X11
	if(XInitThreads() == 0)
		qFatal("XInitThreads didn't succeed");
#endif

	// Create a QApplication object and add default close
    QApplication a( argc, argv );
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );

	// Start the configuration selection dialog if more than one config file is available
	ConfigSelector cs;
	if(cs.getNumConfigs() > 1)
	{
		cs.resize(300,150);
		cs.show();
		a.exec();
	}

	// Load configuration
	Configuration * config = new Configuration();
	QString configfile(cs.getConfig());
	if(!config->load(configfile))
	{
		qFatal("Unable to load %s", configfile.ascii());
	}

	ConfigNode * cn = config->getConfig();
	if(!cn)
	{
		qFatal("Unable to get ConfigNode");
	}

	ApplicationNode * an = cn->getApplicationNode();
	if(!an)
	{
		qFatal("Unable to get ApplicationNode");
	}

	PluginsNode * pn = cn->getPluginsNode();
	if(!pn)
	{
		qFatal("Unable to get PluginsNode");
	}

	OBJECTVALUENODE_DECLARE_AND_GET(QPoint,position,an);
	OBJECTVALUENODE_DECLARE_AND_GET(QSize,size,an);
	SIMPLEVALUENODE_DECLARE_AND_GET(bool,maximized,an);
	SIMPLEVALUENODE_DECLARE_AND_GET(Q_INT8,tbindex,an);

    // Create the toplevel window
	Q3HBox * w = new Q3HBox();
	w->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);

	// Add a widget that contains the toolbox and measurements
	Q3VBox * pVBox = new Q3VBox( w );
	pVBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
	pVBox->setSpacing( 5 );
	pVBox->setMargin( 2 );

	// Create the toolbox
	QToolBox * tb = new QToolBox( pVBox );

	// Create all plugins
    Plugin * VisualizePlugin = new Plugin("visualize");
    Plugin * AnalysePlugin = new Plugin("analyse_os");
    Plugin * WaveInPlugin = new Plugin("wavein");
    Plugin * FileWriterPlugin = new Plugin("filewriter");
    // Load plugin objects
	PI_Unknown *ukvi = VisualizePlugin->getObject();
	PI_Unknown *ukan = AnalysePlugin->getObject();
	PI_Unknown *ukwi = WaveInPlugin->getObject();
	PI_Unknown *ukfw = FileWriterPlugin->getObject();

	// Configure the system
	if( ukvi && ukan && ukwi && ukfw )
	{
		PI_GuiContainer* gcwiobj = NULL;
		PI_GuiContainer* gcviobj = NULL;
		PI_GuiContainer* gcfwobj = NULL;
		PI_Configuration* xcanobj = NULL;
		PI_Configuration* xcviobj = NULL;
		PI_Configuration* xcwiobj = NULL;
		PI_Configuration* xcfwobj = NULL;
		PI_DataBufferProvider* dbpwiobj = NULL;
		PI_DataBufferProvider* dbpanobj = NULL;
		PI_DataBufferConsumer* dbcanobj = NULL;
		PI_DataBufferConsumer* dbcviobj = NULL;
		PI_DataBufferConsumer* dbcfwobj = NULL;
		PI_TimeProvider* tpwiobj = NULL;
		PI_TimeConsumer* tcviobj = NULL;
		PI_TimeConsumer* tcfwobj = NULL;

		ukwi->queryInterface( PIID_GUI_CONTAINER, (void**)&gcwiobj );
		ukvi->queryInterface( PIID_GUI_CONTAINER , (void**)&gcviobj );
		ukfw->queryInterface( PIID_GUI_CONTAINER, (void**)&gcfwobj );
		ukan->queryInterface( PIID_CONFIGURATION, (void**)&xcanobj );
		ukvi->queryInterface( PIID_CONFIGURATION, (void**)&xcviobj );
		ukwi->queryInterface( PIID_CONFIGURATION, (void**)&xcwiobj );
		ukfw->queryInterface( PIID_CONFIGURATION, (void**)&xcfwobj );
		ukwi->queryInterface( PIID_DATA_BUFFER_PROVIDER, (void**)&dbpwiobj );
		ukan->queryInterface( PIID_DATA_BUFFER_PROVIDER, (void**)&dbpanobj );
		ukan->queryInterface( PIID_DATA_BUFFER_CONSUMER, (void**)&dbcanobj );
		ukvi->queryInterface( PIID_DATA_BUFFER_CONSUMER, (void**)&dbcviobj );
		ukfw->queryInterface( PIID_DATA_BUFFER_CONSUMER, (void**)&dbcfwobj );
		ukwi->queryInterface( PIID_TIME_PROVIDER, (void**)&tpwiobj );
		ukvi->queryInterface( PIID_TIME_CONSUMER, (void**)&tcviobj );
		ukfw->queryInterface( PIID_TIME_CONSUMER, (void**)&tcfwobj );

		if( gcwiobj && gcviobj && gcfwobj &&
			xcwiobj && xcanobj && xcviobj && xcfwobj &&
			dbpwiobj && dbpanobj && dbcanobj && dbcviobj && dbcfwobj &&
			tpwiobj && tcviobj && tcfwobj)
		{
			// Wave in object
			gcwiobj->setParentWindow( tb, "WaveDeviceConfiguration" );
			// Visualize object
    		gcviobj->setParentWindow( tb, "Diagram1" );
    		gcviobj->setParentWindow( tb, "Diagram2" );
    		gcviobj->setParentWindow( tb, "Diagram3" );
			gcviobj->setParentWindow( tb, "Diagram4" );
			gcviobj->setParentWindow( tb, "Diagram5" );
			gcviobj->setParentWindow( tb, "Configuration" );
			gcviobj->setParentWindow( tb, "BaseFrequency" );
			gcviobj->setParentWindow( pVBox, "TopDisplay" );
			gcviobj->setParentWindow( w, "Graph" );
			// File writer object
			gcfwobj->setParentWindow( tb, "SpectralDataSaveGui" );

			// Wave in object
			PLUGINNODE_DECLARE_AND_GET(wavein,pn);
			xcwiobj->configure(NODE_VARIABLE_NAME(wavein));
			// Analyse object
			PLUGINNODE_DECLARE_AND_GET(analyse,pn);
			xcanobj->configure(NODE_VARIABLE_NAME(analyse));
			// Visualize object
			PLUGINNODE_DECLARE_AND_GET(visualize,pn);
			xcviobj->configure(NODE_VARIABLE_NAME(visualize));
			// File writer object
			PLUGINNODE_DECLARE_AND_GET(filewriter,pn);
			xcfwobj->configure(NODE_VARIABLE_NAME(filewriter));

			// Connect the 'pause' source to different sinks
			gcviobj->connectSlot( "pause", gcwiobj->getObject("WaveDeviceConfiguration"), "setPause" );
			gcviobj->connectSlot( "pause", gcfwobj->getObject("SpectralDataSaveGui"), "setPause" );

			// Add visualize object configurations to the toolbox
			tb->addItem( gcviobj->getWidget("Diagram1"), "Diagramm 1" );
			tb->addItem( gcviobj->getWidget("Diagram2"), "Diagramm 2" );
			tb->addItem( gcviobj->getWidget("Diagram3"), "Diagramm 3" );
			tb->addItem( gcviobj->getWidget("Diagram4"), "Diagramm 4" );
			tb->addItem( gcviobj->getWidget("Diagram5"), "Diagramm 5" );
			tb->addItem( gcviobj->getWidget("Configuration"), "Konfiguration" );
			tb->addItem( gcviobj->getWidget("BaseFrequency"), "Bezugston, Stimmung" );
			// Add file writer object configuration to the toolbox
			tb->addItem( gcfwobj->getWidget("SpectralDataSaveGui"), "Datenspeicherung" );
			// Add wave in object configuration to the toolbox
			tb->addItem( gcwiobj->getWidget("WaveDeviceConfiguration"), "Soundkarte" );

			dbpwiobj->addRef();
			dbcanobj->connectToProvider( dbpwiobj );
			dbpanobj->addRef();
			dbcviobj->connectToProvider( dbpanobj );

			dbpwiobj->addRef();
			dbcfwobj->connectToProvider( dbpwiobj ); //filewrite
			dbpanobj->addRef();
			dbcfwobj->connectToProvider( dbpanobj ); //filewrite

			tpwiobj->addRef();
			tcviobj->connectToProvider( tpwiobj );
			tpwiobj->addRef();
			tcfwobj->connectToProvider( tpwiobj ); //filewrite

			xcwiobj->startRunning();
			xcanobj->startRunning();
			xcviobj->startRunning();
			xcfwobj->startRunning(); //filewrite

		}

		if( gcwiobj ) gcwiobj->release();
		if( gcviobj ) gcviobj->release();
		if( gcfwobj ) gcfwobj->release();
		if( xcanobj ) xcanobj->release();
		if( xcviobj ) xcviobj->release();
		if( xcwiobj ) xcwiobj->release();
		if( xcfwobj ) xcfwobj->release();
		if( dbpwiobj ) dbpwiobj->release();
		if( dbpanobj ) dbpanobj->release();
		if( dbcanobj ) dbcanobj->release();
		if( dbcviobj ) dbcviobj->release();
		if( dbcfwobj ) dbcfwobj->release();
		if( tpwiobj ) tpwiobj->release();
		if( tcviobj ) tcviobj->release();
		if( tcfwobj ) tcfwobj->release();
	}

	// Set active item in the ToolBox
	tb->setCurrentIndex(VALUENODE_GET_VALUE(tbindex));

	w->resize(VALUENODE_GET_VALUE(size));
	w->move(VALUENODE_GET_VALUE(position));
	if(VALUENODE_GET_VALUE(maximized))
		w->showMaximized();
	w->setCaption("Prisma-Realtime v1.3b");
    w->show();

    Q3Accel *esc = new Q3Accel( w );
    esc->connectItem( esc->insertItem( Qt::Key_Escape ), &a, SLOT( quit() ) );

    a.exec();

	w->hide();

	if(!w->isMaximized())
	{
		VALUENODE_SET_VALUE(size,w->size());
		VALUENODE_SET_VALUE(position,w->pos());
	}
	VALUENODE_SET_VALUE(maximized,w->isMaximized());

	VALUENODE_SET_VALUE(tbindex,tb->currentIndex());

	if( ukvi && ukan && ukwi && ukfw )
	{
		PI_Configuration * xmlconfig = NULL;

		ukvi->queryInterface(PIID_CONFIGURATION, (void**)&xmlconfig);
		if(xmlconfig != NULL)
		{
			xmlconfig->stopRunning();
			xmlconfig->release();
			xmlconfig = NULL;
		}
		ukan->queryInterface(PIID_CONFIGURATION, (void**)&xmlconfig);
		if(xmlconfig != NULL)
		{
			xmlconfig->stopRunning();
			xmlconfig->release();
			xmlconfig = NULL;
		}
		ukwi->queryInterface(PIID_CONFIGURATION, (void**)&xmlconfig);
		if(xmlconfig != NULL)
		{
			xmlconfig->stopRunning();
			xmlconfig->release();
			xmlconfig = NULL;
		}
		ukfw->queryInterface(PIID_CONFIGURATION, (void**)&xmlconfig);
		if(xmlconfig != NULL)
		{
			xmlconfig->stopRunning();
			xmlconfig->release();
			xmlconfig = NULL;
		}
	}

	if(ukvi) ukvi->release();
	if(ukan) ukan->release();
	if(ukwi) ukwi->release();
	if(ukfw) ukfw->release();

	delete w;

	config->save(configfile);
	// Delete before unloading plugins!!!
	delete config;

	// Release plugins
	delete VisualizePlugin;
	delete FileWriterPlugin;
	delete AnalysePlugin;
	delete WaveInPlugin;


	if(mymsghandler)
		delete mymsghandler;

    return 0;

}
Beispiel #13
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);
}
Beispiel #14
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);
}