QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent)
{
    QWidget * fileWidget = new QWidget(parent);
    QHBoxLayout * editLayout = new QHBoxLayout();
    QMargins margins = editLayout->contentsMargins();
    editLayout->setContentsMargins(0, 0, 0, margins.bottom());
    fileWidget->setContentsMargins(margins.left(), margins.right(), 0, margins.bottom());
    QPushButton * button = new QPushButton(UTF8_HORIZONTAL_ELLIPSIS, fileWidget);

    textBox = new QLineEdit(_default->toString(), parent);
    textBox->setReadOnly(true);

    if ( _argument->default_complex != NULL && _argument->arg_type == EXTCAP_ARG_STRING )
        textBox->setText(QString().fromUtf8(extcap_complex_get_string(_argument->default_complex)));

    if ( _argument->tooltip != NULL )
    {
        textBox->setToolTip(QString().fromUtf8(_argument->tooltip));
        button->setToolTip(QString().fromUtf8(_argument->tooltip));
    }


    connect(button, SIGNAL(clicked()), (QObject *)this, SLOT(openFileDialog()));

    editLayout->addWidget(textBox);
    editLayout->addWidget(button);

    fileWidget->setLayout(editLayout);

    return fileWidget;
}
Пример #2
0
    void AbstractNumberFilter::createWidget()
    {
      QFont greaterThanLessThanFont("SansSerif", 9);

      QRadioButton * lessThanButton = new QRadioButton("<=");
      lessThanButton->setFont(greaterThanLessThanFont);
      QRadioButton * greaterThanButton = new QRadioButton(">=");
      greaterThanButton->setFont(greaterThanLessThanFont);

      greaterThanLessThan = new QButtonGroup;
      connect(greaterThanLessThan, SIGNAL(buttonClicked(int)),
              this, SIGNAL(filterChanged()));
      greaterThanLessThan->addButton(lessThanButton, 0);
      greaterThanLessThan->addButton(greaterThanButton, 1);

      // hide inclusive and exclusive buttons, and add greater than and less than
      // in the inclusiveExclusiveLayout.
      getInclusiveExclusiveLayout()->itemAt(0)->widget()->setVisible(false);
      getInclusiveExclusiveLayout()->itemAt(1)->widget()->setVisible(false);
      getInclusiveExclusiveLayout()->addWidget(lessThanButton);
      getInclusiveExclusiveLayout()->addWidget(greaterThanButton);

      lineEditText = new QString;

      lineEdit = new QLineEdit;
      lineEdit->setMinimumWidth(75);
      connect(lineEdit, SIGNAL(textChanged(QString)),
              this, SLOT(updateLineEditText(QString)));
      connect(lineEdit, SIGNAL(textChanged(QString)),
              this, SIGNAL(filterChanged()));


      QHBoxLayout * layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(lineEdit);
      layout->addStretch();

      getMainLayout()->addLayout(layout);

      // FIXME: QSettings should handle this
      lessThanButton->click();
    }
Пример #3
0
    void AbstractStringFilter::createWidget()
    {
      lineEditText = new QString;

      lineEdit = new QLineEdit;
      lineEdit->setMinimumWidth(250);
      connect(lineEdit, SIGNAL(textChanged(QString)),
          this, SLOT(updateLineEditText(QString)));
      connect(lineEdit, SIGNAL(textChanged(QString)),
          this, SIGNAL(filterChanged()));

      QHBoxLayout * layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(lineEdit);
      layout->addStretch();

      getMainLayout()->addLayout(layout);
    }
Пример #4
0
    void AbstractMultipleChoiceFilter::createWidget(QStringList options) {
      m_combo = new QComboBox;
      foreach (QString option, options)
        m_combo->addItem(option);

      m_combo->setCurrentIndex(0);

      *m_curChoice = m_combo->currentText();

      connect(m_combo, SIGNAL(currentIndexChanged(QString)),
          this, SLOT(updateCurChoice(QString)));

      QHBoxLayout *layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(m_combo);
      layout->addStretch();

      getMainLayout()->addLayout(layout);
    }
Пример #5
0
    void AbstractFilter::createWidget() {
      QRadioButton *inclusiveButton = new QRadioButton("Inclusive");
      inclusiveButton->setFont(*m_smallFont);
      QRadioButton *exclusiveButton = new QRadioButton("Exclusive");
      exclusiveButton->setFont(*m_smallFont);

      m_inclusiveExclusiveGroup = new QButtonGroup;
      connect(m_inclusiveExclusiveGroup, SIGNAL(buttonClicked(int)),
          this, SIGNAL(filterChanged()));
      m_inclusiveExclusiveGroup->addButton(inclusiveButton, 0);
      m_inclusiveExclusiveGroup->addButton(exclusiveButton, 1);

      m_inclusiveExclusiveLayout = new QHBoxLayout;
      QMargins margins = m_inclusiveExclusiveLayout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      m_inclusiveExclusiveLayout->setContentsMargins(margins);
      m_inclusiveExclusiveLayout->addWidget(inclusiveButton);
      m_inclusiveExclusiveLayout->addWidget(exclusiveButton);

      QHBoxLayout *controlsLayout = new QHBoxLayout;
      margins = controlsLayout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      controlsLayout->setContentsMargins(margins);

      controlsLayout->addLayout(m_inclusiveExclusiveLayout);

      m_effectivenessGroup = new QButtonGroup();
      m_effectivenessGroup->setExclusive(false);

      if (m_effectivenessFlags->testFlag(Images))
        m_effectivenessGroup->addButton(
          createEffectivenessCheckBox("&Images"), 0);

      if (m_effectivenessFlags->testFlag(Points))
        m_effectivenessGroup->addButton(
          createEffectivenessCheckBox("&Points"), 1);

      if (m_effectivenessFlags->testFlag(Measures))
        m_effectivenessGroup->addButton(
          createEffectivenessCheckBox("&Measures"), 2);

      QString firstGroupEntry;
      ASSERT(m_effectivenessGroup->buttons().size());
      if (m_effectivenessGroup->buttons().size()) {
        firstGroupEntry = m_effectivenessGroup->buttons()[0]->text();
        firstGroupEntry.remove(0, 1);
      }

      QList<QAbstractButton *> buttons = m_effectivenessGroup->buttons();
      if (m_effectivenessGroup->buttons().size() >= 2) {
        QHBoxLayout *effectivenessLayout = new QHBoxLayout;
        QMargins effectivenessMargins = effectivenessLayout->contentsMargins();
        effectivenessMargins.setTop(0);
        effectivenessMargins.setBottom(0);
        effectivenessLayout->setContentsMargins(effectivenessMargins);

        for (int i = 0; i < buttons.size(); i++)
          effectivenessLayout->addWidget(buttons[i]);

        controlsLayout->addLayout(effectivenessLayout);
      }
      else {
        for (int i = 0; i < buttons.size(); i++)
          delete buttons[i];
        delete m_effectivenessGroup;
        m_effectivenessGroup = NULL;
      }

      if (m_minForSuccess != -1) {
        QLabel *label = new QLabel;
        label->setText(
          "<span>Min Count<br/>for " + firstGroupEntry + "</span>");
        label->setFont(QFont("SansSerif", 7));
        QSpinBox *spinBox = new QSpinBox;
        spinBox->setRange(1, std::numeric_limits< int >::max());
        spinBox->setValue(1);  // FIXME: QSettings should handle this
        connect(spinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateMinForSuccess(int)));
        QHBoxLayout *minLayout = new QHBoxLayout;
        margins = minLayout->contentsMargins();
        margins.setTop(0);
        margins.setBottom(0);
        minLayout->setContentsMargins(margins);
        minLayout->addWidget(label);
        minLayout->addWidget(spinBox);
        m_minWidget = new QWidget;
        m_minWidget->setLayout(minLayout);

        controlsLayout->addWidget(m_minWidget);
        controlsLayout->setAlignment(m_minWidget, Qt::AlignTop);
        m_minWidget->setVisible(true); // FIXME: QSettings should handle this
      }