コード例 #1
0
ファイル: Dialog.cpp プロジェクト: SciBoy/douml
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);
}
コード例 #2
0
ファイル: Dialog.cpp プロジェクト: bleakxanadu/douml
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 
 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 '&
' and '&
'", 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);
}