Changeset 6beb157497 in tspsg for src


Ignore:
Timestamp:
Feb 23, 2010, 11:17:48 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:
b2bf8e3b6b
Parents:
11086c2def
Message:

+ Preliminary Symbian support.

Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/defaults.h

    r11086c2def r6beb157497  
    7777        #define DEF_FONT_FAMILY "Courier New"
    7878#endif
    79 //! Default font size
    80 #define DEF_FONT_SIZE 10
     79/*!
     80 * \def DEF_FONT_SIZE
     81 * \brief Default font size
     82 */
     83#ifdef Q_OS_SYMBIAN
     84        #define DEF_FONT_SIZE 8
     85#else
     86        #define DEF_FONT_SIZE 10
     87#endif // Q_OS_SYMBIAN
    8188//! Default font color
    8289#define DEF_FONT_COLOR Qt::black
  • src/globals.h

    r11086c2def r6beb157497  
    5757 * \brief Bath to documentation files.
    5858 */
    59 #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
     59#if defined(Q_OS_LINUX) || (defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN))
    6060        #define PATH_I18N "/usr/share/tspsg/i18n"
    6161        #define PATH_DOCS "/usr/share/doc/tspsg"
  • src/main.cpp

    r11086c2def r6beb157497  
    3333#endif
    3434
    35 #include "qtwin.h"
    36 
    3735#ifdef STATIC_BUILD
    3836        Q_IMPORT_PLUGIN(qjpeg)
  • src/mainwindow.cpp

    r11086c2def r6beb157497  
    6464        connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int)));
    6565
     66#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    6667        if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
    6768                // Loading of saved window state
    6869                settings->beginGroup("MainWindow");
    69 #ifndef Q_OS_WINCE
    7070                restoreGeometry(settings->value("Geometry").toByteArray());
    71 #endif // Q_OS_WINCE
    7271                restoreState(settings->value("State").toByteArray());
    7372                settings->endGroup();
    74 #ifndef Q_OS_WINCE
    7573        } else {
    7674                // Centering main window
     
    7876                rect.moveCenter(QApplication::desktop()->availableGeometry(this).center());
    7977                setGeometry(rect);
     78        }
     79#else
     80        setWindowState(windowState() | Qt::WindowMaximized);
    8081#endif // Q_OS_WINCE
    81         }
    8282
    8383        tspmodel = new CTSPModel(this);
     
    297297//! \todo TODO: Normal about window :-)
    298298QString title;
    299 #ifdef Q_OS_WINCE
     299#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
    300300        title += QString::fromUtf8("<b>TSPSG<br>TSP Solver and Generator</b><br>");
    301301#else
     
    455455        output.append("<p>&nbsp;&nbsp;" + solver.getSortedPath() + "</p>");
    456456        if (isInteger(step->price))
    457                 output.append("<p>" + tr("The price is <b>%n</b> unit(s).", "", step->price) + "</p>");
     457                output.append("<p>" + tr("The price is <b>%n</b> unit(s).", "", qRound(step->price)) + "</p>");
    458458        else
    459459                output.append("<p>" + tr("The price is <b>%1</b> units.").arg(step->price, 0, 'f', settings->value("Task/FractionalAccuracy", DEF_FRACTIONAL_ACCURACY).toInt()) + "</p>");
     
    531531        if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
    532532                settings->beginGroup("MainWindow");
    533 #ifndef Q_OS_WINCE
     533#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    534534                settings->setValue("Geometry", saveGeometry());
    535535#endif // Q_OS_WINCE
     
    555555void MainWindow::loadLangList()
    556556{
    557 QSettings langinfo(PATH_I18N"/languages.ini",QSettings::IniFormat);
     557QSettings langinfo(PATH_I18N"/languages.ini", QSettings::IniFormat);
    558558#if QT_VERSION >= 0x040500
    559559        // In Qt < 4.5 QSettings doesn't have method setIniCodec.
    560560        langinfo.setIniCodec("UTF-8");
    561561#endif
    562 QDir dir(PATH_I18N,"*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);
     562QDir dir(PATH_I18N, "*.qm", QDir::Name | QDir::IgnoreCase, QDir::Files);
    563563        if (!dir.exists())
    564564                return;
     
    571571                if (!lang.completeBaseName().startsWith("qt_") && lang.completeBaseName().compare("en")) {
    572572#if QT_VERSION >= 0x040500
    573                         a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/NativeName",lang.completeBaseName()).toString());
     573                        a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/NativeName", lang.completeBaseName()).toString());
    574574#else
    575575                        // We use Name if Qt < 4.5 because NativeName is in UTF-8, QSettings
    576576                        // reads .ini file as ASCII and there is no way to set file encoding.
    577                         a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/Name",lang.completeBaseName()).toString());
     577                        a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/Name", lang.completeBaseName()).toString());
    578578#endif
    579579                        a->setData(lang.completeBaseName());
    580580                        a->setCheckable(true);
    581581                        a->setActionGroup(groupSettingsLanguageList);
    582                         if (settings->value("Language",QLocale::system().name()).toString().startsWith(lang.completeBaseName()))
     582                        if (settings->value("Language", QLocale::system().name()).toString().startsWith(lang.completeBaseName()))
    583583                                a->setChecked(true);
    584584                }
     
    592592QString lng = lang;
    593593        if (lng.isEmpty()) {
    594                 ad = settings->value("Language","").toString().isEmpty();
    595                 lng = settings->value("Language",QLocale::system().name()).toString();
     594                ad = settings->value("Language", "").toString().isEmpty();
     595                lng = settings->value("Language", QLocale::system().name()).toString();
    596596        }
    597597static QTranslator *qtTranslator; // Qt library translator
     
    613613        // Trying to load system Qt library translation...
    614614        qtTranslator = new QTranslator(this);
    615         if (qtTranslator->load("qt_" + lng,QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
     615        if (qtTranslator->load("qt_" + lng, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
    616616                qApp->installTranslator(qtTranslator);
    617617        else {
    618618                // No luck. Let's try to load a bundled one.
    619                 if (qtTranslator->load("qt_" + lng,PATH_I18N))
     619                if (qtTranslator->load("qt_" + lng, PATH_I18N))
    620620                        qApp->installTranslator(qtTranslator);
    621621                else {
     
    628628        // Now let's load application translation.
    629629        translator = new QTranslator(this);
    630         if (translator->load(lng,PATH_I18N))
     630        if (translator->load(lng, PATH_I18N))
    631631                qApp->installTranslator(translator);
    632632        else {
     
    634634                translator = NULL;
    635635                if (!ad)
    636                         QMessageBox(QMessageBox::Warning,tr("Language Change"),tr("Unable to load translation language."),QMessageBox::Ok,this).exec();
     636                        QMessageBox::warning(this, tr("Language Change"), tr("Unable to load translation language."));
    637637                return false;
    638638        }
     
    761761#endif
    762762
    763 #ifndef Q_OS_WINCE
     763#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    764764QStatusBar *statusbar = new QStatusBar(this);
    765765        statusbar->setObjectName("statusbar");
     
    771771#endif // Q_OS_WINCE
    772772
     773        //! \hack HACK: A little hack for toolbar icons to have a sane size.
    773774#ifdef Q_OS_WINCE
    774         //! \hack HACK: A little hack for toolbar icons to have a sane size.
    775775        toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4));
     776#elif defined(Q_OS_SYMBIAN)
     777        toolBar->setIconSize(QSize(logicalDpiX() / 5, logicalDpiY() / 5));
    776778#endif // Q_OS_WINCE
    777779
  • src/settingsdialog.cpp

    r11086c2def r6beb157497  
    4242        buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor));
    4343
    44 #ifdef Q_OS_WINCE
     44#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
    4545        // Layout helper elements
    4646QVBoxLayout *vbox1;
     
    5555        hbox1->addWidget(buttonHelp);
    5656        hbox1->addStretch();
    57         hbox1->addWidget(buttonBox);
    5857
    5958        // Central layout
     
    151150//      setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
    152151        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    153 #ifndef Q_OS_WINCE
     152#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    154153        // Setting initial text of dialog hint label to own status tip text.
    155154        labelHint->setText(labelHint->statusTip());
     
    164163                cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool());
    165164#endif // Q_OS_WIN32
    166 #ifndef Q_OS_WINCE
     165#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    167166        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
    168167#endif // Q_OS_WINCE
     
    223222void SettingsDialog::accept()
    224223{
    225 #ifndef Q_OS_WINCE
     224#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    226225        settings->setValue("SavePos", cbSaveState->isChecked());
    227226#endif // Q_OS_WINCE
     
    282281}
    283282
    284 #ifndef Q_OS_WINCE
     283#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    285284bool SettingsDialog::event(QEvent *ev)
    286285{
  • src/settingsdialog.h

    r11086c2def r6beb157497  
    5959        QCheckBox *cbUseTranslucency;
    6060#endif // Q_OS_WIN32
    61 #ifndef Q_OS_WINCE
     61#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
    6262        QCheckBox *cbSaveState;
    6363        QLabel *imgIcon;
     64        QFrame *lineVertical;
    6465        QLabel *labelHint;
    65         QFrame *lineVertical;
    6666
    6767        bool event(QEvent *ev);
  • src/tspsolver.cpp

    r11086c2def r6beb157497  
    106106int nRow, nCol;
    107107bool firstStep = true;
    108 double check;
     108double check = INFINITY;
    109109        while (this->route.size() < nCities) {
    110110//              forbidden.clear();
     
    141141                left->matrix = step->matrix;
    142142                left->matrix[nRow][nCol] = INFINITY;
    143                 left->price = step->price + align(left->matrix);
     143                left->price = step->price + align(left->matrix);
    144144
    145145                step->candidate.nRow = nRow;
Note: See TracChangeset for help on using the changeset viewer.