Example #1
0
void SpotMapperWindow::setBlobs(map<int, threeDPeaks*> Blobs) {
    blobs = Blobs;
    // delete the current checkboxes if any..

    while(blobChecks.size()) {
        map<int, QCheckBox*>::iterator it = blobChecks.begin();
        (*it).second->hide();
        delete (*it).second;
        blobChecks.erase(it);
    }
    // and make some new ones..
    QString label;
    for(map<int, threeDPeaks*>::iterator it=blobs.begin(); it != blobs.end(); it++) {
        label.setNum((*it).first);
        QCheckBox* box = new QCheckBox(label, this);
        connect(box, SIGNAL(released()), this, SLOT(waveLengthSelectionChanged()) );
        blobChecks.insert(make_pair((*it).first, box));
        checksBox->addWidget(box);
        box->show();
    }
    // when setting blobs the first time, nothing will be present in the allBlobs or
    // visBlobs since none of the wavelengths will be selected..
    // then resize the blobs
    visibleBlobs.resize(0);
    allBlobs.resize(0);
    selectedDrops.resize(0);

}
void DataSelectionScreen::addItem(QString name)
{
	QCheckBox *box = new QCheckBox(this);
	ui.scrollAreaWidgetContents->layout()->addWidget(box);
	box->setText(name);
	connect(box,SIGNAL(clicked(bool)),this,SLOT(checkBoxClicked(bool)));
	box->show();
    m_itemList.append(box);
}
Example #3
0
void oprof_start::setup_unit_masks(op_event_descr const & descr)
{
#define OP_MAX_HANDLED_UMS 16
	op_unit_mask const * um = descr.unit;

	hide_masks();

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

	if (um->num > OP_MAX_HANDLED_UMS) {
		ostringstream error;

		error << "Number of unit masks (" << um->num << ") is greater than max allowed ("
		      << OP_MAX_HANDLED_UMS << ").";
		QMessageBox::warning(this, 0, error.str().c_str());
		return;
	}


	event_setting & cfg = event_cfgs[descr.name];

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

	for (size_t i = 0; i < OP_MAX_HANDLED_UMS; ++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 kiptablesgenerator::setupIDefensiveChecksPage()
{
  iDefensiveChecksPage = new QFrame(this);
  
  QVBoxLayout *layout = new QVBoxLayout(iDefensiveChecksPage);
  
  QLabel *summary = new QLabel(i18n(
    "<p>This page allows you to enable additional checks to help protect your system "
    "from common firewall evasion techniques, DOS attacks, and other malicious activities.</p>"
    "<p>If you don't understand the above, the defaults provided are suitable for most systems.</p>"),
    iDefensiveChecksPage);
  summary->show();
  layout->addWidget(summary);
  
  QCheckBox *localSpoof = new QCheckBox(i18n("&Block spoofed local packets"), iDefensiveChecksPage);
  localSpoof->setChecked(true);
  localSpoof->show();
  layout->addWidget(localSpoof);
  namedWidgets["iCheckLocalSpoof"] = localSpoof;
  
  QCheckBox *synFlood = new QCheckBox(i18n("&SYN-flood protection"), iDefensiveChecksPage);
  synFlood->setChecked(true);
  synFlood->show();
  layout->addWidget(synFlood);
  namedWidgets["iSynFloodProtect"] = synFlood;
  
  QCheckBox *checkSyn = new QCheckBox(i18n("&Check new connections start with a SYN packet"), iDefensiveChecksPage);
  checkSyn->setChecked(true);
  checkSyn->show();
  layout->addWidget(checkSyn);
  namedWidgets["iCheckSyn"] = checkSyn;
  
  QCheckBox *checkSynFin = new QCheckBox(i18n("&Drop packets with both SYN and FIN flags set"), iDefensiveChecksPage);
  checkSynFin->setChecked(true);
  checkSynFin->show();
  layout->addWidget(checkSynFin);
  namedWidgets["iCheckSynFin"] = checkSynFin;
  
  iDefensiveChecksPage->show();
  this->addPage(iDefensiveChecksPage, i18n("Defensive Checks"));
}
Example #5
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());
}
Example #6
0
MigrateDialog::MigrateDialog(const QString &dir, const QStringList &cnvDirs) : QWizard(NULL)
        //: MigrateDialogBase(NULL, "migrate", true)
{
	setupUi(this);
    m_dir      = dir;
    m_cnvDirs  = cnvDirs;
    m_bProcess = false;
    QVBoxLayout *lay = (QVBoxLayout*)(page1->layout());
    for (QStringList::Iterator it = m_cnvDirs.begin(); it != m_cnvDirs.end(); ++it){
        QCheckBox *chk = new QCheckBox(*it, page1);
        lay->insertWidget(1, chk);
        chk->show();
        chk->setChecked(true);
        m_boxes.push_back(chk);
    }
    chkRemove->setChecked(true);
    connect(this, SIGNAL(selected(const QString&)), this, SLOT(pageSelected(const QString&)));
    button( QWizard::HelpButton )->hide();
}
Example #7
0
//+++++++++++++++++++++++++
void view_player::set_question(question *q){

    //  Set the main text.
    //
    _text_browser->setText( q->get_question() );

    //
    hide_all_options();

    //  Set the options.
    //
    for( int ii=0; ii<q->get_options().size(); ii++ ){

        //
        QLabel *label = _list_label.at(ii);
        label->setText( q->get_options().at(ii) );
        label->show();

        //
        QCheckBox *check = _list_check.at(ii);
        check->show();
    }
}
void KListDebugDialog::generateCheckBoxes(const QString &filter)
{
    QPtrListIterator< QCheckBox > cb_it(boxes);
    for(; cb_it.current(); ++cb_it)
    {
        if((*cb_it)->state() != QButton::NoChange)
            m_changes.insert((*cb_it)->name(), (*cb_it)->isChecked() ? 2 : 4);
    }

    boxes.setAutoDelete(true);
    boxes.clear();
    boxes.setAutoDelete(false);

    QWidget *taborder = m_incrSearch;
    QStringList::Iterator it = m_areaList.begin();
    for(; it != m_areaList.end(); ++it)
    {
        QString data = (*it).simplifyWhiteSpace();
        if(filter.isEmpty() || data.lower().contains(filter.lower()))
        {
            int space = data.find(" ");
            if(space == -1)
                kdError() << "No space:" << data << endl;

            QString areaNumber = data.left(space);
            // kdDebug() << areaNumber << endl;
            QCheckBox *cb = new QCheckBox(data, m_box, areaNumber.latin1());
            cb->show();
            boxes.append(cb);
            setTabOrder(taborder, cb);
            taborder = cb;
        }
    }

    load();
}
Example #9
0
void MainWindow::addLevelCheckBox(QWidget * iParent, int iLevel, QString iLabel)
{
  int nboxes = (int)m_levelCheckBoxes.size();
  QCheckBox * checkBox = new QCheckBox(iParent);
  //checkBox->setChecked(Qt::Checked);
  checkBox->setChecked(Qt::Unchecked);
  checkBox->setGeometry(QRect(10, 10 + nboxes*30, 80, 20));
  if (!iLabel.isEmpty())
  {
    checkBox->setText(iLabel);
  }
  else
  {
    checkBox->setText("level" + QString::number(iLevel));
  }
  //checkBox->setProperty("idx", iLevel);
  checkBox->setProperty("idx", nboxes);
  checkBox->setChecked(true);
  checkBox->show();

  m_levelCheckBoxes.push_back(checkBox);

  connect(checkBox, SIGNAL(clicked()), this, SLOT(levelCheckBoxModified()));
}
Example #10
0
void toNewConnection::changeProvider(int current)
{
    try
    {
        QString provider = getCurrentProvider();
        if (provider.isNull() || provider.isEmpty())
            return;

        bool oldStateH = Host->blockSignals(true);
        Host->clear();
        QList<QString> hosts = toConnectionProviderRegistrySing::Instance().get(provider).hosts();
        DefaultPort = 0;
        foreach(QString const & host, hosts)
        {
            if (host.isEmpty())
                continue;
            else if (host.startsWith(":"))
                DefaultPort = host.mid(1).toInt();
            else
                Host->addItem(host); // This might also call changeHost(), unless blockSignals == true
        }
        Host->blockSignals(oldStateH);

        Database->clear();
        changeHost(); // will populate Databases combobox

        // seems i broke this for oracle
        if (!DefaultPort)
        {
            if (provider.startsWith("Oracle"))
                DefaultPort = 1521;
        }

        if (Provider->currentText().startsWith("Oracle")) // TODO add provider property
        {
            SchemaLabel->show();
            Schema->show();
        }
        else
        {
            SchemaLabel->hide();
            Schema->hide();
        }

        Port->setValue(DefaultPort);

        if (Provider->currentText().startsWith(ORACLE_TNSCLIENT) || getCurrentProvider() == "QODBC")
        {
            HostLabel->hide();
            Host->hide();
            PortLabel->hide();
            Port->hide();
        }
        else
        {
            HostLabel->show();
            Host->show();
            PortLabel->show();
            Port->show();
        }

        QList<QWidget *> widgets = OptionGroup->findChildren<QWidget *>();
        foreach(QWidget * w, widgets)
        delete w;

        QList<QString> options = toConnectionProviderRegistrySing::Instance().get(provider).options();
        foreach(QString option, options)
        {

            if (option == "-")
                continue;

            bool defOn = false;
            if (option.startsWith("*"))
            {
                defOn = true;
                option = option.mid(1);
            }

            QCheckBox *ow = new QCheckBox(OptionGroup);
            ow->setText(option);
            ow->setChecked(defOn);
            OptionGroup->layout()->addWidget(ow);
            ow->show();
        }

        if (options.empty())
            OptionGroup->hide();
        else
            OptionGroup->show();
    }
    catch (const QString &str)
    {
        Utils::toStatusMessage(str);
    }
}
void kiptablesgenerator::setupIConntrackPage()
{
  iConntrackPage = new QFrame(this);
  QGridLayout *layout = new QGridLayout(iConntrackPage, 7, 4);
  
  QLabel *intro = new QLabel(i18n( "<p><i>Advanced users only</i> - "
    "The defaults here are sensible, and will work for most users.</p>"
    "<p>If packets match one of the following connection states, they "
    "will be admitted by the firewall.</p>"), iConntrackPage);
  intro->show();
  layout->addMultiCellWidget(intro, 0, 0, 0, 3);
  
  QCheckBox *allSame = new QCheckBox(i18n("Use same settings for all protocols"), iConntrackPage);
  allSame->show();
  layout->addMultiCellWidget(allSame, 1, 1, 0, 3);
  namedWidgets["iConntrackAllSame"] = allSame;
  
  // ALL CONNTRACK
  
  QLabel *allLabel = new QLabel(i18n("All: "), iConntrackPage);
  allLabel->show();
  layout->addWidget(allLabel, 2, 0);
  
  QCheckBox *allEstablished = new QCheckBox(i18n("Established"), iConntrackPage);
  allEstablished->setChecked(true);
  allEstablished->show();
  namedWidgets["iConntrackAllEstablished"] = allEstablished;
  layout->addWidget(allEstablished, 2, 1);
  
  QCheckBox *allRelated = new QCheckBox(i18n("Related"), iConntrackPage);
  allRelated->setChecked(true);
  allRelated->show();
  namedWidgets["iConntrackAllRelated"] = allRelated;
  layout->addWidget(allRelated, 2, 2);
  
  QCheckBox *allNew = new QCheckBox(i18n("New"), iConntrackPage);
  allNew->show();
  namedWidgets["iConntrackAllNew"] = allNew;
  layout->addWidget(allNew, 2, 3);
  
  KSeparator *separator = new KSeparator(iConntrackPage);
  layout->addMultiCellWidget(separator, 3, 3, 0, 3);
  
  // TCP CONNTRACK
    
  QLabel *tcpLabel = new QLabel(i18n("TCP: "), iConntrackPage);
  tcpLabel->show();
  layout->addWidget(tcpLabel, 4, 0);
  
  QCheckBox *tcpEstablished = new QCheckBox(i18n("Established"), iConntrackPage);
  tcpEstablished->setChecked(true);
  tcpEstablished->show();
  layout->addWidget(tcpEstablished, 4, 1);
  namedWidgets["iConntrackTcpEstablished"] = tcpEstablished;
  
  QCheckBox *tcpRelated = new QCheckBox(i18n("Related"), iConntrackPage);
  tcpRelated->setChecked(true);
  tcpRelated->show();
  layout->addWidget(tcpRelated, 4, 2);
  namedWidgets["iConntrackTcpRelated"] = tcpRelated;
  
  QCheckBox *tcpNew = new QCheckBox(i18n("New"), iConntrackPage);
  tcpNew->show();
  layout->addWidget(tcpNew, 4, 3);
  namedWidgets["iConntrackTcpNew"] = tcpNew;
  
  // UDP CONNTRACK
  
  QLabel *udpLabel = new QLabel(i18n("UDP: "), iConntrackPage);
  udpLabel->show();
  layout->addWidget(udpLabel, 5, 0);
  
  QCheckBox *udpEstablished = new QCheckBox(i18n("Established"), iConntrackPage);
  udpEstablished->setChecked(true);
  udpEstablished->show();
  layout->addWidget(udpEstablished, 5, 1);
  namedWidgets["iConntrackUdpEstablished"] = udpEstablished;
  
  QCheckBox *udpRelated = new QCheckBox(i18n("Related"), iConntrackPage);
  udpRelated->setChecked(true);
  udpRelated->show();
  layout->addWidget(udpRelated, 5, 2);
  namedWidgets["iConntrackUdpRelated"] = udpRelated;
  
  QCheckBox *udpNew = new QCheckBox(i18n("New"), iConntrackPage);
  udpNew->show();
  layout->addWidget(udpNew, 5, 3);
  namedWidgets["iConntrackUdpNew"] = udpNew;
  
  // ICMP CONNTRACK
  
  QLabel *icmpLabel = new QLabel(i18n("ICMP: "), iConntrackPage);
  icmpLabel->show();
  layout->addWidget(icmpLabel, 6, 0);
  
  QCheckBox *icmpEstablished = new QCheckBox(i18n("Established"), iConntrackPage);
  icmpEstablished->setChecked(true);
  icmpEstablished->show();
  layout->addWidget(icmpEstablished, 6, 1);
  namedWidgets["iConntrackICMPEstablished"] = icmpEstablished;
  
  QCheckBox *icmpRelated = new QCheckBox(i18n("Related"), iConntrackPage);
  icmpRelated->setChecked(true);
  icmpRelated->show();
  layout->addWidget(icmpRelated, 6, 2);
  namedWidgets["iConntrackICMPRelated"] = icmpRelated;
  
  QCheckBox *icmpNew = new QCheckBox(i18n("New"), iConntrackPage);
  icmpNew->show();
  layout->addWidget(icmpNew, 6, 3);
  namedWidgets["iConntrackICMPNew"] = icmpNew;

  connect(allSame, SIGNAL(toggled(bool )), allLabel, SLOT(setEnabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), allEstablished, SLOT(setEnabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), allNew, SLOT(setEnabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), allRelated, SLOT(setEnabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), tcpLabel, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), tcpEstablished, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), tcpNew, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), tcpRelated, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), udpLabel, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), udpEstablished, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), udpNew, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), udpRelated, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), icmpLabel, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), icmpEstablished, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), icmpNew, SLOT(setDisabled(bool )));
  connect(allSame, SIGNAL(toggled(bool )), icmpRelated, SLOT(setDisabled(bool )));
  
  allSame->setChecked(true);
  
  iConntrackPage->show();
  this->addPage(iConntrackPage, i18n("Connection Tracking"));
}