- Timestamp:
- Jan 7, 2010, 3:48:24 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/globals.h
r81 r82 46 46 //! Default number of cities 47 47 #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" 49 62 #define DEF_FRACTIONAL_RANDOM false 50 //! Default value for showing or not solution step matrices63 //! Default for "Show solution steps' matrices for every solution step" 51 64 #define DEF_SHOW_MATRIX true 52 //! Default value for using or not city limit for showing solution steps matrices65 //! Default for "Show or hide solution steps' matrices based on number of cities in the task" 53 66 #define DEF_USE_SHOW_MATRIX_LIMIT true 54 //! Default maximum number of cities to show solution step matrices55 #define DEF_SHOW_MATRIX_ CITY_LIMIT 1556 //! Default for scrolling to the end of output after solving67 //! 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" 57 70 #define DEF_SCROLL_TO_END true 58 71 //! Default font name … … 114 127 // FUNCTIONS 115 128 /*! 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. 119 132 */ 120 133 inline bool isInteger(double x) -
trunk/src/mainwindow.cpp
r81 r82 64 64 connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int))); 65 65 66 if (settings->value("SavePos", false).toBool()) {66 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 67 67 // Loading of saved window state 68 68 settings->beginGroup("MainWindow"); … … 129 129 filters.append(trUtf8("All Files") + " (*)"); 130 130 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 131 QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog; 132 QString file = QFileDialog::getOpenFileName(this, trUtf8("Task Load"), QString(), filters.join(";;"), NULL, opts); 136 133 if (file.isEmpty() || !QFileInfo(file).isFile()) 137 134 return; … … 188 185 filters.append(trUtf8("All Files") + " (*)"); 189 186 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 187 QFileDialog::Options opts = settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog; 188 QString file = QFileDialog::getSaveFileName(this, QString(), selectedFile, filters.join(";;"), NULL, opts); 195 189 if (file.isEmpty()) 196 190 return; … … 421 415 if (n != spinCities->value()) { 422 416 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/ShowMatrix CitiesLimit", 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())) { 424 418 outputMatrix(*step, output); 425 419 } … … 481 475 { 482 476 setWindowModified(true); 483 if (settings->value("Autosize", true).toBool()) {477 if (settings->value("Autosize", DEF_AUTOSIZE).toBool()) { 484 478 for (int k = tl.row(); k <= br.row(); k++) 485 479 taskView->resizeRowToContents(k); … … 508 502 int count = tspmodel->numCities(); 509 503 tspmodel->setNumCities(n); 510 if ((n > count) && settings->value("Autosize", true).toBool())504 if ((n > count) && settings->value("Autosize", DEF_AUTOSIZE).toBool()) 511 505 for (int k = count; k < n; k++) { 512 506 taskView->resizeColumnToContents(k); … … 525 519 526 520 // Saving Main Window state 527 if (settings->value("SavePos", false).toBool()) {521 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 528 522 settings->beginGroup("MainWindow"); 529 523 #ifndef Q_OS_WINCE … … 730 724 file = QFileInfo(fileName).canonicalPath() + "/" + QFileInfo(fileName).completeBaseName() + ".tspt"; 731 725 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 726 QFileDialog::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); 737 728 738 729 if (file.isEmpty()) -
trunk/src/settingsdialog.cpp
r81 r82 68 68 vbox2->addWidget(cbScrollToEnd); 69 69 vbox2->addWidget(cbAutosize); 70 vbox2->addWidget(cbUseNativeDialogs); 70 71 71 72 // Output settings group … … 108 109 imgIcon->setLineWidth(0); 109 110 imgIcon->setPixmap(QPixmap(":/images/icons/preferences_system.png")); 110 imgIcon->setStyleSheet("background-color: #0080C0; ");111 imgIcon->setAlignment(Qt::Align Center);111 imgIcon->setStyleSheet("background-color: #0080C0; padding-top: 11px;"); 112 imgIcon->setAlignment(Qt::AlignTop | Qt::AlignHCenter); 112 113 imgIcon->setMinimumWidth(150); 113 114 … … 150 151 // Top right part (with white bg) 151 152 vbox2 = new QVBoxLayout(bgWhite); 152 vbox2->addStretch();153 // vbox2->addStretch(); 153 154 vbox2->addLayout(hbox2); 154 155 vbox2->addWidget(cbFractionalRandom); … … 157 158 vbox2->addWidget(cbScrollToEnd); 158 159 vbox2->addWidget(cbAutosize); 160 vbox2->addWidget(cbUseNativeDialogs); 159 161 vbox2->addWidget(cbSaveState); 160 162 vbox2->addStretch(); … … 193 195 spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt()); 194 196 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()); 196 199 #ifndef Q_OS_WINCE 197 cbSaveState->setChecked(settings->value("SavePos", false).toBool());200 cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool()); 198 201 #endif // Q_OS_WINCE 199 202 … … 203 206 cbCitiesLimit->setChecked(settings->value("UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT && cbShowMatrix->isChecked()).toBool()); 204 207 spinCitiesLimit->setEnabled(cbShowMatrix->isChecked()); 205 spinCitiesLimit->setValue(settings->value("ShowMatrix CitiesLimit", DEF_SHOW_MATRIX_CITY_LIMIT).toInt());208 spinCitiesLimit->setValue(settings->value("ShowMatrixLimit", DEF_SHOW_MATRIX_LIMIT).toInt()); 206 209 spinCitiesLimit->setMaximum(MAX_NUM_CITIES); 207 210 cbScrollToEnd->setChecked(settings->value("ScrollToEnd", DEF_SCROLL_TO_END).toBool()); … … 239 242 settings->setValue("SavePos", cbSaveState->isChecked()); 240 243 #endif // Q_OS_WINCE 244 settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked()); 241 245 settings->setValue("Autosize", cbAutosize->isChecked()); 242 246 settings->setValue("MinCost", spinRandMin->value()); … … 248 252 settings->setValue("UseShowMatrixLimit", cbShowMatrix->isChecked() && cbCitiesLimit->isChecked()); 249 253 if (cbCitiesLimit->isChecked()) 250 settings->setValue("ShowMatrix CitiesLimit", spinCitiesLimit->value());254 settings->setValue("ShowMatrixLimit", spinCitiesLimit->value()); 251 255 settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked()); 252 256 if (newFont)
Note: See TracChangeset
for help on using the changeset viewer.