Changeset 1757eb594b in tspsg for src/settingsdialog.cpp


Ignore:
Timestamp:
Jan 12, 2010, 3:11:24 PM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
fcd8c1e4c1
Parents:
64f288c0f8
Message:

+ Added Fractional accuracy (in decimail places) to settings.
+ Created defaults.h file. Moved all default defines there.

  • Replaced all double types with qreal.
  • Replaced all calls to trUtf8() with tr() as we use setCodecForTr() to set UTF-8 encoding as default and tr() is enough.
  • Replaced all 2009 with 2010 in copyrights.
  • Fixed an error when loading .zkt file with less than 5 cities.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/settingsdialog.cpp

    r64f288c0f8 r1757eb594b  
    11/*
    22 *  TSPSG: TSP Solver and Generator
    3  *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
     3 *  Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    3434{
    3535        setupUi(this);
    36         // Laying out elements
    37 /*      layoutCitiesLimit = new QHBoxLayout();
    38         layoutCitiesLimit->setMargin(0);
    39         layoutCitiesLimit->setSpacing(0);
    40         layoutCitiesLimit->addSpacing(10);
    41         layoutCitiesLimit->addWidget(cbCitiesLimit);
    42         layoutCitiesLimit->addWidget(spinCitiesLimit);
    43         layoutCitiesLimit->addStretch();
    44 */
     36
    4537        buttonBox->button(QDialogButtonBox::Save)->setIcon(QIcon(":/images/icons/button_ok.png"));
    46         buttonBox->button(QDialogButtonBox::Save)->setStatusTip(trUtf8("Save new preferences"));
     38        buttonBox->button(QDialogButtonBox::Save)->setStatusTip(tr("Save new preferences"));
    4739        buttonBox->button(QDialogButtonBox::Save)->setCursor(QCursor(Qt::PointingHandCursor));
    4840        buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":/images/icons/button_cancel.png"));
    49         buttonBox->button(QDialogButtonBox::Cancel)->setStatusTip(trUtf8("Close without saving preferences"));
     41        buttonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Close without saving preferences"));
    5042        buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor));
    5143
     
    8072        cbSaveState->setObjectName("cbSaveState");
    8173#ifndef QT_NO_STATUSTIP
    82         cbSaveState->setStatusTip(trUtf8("Restore main window state and position on application restart"));
     74        cbSaveState->setStatusTip(tr("Restore main window state and position on application restart"));
    8375#endif // QT_NO_STATUSTIP
    84         cbSaveState->setText(trUtf8("Save main window state and position"));
     76        cbSaveState->setText(tr("Save main window state and position"));
    8577        cbSaveState->setCursor(QCursor(Qt::PointingHandCursor));
    8678
     
    10597        labelHint->setWordWrap(true);
    10698#ifndef QT_NO_STATUSTIP
    107         labelHint->setStatusTip(trUtf8("Hover mouse pointer over dialog elements to get additional help"));
     99        labelHint->setStatusTip(tr("Hover mouse pointer over dialog elements to get additional help"));
    108100#endif // QT_NO_STATUSTIP
    109101
     
    121113
    122114        vbox1 = static_cast<QVBoxLayout *>(tabGeneral->layout());
    123         vbox1->insertWidget(vbox2->indexOf(cbUseNativeDialogs) + 1, cbSaveState);
     115        vbox1->insertWidget(vbox1->indexOf(cbUseNativeDialogs) + 1, cbSaveState);
    124116
    125117        // Bottom part (with grey bg)
     
    152144        settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this);
    153145
    154         spinRandMin->setMaximum(MAX_RAND_VALUE);
    155         spinRandMin->setValue(settings->value("MinCost",DEF_RAND_MIN).toInt());
    156         spinRandMax->setMaximum(MAX_RAND_VALUE);
    157         spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt());
    158         cbFractionalRandom->setChecked(settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool());
    159146        cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool());
    160147        cbUseNativeDialogs->setChecked(settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool());
     
    162149        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
    163150#endif // Q_OS_WINCE
     151
     152        settings->beginGroup("Task");
     153        spinFractionalAccuracy->setValue(settings->value("FractionalAccuracy", DEF_FRACTIONAL_ACCURACY).toInt());
     154        spinRandMin->setMaximum(MAX_RAND_VALUE);
     155        spinRandMin->setValue(settings->value("RandMin",DEF_RAND_MIN).toInt());
     156        spinRandMax->setMaximum(MAX_RAND_VALUE);
     157        spinRandMax->setValue(settings->value("RandMax",DEF_RAND_MAX).toInt());
     158        cbFractionalRandom->setChecked(settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool());
     159        settings->endGroup();
    164160
    165161        settings->beginGroup("Output");
     
    206202        settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked());
    207203        settings->setValue("Autosize", cbAutosize->isChecked());
    208         settings->setValue("MinCost", spinRandMin->value());
    209         settings->setValue("MaxCost", spinRandMax->value());
     204
     205        settings->beginGroup("Task");
     206        settings->setValue("FractionalAccuracy", spinFractionalAccuracy->value());
     207        settings->setValue("RandMin", spinRandMin->value());
     208        settings->setValue("RandMax", spinRandMax->value());
    210209        settings->setValue("FractionalRandom", cbFractionalRandom->isChecked());
     210        settings->endGroup();
    211211
    212212        settings->beginGroup("Output");
Note: See TracChangeset for help on using the changeset viewer.