Exemple #1
0
void
ViewManager::back()
{
    ViewStep* step = m_steps.at( m_currentStep );
    if ( step->isAtBeginning() && m_currentStep > 0 )
    {
        m_currentStep--;
        m_stack->setCurrentIndex( m_currentStep );
        step->onLeave();
        m_steps.at( m_currentStep )->onActivate();
        emit currentStepChanged();
    }
    else if ( !step->isAtBeginning() )
    {
        step->back();
    }
    else return;

    m_next->setEnabled( m_steps.at( m_currentStep )->isNextEnabled() );
    m_back->setEnabled( m_steps.at( m_currentStep )->isBackEnabled() );

    if ( m_currentStep == 0 && m_steps.first()->isAtBeginning() )
        m_back->setEnabled( false );

    if ( !( m_currentStep == m_steps.count() -1 &&
            m_steps.last()->isAtEnd() ) )
        m_quit->setText( tr( "&Cancel" ) );
}
Exemple #2
0
int ChaserRunner::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: currentStepChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Exemple #3
0
bool ChaserRunner::write(MasterTimer* timer, UniverseArray* universes)
{
    // Nothing to do
    if (m_steps.size() == 0)
        return false;

    if (m_newCurrent != -1)
    {
        // Manually-set current step
        m_currentStep = m_newCurrent;
        m_newCurrent = -1;

        // No need to do roundcheck here, since manually-set steps are
        // always within m_steps limits.

        m_elapsed = 1;
        handleChannelSwitch(timer, universes);
        emit currentStepChanged(m_currentStep);
    }
    else if (m_elapsed == 0)
    {
        // First step
        m_elapsed = 1;
        handleChannelSwitch(timer, universes);
        emit currentStepChanged(m_currentStep);
    }
    else if ((isAutoStep() && m_elapsed >= Bus::instance()->value(m_holdBusId))
             || m_next == true || m_previous == true)
    {
        // Next step
        if (m_direction == Function::Forward)
        {
            // "Previous" for a forwards chaser is -1
            if (m_previous == true)
                m_currentStep--;
            else
                m_currentStep++;
        }
        else
        {
            // "Previous" for a backwards scene is +1
            if (m_previous == true)
                m_currentStep++;
            else
                m_currentStep--;
        }

        if (roundCheck() == false)
            return false;

        m_elapsed = 1;
        m_next = false;
        m_previous = false;

        handleChannelSwitch(timer, universes);
        emit currentStepChanged(m_currentStep);
    }
    else
    {
        // Current step. UINT_MAX is the maximum hold time.
        if (m_elapsed < UINT_MAX)
            m_elapsed++;
    }

    QMutableMapIterator <quint32,FadeChannel> it(m_channelMap);
    while (it.hasNext() == true)
    {
        Scene* scene = qobject_cast<Scene*> (m_steps.at(m_currentStep));
        if (scene == NULL)
            continue;

        quint32 fadeTime = Bus::instance()->value(scene->busID());

        FadeChannel& channel(it.next().value());
        if (channel.current() == channel.target() && channel.group() != QLCChannel::Intensity)
        {
            /* Write the final value to LTP channels only once */
        }
        else
        {
            uchar value = uchar(floor((qreal(channel.calculateCurrent(fadeTime, m_elapsed)) * m_intensity) + 0.5));
            universes->write(channel.address(), value, channel.group());
        }
    }

    return true;
}
Exemple #4
0
bool ChaserRunner::write(MasterTimer* timer, UniverseArray* universes)
{
    Q_UNUSED(universes);

    // Nothing to do
    if (m_chaser->steps().size() == 0)
        return false;

    if (m_newCurrent != -1)
    {
        // Manually-set current step
        m_currentStep = m_newCurrent;
        m_newCurrent = -1;

        // No need to do roundcheck here, since manually-set steps are
        // always within m_chaser->steps() limits.

        m_elapsed = MasterTimer::tick();
        switchFunctions(timer);
        emit currentStepChanged(m_currentStep);
    }
    else if (m_elapsed == 0)
    {
        // First step
        m_elapsed = MasterTimer::tick();
        switchFunctions(timer);
        emit currentStepChanged(m_currentStep);
    }
    else if (m_next == true || m_previous == true ||
             (currentDuration() != Function::infiniteSpeed() && m_elapsed >= currentDuration()))
    {
        // Next step
        if (m_direction == Function::Forward)
        {
            // "Previous" for a forwards chaser is -1
            if (m_previous == true)
                m_currentStep--;
            else
                m_currentStep++;
        }
        else
        {
            // "Previous" for a backwards scene is +1
            if (m_previous == true)
                m_currentStep++;
            else
                m_currentStep--;
        }

        if (roundCheck() == false)
            return false;

        m_elapsed = MasterTimer::tick();
        m_next = false;
        m_previous = false;

        switchFunctions(timer);
        emit currentStepChanged(m_currentStep);
    }
    else
    {
        // Current step. UINT_MAX is the maximum hold time.
        if (m_elapsed < UINT_MAX)
            m_elapsed += MasterTimer::tick();
    }

    // When the speeds of the chaser change, they need to be updated to the lower
    // level (only current function) as well. Otherwise the new speeds would take
    // effect only on the next step change.
    if (m_updateOverrideSpeeds == true)
    {
        m_updateOverrideSpeeds = false;
        if (m_currentFunction != NULL)
        {
            m_currentFunction->setOverrideFadeInSpeed(currentFadeIn());
            m_currentFunction->setOverrideFadeOutSpeed(currentFadeOut());
        }
    }

    return true;
}
Exemple #5
0
void
ViewManager::next()
{
    ViewStep* step = m_steps.at( m_currentStep );
    bool installing = false;
    if ( step->isAtEnd() )
    {
        // Special case when the user clicks next on the very last page in the Prepare phase
        // and right before switching to the Install phase.
        // Depending on Calamares::Settings, we show an "are you sure" prompt or not.
        if ( Calamares::Settings::instance()->showPromptBeforeInstall() &&
             m_currentStep + 1 < m_steps.count() &&
             m_steps.at( m_currentStep + 1 ) == m_installationViewStep )
        {
            int reply =
                QMessageBox::question( m_widget,
                                       tr( "Continue with setup?" ),
                                       tr( "The %1 installer is about to make changes to your "
                                           "disk in order to install %2.<br/><strong>You will not be able "
                                           "to undo these changes.</strong>" )
                                       .arg( Calamares::Branding::instance()->string(
                                                Calamares::Branding::ShortProductName ) )
                                       .arg( Calamares::Branding::instance()->string(
                                                Calamares::Branding::ShortVersionedName ) ),
                                       tr( "&Install now" ),
                                       tr( "Go &back" ),
                                       QString(),
                                       0,
                                       1 );
            if ( reply == 1 )
                return;
        }

        m_currentStep++;
        m_stack->setCurrentIndex( m_currentStep );
        step->onLeave();
        m_steps.at( m_currentStep )->onActivate();
        installing = m_steps.at( m_currentStep ) == m_installationViewStep;
        emit currentStepChanged();
        if ( installing )
        {
            emit phaseChangeRequested( Calamares::Install );
            m_phase = Install;
            m_back->setEnabled( false );
            m_next->setEnabled( false );
            connect( Calamares::JobQueue::instance(), &Calamares::JobQueue::finished,
                     this, [this]
            {
                emit phaseChangeRequested( Calamares::PostInstall );
                m_phase = PostInstall;
                m_next->setEnabled( true );
            } );
        }
    }
    else
    {
        step->next();
    }

    m_next->setEnabled( !installing && m_steps.at( m_currentStep )->isNextEnabled() );
    m_back->setEnabled( !installing && m_steps.at( m_currentStep )->isBackEnabled() );

    if ( m_currentStep == m_steps.count() -1 &&
         m_steps.last()->isAtEnd() )
        m_quit->setText( tr( "&Quit" ) );
}