Exemplo n.º 1
0
    bool Greeter::start() {
        // check flag
        if (m_started)
            return false;

        if (daemonApp->testing()) {
            // create process
            m_process = new QProcess(this);

            // delete process on finish
            connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished()));

            connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(onReadyReadStandardOutput()));
            connect(m_process, SIGNAL(readyReadStandardError()), SLOT(onReadyReadStandardError()));

            // log message
            qDebug() << "Greeter starting...";

            // set process environment
            QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
            env.insert("DISPLAY", m_display->name());
            env.insert("XAUTHORITY", m_authPath);
            env.insert("XCURSOR_THEME", mainConfig.Theme.CursorTheme.get());
            m_process->setProcessEnvironment(env);

            // start greeter
            QStringList args;
            if (daemonApp->testing())
                args << "--test-mode";
            args << "--socket" << m_socket
                 << "--theme" << m_theme;
            m_process->start(QString("%1/sddm-greeter").arg(BIN_INSTALL_DIR), args);

            //if we fail to start bail immediately, and don't block in waitForStarted
            if (m_process->state() == QProcess::NotRunning) {
                qCritical() << "Greeter failed to launch.";
                return false;
            }
            // wait for greeter to start
            if (!m_process->waitForStarted()) {
                // log message
                qCritical() << "Failed to start greeter.";

                // return fail
                return false;
            }

            // log message
            qDebug() << "Greeter started.";

            // set flag
            m_started = true;
        } else {
Exemplo n.º 2
0
void ArchiverProcess::onFinished(int code,UnixProcess::ExitStatus status) {
    setReadChannel(UnixProcess::StandardOutput);
    bool at_end = atEnd();
    setReadChannel(UnixProcess::StandardError);
    if (at_end && atEnd() && !isReading) {
        if (code != 0) {
            if (wasTerminated()) m_errors.clear();
            if (!m_errors.isEmpty()) emit error(m_errors);
            else emit error(((status == UnixProcess::CrashExit) && !wasTerminated())?FlushedProcess::errorString():"");
        }
        else emit finished();
        m_errors.clear();
        deleteLater();
        active_processes.removeAll(this);
    }
    else {
        if (!isReading) {
            onReadyReadStandardOutput();
            onReadyReadStandardError();
        }
        QMetaObject::invokeMethod(this,"onFinished",Qt::QueuedConnection,Q_ARG(int,code),Q_ARG(UnixProcess::ExitStatus,status));
    }
}
Exemplo n.º 3
0
    bool Greeter::start() {
        // check flag
        if (m_started)
            return false;

        // themes
        QString xcursorTheme = mainConfig.Theme.CursorTheme.get();
        if (m_themeConfig->contains(QLatin1String("cursorTheme")))
            xcursorTheme = m_themeConfig->value(QLatin1String("cursorTheme")).toString();
        QString platformTheme;
        if (m_themeConfig->contains(QLatin1String("platformTheme")))
            platformTheme = m_themeConfig->value(QLatin1String("platformTheme")).toString();
        QString style;
        if (m_themeConfig->contains(QLatin1String("style")))
            style = m_themeConfig->value(QLatin1String("style")).toString();

        // greeter command
        QStringList args;
        args << QLatin1String("--socket") << m_socket
             << QLatin1String("--theme") << m_themePath;
        if (!platformTheme.isEmpty())
            args << QLatin1String("-platformtheme") << platformTheme;
        if (!style.isEmpty())
            args << QLatin1String("-style") << style;

        if (daemonApp->testing()) {
            // create process
            m_process = new QProcess(this);

            // delete process on finish
            connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished()));

            connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(onReadyReadStandardOutput()));
            connect(m_process, SIGNAL(readyReadStandardError()), SLOT(onReadyReadStandardError()));

            // log message
            qDebug() << "Greeter starting...";

            // set process environment
            QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
            env.insert(QStringLiteral("DISPLAY"), m_display->name());
            env.insert(QStringLiteral("XAUTHORITY"), m_authPath);
            env.insert(QStringLiteral("XCURSOR_THEME"), xcursorTheme);
            env.insert(QStringLiteral("QT_IM_MODULE"), mainConfig.InputMethod.get());
            m_process->setProcessEnvironment(env);

            // start greeter
            if (daemonApp->testing())
                args << QStringLiteral("--test-mode");
            m_process->start(QStringLiteral("%1/sddm-greeter").arg(QStringLiteral(BIN_INSTALL_DIR)), args);

            //if we fail to start bail immediately, and don't block in waitForStarted
            if (m_process->state() == QProcess::NotRunning) {
                qCritical() << "Greeter failed to launch.";
                return false;
            }
            // wait for greeter to start
            if (!m_process->waitForStarted()) {
                // log message
                qCritical() << "Failed to start greeter.";

                // return fail
                return false;
            }

            // log message
            qDebug() << "Greeter started.";

            // set flag
            m_started = true;
        } else {
Exemplo n.º 4
0
void ArchiverProcess::init_connections() {
    connect(this,SIGNAL(error(UnixProcess::ProcessError)),this,SLOT(onError(UnixProcess::ProcessError)));
    connect(this,SIGNAL(finished(int,UnixProcess::ExitStatus)),this,SLOT(onFinished(int,UnixProcess::ExitStatus)),Qt::QueuedConnection);
    connect(this,SIGNAL(readyReadStandardError()),this,SLOT(onReadyReadStandardError()));
    connect(this,SIGNAL(readyReadStandardOutput()),this,SLOT(onReadyReadStandardOutput()));
}