Example #1
0
void WizardLanguage::languageAccepted()
{
    qDebug() << Q_FUNC_INFO << "settingsLanguage: " << settingsLanguage << "choosenLanguage: " << choosenLanguage;

    if(choosenLanguage == SPANISH)
        QBook::settings().setValue("setting/language", "es");
    else if (choosenLanguage == ENGLISH)
        QBook::settings().setValue("setting/language", "en");
    else if (choosenLanguage == PORTUGUES)
        QBook::settings().setValue("setting/language", "pt");
    else if (choosenLanguage == CATALAN)
        QBook::settings().setValue("setting/language", "ca");
    else if (choosenLanguage == BASQUE)
        QBook::settings().setValue("setting/language", "eu");
    else if (choosenLanguage == GALICIAN)
        QBook::settings().setValue("setting/language", "gl");

    QBook::settings().setValue("setting/initial_lang_selection", false);

    if(settingsLanguage != choosenLanguage){

        PowerManagerLock* lock = PowerManager::getNewLock(this);
        lock->activate();
        QBookApp::instance()->disableUserEvents();
        QBookApp::instance()->showRestoringImage();
        Screen::getInstance()->lockScreen();

        QBook::settings().sync();
        ::sync();
        QTimer::singleShot(100, this, SLOT(quitApp()));
    }else
        emit languageSelected();
}
Example #2
0
WizardWelcome::WizardWelcome(QWidget* parent)
    : QBookForm(parent)
    , current_widget(0)
    , m_WizardLanguage(0)
    , m_WizardDateTime(0)
    , m_elfFinishWizard(0)
{
    qDebug() << Q_FUNC_INFO;
    setupUi(this);

    connect(nextStepBtn, SIGNAL(clicked()), this, SLOT(requestConnection()));
    connect(skipBtn, SIGNAL(clicked()), this, SLOT(skipWizard()));
    nextStepBtn->setFocus();

    if(QBook::settings().value("setting/initial_lang_selection",true).toBool())
    {
        if(!m_WizardLanguage)
            m_WizardLanguage = new WizardLanguage(this);


        connect(m_WizardLanguage, SIGNAL(languageSelected()), this, SLOT(hideLanguageSettings()));
        showElement(m_WizardLanguage);
    }
    if(QBookApp::instance()->isActivated())
    {
        intro3Lbl->hide();
        welcomeTitleLbl->setText(tr("Enlazar dispositivo"));
    }else
        intro3Lbl->show();

    // Check if: 1. language selection is needed, 2. initial power on for user is set and 3. Device has not been manually deactivated because of OTA
    if(!QBook::settings().value("setting/initial_lang_selection", true).toBool()&& QBook::settings().value("setting/initial",true).toBool()
            && !QBook::settings().value("setting/activated").isValid())
    {
        if(!m_WizardDateTime)
            m_WizardDateTime = new WizardDateTime(this);

        connect(m_WizardDateTime, SIGNAL(hideMe()), this, SLOT(hideWizardDateTime()));
        showElement(m_WizardDateTime);
    }
    QFile fileSpecific(":/res/wizard_styles.qss");
    QFile fileCommons(":/res/wizard_styles_generic.qss");
    fileSpecific.open(QFile::ReadOnly);
    fileCommons.open(QFile::ReadOnly);

    QString styles = QLatin1String(fileSpecific.readAll() + fileCommons.readAll());
    setStyleSheet(styles);
}
Example #3
0
void MainWindow::replyFinished(QNetworkReply *reply)
{
    QVariant mirrorRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
    this->mirrorURL = mirrorRedirectUrl.toString().remove("sync");
    utils::writeLog("Resolved mirror to " + this->mirrorURL);
    reply->deleteLater();
    ui->spinnerLabel->hide();
    /* Enumerating devices */
    QList<SupportedDevice *> devices = utils::buildDeviceList();
    ls = new LangSelection(this, devices);
    connect(ls, SIGNAL(languageSelected(QString, SupportedDevice)), this, SLOT(setLanguage(QString, SupportedDevice)));
    ls->move(WIDGET_START);
    ls->show();
    /* Check if an update exists */
    updater->isUpdateAvailable(mirrorURL);
}
// ----------------------------------------------------------------------------
// SifUiDialogSelectLanguage::handleAccepted()
// ----------------------------------------------------------------------------
//
void SifUiDialogSelectLanguage::handleAccepted()
{
    int index = selectedLanguageIndex();
    emit languageSelected(index);
    close();
}