コード例 #1
0
ファイル: xgui.cpp プロジェクト: q5sys/pcbsd
void XGUI::ProgramInit()
{
    
    //gridLayout_4->setMargin(0);
    //gridLayout_4->setSpacing(0);
    
    // Load the screen resolutions
    loadResolutions();

    // Load the drivers
    loadDrivers();

    // Load the Depth
    loadDepth();

    // Load the Device Information
    loadDeviceInformation();
   
    // Disable the monitor advanced group box
    monitorChangedSlot();

    // Check for an unprobed monitor
    checkUnprobedMonitor(); 

    // Connect our Dual-head checkbox / slot
    connect(checkDualHead, SIGNAL( clicked() ), this, SLOT( dualChangedSlot() ) );
    connect(checkMonitorSync, SIGNAL( clicked() ), this, SLOT( monitorChangedSlot() ) );
    connect(pushApply, SIGNAL( clicked() ), this, SLOT( applySlot() ) );
    connect(pushClose, SIGNAL( clicked() ), this, SLOT( closeSlot() ) );

    // Check out dualChangedSlot to ensure we disable the box by default
    dualChangedSlot();
}
コード例 #2
0
ファイル: PrefsWidget.cpp プロジェクト: benhj/playnews
PrefsWidget::PrefsWidget(QWidget *parent)
  : QWidget(parent)
  , ui(new Ui::PrefsWidget)
{
    ui->setupUi(this);
    QObject::connect(ui->cancelbutton, SIGNAL(clicked()), this, SLOT(closeSlot()));
}
コード例 #3
0
void InfoEventStackWidget::destorySlot()
{
    ui->stackedWidget->removeWidget(qobject_cast<QWidget*>(sender()));
    updatePage();
    emit countChanged(ui->stackedWidget->count());
    sender()->deleteLater();

    if (ui->stackedWidget->count() == 0) {
        closeSlot();
        emit infoEventCleared();
    }
}
コード例 #4
0
InfoEventStackWidget::InfoEventStackWidget(QXmppClient *client, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InfoEventStackWidget),
    m_client(client),
    m_timeLine(new QTimeLine(150, this))
{
    ui->setupUi(this);
    connect(ui->closeButton, SIGNAL(clicked()),
            this, SLOT(closeSlot()) );
    connect(ui->previousButton, SIGNAL(clicked()),
            this, SLOT(previousSlot()) );
    connect(ui->nextButton , SIGNAL(clicked()),
            this, SLOT(nextSlot()) );

    connect(m_timeLine, SIGNAL(valueChanged(qreal)),
            this, SLOT(animeSlot(qreal)) );
}
コード例 #5
0
CQGnuPlotDataDialog::
CQGnuPlotDataDialog(CQGnuPlotMainWindow *window, const CGnuPlotFile &file) :
 window_(window)
{
  setWindowTitle("Data Dialog");

  setObjectName("dataDialog");

  enum_ = new CQGnuPlotEnum;

  enum_->setPlotStyle(CQGnuPlotEnum::PlotLinesPoints);

  QVBoxLayout *layout = new QVBoxLayout(this);
  layout->setMargin(2); layout->setSpacing(2);

  //------

  QGroupBox *loadGroup = new QGroupBox("File Data");

  QVBoxLayout *loadLayout = new QVBoxLayout(loadGroup);
  loadLayout->setMargin(2); loadLayout->setSpacing(2);

  layout->addWidget(loadGroup);

  //--

  QHBoxLayout *fileLayout = new QHBoxLayout;
  fileLayout->setMargin(2); fileLayout->setSpacing(2);

  fileEdit_ = new CQGnuPlotFilename;

  fileEdit_->setName(file.fileName().c_str());
  fileEdit_->setPattern("Text (*.txt);; CSV (*.csv);; File (*.*);; All (*)");

  QPushButton *loadButton = new QPushButton("Load");

  connect(loadButton, SIGNAL(clicked()), this, SLOT(loadSlot()));

  fileLayout->addWidget(new QLabel("File"));
  fileLayout->addWidget(fileEdit_);
  fileLayout->addWidget(loadButton);

  loadLayout->addLayout(fileLayout);

  //------

  QHBoxLayout *numberLayout = new QHBoxLayout;
  numberLayout->setMargin(2); numberLayout->setSpacing(2);

  numberEdit_ = new CQIntegerSpin;

  numberEdit_->setValue(100);

  QPushButton *generateButton = new QPushButton("Generate");

  connect(generateButton, SIGNAL(clicked()), this, SLOT(generateSlot()));

  numberLayout->addWidget(generateButton);
  numberLayout->addWidget(numberEdit_);
  numberLayout->addWidget(new QLabel("Points"));
  numberLayout->addStretch(1);

  loadLayout->addLayout(numberLayout);

  //------

  QHBoxLayout *formatLayout = new QHBoxLayout;
  formatLayout->setMargin(2); formatLayout->setSpacing(2);

  formatLayout->addWidget(csvCheck_ = new QCheckBox("CSV"));
  formatLayout->addWidget(headerCheck_ = new QCheckBox("Header"));
  formatLayout->addStretch(1);

  loadLayout->addLayout(formatLayout);

  //------

  QHBoxLayout *separatorLayout = new QHBoxLayout;
  separatorLayout->setMargin(2); separatorLayout->setSpacing(2);

  separatorLayout->addWidget(new QLabel("Separator"));
  separatorLayout->addWidget(separatorEdit_ = new QLineEdit);
  separatorLayout->addStretch(1);

  loadLayout->addLayout(separatorLayout);

  char sepChar = file.separator();

  std::string sepStr(&sepChar, 1);

  separatorEdit_->setText(sepStr.c_str());

  //------

  QHBoxLayout *missingLayout = new QHBoxLayout;
  missingLayout->setMargin(2); missingLayout->setSpacing(2);

  missingLayout->addWidget(new QLabel("Missing"));
  missingLayout->addWidget(missingEdit_ = new QLineEdit);
  missingLayout->addStretch(1);

  loadLayout->addLayout(missingLayout);

  missingEdit_->setText(file.missingStr().c_str());

  //------

  tree_ = new CQGnuPlotDataTree(file);

  layout->addWidget(tree_);

  //------

  QGroupBox *filterGroup = new QGroupBox("Filter Data");

  QVBoxLayout *filterLayout = new QVBoxLayout(filterGroup);
  filterLayout->setMargin(2); filterLayout->setSpacing(2);

  layout->addWidget(filterGroup);

  //--

  QHBoxLayout *usingLayout = new QHBoxLayout;
  usingLayout->setMargin(2); usingLayout->setSpacing(2);

  usingLayout->addWidget(new QLabel("Using"));
  usingLayout->addWidget(usingEdit_ = new QLineEdit);

  filterLayout->addLayout(usingLayout);

  usingEdit_->setText(window_->qapp()->usingString().c_str());

  //--

  QHBoxLayout *indexLayout = new QHBoxLayout;
  indexLayout->setMargin(2); indexLayout->setSpacing(2);

  indexLayout->addWidget(new QLabel("Index"));
  indexLayout->addWidget(indexEdit_ = new QLineEdit);

  filterLayout->addLayout(indexLayout);

  //--

  QHBoxLayout *everyLayout = new QHBoxLayout;
  everyLayout->setMargin(2); everyLayout->setSpacing(2);

  everyLayout->addWidget(new QLabel("Every"));
  everyLayout->addWidget(everyEdit_ = new QLineEdit);

  filterLayout->addLayout(everyLayout);

  //--

  QHBoxLayout *whereLayout = new QHBoxLayout;
  whereLayout->setMargin(2); whereLayout->setSpacing(2);

  whereLayout->addWidget(new QLabel("Where"));
  whereLayout->addWidget(whereEdit_ = new QLineEdit);

  filterLayout->addLayout(whereLayout);

  //--

  QHBoxLayout *filterOptionsLayout = new QHBoxLayout;
  filterOptionsLayout->setMargin(2); filterOptionsLayout->setSpacing(2);

  filterOptionsLayout->addWidget(averageCheck_ = new QCheckBox("Average"));
  filterOptionsLayout->addWidget(summedCheck_  = new QCheckBox("Summed" ));
  filterOptionsLayout->addStretch(1);

  filterLayout->addLayout(filterOptionsLayout);

  //------

  QGroupBox *plotGroup = new QGroupBox("Plot Style");

  QVBoxLayout *plotPlayout = new QVBoxLayout(plotGroup);
  plotPlayout->setMargin(2); plotPlayout->setSpacing(2);

  layout->addWidget(plotGroup);

  //--

  enum_->setPlotStyle(CQGnuPlotEnum::plotStyleConv(window_->qapp()->plotStyle()));

  QHBoxLayout *styleLayout = new QHBoxLayout;
  styleLayout->setMargin(2); styleLayout->setSpacing(2);

  CQEnumCombo *styleCombo = new CQEnumCombo(this, enum_, "plotStyle");

  styleLayout->addWidget(new QLabel("Style"));
  styleLayout->addWidget(styleCombo);
  styleLayout->addStretch(1);

  plotPlayout->addLayout(styleLayout);

  //--

  QHBoxLayout *dimensionLayout = new QHBoxLayout;
  dimensionLayout->setMargin(2); dimensionLayout->setSpacing(2);

  dimensionLayout->addWidget(new QLabel("Dimension"));
  dimensionLayout->addWidget(dimension2DRadio_ = new QRadioButton("2D"));
  dimensionLayout->addWidget(dimension3DRadio_ = new QRadioButton("3D"));
  dimensionLayout->addStretch(1);

  dimension2DRadio_->setChecked(true);

  plotPlayout->addLayout(dimensionLayout);

  //--

  QHBoxLayout *lineStyleLayout = new QHBoxLayout;
  lineStyleLayout->setMargin(2); lineStyleLayout->setSpacing(2);

  lineStyleLayout->addWidget(new QLabel("Line Style"));
  lineStyleLayout->addWidget(lineTypeEdit_ = new CQIntegerSpin);
  lineStyleLayout->addStretch(1);

  lineTypeEdit_->setValue(-1);

  plotPlayout->addLayout(lineStyleLayout);

  //--

  QHBoxLayout *plotButtonsLayout = new QHBoxLayout;
  plotButtonsLayout->setMargin(2); plotButtonsLayout->setSpacing(2);

  QPushButton *filterButton      = new QPushButton("Filter");
  QPushButton *overlayPlotButton = new QPushButton("Overlay Plot");
  QPushButton *addPlotButton     = new QPushButton("Add Plot");

  connect(filterButton     , SIGNAL(clicked()), this, SLOT(filterSlot()));
  connect(overlayPlotButton, SIGNAL(clicked()), this, SLOT(overlayPlotSlot()));
  connect(addPlotButton    , SIGNAL(clicked()), this, SLOT(addPlotSlot()));

  plotButtonsLayout->addWidget(filterButton);
  plotButtonsLayout->addWidget(overlayPlotButton);
  plotButtonsLayout->addWidget(addPlotButton);
  plotButtonsLayout->addStretch(1);

  layout->addLayout(plotButtonsLayout);

  //---

  QHBoxLayout *buttonLayout = new QHBoxLayout;
  buttonLayout->setMargin(2); buttonLayout->setSpacing(2);

  buttonLayout->addStretch(1);

  QPushButton *closeButton  = new QPushButton("Close");

  buttonLayout->addWidget(closeButton);

  connect(closeButton, SIGNAL(clicked()), this, SLOT(closeSlot()));

  layout->addLayout(buttonLayout);
}
コード例 #6
0
/**
 * checkForNewPCSCToken looks into a specific slot for a token.
 *
 * @param slot       Pointer to slot structure.
 *
 * @return
 *                   <P><TABLE>
 *                   <TR><TD>Code</TD><TD>Meaning</TD></TR>
 *                   <TR>
 *                   <TD>CKR_OK                                 </TD>
 *                   <TD>Success                                </TD>
 *                   </TR>
 *                   <TR>
 *                   <TD>CKR_HOST_MEMORY                        </TD>
 *                   <TD>Error getting memory (malloc)          </TD>
 *                   </TR>
 *                   <TR>
 *                   <TD>CKR_GENERAL_ERROR                      </TD>
 *                   <TD>Error opening slot directory           </TD>
 *                   </TR>
 *                   </TABLE></P>
 */
static int checkForNewPCSCToken(struct p11Slot_t *slot)
{
	struct p11Token_t *ptoken;
	int rc, i;
	LONG rv;
	DWORD dwActiveProtocol;
	WORD feature;
	DWORD featurecode, lenr, atrlen,readernamelen,state,protocol;
	unsigned char buf[256];
	unsigned char atr[36];
	char *po;

	FUNC_CALLED();

	if (slot->closed) {
		FUNC_RETURNS(CKR_TOKEN_NOT_PRESENT);
	}

	rv = SCardConnect(slot->context, slot->readername, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T1, &(slot->card), &dwActiveProtocol);

#ifdef DEBUG
	debug("SCardConnect (%i, %s): %s\n", slot->id, slot->readername, pcsc_error_to_string(rv));
#endif

	if (rv == SCARD_E_NO_SMARTCARD || rv == SCARD_W_REMOVED_CARD || rv == SCARD_E_SHARING_VIOLATION) {
		FUNC_RETURNS(CKR_TOKEN_NOT_PRESENT);
	}

	if (rv != SCARD_S_SUCCESS) {
		closeSlot(slot);
		FUNC_FAILS(CKR_DEVICE_ERROR, pcsc_error_to_string(rv));
	}

	if (!slot->hasFeatureVerifyPINDirect) {
		rv = SCardControl(slot->card, SCARD_CTL_CODE(3400), NULL,0, buf, sizeof(buf), &lenr);

#ifdef DEBUG
		debug("SCardControl (CM_IOCTL_GET_FEATURE_REQUEST): %s\n", pcsc_error_to_string(rv));
#endif

		/* Ignore the feature codes if an error occured */
		if (rv == SCARD_S_SUCCESS) {
			for (i = 0; i < lenr; i += 6) {
				feature = buf[i];
				featurecode = (buf[i + 2] << 24) + (buf[i + 3] << 16) + (buf[i + 4] << 8) + buf[i + 5];
	#ifdef DEBUG
				debug("%s - 0x%08X\n", pcsc_feature_to_string(feature), featurecode);
	#endif
				if (feature == FEATURE_VERIFY_PIN_DIRECT) {
					po = getenv("PKCS11_IGNORE_PINPAD");
	#ifdef DEBUG
					if (po) {
						debug("PKCS11_IGNORE_PINPAD=%s\n", po);
					} else {
						debug("PKCS11_IGNORE_PINPAD not found\n");
					}
	#endif
					if (!po || (*po == '0')) {
	#ifdef DEBUG
						debug("Slot supports feature VERIFY_PIN_DIRECT - setting CKF_PROTECTED_AUTHENTICATION_PATH for token\n");
	#endif
						slot->hasFeatureVerifyPINDirect = featurecode;
					}
				}
			}
		}
	}

	readernamelen = 0;
	atrlen = sizeof(atr);

	rc = SCardStatus(slot->card, NULL, &readernamelen, &state, &protocol, atr, &atrlen);

	if (rc != SCARD_S_SUCCESS) {
		closeSlot(slot);
		FUNC_FAILS(CKR_DEVICE_ERROR, pcsc_error_to_string(rc));
	}

	rc = newToken(slot, atr, atrlen, &ptoken);

	if (rc != CKR_OK) {
		FUNC_FAILS(rc, "newToken() failed");
	}

	FUNC_RETURNS(rc);
}