Пример #1
0
void CoreEngine::timerEvent(QTimerEvent* te)
{
    // Fetch away the debug events and notify if debuggee
    // stops. Note that IDebugEventCallback does not
    // cover all cases of a debuggee stopping execution
    // (such as step over,etc).
    if (te->timerId() != m_watchTimer)
        return;
    switch (waitForEvent(1)) {
        case S_OK:
            killWatchTimer();
            emit watchTimerDebugEvent();
            break;
        case S_FALSE:
            // Detect startup (all modules loaded) if the module
            // count no longer changes in a time-out.
            if (!m_modulesLoadedEmitted) {
                const int newModuleCount = moduleCount();
                if (newModuleCount && newModuleCount == m_lastTimerModuleCount) {
                    m_modulesLoadedEmitted = true;
                    emit modulesLoaded();
                } else {
                    m_lastTimerModuleCount = newModuleCount;
                }
            }
            break;
        case E_PENDING:
        case E_FAIL:
            break;
        case E_UNEXPECTED: // Occurs on ExitProcess.
            killWatchTimer();
            break;
    }
}
Пример #2
0
void
ModuleManager::loadModules( Phase phase )
{
    //FIXME: When we depend on Qt 5.4 this ugly hack should be replaced with
    //       QTimer::singleShot.
    QTimer* timer = new QTimer();
    timer->setSingleShot( true );
    connect( timer, &QTimer::timeout,
             this, [ this, timer, phase ]()
    {
        foreach ( const QString& moduleName, Settings::instance()->modules( phase ) )
        {
            if ( !m_availableModules.contains( moduleName ) )
            {
                cDebug() << "Module" << moduleName << "not found in module search paths."
                         << "\nCalamares will now quit.";
                qApp->exit( 1 );
                return;
            }
            if ( m_availableModules.value( moduleName )->isLoaded() )
            {
                cDebug() << "Module" << moduleName << "already loaded.";
                continue;
            }

            doLoad( moduleName );
        }
        emit modulesLoaded( phase );
        // Loading sequence:
        // 1) deps are already fine. check if we have all the modules needed by the roster
        // 2) ask ModuleManager to load them from the list provided by Settings
        // 3) MM must load them asyncly but one at a time, by calling Module::loadSelf
        // 4) Module must have subclasses that reimplement loadSelf for various module types

        timer->deleteLater();
    });