Example #1
0
QList<QWidget *> Object::getControls()
{
    QSpinBox *bonus = new QSpinBox();
    bonus->setObjectName("bonus");    
    bonus->setMaximum(1000);
    bonus->setValue(_bonus);
    connect(bonus,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_bonus = new Control("Bonificación de armadura", bonus);

    QSpinBox *time = new QSpinBox();
    time->setSuffix(" seg");
    time->setObjectName("time");
    time->setMinimum(1);
    time->setMaximum(1000);
    time->setValue(_time);
    connect(time,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_time = new Control("Tiempo de efecto", time);

    QSpinBox *cooldown = new QSpinBox();
    cooldown->setSuffix(" seg");
    cooldown->setObjectName("cooldown");
    cooldown->setMinimum(1);
    cooldown->setMaximum(1000);
    cooldown->setValue(_cooldown);
    connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_cooldown = new Control("Tiempo de reaparición", cooldown);

    QList<QWidget*> controls = IObject::getControls();
    controls.append(c_bonus);
    controls.append(c_time);
    controls.append(c_cooldown);

    return controls;
}
Example #2
0
void ColumnList::updateUnits()
{
  // Replace widget suffices and table headers
  for(Column *col : columns)
  {
    col->colDisplayName = Unit::replacePlaceholders(col->colOrigDisplayName);

    QSpinBox *sb = col->getSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colWidgetSuffix));

    sb = col->getMinSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMinWidgetSuffix));

    sb = col->getMaxSpinBoxWidget();
    if(sb != nullptr)
      sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMaxWidgetSuffix));
  }

  if(minDistanceWidget != nullptr)
    minDistanceWidget->setSuffix(
      Unit::replacePlaceholders(minDistanceWidget->suffix(), minDistanceWidgetSuffix));

  if(maxDistanceWidget != nullptr)
    maxDistanceWidget->setSuffix(
      Unit::replacePlaceholders(maxDistanceWidget->suffix(), maxDistanceWidgetSuffix));
}
AntiDosWindow::AntiDosWindow(QSettings &settings) : settings(settings)
{
    setAttribute(Qt::WA_DeleteOnClose, true);

    QFormLayout *mylayout = new QFormLayout(this);

    QSpinBox *mppip = new QSpinBox();
    mppip->setRange(1,8);
    mppip->setValue(settings.value("AntiDOS/MaxPeoplePerIp").toInt());
    mylayout->addRow(tr("Max number of people connected with the same ip"), mppip);

    QSpinBox *mcpus = new QSpinBox();
    mcpus->setRange(15,150);
    mcpus->setValue(settings.value("AntiDOS/MaxCommandsPerUser").toInt());
    mylayout->addRow(tr("Max number of times someone is active within a minute"), mcpus);

    QSpinBox *mkbpus = new QSpinBox();
    mkbpus->setRange(5,150);
    mkbpus->setValue(settings.value("AntiDOS/MaxKBPerUser").toInt());
    mkbpus->setSuffix(" kB");
    mylayout->addRow(tr("Maximum upload from user per minute"), mkbpus);

    QSpinBox *mlpip = new QSpinBox();
    mlpip->setRange(2,30);
    mlpip->setValue(settings.value("AntiDOS/MaxConnectionRatePerIP").toInt());
    mylayout->addRow(tr("Max number of times the same ip attempts to log in per minute"), mlpip);

    QSpinBox *baxk = new QSpinBox();
    baxk->setRange(1,30);
    baxk->setValue(settings.value("AntiDOS/NumberOfInfractionsBeforeBan").toInt());
    mylayout->addRow(tr("Bans after X antidos kicks per 15 minutes"), baxk);

    trusted_ips = new QLineEdit();
    trusted_ips->setText(settings.value("AntiDOS/TrustedIps").toString());
    mylayout->addRow(tr("Trusted IPs (separated by comma)"),trusted_ips);

    notificationsChannel = new QLineEdit(settings.value("AntiDOS/NotificationsChannel").toString());
    mylayout->addRow(tr("Channel in which to display overactive messages: "), notificationsChannel);

    QCheckBox *aDosOn = new QCheckBox(tr("Turn AntiDos ON"));
    aDosOn->setChecked(!settings.value("AntiDOS/Disabled").toBool());
    mylayout->addWidget(aDosOn);

    QPushButton *ok = new QPushButton("&Apply");
    QPushButton *cancel = new QPushButton("&Cancel");

    mylayout->addRow(ok, cancel);

    connect(cancel, SIGNAL(clicked()), SLOT(close()));
    connect(ok, SIGNAL(clicked()), SLOT(apply()));

    max_people_per_ip = mppip;
    max_commands_per_user = mcpus;
    max_kb_per_user = mkbpus;
    max_login_per_ip = mlpip;
    ban_after_x_kicks = baxk;
    this->aDosOn = aDosOn;
}
QWidget *SpinBoxDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */ ) const
{
    QSpinBox *editor = new QSpinBox( parent );
    editor->setMinimum( 1 );
    editor->setMaximum( 999 );
    editor->setSuffix( "min" );

    return editor;
}
Example #5
0
TtipMelody::TtipMelody(TquestionPoint *point) :
    TtipChart(point)
{
    setBgColor(point->color());
    setPlainText(" ");

    m_w = new QWidget();
    m_w->setObjectName("m_melodyView");
    m_w->setStyleSheet("QWidget#m_melodyView { background: transparent }");
    QString txt;
    if (point->nr())
        txt = QString(TquestionAsWdg::questionTxt() + " <big><b>%1.</b></big>").arg(point->nr());
    if (point->question()->questionAsNote() && point->question()->answerAsSound())
        txt += (" <b>" + TexTrans::playMelodyTxt() + "</b>");
    else if (point->question()->questionAsSound() && point->question()->answerAsNote())
        txt += (" <b>" + TexTrans::writeMelodyTxt() + "</b>");
    QLabel *headLab = new QLabel(txt, m_w);
    headLab->setAlignment(Qt::AlignCenter);
    m_score = new TmelodyView(qa()->question()->melody(), m_w);
    m_score->setFixedHeight(qApp->desktop()->availableGeometry().height() / 12);
    if (point->question()->exam()) {
        if (point->question()->exam()->level()->showStrNr)
            m_score->showStringNumbers(true);
    }
    QSpinBox *spinAtt = new QSpinBox(m_w);
    spinAtt->setRange(0, qa()->question()->attemptsCount());
    spinAtt->setPrefix(TexTrans::attemptTxt() + " ");
    spinAtt->setSuffix(" " + tr("of", "It will give text: 'Attempt x of y'") + QString(" %1").arg(qa()->question()->attemptsCount()));
    m_attemptLabel = new QLabel(m_w);
    m_resultLabel = new QLabel(wasAnswerOKtext(point->question(), point->color()).replace("<br>", " "), m_w);
    m_resultLabel->setAlignment(Qt::AlignCenter);
//   txt = wasAnswerOKtext(point->question(), point->color()).replace("<br>", " ") + "<br>";
    txt = tr("Melody was played <b>%n</b> times", "", qa()->question()->totalPlayBacks()) + "<br>";
    txt += TexTrans::effectTxt() + QString(": <big><b>%1%</b></big>, ").arg(point->question()->effectiveness(), 0, 'f', 1, '0');
    txt += TexTrans::reactTimeTxt() + QString("<big><b>  %1</b></big>").arg(Texam::formatReactTime(point->question()->time, true));
    QLabel *sumLab = new QLabel(txt, m_w);
    sumLab->setAlignment(Qt::AlignCenter);

    QVBoxLayout *lay = new QVBoxLayout;
    lay->addWidget(headLab);
    lay->addWidget(m_score, 0, Qt::AlignCenter);
    QHBoxLayout *attLay = new QHBoxLayout;
    attLay->addStretch();
    attLay->addWidget(spinAtt);
    attLay->addStretch();
    lay->addLayout(attLay);
    lay->addWidget(m_attemptLabel);
    lay->addWidget(m_resultLabel);
    lay->addWidget(sumLab);

    m_w->setLayout(lay);
    m_widget = point->scene()->addWidget(m_w);
    m_widget->setParentItem(this);

    connect(spinAtt, SIGNAL(valueChanged(int)), this, SLOT(attemptChanged(int)));
}
QWidget *BrainTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
    const BrainTreeModel* pBrainTreeModel = static_cast<const BrainTreeModel*>(index.model());
    const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pBrainTreeModel->itemFromIndex(index));

    switch(pAbstractItem->type()) {
        case BrainTreeModelItemTypes::SurfaceColorGyri: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            pColorDialog->show();
            return pColorDialog;
        }

        case BrainTreeModelItemTypes::SurfaceColorSulci: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            pColorDialog->show();
            return pColorDialog;
        }

        case BrainTreeModelItemTypes::SurfaceColorInfoOrigin: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Color from curvature");
            pComboBox->addItem("Color from annotation");
            return pComboBox;
        }

        case BrainTreeModelItemTypes::RTDataColormapType: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Hot Negative 1");
            pComboBox->addItem("Hot Negative 2");
            pComboBox->addItem("Hot");
            return pComboBox;
        }

        case BrainTreeModelItemTypes::RTDataNormalizationValue: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            pDoubleSpinBox->setMinimum(0.01);
            pDoubleSpinBox->setMaximum(10.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataNormalizationValue).toDouble());
            return pDoubleSpinBox;
            break;
        }

        case BrainTreeModelItemTypes::RTDataTimeInterval: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            pSpinBox->setSuffix(" mSec");
            pSpinBox->setMinimum(17);
            pSpinBox->setMaximum(5000);
            pSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataTimeInterval).toInt());
            return pSpinBox;
            break;
        }
    }

    return QItemDelegate::createEditor(parent, option, index);
}
Example #7
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QSpinBox* nextentry = new QSpinBox;
    nextentry->setSuffix(")");
    nextentry->setSuffix(" MB");
    QSlider* on_moverecords_sliderMoved = new QSlider(Qt::Horizontal);
    QHBoxLayout* layout = new QHBoxLayout;
    layout->addWidget(nextentry);
    layout->addWidget(on_moverecords_sliderMoved);
    QObject::connect(nextentry, SIGNAL(valueChanged(int)),
    on_moverecords_sliderMoved, SLOT(setValue(int)));
    QObject::connect(on_moverecords_sliderMoved, SIGNAL(valueChanged(int)),
    nextentry, SLOT(setValue(int)));
    nextentry->setValue(99);

    DiplomWork w;
    w.show();
    return a.exec();
}
Example #8
0
HzW::HzW(int c, const QStringList &freqs)
{
	QGridLayout *layout = new QGridLayout(this);
	for (int i = 0; i < c; ++i)
	{
		QSpinBox *sB = new QSpinBox;
		sB->setRange(0, 96000);
		sB->setSuffix(" Hz");
		if (freqs.count() > i)
			sB->setValue(freqs[i].toInt());
		else
			sB->setValue(440);
		hzB.append(sB);
		layout->addWidget(sB, i/4, i%4);
	}
}
Example #9
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSpinBox *spinBox = new QSpinBox;
      spinBox->setRange(1,100);        //set range of spinBox's values
      spinBox->setSuffix(" MB");       // set suffix after our values
      spinBox->setButtonSymbols(QSpinBox::PlusMinus);
      spinBox->setWrapping(true);  // loop mode activating
      spinBox->setFixedHeight(100);
      spinBox->setFixedWidth(100);
      spinBox->move(430,340);
    spinBox->show();


    return a.exec();
}
QSpinBox* RenderSettingsWindow::create_integer_input(
    const string&           widget_key,
    const int               min,
    const int               max,
    const QString&          label)
{
    QSpinBox* spinbox = create_integer_input(widget_key, min, max);

    const QString suffix = " " + label;
    spinbox->setSuffix(suffix);

    QString text;
    text.setNum(max);
    text.append(suffix);
    set_widget_width_for_text(spinbox, text, SpinBoxMargin, SpinBoxMinWidth);

    return spinbox;
}
Example #11
0
//! [1]
void Window::createSpinBoxes()
{
    spinBoxesGroup = new QGroupBox(tr("Spinboxes"));

    QLabel *integerLabel = new QLabel(tr("Enter a value between "
        "%1 and %2:").arg(-20).arg(20));
    QSpinBox *integerSpinBox = new QSpinBox;
    integerSpinBox->setRange(-20, 20);
    integerSpinBox->setSingleStep(1);
    integerSpinBox->setValue(0);
//! [1]

//! [2]
    QLabel *zoomLabel = new QLabel(tr("Enter a zoom value between "
        "%1 and %2:").arg(0).arg(1000));
//! [3]
    QSpinBox *zoomSpinBox = new QSpinBox;
    zoomSpinBox->setRange(0, 1000);
    zoomSpinBox->setSingleStep(10);
    zoomSpinBox->setSuffix("%");
    zoomSpinBox->setSpecialValueText(tr("Automatic"));
    zoomSpinBox->setValue(100);
//! [2] //! [3]

//! [4]
    QLabel *priceLabel = new QLabel(tr("Enter a price between "
        "%1 and %2:").arg(0).arg(999));
    QSpinBox *priceSpinBox = new QSpinBox;
    priceSpinBox->setRange(0, 999);
    priceSpinBox->setSingleStep(1);
    priceSpinBox->setPrefix("$");
    priceSpinBox->setValue(99);
//! [4] //! [5]

    QVBoxLayout *spinBoxLayout = new QVBoxLayout;
    spinBoxLayout->addWidget(integerLabel);
    spinBoxLayout->addWidget(integerSpinBox);
    spinBoxLayout->addWidget(zoomLabel);
    spinBoxLayout->addWidget(zoomSpinBox);
    spinBoxLayout->addWidget(priceLabel);
    spinBoxLayout->addWidget(priceSpinBox);
    spinBoxesGroup->setLayout(spinBoxLayout);
}
Example #12
0
QueryPage:: QueryPage(QWidget *parent)
	: QWidget(parent)
{
	QGroupBox *packagesGroup = new QGroupBox("Look for packages");
	
	QLabel *nameLabel = new QLabel("Name:");
	QLineEdit *nameLineEdit = new QLineEdit;
	
	QLabel *dateLabel = new QLabel("Released after:");
	QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
	
	QCheckBox *releaseCheckBox = new QCheckBox("Releases");
	QCheckBox *upgradesCheckBox = new QCheckBox("Upgrades");
	
	QSpinBox *hitsSpinBox = new QSpinBox;
	hitsSpinBox->setPrefix("Return up to");	
	hitsSpinBox->setSuffix(" results");
	hitsSpinBox->setSpecialValueText("Return only the first result");
	hitsSpinBox->setMinimum(1);
	hitsSpinBox->setMaximum(100);
	hitsSpinBox->setSingleStep(10);
	
	QPushButton *startQueryButton = new QPushButton("Start query");
	
	QGridLayout *packagesLayout = new QGridLayout;
	packagesLayout->addWidget(nameLabel, 0, 0);
	packagesLayout->addWidget(nameLineEdit, 0, 1);
	packagesLayout->addWidget(dateLabel, 1, 0);
	packagesLayout->addWidget(dateEdit, 1, 1);
	packagesLayout->addWidget(releaseCheckBox, 2, 0);
	packagesLayout->addWidget(upgradesCheckBox, 3, 0);
	packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
	packagesGroup->setLayout(packagesLayout);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(packagesGroup);
	mainLayout->addSpacing(12);
	mainLayout->addWidget(startQueryButton);
	mainLayout->addStretch(1);
	
	setLayout(mainLayout);
}
Example #13
0
void ProgressDelegate::setEditorData(QWidget *editor,
                                     const QModelIndex &index) const {
  auto model = index.model();
  auto id =
      model->data(model->index(index.row(), ListRoles::ID), Qt::DisplayRole);

  AnimePtr anime = User::sharedUser()->getAnimeByID(id.toString());

  auto episodes_watched = anime->episodesWatched();
  auto total_episodes = anime->totalEpisodes();

  if (total_episodes == 0) {
    total_episodes = std::numeric_limits<int>::max();
  }

  QSpinBox *spinBox = static_cast<QSpinBox *>(editor);
  spinBox->setMaximum(total_episodes);
  spinBox->setValue(episodes_watched);
  spinBox->setSuffix(" / " + QString::number(anime->totalEpisodes()));
}
Example #14
0
QWidget *SpinBoxItem::createEditor() const
{
    // create a spinbox editor
    QSpinBox *spinbox = new QSpinBox(table()->viewport());
    spinbox->setSuffix(" ns");
    if (field_ == OFFSET) {
        spinbox->setRange(-1, INT_MAX);
        spinbox->setValue(node_->autoOffset() ? -1 : (int)node_->offset());
        spinbox->setSpecialValueText
            (QString("Auto (%1 ns)").arg(node_->offset()));
    }
    else {
        spinbox->setRange(0, INT_MAX);
        spinbox->setValue(field_ == CLOCK
                           ? node_->clock()
                           : node_->runtime());
    }

    return spinbox;
}
Example #15
0
int main(int argc, char** argv) {
	QApplication app(argc, argv);

	QWidget wgt;
	wgt.setWindowTitle("Spin Boxes");

	QLabel* plblCount = new QLabel("Megabytes:");	
	QLabel* plblDate = new QLabel("Date and Time:");
	QLabel* plblValid = new QLabel("Name:");

	QSpinBox spb;
	spb.setRange(1, 100);
	spb.setSuffix(" MB");
	spb.setButtonSymbols(QSpinBox::PlusMinus);
	spb.setWrapping(true);
	spb.resize(100, 30);

	plblCount->setBuddy(&spb);
	QObject::connect(&spb, SIGNAL(valueChanged(const QString&)), plblCount, SLOT(setText(const QString&)));

	QDateTimeEdit dateTimeEdit(QDateTime::currentDateTime());

	QLineEdit* ptxt = new QLineEdit;

	NameValidator* pnameValidator = new NameValidator(ptxt);
	ptxt->setValidator(pnameValidator);
	plblValid->setBuddy(ptxt);

	QVBoxLayout* pvbxLayout = new QVBoxLayout;
	pvbxLayout->addWidget(plblCount);
	pvbxLayout->addWidget(&spb);
	pvbxLayout->addWidget(plblDate);
	pvbxLayout->addWidget(&dateTimeEdit);
	pvbxLayout->addWidget(plblValid);
	pvbxLayout->addWidget(ptxt);

	wgt.setLayout(pvbxLayout);
	wgt.resize(230, 180);
	wgt.show();
	return app.exec();
}
Example #16
0
QList<QPointer<QWidget> > KoCreatePathTool::createOptionWidgets()
{
    Q_D(KoCreatePathTool);

    QList<QPointer<QWidget> > list;

    QWidget *angleWidget = new QWidget();
    angleWidget->setObjectName("Angle Constraints");
    QGridLayout *layout = new QGridLayout(angleWidget);
    layout->addWidget(new QLabel(i18n("Angle snapping delta:"), angleWidget), 0, 0);
    QSpinBox *angleEdit = new QSpinBox(angleWidget);
    angleEdit->setValue(d->angleSnappingDelta);
    angleEdit->setRange(1, 360);
    angleEdit->setSingleStep(1);
    angleEdit->setSuffix(QChar(Qt::Key_degree));
    layout->addWidget(angleEdit, 0, 1);
    layout->addWidget(new QLabel(i18n("Activate angle snap:"), angleWidget), 1, 0);
    QCheckBox *angleSnap = new QCheckBox(angleWidget);
    angleSnap->setChecked(false);
    angleSnap->setCheckable(true);
    layout->addWidget(angleSnap, 1, 1);
    QWidget *specialSpacer = new QWidget();
    specialSpacer->setObjectName("SpecialSpacer");
    layout->addWidget(specialSpacer, 2, 1);
    angleWidget->setWindowTitle(i18n("Angle Constraints"));
    list.append(angleWidget);

    d->strokeWidget = new KoStrokeConfigWidget(0);
    d->strokeWidget->setWindowTitle(i18n("Line"));
    d->strokeWidget->setCanvas(canvas());
    d->strokeWidget->setActive(false);
    list.append(d->strokeWidget);


    connect(angleEdit, SIGNAL(valueChanged(int)), this, SLOT(angleDeltaChanged(int)));
    connect(angleSnap, SIGNAL(stateChanged(int)), this, SLOT(angleSnapChanged(int)));

    return list;
}
Example #17
0
StimConfigTab::StimConfigTab (QWidget *parent)
  : QWidget(parent)
{
  QGridLayout *layout = new QGridLayout;
  layout->addWidget(new QLabel("Number of pulse trains"), 0, 0,
      Qt::AlignRight | Qt::AlignVCenter);

  QSpinBox *nTrainsSpinBox = new QSpinBox();
  nTrainsSpinBox->setAlignment(Qt::AlignRight);
  nTrainsSpinBox->setDecimals(1);
  nTrainsSpinBox->setRange(1,200);
  layout->addWidget(nTrainsSpinBox, 0, 1);

  QPushButton *continuousButton = new QPushButton("Contiuous");
  layout->addWidget(continuousButton,0,2);

  layout->addWidget(new QLabel("Inter-train Interval"), 1, 0,
      Qt::AlignRight | Qt::AlignVCenter);
  QSpinBox *trainIntervalSpinBox = new QSpinBox();
  trainIntervalSpinBox->setAlignment(Qt::AlignRight);
  trainIntervalSpinBox->setSuffix(" ms");
  trainIntervalSpinBox->setRange(500, 50000);
  layout->addWidget(trainIntervalSpinBox, 1, 1);

  QPushButton *stimSingleButton = new QPushButton("Trigger Single Pulse Sequence");
  layout->addWidget(stimSingleButton,2,0);

  QPushButton *startStimButton = new QPushButton("Start Pulse Sequence");
  layout->addWidget(stimSingleButton,2,1);

  QPushButton *abortStimButton = new QPushButton("Abort");
  layout->addWidget(abortSingleButton,2,2);

  setLayout(layout);

}
Example #18
0
QList<QWidget *> Object::getControls()
{
    QSpinBox *experience = new QSpinBox();
    experience->setObjectName("experience");
    experience->setMaximum(1000);
    experience->setValue(_experience);
    connect(experience,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_experience = new Control("Bonificación de experiencia",experience);

    QSpinBox *cooldown = new QSpinBox();
    cooldown->setSuffix(" seg");
    cooldown->setObjectName("cooldown");
    cooldown->setMaximum(1000);
    cooldown->setValue(_cooldown);

    connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_cooldown = new Control("Tiempo de reaparición",cooldown);

    QList<QWidget*> controls = IObject::getControls();
    controls.append(c_experience);
    controls.append(c_cooldown);

    return controls;
}
void ConfigScreen::CreateActiveMQConnectivityWidgets()
{
    QLineEdit* activemquri = new QLineEdit ( _activemqscreen );
    activemquri->setObjectName ( "kcfg_ActiveMQURI" );
    _lactivemqscreen->addRow ( "ActiveMQ URI:", activemquri );
    _confman->addWidget ( activemquri );
    QLineEdit* activemqusername = new QLineEdit ( _activemqscreen );
    activemqusername->setObjectName ( "kcfg_ActiveMQUsername" );
    _lactivemqscreen->addRow ( "ActiveMQ username:"******"kcfg_ActiveMQPassword" );
    _lactivemqscreen->addRow ( "ActiveMQ password:"******"kcfg_ActiveMQTopicName" );
    _lactivemqscreen->addRow ( "CSS Alarm Server topic name:", activemqtopicname );
    _confman->addWidget ( activemqtopicname );
    QSpinBox* laboratorynotificationtimeout = new QSpinBox ( _activemqscreen );
    laboratorynotificationtimeout->setMinimum ( 0 );
    laboratorynotificationtimeout->setMaximum ( 3600 );
    laboratorynotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    laboratorynotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    laboratorynotificationtimeout->setObjectName ( "kcfg_LaboratoryNotificationTimeout" );
    _lactivemqscreen->addRow ( "Laboratory notification timeout:", laboratorynotificationtimeout );
    _confman->addWidget ( laboratorynotificationtimeout );
    QSpinBox* desktopnotificationtimeout = new QSpinBox ( _activemqscreen );
    desktopnotificationtimeout->setMinimum ( 0 );
    desktopnotificationtimeout->setMaximum ( 3600 );
    desktopnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    desktopnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    desktopnotificationtimeout->setObjectName ( "kcfg_DesktopNotificationTimeout" );
    _lactivemqscreen->addRow ( "Desktop notification timeout:", desktopnotificationtimeout );
    _confman->addWidget ( desktopnotificationtimeout );
    QSpinBox* emailnotificationtimeout = new QSpinBox ( _activemqscreen );
    emailnotificationtimeout->setMinimum ( 0 );
    emailnotificationtimeout->setMaximum ( 3600 );
    emailnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    emailnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    emailnotificationtimeout->setObjectName ( "kcfg_EMailNotificationTimeout" );
    _lactivemqscreen->addRow ( "E-Mail notification timeout:", emailnotificationtimeout );
    _confman->addWidget ( emailnotificationtimeout );
    QLineEdit* emailnotificationfrom = new QLineEdit ( _activemqscreen );
    emailnotificationfrom->setObjectName ( "kcfg_EMailNotificationFrom" );
    _lactivemqscreen->addRow ( "E-Mail notification sender address:", emailnotificationfrom );
    _confman->addWidget ( emailnotificationfrom );
    QLineEdit* emailnotificationto = new QLineEdit ( _activemqscreen );
    emailnotificationto->setObjectName ( "kcfg_EMailNotificationTo" );
    _lactivemqscreen->addRow ( "E-Mail notification recipient address:", emailnotificationto );
    _confman->addWidget ( emailnotificationto );
    QLineEdit* emailnotificationservername = new QLineEdit ( _activemqscreen );
    emailnotificationservername->setObjectName ( "kcfg_EMailNotificationServerName" );
    _lactivemqscreen->addRow ( "SMTP server name:", emailnotificationservername );
    _confman->addWidget ( emailnotificationservername );
    QSpinBox* emailnotificationserverport = new QSpinBox ( _activemqscreen );
    emailnotificationserverport->setMinimum ( 0 ); // Minimum port number in TCP standard
    emailnotificationserverport->setMaximum ( 65535 ); // Maximum port number in TCP standard
    emailnotificationserverport->setObjectName ( "kcfg_EMailNotificationServerPort" );
    _lactivemqscreen->addRow ( "SMTP server port:", emailnotificationserverport );
    _confman->addWidget ( emailnotificationserverport );
    QLineEdit* flashlightrelaisdevicenode = new QLineEdit ( _activemqscreen );
    flashlightrelaisdevicenode->setObjectName ( QString::fromUtf8 ( "kcfg_FlashLightRelaisDeviceNode" ) );
    _lactivemqscreen->addRow ( QString::fromUtf8 ( "Device node of relais for red flash light:" ), flashlightrelaisdevicenode );
    _confman->addWidget ( flashlightrelaisdevicenode );
}
Example #20
0
void DkDisplayPreference::createLayout() {

	// zoom settings
	QCheckBox* invertZoom = new QCheckBox(tr("Invert mouse wheel behaviour for zooming"), this);
	invertZoom->setObjectName("invertZoom");
	invertZoom->setToolTip(tr("If checked, the mouse wheel behaviour is inverted while zooming."));
	invertZoom->setChecked(Settings::param().display().invertZoom);

	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);

	QSpinBox* sbInterpolation = new QSpinBox(this);
	sbInterpolation->setObjectName("interpolationBox");
	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
	sbInterpolation->setSuffix("%");
	sbInterpolation->setMinimum(0);
	sbInterpolation->setMaximum(10000);
	sbInterpolation->setValue(Settings::param().display().interpolateZoomLevel);

	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
	zoomGroup->addWidget(invertZoom);
	zoomGroup->addWidget(interpolationLabel);
	zoomGroup->addWidget(sbInterpolation);

	// keep zoom radio buttons
	QVector<QRadioButton*> keepZoomButtons;
	keepZoomButtons.resize(DkSettings::zoom_end);
	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);

	QCheckBox* cbZoomToFit = new QCheckBox(tr("Always zoom to fit"), this);
	cbZoomToFit->setObjectName("zoomToFit");
	cbZoomToFit->setChecked(Settings::param().display().zoomToFit);

	// check wrt the current settings
	keepZoomButtons[Settings::param().display().keepZoom]->setChecked(true);

	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
	keepZoomButtonGroup->setObjectName("keepZoom");
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);

	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
	keepZoomGroup->addWidget(cbZoomToFit);
	
	// icon size
	QSpinBox* sbIconSize = new QSpinBox(this);
	sbIconSize->setObjectName("iconSizeBox");
	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
	sbIconSize->setSuffix(" px");
	sbIconSize->setMinimum(16);
	sbIconSize->setMaximum(1024);
	sbIconSize->setValue(Settings::param().display().iconSize);

	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
	iconGroup->addWidget(sbIconSize);

	// slideshow
	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);

	QComboBox* cbTransition = new QComboBox(this);
	cbTransition->setObjectName("transition");
	cbTransition->setToolTip(tr("Choose a transition when loading a new image"));

	for (int idx = 0; idx < DkSettings::trans_end; idx++) {

		QString str = tr("Unknown Transition");

		switch (idx) {
		case DkSettings::trans_appear:	str = tr("Appear"); break;
		case DkSettings::trans_swipe:	str = tr("Swipe");	break;
		case DkSettings::trans_fade:	str = tr("Fade");	break;
		}

		cbTransition->addItem(str);
	}
	cbTransition->setCurrentIndex(Settings::param().display().transition);

	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
	fadeImageBox->setObjectName("fadeImageBox");
	fadeImageBox->setToolTip(tr("Define the image transition speed."));
	fadeImageBox->setSuffix(" sec");
	fadeImageBox->setMinimum(0.0);
	fadeImageBox->setMaximum(3);
	fadeImageBox->setSingleStep(.2);
	fadeImageBox->setValue(Settings::param().display().animationDuration);

	QCheckBox* cbAlwaysAnimate = new QCheckBox(tr("Always Animate Image Loading"), this);
	cbAlwaysAnimate->setObjectName("alwaysAnimate");
	cbAlwaysAnimate->setToolTip(tr("If unchecked, loading is only animated if nomacs is fullscreen"));
	cbAlwaysAnimate->setChecked(Settings::param().display().alwaysAnimate);

	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);
	
	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
	displayTimeBox->setObjectName("displayTimeBox");
	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
	displayTimeBox->setSuffix(" sec");
	displayTimeBox->setMinimum(0.0);
	displayTimeBox->setMaximum(30);
	displayTimeBox->setSingleStep(.2);
	displayTimeBox->setValue(Settings::param().slideShow().time);

	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
	slideshowGroup->addWidget(fadeImageLabel);
	slideshowGroup->addWidget(cbTransition);
	slideshowGroup->addWidget(fadeImageBox);
	slideshowGroup->addWidget(cbAlwaysAnimate);
	slideshowGroup->addWidget(displayTimeLabel);
	slideshowGroup->addWidget(displayTimeBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->setAlignment(Qt::AlignTop);
	leftLayout->addWidget(zoomGroup);
	leftLayout->addWidget(keepZoomGroup);
	leftLayout->addWidget(iconGroup);
	leftLayout->addWidget(slideshowGroup);

	// right column
	QWidget* rightWidget = new QWidget(this);
	QVBoxLayout* rightLayout = new QVBoxLayout(rightWidget);
	rightLayout->setAlignment(Qt::AlignTop);

	QHBoxLayout* layout = new QHBoxLayout(this);
	layout->setAlignment(Qt::AlignLeft);

	layout->addWidget(leftWidget);
	layout->addWidget(rightWidget);
}
Example #21
0
void DkFilePreference::createLayout() {

	// temp folder
	DkDirectoryChooser* dirChooser = new DkDirectoryChooser(Settings::param().global().tmpPath, this);
	dirChooser->setObjectName("dirChooser");

	QLabel* tLabel = new QLabel(tr("Screenshots are automatically saved to this folder"), this);
	
	DkGroupWidget* tempFolderGroup = new DkGroupWidget(tr("Use Temporary Folder"), this);
	tempFolderGroup->addWidget(dirChooser);
	tempFolderGroup->addWidget(tLabel);

	// cache size
	int maxCache = qMax(qRound(DkMemory::getTotalMemory()*0.1), 512);
	qDebug() << "max cache" << maxCache;
	QSpinBox* cacheBox = new QSpinBox(this);
	cacheBox->setObjectName("cacheBox");
	cacheBox->setMinimum(0);
	cacheBox->setMaximum(maxCache);
	cacheBox->setSuffix(" MB");
	cacheBox->setMaximumWidth(200);
	cacheBox->setValue(qRound(Settings::param().resources().cacheMemory));

	QLabel* cLabel = new QLabel(tr("We recommend to set a moderate cache value arround 100 MB"), this);
	
	DkGroupWidget* cacheGroup = new DkGroupWidget(tr("Maximal Cache Size"), this);
	cacheGroup->addWidget(cacheBox);
	cacheGroup->addWidget(cLabel);

	// history size
	// cache size
	QSpinBox* historyBox = new QSpinBox(this);
	historyBox->setObjectName("historyBox");
	historyBox->setMinimum(0);
	historyBox->setMaximum(1024);
	historyBox->setSuffix(" MB");
	historyBox->setMaximumWidth(200);
	historyBox->setValue(qRound(Settings::param().resources().historyMemory));

	QLabel* hLabel = new QLabel(tr("We recommend to set a moderate edit history value arround 100 MB"), this);

	DkGroupWidget* historyGroup = new DkGroupWidget(tr("History Size"), this);
	historyGroup->addWidget(historyBox);
	historyGroup->addWidget(hLabel);


	// loading policy
	QVector<QRadioButton*> loadButtons;
	loadButtons.append(new QRadioButton(tr("Skip Images"), this));
	loadButtons[0]->setToolTip(tr("Images are skipped until the Next key is released"));
	loadButtons.append(new QRadioButton(tr("Wait for Images to be Loaded"), this));
	loadButtons[1]->setToolTip(tr("The next image is loaded after the current image is shown."));

	// check wrt the current settings
	loadButtons[0]->setChecked(!Settings::param().resources().waitForLastImg);
	loadButtons[1]->setChecked(Settings::param().resources().waitForLastImg);

	QButtonGroup* loadButtonGroup = new QButtonGroup(this);
	loadButtonGroup->setObjectName("loadGroup");
	loadButtonGroup->addButton(loadButtons[0], 0);
	loadButtonGroup->addButton(loadButtons[1], 1);

	DkGroupWidget* loadGroup = new DkGroupWidget(tr("Image Loading Policy"), this);
	loadGroup->addWidget(loadButtons[0]);
	loadGroup->addWidget(loadButtons[1]);

	// skip images
	QSpinBox* skipBox = new QSpinBox(this);
	skipBox->setObjectName("skipBox");
	skipBox->setMinimum(2);
	skipBox->setMaximum(1000);
	skipBox->setValue(Settings::param().global().skipImgs);
	skipBox->setMaximumWidth(200);

	DkGroupWidget* skipGroup = new DkGroupWidget(tr("Number of Skipped Images on PgUp/PgDown"), this);
	skipGroup->addWidget(skipBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->addWidget(tempFolderGroup);
	leftLayout->addWidget(cacheGroup);
	leftLayout->addWidget(historyGroup);
	leftLayout->addWidget(loadGroup);
	leftLayout->addWidget(skipGroup);

	QHBoxLayout* layout = new QHBoxLayout(this);
	layout->setAlignment(Qt::AlignLeft);
	layout->addWidget(leftWidget);
}
Example #22
0
void ClassResultOp::operator()(const imagein::Image* img, const std::map<const imagein::Image*, std::string>&) {

    QDialog* dialog = new QDialog(QApplication::activeWindow());
    QVBoxLayout* layout = new QVBoxLayout(dialog);
    QFormLayout* formLayout = new QFormLayout();
    QSpinBox* innerBox = new QSpinBox();
    QSpinBox* borderBox = new QSpinBox();
    innerBox->setRange(0, img->getWidth());
    borderBox->setRange(0, img->getWidth());
    innerBox->setSuffix(" px");
    borderBox->setSuffix(" px");
    innerBox->setValue(8);
    borderBox->setValue(2);
    formLayout->insertRow(0, qApp->translate("ClassResult", "Critère de zone intérieure : "), innerBox);
    formLayout->insertRow(1, qApp->translate("ClassResult", "Critère de zone frontière : "), borderBox);
    layout->addWidget(new QLabel(qApp->translate("ClassResult", "<b>Critère de zones (relatifs aux zones totales) : </b>")));
    layout->addLayout(formLayout);
    layout->addWidget(new QLabel(qApp->translate("ClassResult", "<b>Select the image's classes zones : </b>")));
    ImageZoneSelector* zoneSelector = new ImageZoneSelector(dialog, img);
    layout->addWidget(zoneSelector);
    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
    layout->addWidget(buttonBox);
    QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
    QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
    QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());

    if(code!=QDialog::Accepted) return;

    string returnval;

    int param1 = 2;
    int param2 = 8;
    vector<Rectangle> selection = zoneSelector->getSelections();
    int K = selection.size();
    int* classes = new int[K];
    outText(qApp->translate("ClassResult", "Voici les résultats du classement : \n").toStdString());
    outText(qApp->translate("ClassResult", "\nNombre de classes = %1 ").arg(K).toStdString());
    for(int i = 0; i < K; ++i) {
        Histogram histo = img->getHistogram(0, selection.at(i));
        classes[i] = (uint8_t) (std::max_element(histo.begin(), histo.end()) - histo.begin());
        outText(qApp->translate("ClassResult", "Valeur de la classe %1 = %2").arg(i+1).arg(classes[i]).toStdString());
    }


    //Zone frontire
    double *tauxF = new double[K];
    double *tauxI = new double[K];
    for(int i = 0; i < K; ++i){
        tauxF[i] = 0.;
        tauxI[i] = 0.;
    }

    for(int n = 0; n < K; ++n) {
        Rectangle zone = selection.at(n);
        for(unsigned int j = zone.top(); j < zone.bottom(); ++j) {
            for(unsigned int i = zone.left(); i < zone.right(); ++i) {
                if(img->getPixelAt(i, j) == classes[n]) {
                    if( i >= zone.left() + param2 && i < zone.right() - param2 && j >= zone.top() + param2 && j < zone.bottom() - param2 ) {
                        tauxI[n]++;
                    }
                    if( i < zone.left() + param1 || i >= zone.right() - param1 || j < zone.top() + param1 || j >= zone.bottom() - param1 ) {
                        tauxF[n]++;
                    }
                }
            }
        }
    }

    for(int n = 0; n < K; ++n) {
        Rectangle zone = selection.at(n);
        const double areaI = (zone.h - 2*param2) * (zone.w - 2*param2);
        const double areaF = (zone.h * zone.w) - (zone.h - 2*param1) * (zone.w - 2*param1);
        tauxI[n] = tauxI[n] * 100. / areaI;
        tauxF[n] = tauxF[n] * 100. / areaF;
    }
    for(int n = 0; n < K; ++n) {
        outText(qApp->translate("ClassResult", "Le taux de bon classement en zone intérieure %1 vaut: %2\%").arg(n+1).arg(tauxI[n], 0, 'f', 2).toStdString());
    }
    for(int n = 0; n < K; ++n) {
        outText(qApp->translate("ClassResult", "Le taux de bon classement en zone frontière %1 vaut: %2\%").arg(n+1).arg(tauxF[n], 0, 'f', 2).toStdString());
    }

    double tauxGI = 0., tauxGF = 0.;
    for(int i = 0; i < K; ++i){
        tauxGI += tauxI[i];
        tauxGF += tauxF[i];
    }
    tauxGI /= K;
    tauxGF /= K;

    outText(qApp->translate("ClassResult", "Le taux de bon classement en zone intérieure globale vaut: %1\%").arg(tauxGI, 0, 'f', 2).toStdString());
    outText(qApp->translate("ClassResult", "Le taux de bon classement en zone frontière globale vaut: %1\%").arg(tauxGF, 0, 'f', 2).toStdString());

    outText(returnval);
}
Example #23
0
TrayMenu::TrayMenu(QObject *parent)
	: QObject(parent)
{
	
	tray = new QSystemTrayIcon(QIcon(":/img/update.png"),this);
	tray->show();
	//Create menu
	menu = new QMenu(tr("rTorrent client"),0);
	
	//create separator
	

	//add rate control
	QWidget * rate_control = new QWidget(menu);
	QVBoxLayout * vlayout = new QVBoxLayout(rate_control);
	
	// UP SECTION
	QHBoxLayout * hlayout = new QHBoxLayout();
	QSpinBox * spinUp = new QSpinBox(rate_control);
	InfoLabel * lbl_up = new InfoLabel(rate_control);
	QLabel * lbl = new QLabel(rate_control);
	lbl->setPixmap(QPixmap(":/img/up.png"));
	hlayout->addWidget(lbl);
	hlayout->addWidget(lbl_up);
	#if QT_VERSION >= 0x040403
	hlayout->addSpacerItem(new QSpacerItem(40, 20, QSizePolicy::Expanding));
	#endif
	hlayout->addWidget(spinUp);
	

	lbl_up->setText(tr("%1 kb/s"));
	spinUp->setMaximum (10*1024);
	spinUp->setSuffix (tr("kb/s"));
	//spinUp->setPrefix (tr("Up "));
	
	vlayout->addLayout(hlayout);

	//DOWN SECTION
	hlayout = new QHBoxLayout();
	QSpinBox * spinDown = new QSpinBox(rate_control);
	InfoLabel * lbl_down = new InfoLabel(rate_control);
	lbl = new QLabel(rate_control);
	lbl->setPixmap(QPixmap(":/img/down.png"));
	hlayout->addWidget(lbl);
	hlayout->addWidget(lbl_down);
	#if QT_VERSION >= 0x040403
	hlayout->addSpacerItem(new QSpacerItem(40, 20, QSizePolicy::Expanding));
	#endif
	hlayout->addWidget(spinDown);
	

	lbl_down->setText(tr("%1 kb/s"));
	spinDown->setMaximum (10*1024);
	spinDown->setSuffix (tr("kb/s"));
	//spinDown->setPrefix (tr("Down "));
	
	vlayout->addLayout(hlayout);

	//insert control
	QWidgetAction * waction = new QWidgetAction(menu);
	waction->setDefaultWidget(rate_control);
	menu->addAction(waction);

	menu->addSeparator();
	no_torrent = menu->addAction(tr("No torrents"));
	no_torrent->setDisabled(true);
	sep = menu->addSeparator();

	//set new limit rate value
	connect(spinUp,SIGNAL(valueChanged(int)),
		this,SIGNAL(setUploadRate(int)));
	connect(spinDown,SIGNAL(valueChanged(int)),
		this,SIGNAL(setDownloadRate(int)));

	//update limit rate value
	connect(this,SIGNAL(getUploadRate(int)),
		spinUp,SLOT(setValue(int)));
	connect(this,SIGNAL(getDownloadRate(int)),
		spinDown,SLOT(setValue(int)));

	//update rate value
	connect(this,SIGNAL(getUpRate(double)),
		lbl_up,SLOT(setParam(double)));
	connect(this,SIGNAL(getDownRate(double)),
		lbl_down,SLOT(setParam(double)));

	//create settings item
	QAction * settings = menu->addAction(QIcon(":/img/gear.png"),tr("Settings"));
	connect(settings,SIGNAL(triggered(bool)),
		this, SLOT(openSettings(bool)));

	//create status item
	status = new QAction(QIcon(":/img/state2.png"),tr("Disconnected"),menu);
	menu->addAction(status);
	tray->setContextMenu(menu);

	//create exit item
	QAction * exit = menu->addAction(QIcon(":/img/exit.png"),tr("Exit"));


	//connect menu show
	connect(menu,SIGNAL(aboutToShow()),
		this,SIGNAL(menuShow()));
	connect(menu,SIGNAL(aboutToHide()),
		this,SIGNAL(menuHide()));

	//connect exit
	connect(exit,SIGNAL(triggered(bool)),
		this,SIGNAL(exitClicked(bool)));
}
Example #24
0
    void setupUi(QWidget *q)
    {
        groupBoxGeneral = new QGroupBox(q);
        groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));

        labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
        labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:"));
        labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr(
            "This is the number of seconds Qt Creator will wait before\n"
            "it terminates a non-responsive GDB process. The default value of 20 seconds\n"
            "should be sufficient for most applications, but there are situations when\n"
            "loading big libraries or listing source files takes much longer than that\n"
            "on slow machines. In this case, the value should be increased."));

        spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral);
        spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip());
        spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec"));
        spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight);
        spinBoxGdbWatchdogTimeout->setMinimum(20);
        spinBoxGdbWatchdogTimeout->setMaximum(1000000);
        spinBoxGdbWatchdogTimeout->setSingleStep(20);
        spinBoxGdbWatchdogTimeout->setValue(20);

        checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
        checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
        checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
            "Allows 'Step Into' to compress several steps into one step\n"
            "for less noisy debugging. For example, the atomic reference\n"
            "counting code is skipped, and a single 'Step Into' for a signal\n"
            "emission ends up directly in the slot connected to it."));

        checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
        checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
            "Show a message box when receiving a signal"));
        checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
            "This will show a message box as soon as your application\n"
            "receives a signal like SIGSEGV during debugging."));

        checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
        checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
            "Adjust breakpoint locations"));
        checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
            "GDB allows setting breakpoints on source lines for which no code \n"
            "was generated. In such situations the breakpoint is shifted to the\n"
            "next source code line for which code was actually generated.\n"
            "This option reflects such temporary change by moving the breakpoint\n"
            "markers in the source code editor."));

        checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
        checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
            "Use dynamic object type for display"));
        checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
            "This specifies whether the dynamic or the static type of objects will be"
            "displayed. Choosing the dynamic type might be slower."));

        checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral);
        checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup"));
        checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr(
            "This allows or inhibits reading the user's default\n"
            ".gdbinit file on debugger startup."));

        checkBoxWarnOnReleaseBuilds = new QCheckBox(groupBoxGeneral);
        checkBoxWarnOnReleaseBuilds->setText(GdbOptionsPage::tr(
            "Warn when debugging \"Release\" builds"));
        checkBoxWarnOnReleaseBuilds->setToolTip(GdbOptionsPage::tr(
            "Show a warning when starting the debugger "
            "on a binary with insufficient debug information."));

        labelDangerous = new QLabel(GdbOptionsPage::tr(
            "The options below should be used with care."));

        checkBoxTargetAsync = new QCheckBox(groupBoxGeneral);
        checkBoxTargetAsync->setText(GdbOptionsPage::tr(
            "Use asynchronous mode to control the inferior"));

        checkBoxAutoEnrichParameters = new QCheckBox(groupBoxGeneral);
        checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr(
            "Use common locations for debug information"));
        checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr(
            "This adds common paths to locations of debug information\n"
            "at debugger startup."));

        checkBoxBreakOnWarning = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnWarning->setText(GdbOptionsPage::tr("Stop when a qWarning is issued"));

        checkBoxBreakOnFatal = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnFatal->setText(GdbOptionsPage::tr("Stop when a qFatal is issued"));

        checkBoxBreakOnAbort = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnAbort->setText(GdbOptionsPage::tr("Stop when abort() is called"));

        checkBoxEnableReverseDebugging = new QCheckBox(groupBoxGeneral);
        checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
        checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
            "<html><head/><body><p>Selecting this enables reverse debugging.</p><.p>"
            "<b>Note:</b> This feature is very slow and unstable on the GDB side."
            "It exhibits unpredictable behavior when going backwards over system "
            "calls and is very likely to destroy your debugging session.</p><body></html>"));

        checkBoxAttemptQuickStart = new QCheckBox(groupBoxGeneral);
        checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
        checkBoxAttemptQuickStart->setToolTip(GdbOptionsPage::tr("Checking this option "
            "will postpone reading debug information as long as possible. This can result "
            "in faster startup times at the price of not being able to set breakpoints "
            "by file and number."));

        groupBoxStartupCommands = new QGroupBox(q);
        groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));

        textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
        textEditStartupCommands->setAcceptRichText(false);

        /*
        groupBoxPluginDebugging = new QGroupBox(q);
        groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
            "Behavior of Breakpoint Setting in Plugins"));

        radioButtonAllPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
        radioButtonAllPluginBreakpoints->setText(GdbOptionsPage::tr(
            "Always try to set breakpoints in plugins automatically"));
        radioButtonAllPluginBreakpoints->setToolTip(GdbOptionsPage::tr(
            "This is the slowest but safest option."));

        radioButtonSelectedPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
        radioButtonSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
            "Try to set breakpoints in selected plugins"));

        radioButtonNoPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
        radioButtonNoPluginBreakpoints->setText(GdbOptionsPage::tr(
            "Never set breakpoints in plugins automatically"));

        lineEditSelectedPluginBreakpointsPattern = new QLineEdit(groupBoxPluginDebugging);

        labelSelectedPluginBreakpoints = new QLabel(groupBoxPluginDebugging);
        labelSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
            "Matching regular expression: "));
        */

        QFormLayout *formLayout = new QFormLayout(groupBoxGeneral);
        formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
        formLayout->addRow(checkBoxSkipKnownFrames);
        formLayout->addRow(checkBoxUseMessageBoxForSignals);
        formLayout->addRow(checkBoxAdjustBreakpointLocations);
        formLayout->addRow(checkBoxUseDynamicType);
        formLayout->addRow(checkBoxLoadGdbInit);
        formLayout->addRow(checkBoxWarnOnReleaseBuilds);
        formLayout->addRow(new QLabel(QString()));
        formLayout->addRow(labelDangerous);
        formLayout->addRow(checkBoxTargetAsync);
        formLayout->addRow(checkBoxAutoEnrichParameters);
        formLayout->addRow(checkBoxBreakOnWarning);
        formLayout->addRow(checkBoxBreakOnFatal);
        formLayout->addRow(checkBoxBreakOnAbort);
        formLayout->addRow(checkBoxEnableReverseDebugging);
        formLayout->addRow(checkBoxAttemptQuickStart);

        QGridLayout *startLayout = new QGridLayout(groupBoxStartupCommands);
        startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);

        //QHBoxLayout *horizontalLayout = new QHBoxLayout();
        //horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
        //horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
        //horizontalLayout->addWidget(lineEditSelectedPluginBreakpointsPattern);

        QGridLayout *gridLayout = new QGridLayout(q);
        gridLayout->addWidget(groupBoxGeneral, 0, 0);
        gridLayout->addWidget(groupBoxStartupCommands, 0, 1);

        //gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
        //gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
        //gridLayout->addWidget(radioButtonSelectedPluginBreakpoints, 1, 0, 1, 1);

        //gridLayout->addLayout(horizontalLayout, 2, 0, 1, 1);
        //gridLayout->addWidget(radioButtonNoPluginBreakpoints, 3, 0, 1, 1);
        //gridLayout->addWidget(groupBoxPluginDebugging, 1, 0, 1, 2);
    }
QWidget *HardwareItem::createEditor(QWidget *pParent, const QStyleOptionViewItem & /* styleOption */, const QModelIndex &idx) const
{
    QWidget *editor = NULL;
    if (idx.column() == ConfigValueSection)
    {
        switch (m_type)
        {
            case KVirtualSystemDescriptionType_OS:
            {
                VBoxOSTypeSelectorButton *e = new VBoxOSTypeSelectorButton(pParent);
                /* Fill the background with the highlight color in the case
                 * the button hasn't a rectangle shape. This prevents the
                 * display of parts from the current text on the Mac. */
#ifdef QT_MAC_USE_COCOA
                /* Use the palette from the tree view, not the one from the
                 * editor. */
                QPalette p = e->palette();
                p.setBrush(QPalette::Highlight, pParent->palette().brush(QPalette::Highlight));
                e->setPalette(p);
#endif /* QT_MAC_USE_COCOA */
                e->setAutoFillBackground(true);
                e->setBackgroundRole(QPalette::Highlight);
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_Name:
            case KVirtualSystemDescriptionType_Product:
            case KVirtualSystemDescriptionType_ProductUrl:
            case KVirtualSystemDescriptionType_Vendor:
            case KVirtualSystemDescriptionType_VendorUrl:
            case KVirtualSystemDescriptionType_Version:
            {
                QLineEdit *e = new QLineEdit(pParent);
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_Description:
            case KVirtualSystemDescriptionType_License:
            {
                UILineTextEdit *e = new UILineTextEdit(pParent);
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_CPU:
            {
                QSpinBox *e = new QSpinBox(pParent);
                e->setRange(UIApplianceEditorWidget::minGuestCPUCount(), UIApplianceEditorWidget::maxGuestCPUCount());
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_Memory:
            {
                QSpinBox *e = new QSpinBox(pParent);
                e->setRange(UIApplianceEditorWidget::minGuestRAM(), UIApplianceEditorWidget::maxGuestRAM());
                e->setSuffix(" " + VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"));
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_SoundCard:
            {
                QComboBox *e = new QComboBox(pParent);
                e->addItem(gpConverter->toString(KAudioControllerType_AC97), KAudioControllerType_AC97);
                e->addItem(gpConverter->toString(KAudioControllerType_SB16), KAudioControllerType_SB16);
                e->addItem(gpConverter->toString(KAudioControllerType_HDA),  KAudioControllerType_HDA);
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_NetworkAdapter:
            {
                QComboBox *e = new QComboBox(pParent);
                e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
                e->addItem(gpConverter->toString(KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
#ifdef VBOX_WITH_E1000
                e->addItem(gpConverter->toString(KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
                e->addItem(gpConverter->toString(KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
                e->addItem(gpConverter->toString(KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
#endif /* VBOX_WITH_E1000 */
#ifdef VBOX_WITH_VIRTIO
                e->addItem(gpConverter->toString(KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
#endif /* VBOX_WITH_VIRTIO */
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
            {
                QComboBox *e = new QComboBox(pParent);
                e->addItem(gpConverter->toString(KStorageControllerType_PIIX3), "PIIX3");
                e->addItem(gpConverter->toString(KStorageControllerType_PIIX4), "PIIX4");
                e->addItem(gpConverter->toString(KStorageControllerType_ICH6),  "ICH6");
                editor = e;
                break;
            }
            case KVirtualSystemDescriptionType_HardDiskImage:
            {
                /* disabled for now
                   VBoxFilePathSelectorWidget *e = new VBoxFilePathSelectorWidget(pParent);
                   e->setMode(VBoxFilePathSelectorWidget::Mode_File);
                   e->setResetEnabled(false);
                   */
                QLineEdit *e = new QLineEdit(pParent);
                editor = e;
                break;
            }
            default: break;
        }
    }
    return editor;
}
Example #26
0
QWidget *Data3DTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
    // Only create the editors here. Do not set any data from the model yet. This is done in setEditorData().
    //Connect to Data3DTreeDelegate::onEditorEdited if you want to have immediate feedback (default by QItemDelegate is on EditorFinished).
    const Data3DTreeModel* pData3DTreeModel = static_cast<const Data3DTreeModel*>(index.model());
    const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pData3DTreeModel->itemFromIndex(index));

    switch(pAbstractItem->type()) {
        case MetaTreeItemTypes::SurfaceColorGyri: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Gyri Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::SurfaceColorSulci: {
            QColorDialog *pColorDialog = new QColorDialog();
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Sulci Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::ColormapType: {
            QComboBox* pComboBox = new QComboBox(parent);
            connect(pComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pComboBox->addItem("Hot Negative 1");
            pComboBox->addItem("Hot Negative 2");
            pComboBox->addItem("Hot");
            pComboBox->addItem("Jet");
            return pComboBox;
        }

        case MetaTreeItemTypes::DataThreshold: {
            Spline* pSpline = new Spline("Set Threshold", 0);
            connect(pSpline, static_cast<void (Spline::*)(double, double, double)>(&Spline::borderChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);

            return pSpline;
        }

        case MetaTreeItemTypes::StreamingTimeInterval: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pSpinBox->setSuffix(" mSec");
            pSpinBox->setMinimum(1);
            pSpinBox->setMaximum(50000);
            pSpinBox->setSingleStep(1);
            return pSpinBox;
        }

        case MetaTreeItemTypes::VisualizationType: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Interpolation based");
            pComboBox->addItem("Annotation based");
            return pComboBox;
        }

        case MetaTreeItemTypes::Color: {
            QColorDialog *pColorDialog = new QColorDialog();
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::NumberAverages: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pSpinBox->setMinimum(1);
            pSpinBox->setMaximum(100);
            pSpinBox->setSingleStep(1);
            return pSpinBox;
        }

        case MetaTreeItemTypes::AlphaValue: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(0.01);
            pDoubleSpinBox->setMaximum(1.0);
            pDoubleSpinBox->setSingleStep(0.01);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTessInner: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)()>(&QDoubleSpinBox::editingFinished),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(1.0);
            pDoubleSpinBox->setMaximum(100.0);
            pDoubleSpinBox->setSingleStep(1.0);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTessOuter: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)()>(&QDoubleSpinBox::editingFinished),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(1.0);
            pDoubleSpinBox->setMaximum(100.0);
            pDoubleSpinBox->setSingleStep(1.0);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTriangleScale: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)()>(&QDoubleSpinBox::editingFinished),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(0.01);
            pDoubleSpinBox->setMaximum(100.0);
            pDoubleSpinBox->setSingleStep(0.01);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::TranslateX: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.001);
            pDoubleSpinBox->setDecimals(5);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::TranslateY: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.001);
            pDoubleSpinBox->setDecimals(5);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::TranslateZ: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.001);
            pDoubleSpinBox->setDecimals(5);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::Scale: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setDecimals(3);
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::NetworkMatrix: {
            QStandardItem* pParentItem = static_cast<QStandardItem*>(pAbstractItem->QStandardItem::parent());
            QModelIndex indexParent = pData3DTreeModel->indexFromItem(pParentItem);
            MatrixXd matRTData = index.model()->data(indexParent, Data3DTreeModelItemRoles::Data).value<MatrixXd>();

            ImageSc* pPlotLA = new ImageSc(matRTData);
            pPlotLA->show();
            //return pPlotLA;
        }

        case MetaTreeItemTypes::MaterialType: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Phong Alpha Tesselation");
            pComboBox->addItem("Phong Alpha");
            pComboBox->addItem("Show normals");
            pComboBox->addItem("GPU Interpolation");
            return pComboBox;
        }
        
        case MetaTreeItemTypes::CancelDistance: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            pDoubleSpinBox->setMinimum(0.001);
            pDoubleSpinBox->setMaximum(1.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setSuffix("m");
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::InterpolationFunction: {
            QComboBox* pComboBox = new QComboBox(parent);
            connect(pComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pComboBox->addItem("Linear");
            pComboBox->addItem("Square");
            pComboBox->addItem("Cubic");
            pComboBox->addItem("Gaussian");
            return pComboBox;
        }

        default: {
                break;
        }
    }

    return QItemDelegate::createEditor(parent, option, index);
}
Example #27
0
QWidget *HopDelegate::createEditor(QWidget *parent,
                                     const QStyleOptionViewItem &/*option*/,
                                     const QModelIndex &index) const
{
    QComboBox *combo;
    QSpinBox *spin;
    QDoubleSpinBox *dspin;
    QString suffix;
    // can only edit name on blank row
    bool blank = index.row() >= index.model()->rowCount();


    // different kind of editor for each column
    switch (index.column()) {
      case HopModel::NAME:
          combo = new QComboBox(parent);
          combo->setEditable(true);
          combo->addItem(QString());
          combo->addItems(Data::instance()->hopsList());
          combo->installEventFilter(const_cast<HopDelegate*>(this));
          return combo;

      case HopModel::WEIGHT:
          if (blank) return 0;
          dspin = new QDoubleSpinBox(parent);
          dspin->setDecimals(3);
          dspin->setRange(0.00, 1000.00);
          dspin->setSingleStep(0.25);
          suffix = " " + Data::instance()->defaultHopUnit().symbol();
          dspin->setSuffix(suffix);
          dspin->setAccelerated(true);
          dspin->installEventFilter(const_cast<HopDelegate*>(this));
          return dspin;

      case HopModel::ALPHA:
          if (blank) return 0;
          dspin = new QDoubleSpinBox(parent);
          dspin->setDecimals(1);
          dspin->setRange(0.0, 50.0);
          dspin->setSingleStep(0.1);
          dspin->setSuffix("%");
          dspin->setAccelerated(true);
          dspin->installEventFilter(const_cast<HopDelegate*>(this));
          return dspin;

      case HopModel::TIME:
          if (blank) return 0;
          spin = new QSpinBox(parent);
          spin->setRange(0, 120);
          spin->setSingleStep(5);
          spin->setSuffix(tr(" min", "minutes"));
          spin->setAccelerated(true);
          spin->installEventFilter(const_cast<HopDelegate*>(this));
          return spin;

      case HopModel::TYPE:
          if (blank) return 0;
          combo = new QComboBox(parent);
          combo->setEditable(true);
          combo->addItems(Hop::typeStringList());
          combo->installEventFilter(const_cast<HopDelegate*>(this));
          return combo;

      default:
          return 0;
    }
}
Example #28
0
void Window::createBottomBar() {
    bottomBar = new QToolBar();
    bottomBar->setOrientation(Qt::Horizontal);
    bottomBar->setFloatable(false);
    bottomBar->setMovable(false);

    //QLabel* linhaColorLabel = new QLabel("Linha");
    //bottomBar->addWidget(linhaColorLabel);
    linhaColorButton = new QToolButton();
    linhaColorButton->setToolTip("Cor de linha");
    linhaColorButton->setAutoRaise(true);
    updateLinhaButton();
    bottomBar->addWidget(linhaColorButton);
    QObject::connect(linhaColorButton, SIGNAL(clicked()), this, SLOT(setLinhaColor()));

    //QLabel* fillColorLabel = new QLabel("Fill");
    //bottomBar->addWidget(fillColorLabel);
    fillColorButton = new QToolButton();
    updateFillButton();
    fillColorButton->setAutoRaise(true);
    fillColorButton->setToolTip("Cor de preenchimento");
    fillColorButton->setAutoRaise(true);
    bottomBar->addWidget(fillColorButton);
    QObject::connect(fillColorButton, SIGNAL(clicked()), this, SLOT(setFillColor()));

    bottomBar->addSeparator();

    QLabel* espessuraLinhaLabel = new QLabel("Espessura");
    QSpinBox* espessuraLinhaSpinBox = new QSpinBox();
    espessuraLinhaSpinBox->setSuffix(" px");
    espessuraLinhaSpinBox->setMinimum(1);
    espessuraLinhaSpinBox->setMaximum(50);
    espessuraLinhaSpinBox->setSingleStep(1);
    espessuraLinhaSpinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
    bottomBar->addWidget(espessuraLinhaLabel);
    bottomBar->addWidget(espessuraLinhaSpinBox);
    QObject::connect(espessuraLinhaSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setEspessuraLinha(int)));

    bottomBar->addSeparator();

    QLabel* estiloLinhaLabel = new QLabel("Estilo");
    estiloLinhaField = new QLineEdit();
    estiloLinhaField->setMaximumWidth(150);
    estiloLinhaField->setText("-");
    QRegExp expr("[-][-,.]+");
    QRegExpValidator *v = new QRegExpValidator(expr, 0);
    estiloLinhaField->setValidator(v);
    bottomBar->addWidget(estiloLinhaLabel);
    bottomBar->addWidget(estiloLinhaField);
    QObject::connect(estiloLinhaField, SIGNAL(textChanged(QString)), this, SLOT(setEstiloLinha(QString)));


    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    bottomBar->addWidget(spacer);

    toggleGradeButton = new QToolButton();
    toggleGradeButton->setIcon(QIcon(":/images/grade.png"));
    toggleGradeButton->setCheckable(true);
    toggleGradeButton->setToolTip("Mostrar/ocultar grade");
    bottomBar->addWidget(toggleGradeButton);
    QObject::connect(toggleGradeButton, SIGNAL(clicked()), this, SLOT(toggleGrade()));

    QSpinBox* zoomSpinBox = new QSpinBox();
    zoomSpinBox->setSuffix("%");
    zoomSpinBox->setMinimum(25);
    zoomSpinBox->setMaximum(1000);
    zoomSpinBox->setValue(100);
    zoomSpinBox->setSingleStep(5);
    bottomBar->addWidget(zoomSpinBox);

}
Example #29
0
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
  ModelPanel(parent, model, generalSettings, firmware)
{
  QGridLayout * gridLayout = new QGridLayout(this);
  bool minimize = false;

  int col = 1;
  if (firmware->getCapability(ChannelsName)) {
    minimize=true;
    addLabel(gridLayout, tr("Name"), col++);
  }
  addLabel(gridLayout, tr("Subtrim"), col++, minimize);
  addLabel(gridLayout, tr("Min"), col++, minimize);
  addLabel(gridLayout, tr("Max"), col++, minimize);
  addLabel(gridLayout, tr("Direction"), col++, minimize);
  if (IS_TARANIS(GetEepromInterface()->getBoard()))
    addLabel(gridLayout, tr("Curve"), col++, minimize);
  if (firmware->getCapability(PPMCenter))
    addLabel(gridLayout, tr("PPM Center"), col++, minimize);
  if (firmware->getCapability(SYMLimits))
    addLabel(gridLayout, tr("Linear Subtrim"), col++, true);

  for (int i=0; i<firmware->getCapability(Outputs); i++) {
    col = 0;

    // Channel label
    QLabel *label = new QLabel(this);
    label->setText(tr("Channel %1").arg(i+1));
    label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
    gridLayout->addWidget(label, i+1, col++, 1, 1);

    // Channel name
    int nameLen = firmware->getCapability(ChannelsName);
    if (nameLen > 0) {
      QLineEdit * name = new QLineEdit(this);
      name->setProperty("index", i);
      name->setMaxLength(nameLen);
      QRegExp rx(CHAR_FOR_NAMES_REGEX);
      name->setValidator(new QRegExpValidator(rx, this));
      name->setText(model.limitData[i].name);
      connect(name, SIGNAL(editingFinished()), this, SLOT(nameEdited()));
      gridLayout->addWidget(name, i+1, col++, 1, 1);
    }

    // Channel offset
    limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0);

    // Channel min
    limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);

    // Channel max
    limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);

    // Channel inversion
    QComboBox * invCB = new QComboBox(this);
    invCB->insertItems(0, QStringList() << tr("---") << tr("INV"));
    invCB->setProperty("index", i);
    invCB->setCurrentIndex((model.limitData[i].revert) ? 1 : 0);
    connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
    gridLayout->addWidget(invCB, i+1, col++, 1, 1);

    // Curve
    if (IS_TARANIS(GetEepromInterface()->getBoard())) {
      QComboBox * curveCB = new QComboBox(this);
      curveCB->setProperty("index", i);
      int numcurves = firmware->getCapability(NumCurves);
      for (int j=-numcurves; j<=numcurves; j++) {
        curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
      }
      curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
      connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
      gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
    }

    // PPM center
    if (firmware->getCapability(PPMCenter)) {
      QSpinBox * center = new QSpinBox(this);
      center->setProperty("index", i);
      center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
      center->setSuffix("us");
      center->setMinimum(1375);
      center->setMaximum(1625);
      center->setValue(1500);
      center->setValue(model.limitData[i].ppmCenter + 1500);
      connect(center, SIGNAL(editingFinished()), this, SLOT(ppmcenterEdited()));
      gridLayout->addWidget(center, i+1, col++, 1, 1);
    }

    // Symetrical limits
    if (firmware->getCapability(SYMLimits)) {
      QCheckBox * symlimits = new QCheckBox(this);
      symlimits->setProperty("index", i);
      symlimits->setChecked(model.limitData[i].symetrical);
      connect(symlimits, SIGNAL(toggled(bool)), this, SLOT(symlimitsEdited()));
      gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
    }
  }
Example #30
0
QWidget *Data3DTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
    const Data3DTreeModel* pData3DTreeModel = static_cast<const Data3DTreeModel*>(index.model());
    const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pData3DTreeModel->itemFromIndex(index));

    switch(pAbstractItem->type()) {
        case MetaTreeItemTypes::SurfaceColorGyri: {
            QColorDialog *pColorDialog = new QColorDialog(parent);
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Gyri Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::SurfaceColorSulci: {
            QColorDialog *pColorDialog = new QColorDialog();
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Sulci Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::RTDataColormapType: {
            QComboBox* pComboBox = new QComboBox(parent);
            connect(pComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pComboBox->addItem("Hot Negative 1");
            pComboBox->addItem("Hot Negative 2");
            pComboBox->addItem("Hot");
            return pComboBox;
        }

        case MetaTreeItemTypes::RTDataNormalizationValue: {
            Spline* pSpline = new Spline("Spline Histogram", 0);
            connect(pSpline, static_cast<void (Spline::*)(double, double, double)>(&Spline::borderChanged),
            this, &Data3DTreeDelegate::onEditorEdited);
            QStandardItem* pParentItem = static_cast<QStandardItem*>(pAbstractItem->QStandardItem::parent());
            QModelIndex indexParent = pData3DTreeModel->indexFromItem(pParentItem);
            MatrixXd matRTData = index.model()->data(indexParent, Data3DTreeModelItemRoles::RTData).value<MatrixXd>();
            Eigen::VectorXd resultClassLimit;
            Eigen::VectorXi resultFrequency;
            MNEMath::histcounts(matRTData, false, 50, resultClassLimit, resultFrequency, 0.0, 0.0);
            pSpline->setData(resultClassLimit, resultFrequency, 0);
            QVector3D vecThresholdValues = index.model()->data(index, MetaTreeItemRoles::RTDataNormalizationValue).value<QVector3D>();
            pSpline->setThreshold(vecThresholdValues);
            AbstractTreeItem* pParentItemAbstract = static_cast<AbstractTreeItem*>(pParentItem);
            QList<QStandardItem*> pColormapItem = pParentItemAbstract->findChildren(MetaTreeItemTypes::RTDataColormapType);
            for(int i = 0; i < pColormapItem.size(); ++i)
            {
                QModelIndex indexColormapItem = pData3DTreeModel->indexFromItem(pColormapItem.at(i));
                QString colorMap = index.model()->data(indexColormapItem, MetaTreeItemRoles::RTDataColormapType).value<QString>();
                pSpline->setColorMap(colorMap);
            }
            return pSpline;
        }

        case MetaTreeItemTypes::RTDataTimeInterval: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pSpinBox->setSuffix(" mSec");
            pSpinBox->setMinimum(17);
            pSpinBox->setMaximum(50000);
            pSpinBox->setSingleStep(10);
            pSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::RTDataTimeInterval).toInt());
            return pSpinBox;
        }

        case MetaTreeItemTypes::RTDataVisualizationType: {
            QComboBox* pComboBox = new QComboBox(parent);
            pComboBox->addItem("Vertex based");
            pComboBox->addItem("Smoothing based");
            pComboBox->addItem("Annotation based");
            return pComboBox;
        }

        case MetaTreeItemTypes::SurfaceColor: {
            QColorDialog *pColorDialog = new QColorDialog();
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Surface Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::PointColor: {
            QColorDialog *pColorDialog = new QColorDialog();
            connect(pColorDialog, &QColorDialog::currentColorChanged,
                    this, &Data3DTreeDelegate::onEditorEdited);
            pColorDialog->setWindowTitle("Select Point Color");
            pColorDialog->show();
            return pColorDialog;
        }

        case MetaTreeItemTypes::RTDataNumberAverages: {
            QSpinBox* pSpinBox = new QSpinBox(parent);
            connect(pSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pSpinBox->setMinimum(1);
            pSpinBox->setMaximum(100);
            pSpinBox->setSingleStep(1);
            pSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::RTDataNumberAverages).toInt());
            return pSpinBox;
        }

        case MetaTreeItemTypes::SurfaceAlpha: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(0.01);
            pDoubleSpinBox->setMaximum(1.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::SurfaceAlpha).toDouble());
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTranslateX: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::SurfaceTranslateX).toDouble());
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTranslateY: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::SurfaceTranslateY).toDouble());
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::SurfaceTranslateZ: {
            QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
            connect(pDoubleSpinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
                    this, &Data3DTreeDelegate::onEditorEdited);
            pDoubleSpinBox->setMinimum(-10000.0);
            pDoubleSpinBox->setMaximum(10000.0);
            pDoubleSpinBox->setSingleStep(0.01);
            pDoubleSpinBox->setValue(index.model()->data(index, MetaTreeItemRoles::SurfaceTranslateZ).toDouble());
            return pDoubleSpinBox;
        }

        case MetaTreeItemTypes::NetworkThreshold: {
            Spline* pSpline = new Spline("Spline Histogram", 0);
            connect(pSpline, static_cast<void (Spline::*)(double, double, double)>(&Spline::borderChanged),
                this, &Data3DTreeDelegate::onEditorEdited);

            QStandardItem* pParentItem = static_cast<QStandardItem*>(pAbstractItem->QStandardItem::parent());
            QModelIndex indexParent = pData3DTreeModel->indexFromItem(pParentItem);
            MatrixXd matRTData = index.model()->data(indexParent, Data3DTreeModelItemRoles::NetworkDataMatrix).value<MatrixXd>();
            Eigen::VectorXd resultClassLimit;
            Eigen::VectorXi resultFrequency;
            MNEMath::histcounts(matRTData, false, 50, resultClassLimit, resultFrequency, 0.0, 0.0);
            pSpline->setData(resultClassLimit, resultFrequency, 0);
            QVector3D vecThresholdValues = index.model()->data(index, MetaTreeItemRoles::NetworkThreshold).value<QVector3D>();
            pSpline->setThreshold(vecThresholdValues);

            return pSpline;
        }

        case MetaTreeItemTypes::NetworkMatrix: {
            QStandardItem* pParentItem = static_cast<QStandardItem*>(pAbstractItem->QStandardItem::parent());
            QModelIndex indexParent = pData3DTreeModel->indexFromItem(pParentItem);
            MatrixXd matRTData = index.model()->data(indexParent, Data3DTreeModelItemRoles::NetworkDataMatrix).value<MatrixXd>();

            ImageSc* pPlotLA = new ImageSc(matRTData);
            pPlotLA->show();
            //return pPlotLA;
        }

        default: // do nothing;
            break;
    }


    return QItemDelegate::createEditor(parent, option, index);
}