Example #1
0
void search_widget::load() {
    model->load();
    Preferences pref;
    pref.beginGroup("SearchWidget");
    checkPlus->setChecked(pref.value("CheckPlus", true).toBool());
    checkOwn->setChecked(pref.value("CheckOwn", true).toBool());

    if (pref.contains("SeachListHeader")) {
        treeResult->header()->restoreState(pref.value("SeachListHeader").toByteArray());
    }

    if (pref.value("defMegas", false).toBool()) {
        //defMegas->setChecked(true);
    }

    if (pref.value("defValue", true).toBool()) {
        //defValue->setChecked(true);
    }

    if (pref.value("defKilos", false).toBool()) {
        //defKilos->setChecked(true);
    }

    int size = pref.beginReadArray("Tabs");

    for (int i = 0; i < size; ++i) {
        pref.setArrayIndex(i);
        QString title = pref.value("Title", QString()).toString();
        qDebug() << "load " << title;
        tabSearch->addTab(QIcon(res::searchResult()), title);
    }

    pref.endArray();

    int currentTab = pref.value("CurrentTab", -1).toInt();
    if (currentTab < tabSearch->count()) {
        tabSearch->setCurrentIndex(currentTab);
    }

    // restore comboName
    size = pref.beginReadArray("ComboNames");
    for (int i = 0; i < size; ++i)
    {
        pref.setArrayIndex(i);
        comboName->addItem(pref.value("CName", QString()).toString());
    }

    pref.endArray();
    comboName->setCurrentIndex(-1);
    pref.endGroup();

    if (tabSearch->count() != 0) tabSearch->show();
}
Example #2
0
void MainWindow::readSettings()
{
    Preferences pref;
    pref.beginGroup(QString::fromUtf8("MainWindow"));

    if(pref.contains("geometry")) {
        if(restoreGeometry(pref.value("geometry").toByteArray()))
            m_posInitialized = true;
    }

    stackedWidget->setCurrentIndex(pref.value("CurrentTab", wTransfer).toInt());

    pref.endGroup();
}