コード例 #1
0
ファイル: statusbar.cpp プロジェクト: tasosbull/yewtic
StatusBar::StatusBar(QWidget * parent)
        : QToolBar(parent)
{
    m_label = new QLabel(this);
    m_label->setMargin(1);
    m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    addWidget(m_label);

    m_zoomOutAction = addAction(QIcon(":/zoom-out.png"), trUtf8("Zoom out"));
    m_zoomOutAction->setShortcut(QKeySequence::ZoomOut);

    m_slider = new ZoomSlider(this);
    addWidget(m_slider);

    m_zoomInAction = addAction(QIcon(":/zoom-in.png"), trUtf8("Zoom in"));
    m_zoomInAction->setShortcut(QKeySequence::ZoomIn);
    m_zoomOriginalAction = addAction(QIcon(":/zoom-original.png"), trUtf8("Original zoom"));
    m_zoomOriginalAction->setShortcut(Qt::CTRL + Qt::Key_0);

    m_progressBar = new QProgressBar(this);
    m_progressBar->setFixedHeight(16);
    m_progressBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    addWidget(m_progressBar);

    connect(m_zoomOutAction, SIGNAL(triggered()), m_slider, SLOT(decreaseValue()));
    connect(m_zoomInAction, SIGNAL(triggered()), m_slider, SLOT(increaseValue()));
    connect(m_zoomOriginalAction, SIGNAL(triggered()), m_slider, SLOT(returnToOriginalValue()));
}
コード例 #2
0
ファイル: stmr-cli.c プロジェクト: wooorm/stmr
/* Tokenise and stem a file */
static void
stemFile(FILE *file) {
  int character;
  int index;

  while (TRUE) {
    character = getc(file);

    if (character == EOF) {
      return;
    }

    if (IS_LETTER(character)) {
      index = 0;

      while (TRUE) {
        if (index == indexMax) {
          increaseValue();
        }

        character = tolower(character);

        value[index] = character;

        index++;

        character = getc(file);

        if (!IS_LETTER(character)) {
          ungetc(character, file);
          break;
        }
      }

      value[stem(value, 0, index - 1) + 1] = 0;

      /* The previous line calls the stemmer and
       * uses its result to zero-terminate the
       * string in `value`. */
      printf("%s", value);
    } else {
      putchar(character);
    }
  }
}
コード例 #3
0
ファイル: 10.c プロジェクト: basheerk/autotest-client-tests
int Test_Rdr(SaHpiSessionIdT sessionId,
	     SaHpiResourceIdT resourceId, SaHpiRdrT rdr)
{
	SaErrorT status;
	int retval = SAF_TEST_NOTSUPPORT;
	SaHpiSensorRecT *sensorRec;
	SaHpiSensorThresholdsT threshold;
	SaHpiSensorReadingTypeT type;
	SaHpiSensorReadingUnionT maxValue;

	if (canTest(sessionId, resourceId, &rdr)) {

		sensorRec = &rdr.RdrTypeUnion.SensorRec;
		type = sensorRec->DataFormat.ReadingType;

		if (hasMax(sensorRec)) {

			maxValue = getMaxValue(sensorRec);
			if (!isOverflow(maxValue, type)) {

				if (hasWriteThreshold
				    (sensorRec, SAHPI_STM_UP_CRIT)) {

					initThresholds(&threshold, type);

					threshold.UpCritical.IsSupported =
					    SAHPI_TRUE;
					threshold.UpCritical.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				} else
				    if (hasWriteThreshold
					(sensorRec, SAHPI_STM_UP_MAJOR)) {

					initThresholds(&threshold, type);

					threshold.UpMajor.IsSupported =
					    SAHPI_TRUE;
					threshold.UpMajor.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				} else
				    if (hasWriteThreshold
					(sensorRec, SAHPI_STM_UP_MINOR)) {

					initThresholds(&threshold, type);

					threshold.UpMinor.IsSupported =
					    SAHPI_TRUE;
					threshold.UpMinor.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				}
			}
		}
	}

	return retval;
}