Changeset 1babbd6ba3 in tspsg for src
- Timestamp:
- Apr 8, 2010, 11:02:26 PM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- a23f4c292f
- Parents:
- 394216e468
- git-author:
- Oleksii Serdiuk <contacts@…> (04/08/10 23:02:26)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:34:20)
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
r394216e468 r1babbd6ba3 33 33 34 34 //////// GENERAL 35 35 36 //! Default for "Automatically resize rows and columns to their contents" 36 37 #define DEF_AUTOSIZE true … … 50 51 51 52 //////// TASK 53 52 54 //! Default for "Accuracy of the fractional values" 53 55 #define DEF_FRACTIONAL_ACCURACY 2 … … 62 64 63 65 //////// OUTPUT 66 64 67 //! Default for "Show solution steps' matrices for every solution step" 65 68 #define DEF_SHOW_MATRIX true … … 74 77 * \brief Default font name. 75 78 */ 76 #ifdef Q_OS_WINCE 79 #ifdef Q_OS_WINCE_WM 77 80 #define DEF_FONT_FAMILY "Tahoma" 78 81 #else 79 82 #define DEF_FONT_FAMILY "Courier New" 80 #endif 83 #endif // Q_OS_WINCE_WM 81 84 /*! 82 85 * \def DEF_FONT_SIZE -
src/globals.h
r394216e468 r1babbd6ba3 54 54 /*! 55 55 * \def PATH_L10N 56 * \brief Bath to internationalization files.56 * \brief Path to internationalization files. 57 57 */ 58 58 #ifndef PATH_L10N … … 117 117 #endif // Q_OS_WIN32 118 118 119 #if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) 120 //! This is defined on handheld (e.g., Windows Mobile, Symbian) devices. 121 #define HANDHELD 122 #endif 123 119 124 // Sanity checks 120 125 // Check that default number of cities is sane (<= MAX_NUM_CITIES) -
src/mainwindow.cpp
r394216e468 r1babbd6ba3 45 45 #endif // QT_NO_PRINTER 46 46 47 #ifdef Q_OS_WINCE 47 #ifdef Q_OS_WINCE_WM 48 48 currentGeometry = QApplication::desktop()->availableGeometry(0); 49 49 // We need to react to SIP show/hide and resize the window appropriately 50 50 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int))); 51 #endif // Q_OS_WINCE 51 #endif // Q_OS_WINCE_WM 52 52 connect(actionFileNew,SIGNAL(triggered()),this,SLOT(actionFileNewTriggered())); 53 53 connect(actionFileOpen,SIGNAL(triggered()),this,SLOT(actionFileOpenTriggered())); … … 73 73 connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int))); 74 74 75 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)75 #ifndef HANDHELD 76 76 // Centering main window 77 77 QRect rect = geometry(); … … 87 87 #else 88 88 setWindowState(Qt::WindowMaximized); 89 #endif // Q_OS_WINCE89 #endif // HANDHELD 90 90 91 91 tspmodel = new CTSPModel(this); … … 269 269 return; 270 270 if (sd.colorChanged() || sd.fontChanged()) { 271 initDocStyleSheet();272 271 if (!solutionText->document()->isEmpty() && sd.colorChanged()) 273 272 QMessageBox::information(this, tr("Settings Changed"), tr("You have changed color settings.\nThey will be applied to the next solution output.")); 273 initDocStyleSheet(); 274 274 } 275 275 if (sd.translucencyChanged() != 0) … … 281 281 if (checked) { 282 282 settings->remove("Language"); 283 QMessageBox::information(this, tr("Language change"), tr("Language will be autodetected on next application start."));283 QMessageBox::information(this, tr("Language change"), tr("Language will be autodetected on the next application start.")); 284 284 } else 285 285 settings->setValue("Language", groupSettingsLanguageList->checkedAction()->data().toString()); … … 309 309 #endif 310 310 QApplication::restoreOverrideCursor(); 311 QMessageBox::information(this, tr("Settings Changed"), tr("You have changed the application language.\nTo get current solution output in the new language\nyou need to re-run the solution process.")); 311 if (!solutionText->document()->isEmpty()) 312 QMessageBox::information(this, tr("Settings Changed"), tr("You have changed the application language.\nTo get current solution output in the new language\nyou need to re-run the solution process.")); 312 313 } 313 314 } … … 330 331 { 331 332 QString title; 332 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)333 #ifdef HANDHELD 333 334 title += QString("<b>TSPSG<br>TSP Solver and Generator</b><br>"); 334 335 #else 335 336 title += QString("<b>TSPSG: TSP Solver and Generator</b><br>"); 336 #endif // Q_OS_WINCE || Q_OS_SYMBIAN337 #endif // HANDHELD 337 338 title += QString("%1: <b>%2</b><br>").arg(tr("Version"), QApplication::applicationVersion()); 338 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)339 #ifndef HANDHELD 339 340 title += QString("<b>© 2007-%1 <a href=\"http://%2/\">%3</a></b><br>").arg(QDate::currentDate().toString("yyyy"), QApplication::organizationDomain(), QApplication::organizationName()); 340 341 title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sourceforge.net/</a></b>"); 341 342 #else 342 343 title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b>"); 343 #endif // Q_OS_WINCE && Q_OS_SYMBIAN344 #endif // Q_OS_WINCE_WM && Q_OS_SYMBIAN 344 345 345 346 QString about; … … 372 373 *lblTitle = new QLabel(dlg), 373 374 *lblTranslated = new QLabel(dlg); 374 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)375 QLabel *lblSubTitle = new QLabel(QString("<b>© 2007-%1 Oleksii \"Lёppa\" Serdiuk</b>").arg(QDate::currentDate().toString("yyyy")), dlg);376 #endif // Q_OS_WINCE || Q_OS_SYMBIAN375 #ifdef HANDHELD 376 QLabel *lblSubTitle = new QLabel(QString("<b>© 2007-%1 <a href=\"http://%2/\">%3</a></b>").arg(QDate::currentDate().toString("yyyy"), QApplication::organizationDomain(), QApplication::organizationName()), dlg); 377 #endif // HANDHELD 377 378 QTextBrowser *txtAbout = new QTextBrowser(dlg); 378 379 QVBoxLayout *vb = new QVBoxLayout(); … … 381 382 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, dlg); 382 383 383 lblIcon->setPixmap(QPixmap(":/images/tspsg.png").scaledToWidth(logicalDpiX() * 2 / 3, Qt::SmoothTransformation));384 lblIcon->setAlignment(Qt::AlignTop);385 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)386 lblIcon->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().windowText().color().name()));387 #endif388 389 384 lblTitle->setOpenExternalLinks(true); 390 385 lblTitle->setText(title); 391 386 lblTitle->setAlignment(Qt::AlignTop); 392 387 lblTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); 393 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)388 #ifndef HANDHELD 394 389 lblTitle->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().shadow().color().name())); 395 #endif 390 #endif // HANDHELD 391 392 lblIcon->setPixmap(QPixmap(":/images/tspsg.png").scaledToHeight(lblTitle->sizeHint().height(), Qt::SmoothTransformation)); 393 lblIcon->setAlignment(Qt::AlignVCenter); 394 #ifndef HANDHELD 395 lblIcon->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().windowText().color().name())); 396 #endif // HANDHELD 396 397 397 398 hb1->addWidget(lblIcon); … … 402 403 txtAbout->setHtml(about); 403 404 txtAbout->moveCursor(QTextCursor::Start); 404 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)405 #ifndef HANDHELD 405 406 txtAbout->setStyleSheet(QString("QTextBrowser {border-color: %1; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().shadow().color().name())); 406 #endif 407 #endif // HANDHELD 407 408 408 409 bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor)); … … 413 414 else { 414 415 lblTranslated->setOpenExternalLinks(true); 415 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)416 #ifndef HANDHELD 416 417 lblTranslated->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().shadow().color().name())); 417 #endif 418 #endif // HANDHELD 418 419 hb2->addWidget(lblTranslated); 419 420 } … … 421 422 hb2->addWidget(bb); 422 423 423 #if defined(Q_OS_WINCE)424 #ifdef Q_OS_WINCE_WM 424 425 vb->setMargin(3); 425 #endif 426 #endif // Q_OS_WINCE_WM 426 427 vb->addLayout(hb1); 427 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)428 #ifdef HANDHELD 428 429 vb->addWidget(lblSubTitle); 429 #endif // Q_OS_WINCE || Q_OS_SYMBIAN430 #endif // HANDHELD 430 431 vb->addWidget(txtAbout); 431 432 vb->addLayout(hb2); … … 486 487 pb->setFormat(tr("%v of %1 parts found").arg(n)); 487 488 pd.setBar(pb); 488 pd.setMaximum(n * 2 + 3);489 pd.set MinimumDuration(1000);489 pd.setMaximum(n); 490 pd.setAutoReset(false); 490 491 pd.setLabelText(tr("Calculating optimal route...")); 491 492 pd.setWindowTitle(tr("Solution Progress")); 492 493 pd.setWindowModality(Qt::ApplicationModal); 493 494 pd.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint); 494 pd.s etValue(0);495 pd.show(); 495 496 496 497 CTSPSolver solver; … … 506 507 return; 507 508 } 508 pb->setFormat( "%p%");509 pb->setFormat(tr("Generating header")); 509 510 pd.setLabelText(tr("Generating solution output...")); 510 pd.setValue(n + 1); 511 pd.setMaximum(n); 512 pd.setValue(0); 511 513 512 514 solutionText->clear(); 513 pd.setValue(n + 2);514 515 515 solutionText->setDocumentTitle(tr("Solution of Variant #%1 task").arg(spinVariant->value())); 516 516 solutionText->append("<p>" + tr("Variant #%1").arg(spinVariant->value()) + "</p>"); … … 520 520 SStep *step = root; 521 521 n = 1; 522 while (n <= spinCities->value()) { 522 pb->setFormat(tr("Generating step %v")); 523 while (n < spinCities->value()) { 523 524 if (pd.wasCanceled()) { 524 525 solutionText->clear(); 525 526 return; 526 527 } 527 pd.setValue( spinCities->value() + 2 +n);528 pd.setValue(n); 528 529 529 530 if (step->prNode->prNode != NULL || ((step->prNode->prNode == NULL) && (step->plNode->prNode == NULL))) { … … 554 555 break; 555 556 } 556 pd.setValue(spinCities->value() + 2 + n); 557 pb->setFormat(tr("Generating footer")); 558 pd.setValue(n); 557 559 558 560 if (solver.isOptimal()) … … 579 581 pd.setMaximum(0); 580 582 pd.setCancelButton(NULL); 581 pd.adjustSize();582 583 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); 583 584 solver.cleanup(true); … … 602 603 } 603 604 604 #ifdef Q_OS_WINCE 605 #ifdef Q_OS_WINCE_WM 605 606 void MainWindow::changeEvent(QEvent *ev) 606 607 { … … 635 636 } 636 637 } 637 #endif // Q_OS_WINCE 638 #endif // Q_OS_WINCE_WM 638 639 639 640 void MainWindow::numCitiesChanged(int nCities) … … 676 677 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 677 678 settings->beginGroup("MainWindow"); 678 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)679 #ifndef HANDHELD 679 680 settings->setValue("Geometry", saveGeometry()); 680 #endif // Q_OS_WINCE681 #endif // HANDHELD 681 682 settings->setValue("State", saveState()); 682 683 settings->endGroup(); … … 931 932 #endif 932 933 933 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)934 #ifndef HANDHELD 934 935 QStatusBar *statusbar = new QStatusBar(this); 935 936 statusbar->setObjectName("statusbar"); 936 937 setStatusBar(statusbar); 937 #endif // Q_OS_WINCE938 939 #ifdef Q_OS_WINCE 938 #endif // HANDHELD 939 940 #ifdef Q_OS_WINCE_WM 940 941 menuBar()->setDefaultAction(menuFile->menuAction()); 941 942 … … 948 949 #else 949 950 setCentralWidget(tabWidget); 950 #endif // Q_OS_WINCE 951 #endif // Q_OS_WINCE_WM 951 952 952 953 //! \hack HACK: A little hack for toolbar icons to have a sane size. 953 #ifdef Q_OS_WINCE 954 #ifdef Q_OS_WINCE_WM 954 955 toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 955 956 #elif defined(Q_OS_SYMBIAN) 956 957 toolBar->setIconSize(QSize(logicalDpiX() / 5, logicalDpiY() / 5)); 957 #endif // Q_OS_WINCE 958 #endif // Q_OS_WINCE_WM 958 959 959 960 solutionText->document()->setDefaultFont(settings->value("Output/Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>()); -
src/mainwindow.h
r394216e468 r1babbd6ba3 74 74 void dataChanged(); 75 75 void dataChanged(const QModelIndex &tl, const QModelIndex &br); 76 #ifdef Q_OS_WINCE 76 #ifdef Q_OS_WINCE_WM 77 77 void changeEvent(QEvent *ev); 78 78 void desktopResized(int screen); 79 #endif // Q_OS_WINCE 79 #endif // Q_OS_WINCE_WM 80 80 void numCitiesChanged(int nCities); 81 81 #ifndef QT_NO_PRINTER … … 97 97 QSettings *settings; 98 98 CTSPModel *tspmodel; 99 #ifdef Q_OS_WINCE 99 #ifdef Q_OS_WINCE_WM 100 100 QRect currentGeometry; 101 #endif // Q_OS_WINCE 101 #endif // Q_OS_WINCE_WM 102 102 103 103 void closeEvent(QCloseEvent *ev); -
src/settingsdialog.cpp
r394216e468 r1babbd6ba3 42 42 buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor)); 43 43 44 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)44 #ifdef HANDHELD 45 45 QVBoxLayout *vbox1; // Layout helper 46 46 47 #ifdef Q_OS_WINCE 47 #ifdef Q_OS_WINCE_WM 48 48 // On screens with small height when SIP is shown and the window is resized 49 49 // there is not enought space for all elements. 50 // So we showscrollbars to be able to access them.50 // So we show the scrollbars to be able to access them. 51 51 QScrollArea *scrollArea = new QScrollArea(this); 52 52 scrollArea->setFrameShape(QFrame::NoFrame); … … 56 56 #else 57 57 buttons->insertStretch(buttons->indexOf(buttonHelp) + 1); 58 #endif // Q_OS_WINCE 58 #endif // Q_OS_WINCE_WM 59 59 60 60 bgWhite->layout()->setMargin(0); … … 64 64 vbox1->setMargin(0); 65 65 vbox1->setSpacing(0); 66 #ifdef Q_OS_WINCE 66 #ifdef Q_OS_WINCE_WM 67 67 vbox1->addWidget(scrollArea); 68 68 #else 69 69 vbox1->addWidget(bgWhite); 70 #endif // Q_OS_WINCE 70 #endif // Q_OS_WINCE_WM 71 71 vbox1->addWidget(bgGrey); 72 72 setLayout(vbox1); 73 #else // Q_OS_WINCE || Q_OS_SYMBIAN73 #else // HANDHELD 74 74 // Layout helper elements 75 75 QVBoxLayout *vbox1, *vbox2; … … 147 147 vbox2->addWidget(bgGrey); 148 148 setLayout(vbox2); 149 #endif // Q_OS_WINCE150 151 #ifdef Q_OS_WINCE 149 #endif // HANDHELD 150 151 #ifdef Q_OS_WINCE_WM 152 152 // We need to react to SIP show/hide and resize the window appropriately 153 153 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int))); 154 #endif // Q_OS_WINCE 154 #endif // Q_OS_WINCE_WM 155 155 connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int))); 156 156 connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked())); 157 157 connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked())); 158 158 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); 159 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)159 #ifndef HANDHELD 160 160 // Setting initial text of dialog hint label to own status tip text. 161 161 labelHint->setText(labelHint->statusTip()); 162 #endif // Q_OS_WINCE162 #endif // HANDHELD 163 163 164 164 settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this); … … 171 171 cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()); 172 172 #endif // Q_OS_WIN32 173 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)173 #ifndef HANDHELD 174 174 cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool()); 175 #endif // Q_OS_WINCE175 #endif // HANDHELD 176 176 177 177 settings->beginGroup("Task"); … … 198 198 settings->endGroup(); 199 199 200 #ifndef Q_OS_WINCE 200 #ifndef Q_OS_WINCE_WM 201 201 adjustSize(); 202 #endif // Q_OS_WINCE 202 #endif // Q_OS_WINCE_WM 203 203 } 204 204 … … 248 248 return; 249 249 } 250 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)250 #ifndef HANDHELD 251 251 settings->setValue("SavePos", cbSaveState->isChecked()); 252 #endif // Q_OS_WINCE252 #endif // HANDHELD 253 253 #ifdef Q_OS_WIN32 254 254 if (QtWin::isCompositionEnabled()) { … … 304 304 } 305 305 306 #ifdef Q_OS_WINCE 306 #ifdef Q_OS_WINCE_WM 307 307 void SettingsDialog::desktopResized(int screen) 308 308 { … … 336 336 QWidget::showEvent(ev); 337 337 } 338 #endif // Q_OS_WINCE 338 #endif // Q_OS_WINCE_WM 339 339 340 340 void SettingsDialog::spinRandMinValueChanged(int val) { … … 342 342 } 343 343 344 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)344 #ifndef HANDHELD 345 345 bool SettingsDialog::event(QEvent *ev) 346 346 { … … 358 358 return QDialog::event(ev); 359 359 } 360 #endif // Q_OS_WINCE360 #endif // HANDHELD -
src/settingsdialog.h
r394216e468 r1babbd6ba3 59 59 QCheckBox *cbUseTranslucency; 60 60 #endif // Q_OS_WIN32 61 #ifdef Q_OS_WINCE 61 #ifdef Q_OS_WINCE_WM 62 62 QRect currentGeometry; 63 63 #elif !defined(Q_OS_SYMBIAN) … … 68 68 69 69 bool event(QEvent *ev); 70 #endif // Q_OS_WINCE 70 #endif // Q_OS_WINCE_WM 71 71 72 72 private slots: … … 74 74 void buttonColorClicked(); 75 75 void buttonFontClicked(); 76 #ifdef Q_OS_WINCE 76 #ifdef Q_OS_WINCE_WM 77 77 void desktopResized(int screen); 78 78 void showEvent(QShowEvent *ev); 79 #endif // Q_OS_WINCE 79 #endif // Q_OS_WINCE_WM 80 80 void spinRandMinValueChanged(int val); 81 81 }; -
src/tspmodel.cpp
r394216e468 r1babbd6ba3 84 84 return tr(INFSTR); 85 85 else 86 //! \hack HACK: Converting to string to prevent spinbox in edit mode86 //! \hack HACK: Converting to string to prevent spinbox in edit mode 87 87 return QVariant(table.at(index.row()).at(index.column())).toString(); 88 88 else -
src/version.h
r394216e468 r1babbd6ba3 72 72 * \brief TSPSG build status 73 73 */ 74 #if !defined(TSPSG_RELEASE_BUILD) 75 #define BUILD_STATUS (dev build) 76 #elif !defined(BUILD_STATUS) 77 #define BUILD_STATUS (build BUILD_NUMBER) 78 #endif // TSPSG_RELEASE_BUILD 74 #ifdef DEBUG 75 #ifndef BUILD_STATUS 76 #define BUILD_STATUS (debug build BUILD_NUMBER) 77 #endif 78 #else 79 #if !defined(TSPSG_RELEASE_BUILD) 80 #define BUILD_STATUS (dev build) 81 #elif !defined(BUILD_STATUS) 82 #define BUILD_STATUS (build BUILD_NUMBER) 83 #endif // TSPSG_RELEASE_BUILD 84 #endif // DEBUG 79 85 80 86 //! \internal \brief A helper for QUOTE(x).
Note: See TracChangeset
for help on using the changeset viewer.