Changeset 1babbd6ba3 in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Apr 8, 2010, 11:02:26 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:
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)
Message:

+ Added Installation Guide.

  • Updated translations.
  • Updated documentaion.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    r394216e468 r1babbd6ba3  
    4545#endif // QT_NO_PRINTER
    4646
    47 #ifdef Q_OS_WINCE
     47#ifdef Q_OS_WINCE_WM
    4848        currentGeometry = QApplication::desktop()->availableGeometry(0);
    4949        // We need to react to SIP show/hide and resize the window appropriately
    5050        connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
    51 #endif // Q_OS_WINCE
     51#endif // Q_OS_WINCE_WM
    5252        connect(actionFileNew,SIGNAL(triggered()),this,SLOT(actionFileNewTriggered()));
    5353        connect(actionFileOpen,SIGNAL(triggered()),this,SLOT(actionFileOpenTriggered()));
     
    7373        connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int)));
    7474
    75 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     75#ifndef HANDHELD
    7676        // Centering main window
    7777QRect rect = geometry();
     
    8787#else
    8888        setWindowState(Qt::WindowMaximized);
    89 #endif // Q_OS_WINCE
     89#endif // HANDHELD
    9090
    9191        tspmodel = new CTSPModel(this);
     
    269269                return;
    270270        if (sd.colorChanged() || sd.fontChanged()) {
    271                 initDocStyleSheet();
    272271                if (!solutionText->document()->isEmpty() && sd.colorChanged())
    273272                        QMessageBox::information(this, tr("Settings Changed"), tr("You have changed color settings.\nThey will be applied to the next solution output."));
     273                initDocStyleSheet();
    274274        }
    275275        if (sd.translucencyChanged() != 0)
     
    281281        if (checked) {
    282282                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."));
    284284        } else
    285285                settings->setValue("Language", groupSettingsLanguageList->checkedAction()->data().toString());
     
    309309#endif
    310310                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."));
    312313        }
    313314}
     
    330331{
    331332QString title;
    332 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
     333#ifdef HANDHELD
    333334        title += QString("<b>TSPSG<br>TSP Solver and Generator</b><br>");
    334335#else
    335336        title += QString("<b>TSPSG: TSP Solver and Generator</b><br>");
    336 #endif // Q_OS_WINCE || Q_OS_SYMBIAN
     337#endif // HANDHELD
    337338        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
    339340        title += QString("<b>&copy; 2007-%1 <a href=\"http://%2/\">%3</a></b><br>").arg(QDate::currentDate().toString("yyyy"), QApplication::organizationDomain(), QApplication::organizationName());
    340341        title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sourceforge.net/</a></b>");
    341342#else
    342343        title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b>");
    343 #endif // Q_OS_WINCE && Q_OS_SYMBIAN
     344#endif // Q_OS_WINCE_WM && Q_OS_SYMBIAN
    344345
    345346QString about;
     
    372373        *lblTitle = new QLabel(dlg),
    373374        *lblTranslated = new QLabel(dlg);
    374 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
    375 QLabel *lblSubTitle = new QLabel(QString("<b>&copy; 2007-%1 Oleksii \"Lёppa\" Serdiuk</b>").arg(QDate::currentDate().toString("yyyy")), dlg);
    376 #endif // Q_OS_WINCE || Q_OS_SYMBIAN
     375#ifdef HANDHELD
     376QLabel *lblSubTitle = new QLabel(QString("<b>&copy; 2007-%1 <a href=\"http://%2/\">%3</a></b>").arg(QDate::currentDate().toString("yyyy"), QApplication::organizationDomain(), QApplication::organizationName()), dlg);
     377#endif // HANDHELD
    377378QTextBrowser *txtAbout = new QTextBrowser(dlg);
    378379QVBoxLayout *vb = new QVBoxLayout();
     
    381382QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, dlg);
    382383
    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 #endif
    388 
    389384        lblTitle->setOpenExternalLinks(true);
    390385        lblTitle->setText(title);
    391386        lblTitle->setAlignment(Qt::AlignTop);
    392387        lblTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    393 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     388#ifndef HANDHELD
    394389        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
    396397
    397398        hb1->addWidget(lblIcon);
     
    402403        txtAbout->setHtml(about);
    403404        txtAbout->moveCursor(QTextCursor::Start);
    404 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     405#ifndef HANDHELD
    405406        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
    407408
    408409        bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
     
    413414        else {
    414415                lblTranslated->setOpenExternalLinks(true);
    415 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     416#ifndef HANDHELD
    416417                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
    418419                hb2->addWidget(lblTranslated);
    419420        }
     
    421422        hb2->addWidget(bb);
    422423
    423 #if defined(Q_OS_WINCE)
     424#ifdef Q_OS_WINCE_WM
    424425        vb->setMargin(3);
    425 #endif
     426#endif // Q_OS_WINCE_WM
    426427        vb->addLayout(hb1);
    427 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
     428#ifdef HANDHELD
    428429        vb->addWidget(lblSubTitle);
    429 #endif // Q_OS_WINCE || Q_OS_SYMBIAN
     430#endif // HANDHELD
    430431        vb->addWidget(txtAbout);
    431432        vb->addLayout(hb2);
     
    486487        pb->setFormat(tr("%v of %1 parts found").arg(n));
    487488        pd.setBar(pb);
    488         pd.setMaximum(n * 2 + 3);
    489         pd.setMinimumDuration(1000);
     489        pd.setMaximum(n);
     490        pd.setAutoReset(false);
    490491        pd.setLabelText(tr("Calculating optimal route..."));
    491492        pd.setWindowTitle(tr("Solution Progress"));
    492493        pd.setWindowModality(Qt::ApplicationModal);
    493494        pd.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    494         pd.setValue(0);
     495        pd.show();
    495496
    496497CTSPSolver solver;
     
    506507                return;
    507508        }
    508         pb->setFormat("%p%");
     509        pb->setFormat(tr("Generating header"));
    509510        pd.setLabelText(tr("Generating solution output..."));
    510         pd.setValue(n + 1);
     511        pd.setMaximum(n);
     512        pd.setValue(0);
    511513
    512514        solutionText->clear();
    513         pd.setValue(n + 2);
    514 
    515515        solutionText->setDocumentTitle(tr("Solution of Variant #%1 task").arg(spinVariant->value()));
    516516        solutionText->append("<p>" + tr("Variant #%1").arg(spinVariant->value()) + "</p>");
     
    520520SStep *step = root;
    521521        n = 1;
    522         while (n <= spinCities->value()) {
     522        pb->setFormat(tr("Generating step %v"));
     523        while (n < spinCities->value()) {
    523524                if (pd.wasCanceled()) {
    524525                        solutionText->clear();
    525526                        return;
    526527                }
    527                 pd.setValue(spinCities->value() + 2 + n);
     528                pd.setValue(n);
    528529
    529530                if (step->prNode->prNode != NULL || ((step->prNode->prNode == NULL) && (step->plNode->prNode == NULL))) {
     
    554555                        break;
    555556        }
    556         pd.setValue(spinCities->value() + 2 + n);
     557        pb->setFormat(tr("Generating footer"));
     558        pd.setValue(n);
    557559
    558560        if (solver.isOptimal())
     
    579581        pd.setMaximum(0);
    580582        pd.setCancelButton(NULL);
    581         pd.adjustSize();
    582583        QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
    583584        solver.cleanup(true);
     
    602603}
    603604
    604 #ifdef Q_OS_WINCE
     605#ifdef Q_OS_WINCE_WM
    605606void MainWindow::changeEvent(QEvent *ev)
    606607{
     
    635636        }
    636637}
    637 #endif // Q_OS_WINCE
     638#endif // Q_OS_WINCE_WM
    638639
    639640void MainWindow::numCitiesChanged(int nCities)
     
    676677                if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
    677678                        settings->beginGroup("MainWindow");
    678 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     679#ifndef HANDHELD
    679680                        settings->setValue("Geometry", saveGeometry());
    680 #endif // Q_OS_WINCE
     681#endif // HANDHELD
    681682                        settings->setValue("State", saveState());
    682683                        settings->endGroup();
     
    931932#endif
    932933
    933 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     934#ifndef HANDHELD
    934935QStatusBar *statusbar = new QStatusBar(this);
    935936        statusbar->setObjectName("statusbar");
    936937        setStatusBar(statusbar);
    937 #endif // Q_OS_WINCE
    938 
    939 #ifdef Q_OS_WINCE
     938#endif // HANDHELD
     939
     940#ifdef Q_OS_WINCE_WM
    940941        menuBar()->setDefaultAction(menuFile->menuAction());
    941942
     
    948949#else
    949950        setCentralWidget(tabWidget);
    950 #endif // Q_OS_WINCE
     951#endif // Q_OS_WINCE_WM
    951952
    952953        //! \hack HACK: A little hack for toolbar icons to have a sane size.
    953 #ifdef Q_OS_WINCE
     954#ifdef Q_OS_WINCE_WM
    954955        toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4));
    955956#elif defined(Q_OS_SYMBIAN)
    956957        toolBar->setIconSize(QSize(logicalDpiX() / 5, logicalDpiY() / 5));
    957 #endif // Q_OS_WINCE
     958#endif // Q_OS_WINCE_WM
    958959
    959960        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.