Changeset 946f442ab0 in tspsg for src


Ignore:
Timestamp:
Jan 7, 2010, 3:48: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:
354e06314f
Parents:
f1fb54b9f7
Message:

+ Added the ability to select between using Native and Qt's File Dialog.

  • Updated translations to reflect changes.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/globals.h

    rf1fb54b9f7 r946f442ab0  
    4646//! Default number of cities
    4747#define DEF_NUM_CITIES 5
    48 //! Default value for generating fractional random values
     48/*!
     49 * \def DEF_USE_NATIVE_DIALOGS
     50 * \brief Default for "Use native file dialog".
     51 */
     52#ifdef Q_OS_WINCE
     53        #define DEF_USE_NATIVE_DIALOGS false
     54#else
     55        #define DEF_USE_NATIVE_DIALOGS true
     56#endif // Q_OS_WINCE
     57//! Default for "Automatically resize rows and columns to their contents"
     58#define DEF_AUTOSIZE true
     59//! Default for "Save main window state and position"
     60#define DEF_SAVEPOS false
     61//! Default for "Fractional random values"
    4962#define DEF_FRACTIONAL_RANDOM false
    50 //! Default value for showing or not solution step matrices
     63//! Default for "Show solution steps' matrices for every solution step"
    5164#define DEF_SHOW_MATRIX true
    52 //! Default value for using or not city limit for showing solution steps matrices
     65//! Default for "Show or hide solution steps' matrices based on number of cities in the task"
    5366#define DEF_USE_SHOW_MATRIX_LIMIT true
    54 //! Default maximum number of cities to show solution step matrices
    55 #define DEF_SHOW_MATRIX_CITY_LIMIT 15
    56 //! Default for scrolling to the end of output after solving
     67//! Default for "Maximum number of cities to show solution steps' matrices"
     68#define DEF_SHOW_MATRIX_LIMIT 15
     69//! Default for "Scroll to the end of output after solving"
    5770#define DEF_SCROLL_TO_END true
    5871//! Default font name
     
    114127// FUNCTIONS
    115128/*!
    116  * \brief Checks whether \a x contains an integer value
    117  * \param x A value to check
    118  * \return \c true if \a x countains an integer, oherwise \c false
     129 * \brief Checks whether \a x contains an integer value.
     130 * \param x A value to check.
     131 * \return \c true if \a x countains an integer, oherwise \c false.
    119132 */
    120133inline bool isInteger(double x)
  • src/mainwindow.cpp

    rf1fb54b9f7 r946f442ab0  
    6464        connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int)));
    6565
    66         if (settings->value("SavePos", false).toBool()) {
     66        if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
    6767                // Loading of saved window state
    6868                settings->beginGroup("MainWindow");
     
    129129        filters.append(trUtf8("All Files") + " (*)");
    130130
    131 #ifdef Q_OS_WINCE
    132         QString file = QFileDialog::getOpenFileName(this, trUtf8("Task Load"), QString(), filters.join(";;"), NULL, QFileDialog::DontUseNativeDialog);
    133 #else
    134 QString file = QFileDialog::getOpenFileName(this, trUtf8("Task Load"), QString(), filters.join(";;"));
    135 #endif // Q_OS_WINCE
     131QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog;
     132QString file = QFileDialog::getOpenFileName(this, trUtf8("Task Load"), QString(), filters.join(";;"), NULL, opts);
    136133        if (file.isEmpty() || !QFileInfo(file).isFile())
    137134                return;
     
    188185        filters.append(trUtf8("All Files") + " (*)");
    189186
    190 #ifdef Q_OS_WINCE
    191 QString file = QFileDialog::getSaveFileName(this, QString(), selectedFile, filters.join(";;"), NULL, QFileDialog::DontUseNativeDialog);
    192 #else
    193 QString file = QFileDialog::getSaveFileName(this, QString(), selectedFile, filters.join(";;"));
    194 #endif
     187QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog;
     188QString file = QFileDialog::getSaveFileName(this, QString(), selectedFile, filters.join(";;"), NULL, opts);
    195189        if (file.isEmpty())
    196190                return;
     
    421415                        if (n != spinCities->value()) {
    422416                                output.append("<p>" + trUtf8("Step #%1").arg(n++) + "</p>");
    423                                 if (settings->value("Output/ShowMatrix", DEF_SHOW_MATRIX).toBool() && settings->value("Output/UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT).toBool() && (spinCities->value() <= settings->value("Output/ShowMatrixCitiesLimit", DEF_SHOW_MATRIX_CITY_LIMIT).toInt())) {
     417                                if (settings->value("Output/ShowMatrix", DEF_SHOW_MATRIX).toBool() && settings->value("Output/UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT).toBool() && (spinCities->value() <= settings->value("Output/ShowMatrixLimit", DEF_SHOW_MATRIX_LIMIT).toInt())) {
    424418                                        outputMatrix(*step, output);
    425419                                }
     
    481475{
    482476        setWindowModified(true);
    483         if (settings->value("Autosize",true).toBool()) {
     477        if (settings->value("Autosize", DEF_AUTOSIZE).toBool()) {
    484478                for (int k = tl.row(); k <= br.row(); k++)
    485479                        taskView->resizeRowToContents(k);
     
    508502int count = tspmodel->numCities();
    509503        tspmodel->setNumCities(n);
    510         if ((n > count) && settings->value("Autosize",true).toBool())
     504        if ((n > count) && settings->value("Autosize", DEF_AUTOSIZE).toBool())
    511505                for (int k = count; k < n; k++) {
    512506                        taskView->resizeColumnToContents(k);
     
    525519
    526520        // Saving Main Window state
    527         if (settings->value("SavePos", false).toBool()) {
     521        if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
    528522                settings->beginGroup("MainWindow");
    529523#ifndef Q_OS_WINCE
     
    730724                file = QFileInfo(fileName).canonicalPath() + "/" + QFileInfo(fileName).completeBaseName() + ".tspt";
    731725
    732 #ifdef Q_OS_WINCE
    733         file = QFileDialog::getSaveFileName(this, trUtf8("Task Save"), file, filters.join(";;"), NULL, QFileDialog::DontUseNativeDialog);
    734 #else
    735         file = QFileDialog::getSaveFileName(this, trUtf8("Task Save"), file, filters.join(";;"));
    736 #endif // Q_OS_WINCE
     726QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog;
     727        file = QFileDialog::getSaveFileName(this, trUtf8("Task Save"), file, filters.join(";;"), NULL, opts);
    737728
    738729        if (file.isEmpty())
  • src/settingsdialog.cpp

    rf1fb54b9f7 r946f442ab0  
    6868        vbox2->addWidget(cbScrollToEnd);
    6969        vbox2->addWidget(cbAutosize);
     70        vbox2->addWidget(cbUseNativeDialogs);
    7071
    7172        // Output settings group
     
    108109        imgIcon->setLineWidth(0);
    109110        imgIcon->setPixmap(QPixmap(":/images/icons/preferences_system.png"));
    110         imgIcon->setStyleSheet("background-color: #0080C0;");
    111         imgIcon->setAlignment(Qt::AlignCenter);
     111        imgIcon->setStyleSheet("background-color: #0080C0; padding-top: 11px;");
     112        imgIcon->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
    112113        imgIcon->setMinimumWidth(150);
    113114
     
    150151        // Top right part (with white bg)
    151152        vbox2 = new QVBoxLayout(bgWhite);
    152         vbox2->addStretch();
     153//      vbox2->addStretch();
    153154        vbox2->addLayout(hbox2);
    154155        vbox2->addWidget(cbFractionalRandom);
     
    157158        vbox2->addWidget(cbScrollToEnd);
    158159        vbox2->addWidget(cbAutosize);
     160        vbox2->addWidget(cbUseNativeDialogs);
    159161        vbox2->addWidget(cbSaveState);
    160162        vbox2->addStretch();
     
    193195        spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt());
    194196        cbFractionalRandom->setChecked(settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool());
    195         cbAutosize->setChecked(settings->value("Autosize",true).toBool());
     197        cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool());
     198        cbUseNativeDialogs->setChecked(settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool());
    196199#ifndef Q_OS_WINCE
    197         cbSaveState->setChecked(settings->value("SavePos",false).toBool());
     200        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
    198201#endif // Q_OS_WINCE
    199202
     
    203206        cbCitiesLimit->setChecked(settings->value("UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT && cbShowMatrix->isChecked()).toBool());
    204207        spinCitiesLimit->setEnabled(cbShowMatrix->isChecked());
    205         spinCitiesLimit->setValue(settings->value("ShowMatrixCitiesLimit", DEF_SHOW_MATRIX_CITY_LIMIT).toInt());
     208        spinCitiesLimit->setValue(settings->value("ShowMatrixLimit", DEF_SHOW_MATRIX_LIMIT).toInt());
    206209        spinCitiesLimit->setMaximum(MAX_NUM_CITIES);
    207210        cbScrollToEnd->setChecked(settings->value("ScrollToEnd", DEF_SCROLL_TO_END).toBool());
     
    239242        settings->setValue("SavePos", cbSaveState->isChecked());
    240243#endif // Q_OS_WINCE
     244        settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked());
    241245        settings->setValue("Autosize", cbAutosize->isChecked());
    242246        settings->setValue("MinCost", spinRandMin->value());
     
    248252        settings->setValue("UseShowMatrixLimit", cbShowMatrix->isChecked() && cbCitiesLimit->isChecked());
    249253        if (cbCitiesLimit->isChecked())
    250                 settings->setValue("ShowMatrixCitiesLimit", spinCitiesLimit->value());
     254                settings->setValue("ShowMatrixLimit", spinCitiesLimit->value());
    251255        settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked());
    252256        if (newFont)
Note: See TracChangeset for help on using the changeset viewer.