Changeset 278bc7818f in tspsg
- Timestamp:
- Feb 27, 2010, 2:13:50 PM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 162d5c5f94
- Parents:
- b2bf8e3b6b
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
rb2bf8e3b6b r278bc7818f 45 45 #endif // Q_OS_WINCE 46 46 //! Default for "Save main window state and position" 47 #define DEF_SAVEPOS false47 #define DEF_SAVEPOS true 48 48 //! Default for "Use translucency effects in Vista/7" 49 49 #define DEF_USE_TRANSLUCENCY true … … 58 58 //! Default for "Fractional random values" 59 59 #define DEF_FRACTIONAL_RANDOM false 60 //! Default for "Symmetric tasks mode" 61 #define DEF_SYMMETRIC_MODE false 60 62 61 63 //////// OUTPUT … … 67 69 #define DEF_SHOW_MATRIX_LIMIT 15 68 70 //! Default for "Scroll to the end of output after solving" 69 #define DEF_SCROLL_TO_END true71 #define DEF_SCROLL_TO_END false 70 72 /*! 71 73 * \def DEF_FONT_FAMILY -
src/mainwindow.cpp
rb2bf8e3b6b r278bc7818f 71 71 72 72 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 73 // Centering main window 74 QRect rect = geometry(); 75 rect.moveCenter(QApplication::desktop()->availableGeometry(this).center()); 76 setGeometry(rect); 73 77 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 74 78 // Loading of saved window state … … 77 81 restoreState(settings->value("State").toByteArray()); 78 82 settings->endGroup(); 79 } else {80 // Centering main window81 QRect rect = geometry();82 rect.moveCenter(QApplication::desktop()->availableGeometry(this).center());83 setGeometry(rect);84 83 } 85 84 #else … … 500 499 501 500 #ifdef Q_OS_WINCE 501 void MainWindow::changeEvent(QEvent *ev) 502 { 503 if ((ev->type() == QEvent::ActivationChange) && isActiveWindow()) 504 desktopResized(0); 505 506 QWidget::changeEvent(ev); 507 } 508 502 509 void MainWindow::desktopResized(int screen) 503 510 { 504 if ( screen != 0)511 if ((screen != 0) || !isActiveWindow()) 505 512 return; 506 513 507 514 QRect availableGeometry = QApplication::desktop()->availableGeometry(0); 508 515 if (currentGeometry != availableGeometry) { 516 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 509 517 /*! 510 518 * \hack HACK: This hack checks whether \link QDesktopWidget::availableGeometry() availableGeometry()\endlink's \c top + \c hegiht = \link QDesktopWidget::screenGeometry() screenGeometry()\endlink's \c height. … … 519 527 setGeometry(availableGeometry); 520 528 } 521 } 522 currentGeometry = availableGeometry; 529 currentGeometry = availableGeometry; 530 QApplication::restoreOverrideCursor(); 531 } 523 532 } 524 533 #endif // Q_OS_WINCE … … 557 566 return; 558 567 } 559 settings->setValue("NumCities", spinCities->value()); 560 561 // Saving Main Window state 562 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 563 settings->beginGroup("MainWindow"); 568 if (!settings->value("SettingsReset", false).toBool()) { 569 settings->setValue("NumCities", spinCities->value()); 570 571 // Saving Main Window state 572 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 573 settings->beginGroup("MainWindow"); 564 574 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 565 settings->setValue("Geometry", saveGeometry());575 settings->setValue("Geometry", saveGeometry()); 566 576 #endif // Q_OS_WINCE 567 settings->setValue("State", saveState()); 568 settings->endGroup(); 577 settings->setValue("State", saveState()); 578 settings->endGroup(); 579 } 580 } else { 581 settings->remove("SettingsReset"); 569 582 } 570 583 -
src/mainwindow.h
rb2bf8e3b6b r278bc7818f 72 72 void dataChanged(const QModelIndex &tl, const QModelIndex &br); 73 73 #ifdef Q_OS_WINCE 74 void changeEvent(QEvent *ev); 74 75 void desktopResized(int screen); 75 76 #endif // Q_OS_WINCE -
src/settingsdialog.cpp
rb2bf8e3b6b r278bc7818f 54 54 scrollArea->setWidgetResizable(true); 55 55 scrollArea->setWidget(bgWhite); 56 #else 57 buttons->insertStretch(buttons->indexOf(buttonHelp) + 1); 56 58 #endif // Q_OS_WINCE 57 59 … … 146 148 147 149 #ifdef Q_OS_WINCE 148 currentGeometry = QApplication::desktop()->availableGeometry(0);149 150 // We need to react to SIP show/hide and resize the window appropriately 150 151 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int))); … … 153 154 connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked())); 154 155 connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked())); 155 // setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);156 156 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); 157 157 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) … … 161 161 162 162 settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this); 163 settings->remove("SettingsReset"); 163 164 164 165 cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool()); … … 173 174 174 175 settings->beginGroup("Task"); 176 cbSymmetricMode->setChecked(settings->value("SymmetricMode", DEF_SYMMETRIC_MODE).toBool()); 175 177 spinFractionalAccuracy->setValue(settings->value("FractionalAccuracy", DEF_FRACTIONAL_ACCURACY).toInt()); 176 178 spinRandMin->setMaximum(MAX_RAND_VALUE); … … 194 196 settings->endGroup(); 195 197 198 #ifndef Q_OS_WINCE 196 199 adjustSize(); 200 #endif // Q_OS_WINCE 197 201 } 198 202 … … 230 234 void SettingsDialog::accept() 231 235 { 236 if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { 237 if (QMessageBox::question(this, tr("Settings Reset"), tr("Do you really want to <b>reset all application settings to their defaults</b>?"), QMessageBox::RestoreDefaults | QMessageBox::Cancel) == QMessageBox::RestoreDefaults) { 238 _newFont = (font != QFont(DEF_FONT_FAMILY, DEF_FONT_SIZE)); 239 _newColor = (color != DEF_FONT_COLOR); 240 settings->remove(""); 241 settings->setValue("SettingsReset", true); 242 QDialog::accept(); 243 QMessageBox::information(this, tr("Settings Reset"), tr("All settings where successfully reset to their defaults.\nIt is recommended to restart the application now.")); 244 return; 245 } else 246 return; 247 } 232 248 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 233 249 settings->setValue("SavePos", cbSaveState->isChecked()); … … 246 262 247 263 settings->beginGroup("Task"); 264 settings->setValue("SymmetricMode", cbSymmetricMode->isChecked()); 248 265 settings->setValue("FractionalAccuracy", spinFractionalAccuracy->value()); 249 266 settings->setValue("RandMin", spinRandMin->value()); … … 293 310 QRect availableGeometry = QApplication::desktop()->availableGeometry(0); 294 311 if (currentGeometry != availableGeometry) { 312 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 295 313 /*! 296 314 * \hack HACK: This hack checks whether \link QDesktopWidget::availableGeometry() availableGeometry()\endlink's \c top + \c hegiht = \link QDesktopWidget::screenGeometry() screenGeometry()\endlink's \c height. … … 305 323 setGeometry(availableGeometry); 306 324 } 307 } 308 currentGeometry = availableGeometry; 325 currentGeometry = availableGeometry; 326 QApplication::restoreOverrideCursor(); 327 } 328 } 329 330 void SettingsDialog::showEvent(QShowEvent *ev) 331 { 332 desktopResized(0); 333 334 QWidget::showEvent(ev); 309 335 } 310 336 #endif // Q_OS_WINCE -
src/settingsdialog.h
rb2bf8e3b6b r278bc7818f 76 76 #ifdef Q_OS_WINCE 77 77 void desktopResized(int screen); 78 void showEvent(QShowEvent *ev); 78 79 #endif // Q_OS_WINCE 79 80 void spinRandMinValueChanged(int val); -
src/tspmodel.cpp
rb2bf8e3b6b r278bc7818f 191 191 void CTSPModel::randomize() 192 192 { 193 int randMin = settings->value("Task/RandMin",DEF_RAND_MIN).toInt(); 194 int randMax = settings->value("Task/RandMax",DEF_RAND_MAX).toInt(); 195 for (int r = 0; r < nCities; r++) 196 for (int c = 0; c < nCities; c++) 197 if (r != c) 198 table[r][c] = rand(randMin,randMax); 199 emit dataChanged(index(0,0),index(nCities - 1,nCities - 1)); 193 int randMin = settings->value("Task/RandMin", DEF_RAND_MIN).toInt(); 194 int randMax = settings->value("Task/RandMax", DEF_RAND_MAX).toInt(); 195 if (settings->value("Task/SymmetricMode", DEF_SYMMETRIC_MODE).toBool()) { 196 for (int r = 0; r < nCities; r++) 197 for (int c = 0; c < r; c++) 198 table[c][r] = table[r][c] = rand(randMin, randMax); 199 } else { 200 for (int r = 0; r < nCities; r++) 201 for (int c = 0; c < nCities; c++) 202 if (r != c) 203 table[r][c] = rand(randMin, randMax); 204 } 205 emit dataChanged(index(0,0), index(nCities - 1, nCities - 1)); 200 206 } 201 207 … … 315 321 if (!ok || tmp < 0) 316 322 return false; 317 else 323 else { 318 324 table[index.row()][index.column()] = tmp; 325 if (settings->value("Task/SymmetricMode", DEF_SYMMETRIC_MODE).toBool()) 326 table[index.column()][index.row()] = tmp; 327 } 319 328 } 320 329 emit dataChanged(index,index); -
tspsg.pro
rb2bf8e3b6b r278bc7818f 55 55 share.files = COPYING README 56 56 i18n.path = /share/tspsg/i18n 57 i18n.files = i18n/ languages.ini i18n/*.qm57 i18n.files = i18n/*.qm 58 58 docs.path = /share/doc/tspsg 59 59 # docs.files = docs/* … … 72 72 share.files = COPYING README 73 73 i18n.path = "\tspsg\i18n" 74 i18n.files = i18n \languages.ini i18n\*.qm74 i18n.files = i18n/*.qm 75 75 docs.path = "\tspsg\help" 76 76 # docs.files = docs\* … … 87 87 share.sources = COPYING README 88 88 share.path = "\Storage Card\Program Files\tspsg" 89 i18n.sources = i18n \languages.ini i18n\*.qm89 i18n.sources = i18n/*.qm 90 90 i18n.path = "\Storage Card\Program Files\tspsg\i18n" 91 91 # docs.sources = docs\* … … 100 100 "\"COPYING\" - \"\", FILETEXT, TEXTEXIT" 101 101 share.sources = COPYING README 102 i18n.sources = i18n/ languages.ini i18n/*.qm102 i18n.sources = i18n/*.qm 103 103 i18n.path = i18n 104 104 # docs.sources = docs/* -
ui/mainwindow.ui
rb2bf8e3b6b r278bc7818f 8 8 <x>0</x> 9 9 <y>0</y> 10 <width> 301</width>11 <height> 352</height>10 <width>500</width> 11 <height>450</height> 12 12 </rect> 13 13 </property> … … 253 253 <x>0</x> 254 254 <y>0</y> 255 <width> 301</width>255 <width>500</width> 256 256 <height>21</height> 257 257 </rect> -
ui/settingsdialog.ui
rb2bf8e3b6b r278bc7818f 229 229 <string>Task generation and solving settings</string> 230 230 </attribute> 231 <layout class="QVBoxLayout" name="_5"> 232 <item> 233 <layout class="QHBoxLayout" name="_10"> 234 <item> 231 <layout class="QVBoxLayout" name="_9"> 232 <item> 233 <layout class="QFormLayout" name="_5"> 234 <property name="fieldGrowthPolicy"> 235 <enum>QFormLayout::ExpandingFieldsGrow</enum> 236 </property> 237 <item row="0" column="0"> 235 238 <widget class="QLabel" name="labelFractionalAccuracy"> 236 239 <property name="text"> … … 239 242 </widget> 240 243 </item> 241 <item >244 <item row="0" column="1"> 242 245 <widget class="QSpinBox" name="spinFractionalAccuracy"> 243 246 <property name="cursor"> … … 252 255 </widget> 253 256 </item> 254 <item>255 <spacer name="spacer_3">256 <property name="orientation">257 <enum>Qt::Horizontal</enum>258 </property>259 <property name="sizeHint" stdset="0">260 <size>261 <width>0</width>262 <height>0</height>263 </size>264 </property>265 </spacer>266 </item>267 257 </layout> 268 258 </item> 269 259 <item> 270 <layout class="QHBoxLayout" name="_7"> 271 <item> 272 <widget class="QGroupBox" name="groupBox"> 273 <property name="title"> 274 <string>Random numbers</string> 275 </property> 276 <layout class="QVBoxLayout" name="_8"> 277 <item> 278 <layout class="QFormLayout" name="_9"> 279 <property name="fieldGrowthPolicy"> 280 <enum>QFormLayout::ExpandingFieldsGrow</enum> 281 </property> 282 <item row="0" column="0"> 283 <widget class="QLabel" name="labelRandMin"> 284 <property name="text"> 285 <string>&Minimal:</string> 286 </property> 287 <property name="buddy"> 288 <cstring>spinRandMin</cstring> 289 </property> 290 </widget> 291 </item> 292 <item row="0" column="1"> 293 <widget class="QSpinBox" name="spinRandMin"> 294 <property name="cursor"> 295 <cursorShape>PointingHandCursor</cursorShape> 296 </property> 297 <property name="statusTip"> 298 <string>Minimum for random number generation</string> 299 </property> 300 </widget> 301 </item> 302 <item row="1" column="0"> 303 <widget class="QLabel" name="labelRandMax"> 304 <property name="text"> 305 <string>Ma&ximal:</string> 306 </property> 307 <property name="buddy"> 308 <cstring>spinRandMax</cstring> 309 </property> 310 </widget> 311 </item> 312 <item row="1" column="1"> 313 <widget class="QSpinBox" name="spinRandMax"> 314 <property name="cursor"> 315 <cursorShape>PointingHandCursor</cursorShape> 316 </property> 317 <property name="statusTip"> 318 <string>Maximum for random number generation</string> 319 </property> 320 </widget> 321 </item> 322 </layout> 260 <widget class="QCheckBox" name="cbSymmetricMode"> 261 <property name="cursor"> 262 <cursorShape>PointingHandCursor</cursorShape> 263 </property> 264 <property name="statusTip"> 265 <string>In this mode the cost of travel from city 1 to city 2 and vice versa is the same</string> 266 </property> 267 <property name="text"> 268 <string>Symmetric mode</string> 269 </property> 270 </widget> 271 </item> 272 <item> 273 <widget class="QGroupBox" name="gbTaskGeneration"> 274 <property name="title"> 275 <string>Task generation</string> 276 </property> 277 <layout class="QVBoxLayout" name="_7"> 278 <item> 279 <layout class="QFormLayout" name="_8"> 280 <property name="fieldGrowthPolicy"> 281 <enum>QFormLayout::ExpandingFieldsGrow</enum> 282 </property> 283 <item row="0" column="0"> 284 <widget class="QLabel" name="labelRandMin"> 285 <property name="text"> 286 <string>Minimal random:</string> 287 </property> 288 <property name="buddy"> 289 <cstring>spinRandMin</cstring> 290 </property> 291 </widget> 323 292 </item> 324 <item >325 <widget class="Q CheckBox" name="cbFractionalRandom">293 <item row="0" column="1"> 294 <widget class="QSpinBox" name="spinRandMin"> 326 295 <property name="cursor"> 327 296 <cursorShape>PointingHandCursor</cursorShape> 328 297 </property> 329 298 <property name="statusTip"> 330 <string>Generate fractional random values with the Fractional accuracy</string> 331 </property> 299 <string>Minimum for random number generation</string> 300 </property> 301 </widget> 302 </item> 303 <item row="1" column="0"> 304 <widget class="QLabel" name="labelRandMax"> 332 305 <property name="text"> 333 <string>Fractional random values</string> 306 <string>Maximal random:</string> 307 </property> 308 <property name="buddy"> 309 <cstring>spinRandMax</cstring> 310 </property> 311 </widget> 312 </item> 313 <item row="1" column="1"> 314 <widget class="QSpinBox" name="spinRandMax"> 315 <property name="cursor"> 316 <cursorShape>PointingHandCursor</cursorShape> 317 </property> 318 <property name="statusTip"> 319 <string>Maximum for random number generation</string> 334 320 </property> 335 321 </widget> 336 322 </item> 337 323 </layout> 338 </ widget>339 </item>340 <item>341 <spacer name="spacer_2">342 <property name="orientation">343 < enum>Qt::Horizontal</enum>344 </property>345 <property name="sizeHint" stdset="0">346 < size>347 <width>0</width>348 < height>0</height>349 </ size>350 </ property>351 </ spacer>352 </ item>353 </ layout>354 </item> 355 <item> 356 <spacer name="spacer_ 5">324 </item> 325 <item> 326 <widget class="QCheckBox" name="cbFractionalRandom"> 327 <property name="cursor"> 328 <cursorShape>PointingHandCursor</cursorShape> 329 </property> 330 <property name="statusTip"> 331 <string>Generate fractional random values with the Fractional accuracy</string> 332 </property> 333 <property name="text"> 334 <string>Fractional random values</string> 335 </property> 336 </widget> 337 </item> 338 </layout> 339 </widget> 340 </item> 341 <item> 342 <spacer name="spacer_2"> 357 343 <property name="orientation"> 358 344 <enum>Qt::Vertical</enum> … … 360 346 <property name="sizeHint" stdset="0"> 361 347 <size> 362 <width> 0</width>348 <width>10</width> 363 349 <height>0</height> 364 350 </size> … … 395 381 </property> 396 382 <item> 397 <spacer name="spacer_ 4">383 <spacer name="spacer_3"> 398 384 <property name="orientation"> 399 385 <enum>Qt::Horizontal</enum> … … 437 423 </item> 438 424 <item> 439 <spacer name="spacer_ 6">425 <spacer name="spacer_4"> 440 426 <property name="orientation"> 441 427 <enum>Qt::Horizontal</enum> … … 471 457 <string>Output font settings</string> 472 458 </property> 473 <layout class="QHBoxLayout" name=" horizontalLayout">459 <layout class="QHBoxLayout" name="_13"> 474 460 <item> 475 461 <widget class="QPushButton" name="buttonFont"> … … 506 492 </widget> 507 493 </item> 494 <item> 495 <spacer name="spacer_5"> 496 <property name="orientation"> 497 <enum>Qt::Horizontal</enum> 498 </property> 499 <property name="sizeHint" stdset="0"> 500 <size> 501 <width>0</width> 502 <height>0</height> 503 </size> 504 </property> 505 </spacer> 506 </item> 508 507 </layout> 509 508 </widget> 510 509 </item> 511 <item>512 <spacer name="spacer_7">513 <property name="orientation">514 <enum>Qt::Horizontal</enum>515 </property>516 <property name="sizeHint" stdset="0">517 <size>518 <width>0</width>519 <height>0</height>520 </size>521 </property>522 </spacer>523 </item>524 510 </layout> 525 511 </item> 526 512 <item> 527 <spacer name=" verticalSpacer">513 <spacer name="spacer_6"> 528 514 <property name="orientation"> 529 515 <enum>Qt::Vertical</enum>
Note: See TracChangeset
for help on using the changeset viewer.