Changeset 1babbd6ba3 in tspsg for src


Ignore:
Timestamp:
Apr 8, 2010, 11:02:26 PM (14 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.
Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/defaults.h

    r394216e468 r1babbd6ba3  
    3333
    3434//////// GENERAL
     35
    3536//! Default for "Automatically resize rows and columns to their contents"
    3637#define DEF_AUTOSIZE true
     
    5051
    5152//////// TASK
     53
    5254//! Default for "Accuracy of the fractional values"
    5355#define DEF_FRACTIONAL_ACCURACY 2
     
    6264
    6365//////// OUTPUT
     66
    6467//! Default for "Show solution steps' matrices for every solution step"
    6568#define DEF_SHOW_MATRIX true
     
    7477 * \brief Default font name.
    7578 */
    76 #ifdef Q_OS_WINCE
     79#ifdef Q_OS_WINCE_WM
    7780        #define DEF_FONT_FAMILY "Tahoma"
    7881#else
    7982        #define DEF_FONT_FAMILY "Courier New"
    80 #endif
     83#endif // Q_OS_WINCE_WM
    8184/*!
    8285 * \def DEF_FONT_SIZE
  • src/globals.h

    r394216e468 r1babbd6ba3  
    5454/*!
    5555 * \def PATH_L10N
    56  * \brief Bath to internationalization files.
     56 * \brief Path to internationalization files.
    5757 */
    5858#ifndef PATH_L10N
     
    117117#endif // Q_OS_WIN32
    118118
     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
    119124// Sanity checks
    120125// Check that default number of cities is sane (<= MAX_NUM_CITIES)
  • 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>());
  • src/mainwindow.h

    r394216e468 r1babbd6ba3  
    7474        void dataChanged();
    7575        void dataChanged(const QModelIndex &tl, const QModelIndex &br);
    76 #ifdef Q_OS_WINCE
     76#ifdef Q_OS_WINCE_WM
    7777        void changeEvent(QEvent *ev);
    7878        void desktopResized(int screen);
    79 #endif // Q_OS_WINCE
     79#endif // Q_OS_WINCE_WM
    8080        void numCitiesChanged(int nCities);
    8181#ifndef QT_NO_PRINTER
     
    9797        QSettings *settings;
    9898        CTSPModel *tspmodel;
    99 #ifdef Q_OS_WINCE
     99#ifdef Q_OS_WINCE_WM
    100100        QRect currentGeometry;
    101 #endif // Q_OS_WINCE
     101#endif // Q_OS_WINCE_WM
    102102
    103103        void closeEvent(QCloseEvent *ev);
  • src/settingsdialog.cpp

    r394216e468 r1babbd6ba3  
    4242        buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor));
    4343
    44 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
     44#ifdef HANDHELD
    4545QVBoxLayout *vbox1; // Layout helper
    4646
    47 #ifdef Q_OS_WINCE
     47#ifdef Q_OS_WINCE_WM
    4848        // On screens with small height when SIP is shown and the window is resized
    4949        // there is not enought space for all elements.
    50         //  So we show scrollbars to be able to access them.
     50        // So we show the scrollbars to be able to access them.
    5151QScrollArea *scrollArea = new QScrollArea(this);
    5252        scrollArea->setFrameShape(QFrame::NoFrame);
     
    5656#else
    5757        buttons->insertStretch(buttons->indexOf(buttonHelp) + 1);
    58 #endif // Q_OS_WINCE
     58#endif // Q_OS_WINCE_WM
    5959
    6060        bgWhite->layout()->setMargin(0);
     
    6464        vbox1->setMargin(0);
    6565        vbox1->setSpacing(0);
    66 #ifdef Q_OS_WINCE
     66#ifdef Q_OS_WINCE_WM
    6767        vbox1->addWidget(scrollArea);
    6868#else
    6969        vbox1->addWidget(bgWhite);
    70 #endif // Q_OS_WINCE
     70#endif // Q_OS_WINCE_WM
    7171        vbox1->addWidget(bgGrey);
    7272        setLayout(vbox1);
    73 #else // Q_OS_WINCE || Q_OS_SYMBIAN
     73#else // HANDHELD
    7474        // Layout helper elements
    7575QVBoxLayout *vbox1, *vbox2;
     
    147147        vbox2->addWidget(bgGrey);
    148148        setLayout(vbox2);
    149 #endif // Q_OS_WINCE
    150 
    151 #ifdef Q_OS_WINCE
     149#endif // HANDHELD
     150
     151#ifdef Q_OS_WINCE_WM
    152152        // We need to react to SIP show/hide and resize the window appropriately
    153153        connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
    154 #endif // Q_OS_WINCE
     154#endif // Q_OS_WINCE_WM
    155155        connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int)));
    156156        connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
    157157        connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked()));
    158158        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    159 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     159#ifndef HANDHELD
    160160        // Setting initial text of dialog hint label to own status tip text.
    161161        labelHint->setText(labelHint->statusTip());
    162 #endif // Q_OS_WINCE
     162#endif // HANDHELD
    163163
    164164        settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this);
     
    171171                cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool());
    172172#endif // Q_OS_WIN32
    173 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     173#ifndef HANDHELD
    174174        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
    175 #endif // Q_OS_WINCE
     175#endif // HANDHELD
    176176
    177177        settings->beginGroup("Task");
     
    198198        settings->endGroup();
    199199
    200 #ifndef Q_OS_WINCE
     200#ifndef Q_OS_WINCE_WM
    201201        adjustSize();
    202 #endif // Q_OS_WINCE
     202#endif // Q_OS_WINCE_WM
    203203}
    204204
     
    248248                        return;
    249249        }
    250 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     250#ifndef HANDHELD
    251251        settings->setValue("SavePos", cbSaveState->isChecked());
    252 #endif // Q_OS_WINCE
     252#endif // HANDHELD
    253253#ifdef Q_OS_WIN32
    254254        if (QtWin::isCompositionEnabled()) {
     
    304304}
    305305
    306 #ifdef Q_OS_WINCE
     306#ifdef Q_OS_WINCE_WM
    307307void SettingsDialog::desktopResized(int screen)
    308308{
     
    336336        QWidget::showEvent(ev);
    337337}
    338 #endif // Q_OS_WINCE
     338#endif // Q_OS_WINCE_WM
    339339
    340340void SettingsDialog::spinRandMinValueChanged(int val) {
     
    342342}
    343343
    344 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     344#ifndef HANDHELD
    345345bool SettingsDialog::event(QEvent *ev)
    346346{
     
    358358                return QDialog::event(ev);
    359359}
    360 #endif // Q_OS_WINCE
     360#endif // HANDHELD
  • src/settingsdialog.h

    r394216e468 r1babbd6ba3  
    5959        QCheckBox *cbUseTranslucency;
    6060#endif // Q_OS_WIN32
    61 #ifdef Q_OS_WINCE
     61#ifdef Q_OS_WINCE_WM
    6262        QRect currentGeometry;
    6363#elif !defined(Q_OS_SYMBIAN)
     
    6868
    6969        bool event(QEvent *ev);
    70 #endif // Q_OS_WINCE
     70#endif // Q_OS_WINCE_WM
    7171
    7272private slots:
     
    7474        void buttonColorClicked();
    7575        void buttonFontClicked();
    76 #ifdef Q_OS_WINCE
     76#ifdef Q_OS_WINCE_WM
    7777        void desktopResized(int screen);
    7878        void showEvent(QShowEvent *ev);
    79 #endif // Q_OS_WINCE
     79#endif // Q_OS_WINCE_WM
    8080        void spinRandMinValueChanged(int val);
    8181};
  • src/tspmodel.cpp

    r394216e468 r1babbd6ba3  
    8484                                return tr(INFSTR);
    8585                        else
    86 //! \hack HACK: Converting to string to prevent spinbox in edit mode
     86                                //! \hack HACK: Converting to string to prevent spinbox in edit mode
    8787                                return QVariant(table.at(index.row()).at(index.column())).toString();
    8888                else
  • src/version.h

    r394216e468 r1babbd6ba3  
    7272 * \brief TSPSG build status
    7373 */
    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
    7985
    8086//! \internal \brief A helper for QUOTE(x).
Note: See TracChangeset for help on using the changeset viewer.