Changeset 1babbd6ba3 in tspsg for src/mainwindow.cpp
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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>());
Note: See TracChangeset
for help on using the changeset viewer.