コード例 #1
0
ファイル: progressloggergui.cpp プロジェクト: 4nykey/rockbox
void ProgressLoggerGui::setProgress(int value, int max)
{
    // set maximum first to avoid setting a value outside of the max range.
    // If the current value is outside of the valid range QProgressBar
    // calls reset() internally.
    setProgressMax(max);
    setProgressValue(value);
}
コード例 #2
0
	SSMProcess* SceneModeler::compute(){
		setProgressText("starting computation");
		setProgressMax(100);
		setProgressValue(1);
		this->captureSceneLimits();
		this->calculateClasses();
		this->computeIndexSequence();
		for(int i = Lb(*this->transitionDataStates); i <= Ub(*this->transitionDataStates); i++){
			(*this->transitionDataStates)[i] += 1;
		}
		
		intvector rv(Lb(*this->transitionDataStates) , Ub(*this->transitionDataStates) );
		for(int i = Lb(rv) ; i <= Ub(rv) ; i++){
			rv[i] = (*this->transitionDataStates)[i];
		}
		setProgressText("creating model");
		return modelFromIndexSequence(rv);
	}
コード例 #3
0
/* helper methods */
void ThermalCalibrationHelper::updateTemperature(float temp)
{
    int elapsed = m_startTime.secsTo(QTime::currentTime());
    int secondsSinceLastCheck = m_lastCheckpointTime.secsTo(QTime::currentTime());

    // temperature is low pass filtered
    m_temperature = m_temperature * 0.95f + temp * 0.05f;
    emit temperatureChanged(m_temperature);

    // temperature range
    if (m_temperature < m_minTemperature) {
        m_minTemperature = m_temperature;
    }
    if (m_temperature > m_maxTemperature) {
        m_maxTemperature = m_temperature;
    }
    if (!m_rangeReached && (range() >= TargetTempDelta)) {
        m_rangeReached = true;
        addInstructions(tr("Target temperature span has been acquired. Acquisition may be ended or, preferably, continued."));
    }
    emit temperatureRangeChanged(range());

    if (secondsSinceLastCheck > TimeBetweenCheckpoints) {
        // gradient is expressed in °C/min
        m_gradient = 60.0 * (m_temperature - m_lastCheckpointTemp) / (float)secondsSinceLastCheck;
        emit temperatureGradientChanged(gradient());

        qDebug() << "Temp Gradient " << gradient() << " Elapsed" << elapsed;
        m_debugStream << "INFO::Trace Temp Gradient " << gradient() << " Elapsed" << elapsed << endl;

        m_lastCheckpointTime = QTime::currentTime();
        m_lastCheckpointTemp = m_temperature;
    }
    // at least a checkpoint has been reached
    if (elapsed > TimeBetweenCheckpoints) {
        // .1 is a "very" small value in this case thats > 0
        if (m_initialGradient < .1 && m_gradient > .1) {
            m_initialGradient = m_gradient;
        }

        if (m_targetduration != 0) {
            int tmp = (100 * elapsed) / m_targetduration;
            setProgress(tmp);
        } else if ((m_gradient > .1) && ((m_initialGradient / 2.0f) > m_gradient)) {
            // make a rough estimation of the time needed
            m_targetduration = elapsed * 8;

            setProgressMax(100);

            QTime time = QTime(0, 0).addSecs(m_targetduration);
            QString timeString = time.toString(tr("m''s''''"));
            addInstructions(tr("Estimated acquisition duration is %1.").arg(timeString));

            QString str = QStringLiteral("INFO::Trace gradient : %1, elapsed : %2 initial gradient : %3, target : %4")
                          .arg(m_gradient).arg(elapsed).arg(m_initialGradient).arg(m_targetduration);
            qDebug() << str;
            m_debugStream << str << endl;
        }

        if ((m_gradient < TargetGradient) || m_forceStopAcquisition) {
            m_acquiring = false;
            emit collectionCompleted();
        }
    }
}