SessionConfigWindow::SessionConfigWindow() :
    LxQt::ConfigDialog(tr("LXQt Session Settings"), new LxQt::Settings("session"), 0)
{
    BasicSettings* basicSettings = new BasicSettings(mSettings, this);
    addPage(basicSettings, tr("Basic Settings"), "preferences-desktop-display-color");
    connect(basicSettings, SIGNAL(needRestart()), SLOT(setRestart()));
    connect(this, SIGNAL(reset()), basicSettings, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), basicSettings, SLOT(save()));

    DefaultApps* defaultApps = new DefaultApps(this);
    addPage(defaultApps, tr("Default Applications"), "preferences-desktop-filetype-association");

    AutoStartPage* autoStart = new AutoStartPage(this);
    addPage(autoStart, tr("Autostart"), "preferences-desktop-launch-feedback");
    connect(this, SIGNAL(reset()), autoStart, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), autoStart, SLOT(save()));

    EnvironmentPage* environmentPage = new EnvironmentPage(mSettings, this);
    addPage(environmentPage, tr("Environment (Advanced)"), "preferences-system-session-services");
    connect(environmentPage, SIGNAL(needRestart()), SLOT(setRestart()));
    connect(this, SIGNAL(reset()), environmentPage, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), environmentPage, SLOT(save()));

    // sync Default Apps and Environment
    connect(environmentPage, SIGNAL(envVarChanged(QString,QString)),
            defaultApps, SLOT(updateEnvVar(QString,QString)));
    connect(defaultApps, SIGNAL(defaultAppChanged(QString,QString)),
            environmentPage, SLOT(updateItem(QString,QString)));
    environmentPage->restoreSettings();
    connect(this, SIGNAL(reset()), SLOT(clearRestart()));
    m_restart = false;
}
Esempio n. 2
0
void Field::changeSettings(int rows, int cols , int mines) {
    this->rows = rows;
    this->cols = cols;
    this->mines = mines;
    saveSettings();
    emit needRestart();
}
Esempio n. 3
0
void Field::defeatGame() {
    Defeat* defeat = new Defeat;
    connect(defeat->findChild<QPushButton*>("play_againBtn"), SIGNAL(clicked()),
            SIGNAL(needRestart()));
#ifdef QT_NO_DEBUG
    connect(defeat, SIGNAL(finished(int)),
            SIGNAL(needRestart()));
#endif
    connect(defeat->findChild<QPushButton*>("play_againBtn"), SIGNAL(clicked()),
            defeat, SLOT(close()));
    int bestTime = 0;

    if (rows == 9  && cols == 9  && mines == 10) {
        bestTime = bestBeginnerTime;
    } else if(rows == 16 && cols == 16 && mines == 40) {
        bestTime = bestIntermediateTime;
    } else if(rows == 16 && cols == 30 && mines == 99) {
        bestTime = bestAdvancedTime;
    }

    gamesPlayed++;

    if(bestTime) {
        defeat->setBestTime(bestTime);
    } else {
        defeat->findChild<QLabel*>("bestTime")->deleteLater();
    }

    defeat->setTime(time);
    defeat->setDate(date);
    defeat->setPlayedGames(gamesPlayed);
    defeat->setWonGames(gamesWon);
    defeat->setPercentage(static_cast<float>(gamesWon) / gamesPlayed * 100);
    defeat->show();
}
Esempio n. 4
0
void EnvironmentPage::addButton_clicked()
{
    QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget, QStringList() << "" << "");
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    ui->treeWidget->addTopLevelItem(item);
    ui->treeWidget->setCurrentItem(item);
    emit needRestart();
}
Esempio n. 5
0
void MenuConfig::chooseMenuFile()
{
    QString path = QFileDialog::getOpenFileName(this, tr("Choose menu file"), QDir::homePath(), tr("Menu files (*.menu)"));
    if (!path.isEmpty())
    {
        ui->menuFilePathLE->setText(path);
        mSettings->setValue("menu_file", ui->menuFilePathLE->text());
        emit needRestart();
    }
}
Esempio n. 6
0
void AutoStartPage::save()
{
    bool doRestart = false;

    /*
     * Get the previous settings
     */
    QMap<QString, AutostartItem> previousItems(AutostartItem::createItemMap());
    QMutableMapIterator<QString, AutostartItem> i(previousItems);
    while (i.hasNext()) {
        i.next();
        if (AutostartUtils::isLXQtModule(i.value().file()))
            i.remove();
    }


    /*
     * Get the settings from the Ui
     */
    QMap<QString, AutostartItem> currentItems = mXdgAutoStartModel->items();
    QMutableMapIterator<QString, AutostartItem> j(currentItems);

    while (j.hasNext()) {
        j.next();
        if (AutostartUtils::isLXQtModule(j.value().file()))
            j.remove();
    }


    /* Compare the settings */

    if (previousItems.count() != currentItems.count())
    {
        doRestart = true;
    }
    else
    {
        QMap<QString, AutostartItem>::const_iterator k = currentItems.constBegin();
        while (k != currentItems.constEnd())
        {
            if (previousItems.contains(k.key()))
            {
                if (k.value().file() != previousItems.value(k.key()).file())
                {
                    doRestart = true;
                    break;
                }
            }
            else
            {
                doRestart = true;
                break;
            }
            ++k;
        }
    }

    if (doRestart)
        emit needRestart();

    mXdgAutoStartModel->writeChanges();
}
Esempio n. 7
0
void BasicSettings::save()
{
    /*  If the setting actually changed:
     *      * Save the setting
     *      * Emit a needsRestart signal
     */

    bool doRestart = false;
    const QString windowManager = ui->wmComboBox->currentText();
    const bool leaveConfirmation = ui->leaveConfirmationCheckBox->isChecked();
    const bool lockBeforePowerActions = ui->lockBeforePowerActionsCheckBox->isChecked();
    const int powerAfterLockDelay = ui->powerAfterLockDelaySpinBox->value();

    QMap<QString, AutostartItem> previousItems(AutostartItem::createItemMap());
    QMutableMapIterator<QString, AutostartItem> i(previousItems);
    while (i.hasNext()) {
        i.next();
        if (!AutostartUtils::isLXQtModule(i.value().file()))
            i.remove();
    }


    if (windowManager != m_settings->value(windowManagerKey, openboxValue).toString())
    {
        m_settings->setValue(windowManagerKey, windowManager);
        doRestart = true;
    }


    if (leaveConfirmation != m_settings->value(leaveConfirmationKey, false).toBool())
    {
        m_settings->setValue(leaveConfirmationKey, leaveConfirmation);
        doRestart = true;
    }

    if (lockBeforePowerActions != m_settings->value(lockBeforePowerActionsKey, true).toBool())
    {
        m_settings->setValue(lockBeforePowerActionsKey, lockBeforePowerActions);
        doRestart = true;
    }

    if (powerAfterLockDelay != m_settings->value(powerActionsAfterLockDelayKey, 0).toInt())
    {
        m_settings->setValue(powerActionsAfterLockDelayKey, powerAfterLockDelay);
        doRestart = true;
    }

    QMap<QString, AutostartItem> currentItems = m_moduleModel->items();
    QMap<QString, AutostartItem>::const_iterator k = currentItems.constBegin();
    while (k != currentItems.constEnd())
    {
        if (previousItems.contains(k.key()))
        {
            if (k.value().file() != previousItems.value(k.key()).file())
            {
                doRestart = true;
                break;
            }
        }
        else
        {
            doRestart = true;
            break;
        }
        ++k;
    }

    if (doRestart)
        emit needRestart();

    m_moduleModel->writeChanges();
}