Esempio n. 1
0
Module::Module(QWidget *parent, const QVariantList &args)
    : KCModule(parent, args)
    , ui(new Ui::Module)
    , m_manager(new DriverManager(this))
{
    KAboutData *aboutData = new KAboutData("kcm-driver-manager",
                                    i18n("Driver Manager"),
                                    global_s_versionStringFull,
                                    QStringLiteral(""),
                                    KAboutLicense::LicenseKey::GPL_V3,
                                    i18n("Copyright 2013 Rohan Garg"));

    aboutData->addAuthor(i18n("Rohan Garg"), i18n("Author"), QStringLiteral("*****@*****.**"));
    aboutData->addAuthor(i18n("Harald Sitter"), i18n("Qt 5 port"), QStringLiteral("*****@*****.**"));

    setAboutData(aboutData);

    // We have no help so remove the button from the buttons.
    setButtons(buttons() ^ KCModule::Help);

    ui->setupUi(this);
    ui->progressBar->setVisible(false);
    connect(ui->reloadButton, SIGNAL(clicked(bool)), SLOT(load()));

    m_overlay = new KPixmapSequenceOverlayPainter(this);
    m_overlay->setWidget(this);

#warning variable name
    QString label = xi18nc("@title/rich", "<title>Your computer requires no proprietary drivers</title>");
    m_label = new QLabel(label, this);
    m_label->hide();
    ui->driverOptionsVLayout->addWidget(m_label);

    //Debconf handling
    QString uuid = QUuid::createUuid().toString();
    uuid.remove('{').remove('}').remove('-');
    m_pipe = QDir::tempPath() % QLatin1String("/qapt-sock-") % uuid;
    m_debconfGui = new DebconfKde::DebconfGui(m_pipe, this);
    m_debconfGui->connect(m_debconfGui, SIGNAL(activated()), this, SLOT(showDebconf()));
    m_debconfGui->connect(m_debconfGui, SIGNAL(deactivated()), this, SLOT(hideDebconf()));
    m_debconfGui->hide();

    connect(m_manager, SIGNAL(refreshFailed()),
            this, SLOT(onRefreshFailed()));
    connect(m_manager, SIGNAL(devicesReady(DeviceList)),
            this, SLOT(onDevicesReady(DeviceList)));

    connect(m_manager, SIGNAL(changeProgressChanged(int)),
            this, SLOT(progressChanged(int)));
    connect(m_manager, SIGNAL(changeFinished()),
            this, SLOT(finished()));
    connect(m_manager, SIGNAL(changeFailed(QString)),
            this, SLOT(failed(QString)));
}
void HbSplashGenerator::doStart()
{
    qDebug() << PRE << "accessing theme";
    // Start listening to the theme-change-finished signal.
    HbTheme *theme = hbInstance->theme();
    connect(theme, SIGNAL(changeFinished()), SLOT(regenerate()));

    // Watch also the directories containing splashml files. Files may
    // be added/updated at any time.
    connect(&mFsWatcher, SIGNAL(directoryChanged(QString)), SLOT(onDirectoryChanged(QString)));
    foreach(const QString & dir, hbsplash_splashml_dirs()) {
        // Check for directory existence before calling addPath() to
        // avoid printing warnings.
        if (QDir(dir).exists()) {
            mFsWatcher.addPath(dir);
        }
    }

    // Regenerate screens on startup only when the theme, the language, the
    // number of files in the splash screen directory, or the splash screen
    // directory path is different than the recorded values. (or when
    // regeneration is forced via command line arg)
    QString lastTheme = mSettings->value(QLatin1String(last_theme_key)).toString();
    QString lastLang = mSettings->value(QLatin1String(last_lang_key)).toString();
    int lastFileCount = mSettings->value(QLatin1String(last_file_count_key)).toInt();
    QString lastOutputDir = mSettings->value(QLatin1String(last_output_dir_key)).toString();
    QString currentTheme = theme->name();
    QString currentLang = QLocale::system().name();
    QString currentOutputDir = hbsplash_output_dir();
    int currentFileCount = updateOutputDirContents(currentOutputDir);
    qDebug() << PRE << "last regen:" << lastTheme << lastLang << lastFileCount << lastOutputDir
             << "current:" << currentTheme << currentLang << currentFileCount << currentOutputDir;
    if (mForceRegen
            || currentFileCount == 0 // not having any files is wrong for sure
            || currentTheme != lastTheme
            || currentLang != lastLang
            || currentFileCount != lastFileCount
            || currentOutputDir != lastOutputDir) {
        QMetaObject::invokeMethod(this, "regenerate", Qt::QueuedConnection);
    }
}