Exemple #1
0
void QwwTipWidgetPrivate::initUi() {
    Q_Q(QwwTipWidget);
    QHBoxLayout *l = new QHBoxLayout;
    m_check = new QCheckBox;
    m_check->setChecked(true);
    l->addWidget(m_check);
    l->addStretch();
    m_prev = new QPushButton;
    m_prev->setIcon(QPixmap(":/wwwidgets/arrowleft.png"));
    l->addWidget(m_prev);
    m_next = new QPushButton;
    m_next->setIcon(QPixmap(":/wwwidgets/arrowright.png"));
    l->addWidget(m_next);
    m_close = new QPushButton;
    m_close->setDefault(true);
    m_close->setAutoDefault(true);
    l->addWidget(m_close);
    QVBoxLayout *vl = new QVBoxLayout(q);
    m_browser = new QTextBrowser;
    m_browser->setOpenExternalLinks(true);
    vl->addWidget(m_browser);
    vl->addLayout(l);
    q->connect(m_close, SIGNAL(clicked()), q, SIGNAL(closed()));
    q->connect(m_prev, SIGNAL(clicked()), q, SLOT(prevTip()));
    q->connect(m_next, SIGNAL(clicked()), q, SLOT(nextTip()));
    q->setTabOrder(m_close, m_next);
    q->setTabOrder(m_next, m_prev);
    q->setTabOrder(m_prev, m_check);
    q->setTabOrder(m_check, m_close);
    q->setFocusProxy(m_close);
    retranslateUi();
}
Exemple #2
0
QWidget* CObjectProperty::returnWidget(QWidget *parent_) {
    if(m_visible) {
        if(m_type == "string") {
            QLineEdit* newWidget = new QLineEdit(parent_);
            if(!m_editable) newWidget->setEnabled(false);
            newWidget->setText(m_property.toString());
            QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString)));
            QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString)));
            return newWidget;
        } else if(m_type == "longlong") {
            QLineEdit* newWidget = new QLineEdit(parent_);
            if(!m_editable) newWidget->setEnabled(false);
            QValidator* validator = new QIntValidator();
            newWidget->setValidator(validator);
            newWidget->setText(m_property.toString());
            QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString)));
            QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString)));
            return newWidget;
        } else if(m_type == "bool") {
            QCheckBox* newWidget = new QCheckBox(parent_);
            if(!m_editable) newWidget->setEnabled(false);
            newWidget->setChecked(m_property.toBool());
            QObject::connect(this,SIGNAL(signal_propertyChanged(bool)),newWidget,SLOT(setChecked(bool)));
            QObject::connect(newWidget,SIGNAL(toggled(bool)),this,SLOT(slot_propertyChanged(bool)));
            return newWidget;
        }
    }
Exemple #3
0
QWidget* Sis3350UI::createTriggerFIRControls()
{
    // Trigger Enable FIR mode
    QWidget *box = new QWidget(this);
    QSignalMapper *mapper = new QSignalMapper();
    QHBoxLayout *l = new QHBoxLayout();
    l->setMargin(0);

    triggerFir = new QList<QCheckBox*>();
    QLabel *label = new QLabel(tr("FIR mode:"),this);

    l->addWidget(label);

    for(int i=0; i<4; i++)
    {
        QCheckBox *trgFir = new QCheckBox(this);
        if(module->conf.trigger_fir[i])
        {
            trgFir->setChecked(true);
        }
        triggerFir->append(trgFir);
        connect(trgFir,SIGNAL(stateChanged(int)),mapper,SLOT(map()));
        mapper->setMapping(trgFir,i);
        l->addWidget(trgFir);
    }
    connect(mapper,SIGNAL(mapped(int)),this,SLOT(firChanged(int)));
    box->setLayout(l);
    return box;
}
//! [4]
QGroupBox *Window::createSecondExclusiveGroup()
{
    QGroupBox *groupBox = new QGroupBox(tr("E&xclusive Radio Buttons"));
    groupBox->setCheckable(true);
    groupBox->setChecked(false);
//! [4]

//! [5]
    QRadioButton *radio1 = new QRadioButton(tr("Rad&io button 1"));
    QRadioButton *radio2 = new QRadioButton(tr("Radi&o button 2"));
    QRadioButton *radio3 = new QRadioButton(tr("Radio &button 3"));
    radio1->setChecked(true);
    QCheckBox *checkBox = new QCheckBox(tr("Ind&ependent checkbox"));
    checkBox->setChecked(true);
//! [5]

//! [6]
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(radio1);
    vbox->addWidget(radio2);
    vbox->addWidget(radio3);
    vbox->addWidget(checkBox);
    vbox->addStretch(1);
    groupBox->setLayout(vbox);

    return groupBox;
}
Exemple #5
0
void WidgetParameters::setValue(QWidget* curWidget,QVariant value)
{

    QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(curWidget);
    if(lineEdit)
        lineEdit->setText(value.toString());

    QScienceSpinBox* dblspinbox = dynamic_cast<QScienceSpinBox*>(curWidget);
    if(dblspinbox)
        dblspinbox->setValue(value.toDouble());

    QSpinBox* spinbox = dynamic_cast<QSpinBox*>(curWidget);
    if(spinbox)
        spinbox->setValue(value.toInt());

    QCheckBox* checkbox = dynamic_cast<QCheckBox*>(curWidget);
    if(checkbox)
        checkbox->setChecked(value.toBool());

    QComboBox* combo = dynamic_cast<QComboBox*>(curWidget);
    if(combo)
    {
        combo->setCurrentIndex(combo->findData(value));
    }

}
void QFRDRTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {

     QDateTimeEdit *dateEditor = qobject_cast<QDateTimeEdit *>(editor);
     if (dateEditor) {
         dateEditor->setDateTime(index.model()->data(index, Qt::EditRole).toDateTime());
     } else {
         QFDoubleEdit *dEditor = qobject_cast<QFDoubleEdit *>(editor);
         if (dEditor) {
             dEditor->setValue(index.model()->data(index, Qt::EditRole).toDouble());
         } else {
             QSpinBox *sEditor = qobject_cast<QSpinBox *>(editor);
             if (sEditor) {
                 sEditor->setValue(index.model()->data(index, Qt::EditRole).toLongLong());
             } else {
                 QCheckBox *check = qobject_cast<QCheckBox *>(editor);
                 if (check) {
                     check->setChecked(index.model()->data(index, Qt::EditRole).toBool());
                 } else {
                     QLineEdit *edit = qobject_cast<QLineEdit*>(editor);
                     if (edit) {
                         edit->setText(index.model()->data(index, Qt::EditRole).toString());
                     }
                 }
             }

         }
     }
}
void tst_QErrorMessage::dontShowAgain()
{
    QString plainString = QLatin1String("foo");
    QString htmlString = QLatin1String("foo<br>bar");
    QCheckBox *checkBox = 0;

    QErrorMessage errorMessageDialog(0);

    // show an error with plain string 
    errorMessageDialog.showMessage(plainString);
    QVERIFY(errorMessageDialog.isVisible());
    checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
    QVERIFY(checkBox);
    QVERIFY(checkBox->isChecked());
    errorMessageDialog.close();

    errorMessageDialog.showMessage(plainString);
    QVERIFY(errorMessageDialog.isVisible());
    checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
    QVERIFY(checkBox);
    QVERIFY(checkBox->isChecked());
    checkBox->setChecked(false);
    errorMessageDialog.close();

    errorMessageDialog.showMessage(plainString);
    QVERIFY(!errorMessageDialog.isVisible());

    // show an error with an html string
    errorMessageDialog.showMessage(htmlString);
    QVERIFY(errorMessageDialog.isVisible());
    checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
    QVERIFY(checkBox);
    QVERIFY(!checkBox->isChecked());
    checkBox->setChecked(true);
    errorMessageDialog.close();

    errorMessageDialog.showMessage(htmlString);
    QVERIFY(errorMessageDialog.isVisible());
    checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
    QVERIFY(checkBox);
    QVERIFY(checkBox->isChecked());
    checkBox->setChecked(false);
    errorMessageDialog.close();

    errorMessageDialog.showMessage(htmlString);
    QVERIFY(!errorMessageDialog.isVisible());
}
WalkmeshManager::WalkmeshManager(QWidget *parent, const QGLWidget *shareWidget) :
	QDialog(parent, Qt::Tool),
	idFile(0), caFile(0), infFile(0), scriptsAndTexts(0)
{
	setWindowTitle(tr("Zones"));

	walkmesh = Config::value("OpenGL", true).toBool() ? new WalkmeshWidget(0, shareWidget) : 0;
	QWidget *walkmeshWidget = walkmesh ? walkmesh : new QWidget(this);

	slider1 = new QSlider(this);
	slider2 = new QSlider(this);
	slider3 = new QSlider(this);

	slider1->setRange(-180, 180);
	slider2->setRange(-180, 180);
	slider3->setRange(-180, 180);

	slider1->setValue(0);
	slider2->setValue(0);
	slider3->setValue(0);

	QLabel *keyInfos = new QLabel(tr("Utilisez les touches directionnelles pour déplacer la caméra."));
	keyInfos->setTextFormat(Qt::PlainText);
	keyInfos->setWordWrap(true);

	QPushButton *resetCamera = new QPushButton(tr("Remettre à 0"));

	QCheckBox *showModels = new QCheckBox(tr("Afficher modèles"));

	tabWidget = new QTabWidget(this);
	tabWidget->addTab(buildCameraPage(), tr("Caméra"));
	tabWidget->addTab(buildWalkmeshPage(), tr("Walkmesh"));
	tabWidget->addTab(buildGatewaysPage(), tr("Sorties"));
	tabWidget->addTab(buildDoorsPage(), tr("Portes"));
	tabWidget->addTab(buildArrowPage(), tr("Flèches"));
	tabWidget->addTab(buildCameraRangePage(), tr("Limites caméra"));
	tabWidget->addTab(buildMiscPage(), tr("Divers"));
	tabWidget->setFixedHeight(250);

	QGridLayout *layout = new QGridLayout(this);
	layout->addWidget(walkmeshWidget, 0, 0, 4, 1);
	layout->addWidget(slider1, 0, 1);
	layout->addWidget(slider2, 0, 2);
	layout->addWidget(slider3, 0, 3);
	layout->addWidget(keyInfos, 1, 1, 1, 3);
	layout->addWidget(resetCamera, 2, 1, 1, 3);
	layout->addWidget(showModels, 3, 1, 1, 3);
	layout->addWidget(tabWidget, 4, 0, 1, 4);

	if(walkmesh) {
		connect(slider1, SIGNAL(valueChanged(int)), walkmesh, SLOT(setXRotation(int)));
		connect(slider2, SIGNAL(valueChanged(int)), walkmesh, SLOT(setYRotation(int)));
		connect(slider3, SIGNAL(valueChanged(int)), walkmesh, SLOT(setZRotation(int)));
		connect(resetCamera, SIGNAL(clicked()), SLOT(resetCamera()));
		connect(showModels, SIGNAL(toggled(bool)), SLOT(setModelsVisible(bool)));

		showModels->setChecked(true);
	}
}
/**
 * Add a site to the list.
 */
void sourcesWindow::addCheckboxes()
{
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	QString t = settings.value("Sources/Types", "icon").toString();

	QStringList k = m_sites->keys();
	for (int i = 0; i < k.count(); i++)
	{
		QCheckBox *check = new QCheckBox();
			check->setChecked(m_selected[i]);
			check->setText(k.at(i));
			connect(check, SIGNAL(stateChanged(int)), this, SLOT(checkUpdate()));
			m_checks << check;
			ui->gridLayout->addWidget(check, i, 0);

		int n = 1;
		if (t != "hide")
		{
			if (t == "icon" || t == "both")
			{
				QLabel *image = new QLabel();
				image->setPixmap(QPixmap(savePath("sites/"+m_sites->value(k.at(i))->type()+"/icon.png")));
				ui->gridLayout->addWidget(image, i, n);
				m_labels << image;
				n++;
			}
			if (t == "text" || t == "both")
			{
				QLabel *type = new QLabel(m_sites->value(k.at(i))->value("Name"));
				ui->gridLayout->addWidget(type, i, n);
				m_labels << type;
				n++;
			}
		}

		QBouton *del = new QBouton(k.at(i));
			del->setText(tr("Options"));
			connect(del, SIGNAL(appui(QString)), this, SLOT(settingsSite(QString)));
			m_buttons << del;
			ui->gridLayout->addWidget(del, i, n);
	}

	/*int n =  0+(t == "icon" || t == "both")+(t == "text" || t == "both");
	for (int i = 0; i < m_checks.count(); i++)
	{
		ui->gridLayout->addWidget(m_checks.at(i), i, 0);
		m_checks.at(i)->show();
		if (!m_labels.isEmpty())
		{
			for (int r = 0; r < n; r++)
			{
				ui->gridLayout->addWidget(m_labels.at(i*n+r), i*n+r, 1);
				m_labels.at(i*n+r)->show();
			}
		}
		ui->gridLayout->addWidget(m_buttons.at(i), i, n+1);
		m_buttons.at(i)->show();
	}*/
}
Exemple #10
0
FenetreTaille::FenetreTaille(ImageRGB* image, QWidget *parent) :
    QDialog(parent)
{
    if(image != NULL)
    {
        setFixedSize(260,160);
        proportionnel = true;

        this->image = image;
        this->imagePrec = *image;

        this->valProp = (double)(image->width()) / (double)(image->height());

        QVBoxLayout *layout = new QVBoxLayout;

        QCheckBox* prop = new QCheckBox("Conserver les proportions", this);
        prop->setChecked(true);
        layout->addWidget(prop);
        connect(prop, SIGNAL(toggled(bool)), this, SLOT(changeProp(bool)));


        QLabel* text1 = new QLabel("hauteur", this);
        layout->addWidget(text1);

        BoxHauteur = new QSpinBox(this);
        BoxHauteur->setMinimum(1);
        BoxHauteur->setMaximum(10000);
        BoxHauteur->setValue(image->height());
        hauteurImage = image->height();
        layout->addWidget(BoxHauteur);
        connect(BoxHauteur, SIGNAL(valueChanged(int)), this, SLOT(changeHauteur(int)));


        QLabel* text2 = new QLabel("Largeur", this);
        layout->addWidget(text2);

        BoxLargeur = new QSpinBox(this);
        BoxLargeur->setMinimum(1);
        BoxLargeur->setMaximum(10000);
        BoxLargeur->setValue(image->width());
        largeurImage = image->width();
        layout->addWidget(BoxLargeur);
        connect(BoxLargeur, SIGNAL(valueChanged(int)), this, SLOT(changeLargeur(int)));


        QHBoxLayout* layout2 = new QHBoxLayout;
        QPushButton* bouton_annuler = new QPushButton("Annuler", this);
        layout2->addWidget(bouton_annuler);
        connect(bouton_annuler, SIGNAL(clicked()), this, SLOT(annuler()));

        QPushButton* bouton_ok = new QPushButton("OK", this);
        layout2->addWidget(bouton_ok);
        layout->addLayout(layout2);
        connect(bouton_ok, SIGNAL(clicked()), this, SLOT(valider()));

        this->changePourProp = false;

        this->setLayout(layout);
    }
Exemple #11
0
void CheckBoxDelegate::setEditorData(QWidget *editor,
                                     const QModelIndex &index) const
{
        bool value = index.model()->data(index, Qt::EditRole).toBool();

        QCheckBox *CheckBox = static_cast<QCheckBox*>(editor);
        CheckBox->setChecked(value);
 }
Exemple #12
0
void CheckBoxListDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
   // Set editor data.
   QCheckBox* myEditor = static_cast<QCheckBox*>(editor);

   myEditor->setText(index.model()->data(index, Qt::DisplayRole).toString());
   myEditor->setChecked(index.model()->data(index, Qt::UserRole).toBool());
}
Exemple #13
0
//! [7]
PermissionsTab::PermissionsTab(const QFileInfo &fileInfo, QWidget *parent)
    : QWidget(parent)
{
    QGroupBox *permissionsGroup = new QGroupBox(tr("Permissions"));

    QCheckBox *readable = new QCheckBox(tr("Readable"));
    if (fileInfo.isReadable())
        readable->setChecked(true);

    QCheckBox *writable = new QCheckBox(tr("Writable"));
    if ( fileInfo.isWritable() )
        writable->setChecked(true);

    QCheckBox *executable = new QCheckBox(tr("Executable"));
    if ( fileInfo.isExecutable() )
        executable->setChecked(true);

    QGroupBox *ownerGroup = new QGroupBox(tr("Ownership"));

    QLabel *ownerLabel = new QLabel(tr("Owner"));
    QLabel *ownerValueLabel = new QLabel(fileInfo.owner());
    ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);

    QLabel *groupLabel = new QLabel(tr("Group"));
    QLabel *groupValueLabel = new QLabel(fileInfo.group());
    groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);

    QVBoxLayout *permissionsLayout = new QVBoxLayout;
    permissionsLayout->addWidget(readable);
    permissionsLayout->addWidget(writable);
    permissionsLayout->addWidget(executable);
    permissionsGroup->setLayout(permissionsLayout);

    QVBoxLayout *ownerLayout = new QVBoxLayout;
    ownerLayout->addWidget(ownerLabel);
    ownerLayout->addWidget(ownerValueLabel);
    ownerLayout->addWidget(groupLabel);
    ownerLayout->addWidget(groupValueLabel);
    ownerGroup->setLayout(ownerLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(permissionsGroup);
    mainLayout->addWidget(ownerGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);
}
void DeclarativeSettingsPageImpl::addBoolField(const QString &key, const DeclarativeSettingsPage::Entry &entry)
{
    QCheckBox * control = new QCheckBox(entry.title, pClass_);
    if (entry.defaultValue.isValid())
        control->setChecked(entry.defaultValue.toBool());
    widgets_[key] = control;
    addField("", control);
}
void AssociationsDialog::uncheckCol(int col)
{
	for (int i = 0; i < table->rowCount(); i++){
		QCheckBox *it = (QCheckBox *)table->cellWidget(i, col);
		if (it)
			it->setChecked(false);
	}
}
Exemple #16
0
 void setEditorData(QWidget *editor,
                            const QModelIndex &index) const
 {
    //set editor data
    QCheckBox *myEditor = static_cast<QCheckBox*>(editor);
    myEditor->setText(index.data(Qt::DisplayRole).toString());
    myEditor->setChecked(index.data(Qt::UserRole).toBool());
 }
Exemple #17
0
void Window::createDoubleSpinBoxes() {
  doubleSpinBoxesGroup = new QGroupBox(tr("Double precision spinboxes"));

  QLabel *precisionLabel = new QLabel(tr("Number of decimal places to show:"));
  QSpinBox *precisionSpinBox = new QSpinBox;
  precisionSpinBox->setRange(0, 100);
  precisionSpinBox->setValue(2);

  QLabel *doubleLabel =
      new QLabel(tr("Enter a value between %1 and %2:").arg(-20).arg(20));
  doubleSpinBox = new QDoubleSpinBox;
  doubleSpinBox->setRange(-20.0, 20.0);
  doubleSpinBox->setSingleStep(1.0);
  doubleSpinBox->setValue(0.0);

  QLabel *scaleLabel = new QLabel(
      tr("Enter a scale factor between %1 and %2:").arg(0).arg(1000.0));
  scaleSpinBox = new QDoubleSpinBox;
  scaleSpinBox->setRange(0.0, 1000.0);
  scaleSpinBox->setSingleStep(10.0);
  scaleSpinBox->setSuffix("%");
  scaleSpinBox->setSpecialValueText(tr("No scaling"));
  scaleSpinBox->setValue(100.0);

  QLabel *priceLabel =
      new QLabel(tr("Enter a price between %1 and %2:").arg(0).arg(1000));
  priceSpinBox = new QDoubleSpinBox;
  priceSpinBox->setRange(0.0, 1000.0);
  priceSpinBox->setSingleStep(1.0);
  priceSpinBox->setPrefix(tr("$"));
  priceSpinBox->setValue(99.99);
  connect(precisionSpinBox, SIGNAL(valueChanged(int)), this,
          SLOT(changePrecision(int)));

  groupSeparatorSpinBox_d = new QDoubleSpinBox;
  groupSeparatorSpinBox_d->setRange(-99999999, 99999999);
  groupSeparatorSpinBox_d->setDecimals(2);
  groupSeparatorSpinBox_d->setValue(1000.00);
  groupSeparatorSpinBox_d->setGroupSeparatorShown(true);
  QCheckBox *groupSeparatorChkBox = new QCheckBox;
  groupSeparatorChkBox->setText(tr("Show group separator"));
  groupSeparatorChkBox->setChecked(true);
  connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox_d,
          &QDoubleSpinBox::setGroupSeparatorShown);

  QVBoxLayout *spinBoxLayout = new QVBoxLayout;
  spinBoxLayout->addWidget(precisionLabel);
  spinBoxLayout->addWidget(precisionSpinBox);
  spinBoxLayout->addWidget(doubleLabel);
  spinBoxLayout->addWidget(doubleSpinBox);
  spinBoxLayout->addWidget(scaleLabel);
  spinBoxLayout->addWidget(scaleSpinBox);
  spinBoxLayout->addWidget(priceLabel);
  spinBoxLayout->addWidget(priceSpinBox);
  spinBoxLayout->addWidget(groupSeparatorChkBox);
  spinBoxLayout->addWidget(groupSeparatorSpinBox_d);
  doubleSpinBoxesGroup->setLayout(spinBoxLayout);
}
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;
}
void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
{
    QDialog* dialog = new QDialog(p_QupZilla);
    dialog->setWindowTitle(tr("Authorization required"));

    QFormLayout* formLa = new QFormLayout(dialog);

    QLabel* label = new QLabel(dialog);
    QLabel* userLab = new QLabel(dialog);
    QLabel* passLab = new QLabel(dialog);
    userLab->setText(tr("Username: "******"Password: "******"Save username and password on this site"));
    pass->setEchoMode(QLineEdit::Password);

    QDialogButtonBox* box = new QDialogButtonBox(dialog);
    box->addButton(QDialogButtonBox::Ok);
    box->addButton(QDialogButtonBox::Cancel);
    connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
    connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));

    label->setText(tr("A username and password are being requested by %1. "
                      "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm())));
    formLa->addRow(label);

    formLa->addRow(userLab, user);
    formLa->addRow(passLab, pass);
    formLa->addRow(save);

    formLa->addWidget(box);
    AutoFillModel* fill = mApp->autoFill();
    if (fill->isStored(reply->url())) {
        save->setChecked(true);
        user->setText(fill->getUsername(reply->url()));
        pass->setText(fill->getPassword(reply->url()));
    }
    emit wantsFocus(reply->url());

    //Do not save when private browsing is enabled
    if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
        save->setVisible(false);
    }

    if (dialog->exec() != QDialog::Accepted) {
        return;
    }

    auth->setUser(user->text());
    auth->setPassword(pass->text());

    if (save->isChecked()) {
        fill->addEntry(reply->url(), user->text(), pass->text());
    }
}
bool
NetworkPermissionTester::havePermission()
{
    QSettings settings;
    settings.beginGroup("Preferences");
    
    QString tag = QString("network-permission-%1").arg(SV_VERSION);

    bool permish = false;

    if (settings.contains(tag)) {
	permish = settings.value(tag, false).toBool();
    } else {

	QDialog d;
	d.setWindowTitle(QCoreApplication::translate("NetworkPermissionTester", "Welcome to Sonic Visualiser"));

	QGridLayout *layout = new QGridLayout;
	d.setLayout(layout);

	QLabel *label = new QLabel;
	label->setWordWrap(true);
	label->setText
	    (QCoreApplication::translate
	     ("NetworkPermissionTester",
	      "<h2>Welcome to Sonic Visualiser!</h2>"
	      "<p><img src=\":icons/qm-logo-smaller.png\" style=\"float:right\">Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.</p>"
	      "<p>Developed in the Centre for Digital Music at Queen Mary, University of London, Sonic Visualiser is provided free as open source software under the GNU General Public License.</p>"
              "<p><hr></p>"
	      "<p><b>Before we go on...</b></p>"
	      "<p>Sonic Visualiser would like to make networking connections and open a network port.</p>"
	      "<p>This is to:</p>"
	      "<ul><li> Find information about available and installed plugins;</li>"
	      "<li> Support the use of Open Sound Control, where configured; and</li>"
	      "<li> Tell you when updates are available.</li>"
              "</ul>"
	      "<p>No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.</p>"
	      "<p>We recommend that you allow this, because it makes Sonic Visualiser more useful. But if you do not wish to do so, please un-check the box below.<br></p>"));
	layout->addWidget(label, 0, 0);

	QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this"));
	cb->setChecked(true);
	layout->addWidget(cb, 1, 0);
	
	QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok);
	QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept()));
	layout->addWidget(bb, 2, 0);
	
	d.exec();

        permish = cb->isChecked();
	settings.setValue(tag, permish);
    }

    settings.endGroup();

    return permish;
}
Exemple #21
0
// ---------------------------------------------------------------
void LibraryDialog::slotSelectNone()
{
  QCheckBox *p;
  QListIterator<QCheckBox *> i(BoxList);
  while(i.hasNext()){
    p = i.next();
    p->setChecked(false);
  }
}
void SensorsDialog::setupCheckbox(int index, QString name, bool checked)
{
    QCheckBox *cb = getCheckboxPtr(index);

    if (cb != NULL) {
        cb->setText(name);
        cb->setChecked(checked);
    }
}
QgsDataDefinedSymbolDialog::QgsDataDefinedSymbolDialog( const QMap< QString, QPair< QString, QString > >& properties, const QgsVectorLayer* vl,
    QWidget* parent, Qt::WindowFlags f ): QDialog( parent, f ), mVectorLayer( vl )
{
  setupUi( this );

  QgsFields attributeFields;
  if ( mVectorLayer )
  {
    attributeFields = mVectorLayer->pendingFields();
  }

  mTableWidget->setRowCount( properties.size() );

  int i = 0;
  QMap< QString, QPair< QString, QString > >::const_iterator it = properties.constBegin();
  for ( ; it != properties.constEnd(); ++it )
  {
    //check box
    QCheckBox* cb = new QCheckBox( this );
    cb->setChecked( !it.value().second.isEmpty() );
    mTableWidget->setCellWidget( i, 0, cb );
    mTableWidget->setColumnWidth( 0, cb->width() );


    //property name
    QTableWidgetItem* propertyItem = new QTableWidgetItem( it.value().first );
    propertyItem->setData( Qt::UserRole, it.key() );
    mTableWidget->setItem( i, 1, propertyItem );

    //attribute list
    QString expressionString = it.value().second;
    QComboBox* attributeComboBox = new QComboBox( this );
    attributeComboBox->addItem( QString() );
    for ( int j = 0; j < attributeFields.count(); ++j )
    {
      attributeComboBox->addItem( attributeFields.at( j ).name() );
    }

    int attrComboIndex = comboIndexForExpressionString( expressionString, attributeComboBox );
    if ( attrComboIndex >= 0 )
    {
      attributeComboBox->setCurrentIndex( attrComboIndex );
    }
    else
    {
      attributeComboBox->setItemText( 0, expressionString );
    }

    mTableWidget->setCellWidget( i, 2, attributeComboBox );

    //expression button
    QPushButton* expressionButton = new QPushButton( "...", this );
    QObject::connect( expressionButton, SIGNAL( clicked() ), this, SLOT( expressionButtonClicked() ) );
    mTableWidget->setCellWidget( i, 3, expressionButton );
    ++i;
  }
}
Exemple #24
0
BooleanDelegate::BooleanDelegate(QObject *parent, bool defaultValue) :
    QStyledItemDelegate(parent), defaultValue(defaultValue)
{
    QCheckBox checkbox;
    checkbox.setStyleSheet("background-color:transparent");
    uncheckedPixmap=QPixmap::grabWidget(&checkbox);
    checkbox.setChecked(true);
    checkedPixmap=QPixmap::grabWidget(&checkbox);
}
void JingleContentDialog::setContents(QList<JingleContent*> c)
{
	for (int i = 0; i < c.count(); i++)
	{
		QCheckBox *cb = new QCheckBox(typeToString(c[i]->type()), this);
		cb->setChecked(true);
		if (c[i]->type() == JingleContent::Unknown)
		{
			cb->setChecked(false);
			cb->setEnabled(false);
		}
		m_contentNames << c[i]->name();
		ui.verticalLayout->insertWidget(0, cb);
		m_checkBoxes << cb;
	}
	QLabel *label = new QLabel(i18n("Choose the contents you want to accept:"), this);
	ui.verticalLayout->insertWidget(0, label);
}
void NoiseReductionOptionsWidget::filterGroupChanged(QList<QCheckBox*> list)
{
    m_qFilterListCheckBox.clear();

    qDebug() << "list.size(): " << list.size();

    for(int u = 0; u < list.size(); u++) {
        QCheckBox* tempCheckBox = new QCheckBox(list[u]->text());
        tempCheckBox->setChecked(list[u]->isChecked());

        connect(tempCheckBox, &QCheckBox::toggled,
                list[u], &QCheckBox::setChecked);

        if(tempCheckBox->text() == "Activate user designed filter")
            connect(tempCheckBox, &QCheckBox::toggled,
                    this, &NoiseReductionOptionsWidget::onUserFilterToggled);

        connect(list[u], &QCheckBox::toggled,
                tempCheckBox, &QCheckBox::setChecked);

        m_qFilterListCheckBox.append(tempCheckBox);
    }

    //Delete all widgets in the filter layout
    //QGridLayout* topLayout = static_cast<QGridLayout*>(ui->m_groupBox_temporalFiltering->layout());
    //if(!topLayout) {
       QGridLayout* topLayout = new QGridLayout();
    //}

//    QLayoutItem *child;
//    while((child = topLayout->takeAt(0)) != 0) {
//        delete child->widget();
//        delete child;
//    }

    //Add filters
    int u = 0;

    qDebug() << "m_qFilterListCheckBox.size(): " << m_qFilterListCheckBox.size();

    for(u; u < m_qFilterListCheckBox.size(); ++u) {
        topLayout->addWidget(m_qFilterListCheckBox[u], u, 0);
    }

    //Add push button for filter options
    m_pShowFilterOptions = new QPushButton();
//        m_pShowFilterOptions->setText("Open Filter options");
    m_pShowFilterOptions->setText("Filter options");
    m_pShowFilterOptions->setCheckable(false);
    connect(m_pShowFilterOptions, &QPushButton::clicked,
            this, &NoiseReductionOptionsWidget::onShowFilterOptions);

    topLayout->addWidget(m_pShowFilterOptions, u+1, 0);

    //Find Filter tab and add current layout
    ui->m_groupBox_temporalFiltering->setLayout(topLayout);
}
WidgetParameterBool::WidgetParameterBool(ParameterPtrT<bool> parameter)
: WidgetParameter<bool>(parameter)
{
	QCheckBox* checkBox = new QCheckBox(this);
	checkBox->setChecked(parameter->lastValue());
	checkBox->move(0,0);
	
	parameter->addNewInternalValueCallback([checkBox, this](bool value){
		checkBox->blockSignals(true);
		checkBox->setChecked(value);
		checkBox->blockSignals(false);
	});
	BOOST_VERIFY(connect(checkBox, SELECT<bool>::OVERLOAD_OF(&QCheckBox::clicked), [this](bool b) {
		mParameter->set(b);
	}));
	
	mWidget = checkBox;
}
Exemple #28
0
void Expectations::updateWantedUvs()
{
    QList<const Uv*> uvs = UTManager::instance().uvs();
    Utilities::clearLayout(wantedUvsLayout_);

    for(int i = 0; i < uvs.size(); i++)
    {
        QString code = uvs.at(i)->code();
        QCheckBox* uv = new QCheckBox(code);
        if (exp_->requiredUvs().contains(uvs.at(i)))
            uv->setChecked(true);
        else
            uv->setChecked(false);
        wantedUvsLayout_->addWidget(uv);
    }

    wantedUvsLayout_->insertStretch(-1);
}
Exemple #29
0
void oprof_start::setup_unit_masks(op_event_descr const & descr)
{
	op_unit_mask const * um = descr.unit;

	hide_masks();

	if (!um || um->unit_type_mask == utm_mandatory)
		return;

	event_setting & cfg = event_cfgs[descr.name];

	unit_mask_group->setExclusive(um->unit_type_mask == utm_exclusive);

	for (size_t i = 0; i < um->num ; ++i) {
		QCheckBox * check = 0;
		switch (i) {
			case 0: check = check0; break;
			case 1: check = check1; break;
			case 2: check = check2; break;
			case 3: check = check3; break;
			case 4: check = check4; break;
			case 5: check = check5; break;
			case 6: check = check6; break;
			case 7: check = check7; break;
			case 8: check = check8; break;
			case 9: check = check9; break;
			case 10: check = check10; break;
			case 11: check = check11; break;
			case 12: check = check12; break;
			case 13: check = check13; break;
			case 14: check = check14; break;
			case 15: check = check15; break;
		}
		check->setText(um->um[i].desc);
		if (um->unit_type_mask == utm_exclusive)
			check->setChecked(cfg.umask == um->um[i].value);
		else
			check->setChecked(cfg.umask & um->um[i].value);

		check->show();
	}
	unit_mask_group->setMinimumSize(unit_mask_group->sizeHint());
	setup_config_tab->setMinimumSize(setup_config_tab->sizeHint());
}
void CPBoolPlugin::configDialog()
{
    QDialog dialog;
    QGridLayout *layout = new QGridLayout;

    QLabel *topictxt = new QLabel(tr("Topic Name:"));
    QLineEdit *topicedit = new QLineEdit(topic);
    layout->addWidget(topictxt, 0, 0);
    layout->addWidget(topicedit, 0, 1);

    QLabel *slabeltxt = new QLabel(tr("Show Label:"));
    QCheckBox *slabelcheck = new QCheckBox();
    slabelcheck->setChecked(ui->label->isVisible());
    layout->addWidget(slabeltxt, 1, 0);
    layout->addWidget(slabelcheck, 1, 1);

    QLabel *labeltxt = new QLabel(tr("Label:"));
    QLineEdit *labeledit = new QLineEdit(ui->label->text());
    connect(slabelcheck, SIGNAL(toggled(bool)), labeledit, SLOT(setEnabled(bool)));
    labeledit->setEnabled(ui->label->isVisible());
    layout->addWidget(labeltxt, 2, 0);
    layout->addWidget(labeledit, 2, 1);

    QPushButton *okbutton = new QPushButton(tr("&OK"));
    layout->addWidget(okbutton, 3, 1);

    dialog.setLayout(layout);

    dialog.setWindowTitle("Plugin Configuration - Bool");

    connect(okbutton, SIGNAL(clicked()), &dialog, SLOT(accept()));

    if(!dialog.exec())
        return;

    if(topic != topicedit->text())
    {
        emit changeValue("N/A");
        topic = topicedit->text();
        settings->setValue(uuid.toString() + "/Topic", topic);
        activateNodelet(true);
    }

    if(ui->label->isVisible() != slabelcheck->isChecked())
    {
        ui->label->setVisible(slabelcheck->isChecked());
        ui->value->setAlignment((slabelcheck->isChecked() ? Qt::AlignLeft : Qt::AlignHCenter) | Qt::AlignVCenter);
        settings->setValue(uuid.toString() + "/ShowLabel", slabelcheck->isChecked());
    }

    if(ui->label->text() != labeledit->text())
    {
        emit changeLabel(labeledit->text());
        settings->setValue(uuid.toString() + "/Label", labeledit->text());
    }
}