Changeset f5c945d7ac in tspsg for src/settingsdialog.cpp


Ignore:
Timestamp:
Sep 29, 2010, 11:21:46 PM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
0007f69c46
Parents:
131c5fc3ba
git-author:
Oleksii Serdiuk <contacts@…> (09/29/10 23:21:46)
git-committer:
Oleksii Serdiuk <contacts@…> (06/29/12 19:45:57)
Message:

+ Automatically check for updates at the given interval functionality (Windows only at this moment).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/settingsdialog.cpp

    r131c5fc3ba rf5c945d7ac  
    7272        connect(cbShowGraph, SIGNAL(toggled(bool)), cbHQGraph, SLOT(setEnabled(bool)));
    7373#endif
     74
     75        if (hasUpdater()) {
     76                cbCheck4Updates = new QCheckBox(bgWhite);
     77                cbCheck4Updates->setObjectName("cbCheck4Updates");
     78#ifndef QT_NO_STATUSTIP
     79                cbCheck4Updates->setStatusTip(tr("Automatically check for updates at the given interval"));
     80#endif // QT_NO_STATUSTIP
     81                cbCheck4Updates->setText(tr("Check for updates every"));
     82                cbCheck4Updates->setCursor(QCursor(Qt::PointingHandCursor));
     83
     84                spinUpdateCheckInterval = new QSpinBox(bgWhite);
     85                spinUpdateCheckInterval->setObjectName("spinUpdateCheckInterval");
     86#ifndef QT_NO_STATUSTIP
     87                spinUpdateCheckInterval->setStatusTip(tr("Minimal interval at which to check for updates"));
     88#endif // QT_NO_STATUSTIP
     89                spinUpdateCheckInterval->setSuffix(tr(" days", "Don't forget a space at the beginning!"));
     90                spinUpdateCheckInterval->setRange(1, 365);
     91                spinUpdateCheckInterval->setCursor(QCursor(Qt::PointingHandCursor));
     92
     93                connect(cbCheck4Updates, SIGNAL(toggled(bool)), spinUpdateCheckInterval, SLOT(setEnabled(bool)));
     94
     95                box = static_cast<QBoxLayout *>(tabGeneral->layout());
     96                hbox1 = new QHBoxLayout();
     97                hbox1->setSpacing(0);
     98                hbox1->addWidget(cbCheck4Updates);
     99                hbox1->addWidget(spinUpdateCheckInterval);
     100                hbox1->addStretch();
     101                box->insertLayout(box->indexOf(cbUseNativeDialogs) + 1, hbox1);
     102        } else
     103                cbCheck4Updates = NULL;
    74104
    75105#ifdef HANDHELD
     
    209239        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
    210240#endif // HANDHELD
     241        if (cbCheck4Updates != NULL) {
     242                settings->beginGroup("Check4Updates");
     243                cbCheck4Updates->setChecked(settings->value("Enabled", DEF_CHECK_FOR_UPDATES).toBool());
     244                spinUpdateCheckInterval->setValue(settings->value("Interval", DEF_UPDATE_CHECK_INTERVAL).toInt());
     245                settings->endGroup();
     246                spinUpdateCheckInterval->setEnabled(cbCheck4Updates->isChecked());
     247        }
    211248
    212249        settings->beginGroup("Task");
     
    231268        comboGraphImageFormat->addItem("svg");
    232269#endif // NOSVG && QT_VERSION >= 0x040500
    233 // We create a whitelist of formats, supported by the most popular web browsers according to
    234 //  http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support
    235 //  + TIFF format (there are plugins to support it).
     270        // We create whitelist of formats, supported by the most popular web browsers according to
     271        //  http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support
     272        //  + TIFF format (there are plugins to support it).
    236273QStringList whitelist;
    237274        whitelist << "bmp" << "jpeg" << "png" << "tiff" << "xbm";
     
    327364        settings->setValue("SavePos", cbSaveState->isChecked());
    328365#endif // HANDHELD
     366        if (cbCheck4Updates != NULL) {
     367                settings->beginGroup("Check4Updates");
     368                settings->setValue("Enabled", cbCheck4Updates->isChecked());
     369                if (cbCheck4Updates->isChecked())
     370                        settings->setValue("Interval", spinUpdateCheckInterval->value());
     371                settings->endGroup();
     372        }
    329373
    330374        settings->beginGroup("Task");
Note: See TracChangeset for help on using the changeset viewer.