Ejemplo n.º 1
0
AddGeneratorDialog::AddGeneratorDialog(QWidget* Parent) :
  openfluid::ui::common::OpenFLUIDDialog(Parent),ui(new Ui::AddGeneratorDialog)
{
  ui->setupUi(this);

  ui->MessageLabel->setText(tr("Add generator"));

  connect(ui->FixedRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
  connect(ui->RandomRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
  connect(ui->InterpRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
  connect(ui->InjectRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));

  connect(ui->VectorRadioButton,SIGNAL(toggled(bool)),ui->VectorSpinBox,SLOT(setEnabled(bool)));

  connect(ui->VarNameEdit,SIGNAL(textEdited(const QString&)),this,SLOT(checkGlobal()));
  connect(ui->UnitsClassEdit,SIGNAL(textEdited(const QString&)),this,SLOT(checkGlobal()));

  connect(ui->SourcesBrowseButton,SIGNAL(clicked()),this,SLOT(selectSourcesFile()));
  connect(ui->DistriBrowseButton,SIGNAL(clicked()),this,SLOT(selectDistriFile()));

  connect(ui->ButtonBox,SIGNAL(accepted()),this,SLOT(accept()));
  connect(ui->ButtonBox,SIGNAL(rejected()),this,SLOT(reject()));

  switchGeneratorOptions();

  m_Method = openfluid::fluidx::GeneratorDescriptor::Fixed;

  ui->FixedRadioButton->setChecked(true);
  ui->DoubleRadioButton->setChecked(true);
  ui->VectorSpinBox->setEnabled(false);

  // "required" placeholder
  QString PlaceholderStr = getPlaceholderRequired();
  ui->UnitsClassEdit->setPlaceholderText(PlaceholderStr);
  ui->VarNameEdit->setPlaceholderText(PlaceholderStr);

  openfluid::ui::common::ShortcutCompleter* Completer =
      new openfluid::ui::common::ShortcutCompleter(ProjectCentral::instance()->unitsClassesList(),this);
  Completer->linkToLineEdit(ui->UnitsClassEdit);
  connect(Completer,SIGNAL(activated(const QString&)),this,SLOT(checkGlobal()));

  ui->VarNameEdit->setFocus();

  checkGlobal();
}
Ejemplo n.º 2
0
AddGeneratorDialog::AddGeneratorDialog(const QStringList& UnitsClasses, QWidget* Parent) :
    openfluid::ui::common::OpenFLUIDDialog(Parent),ui(new Ui::AddGeneratorDialog)
{
    ui->setupUi(this);

    ui->MessageLabel->setText(tr("Add generator"));

    connect(ui->FixedRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
    connect(ui->RandomRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
    connect(ui->InterpRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));
    connect(ui->InjectRadioButton,SIGNAL(toggled(bool)),this,SLOT(switchGeneratorOptions()));

    connect(ui->VectorRadioButton,SIGNAL(toggled(bool)),ui->VectorSpinBox,SLOT(setEnabled(bool)));

    connect(ui->VarNameEdit,SIGNAL(textEdited(const QString&)),this,SLOT(checkGlobal()));
    connect(ui->UnitsClassEdit,SIGNAL(textEdited(const QString&)),this,SLOT(checkGlobal()));

    connect(ui->SourcesBrowseButton,SIGNAL(clicked()),this,SLOT(selectSourcesFile()));
    connect(ui->DistriBrowseButton,SIGNAL(clicked()),this,SLOT(selectDistriFile()));

    connect(ui->ButtonBox,SIGNAL(accepted()),this,SLOT(accept()));
    connect(ui->ButtonBox,SIGNAL(rejected()),this,SLOT(reject()));

    switchGeneratorOptions();

    m_Method = openfluid::fluidx::GeneratorDescriptor::Fixed;

    ui->FixedRadioButton->setChecked(true);
    ui->DoubleRadioButton->setChecked(true);
    ui->VectorSpinBox->setEnabled(false);

    ui->VarNameEdit->setPlaceholderText(openfluid::ui::config::PLACEHOLDER_REQUIRED);
    ui->UnitsClassEdit->setPlaceholderText(openfluid::ui::config::PLACEHOLDER_REQUIRED);

    QCompleter* Completer = new QCompleter(UnitsClasses, this);
    Completer->setCaseSensitivity(Qt::CaseInsensitive);
    Completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
    ui->UnitsClassEdit->setCompleter(Completer);

    checkGlobal();
}