Changeset 6beb157497 in tspsg
- Timestamp:
- Feb 23, 2010, 11:17:48 PM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- b2bf8e3b6b
- Parents:
- 11086c2def
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/defaults.h
r11086c2def r6beb157497 77 77 #define DEF_FONT_FAMILY "Courier New" 78 78 #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 81 88 //! Default font color 82 89 #define DEF_FONT_COLOR Qt::black -
src/globals.h
r11086c2def r6beb157497 57 57 * \brief Bath to documentation files. 58 58 */ 59 #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)59 #if defined(Q_OS_LINUX) || (defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)) 60 60 #define PATH_I18N "/usr/share/tspsg/i18n" 61 61 #define PATH_DOCS "/usr/share/doc/tspsg" -
src/main.cpp
r11086c2def r6beb157497 33 33 #endif 34 34 35 #include "qtwin.h"36 37 35 #ifdef STATIC_BUILD 38 36 Q_IMPORT_PLUGIN(qjpeg) -
src/mainwindow.cpp
r11086c2def r6beb157497 64 64 connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int))); 65 65 66 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 66 67 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 67 68 // Loading of saved window state 68 69 settings->beginGroup("MainWindow"); 69 #ifndef Q_OS_WINCE70 70 restoreGeometry(settings->value("Geometry").toByteArray()); 71 #endif // Q_OS_WINCE72 71 restoreState(settings->value("State").toByteArray()); 73 72 settings->endGroup(); 74 #ifndef Q_OS_WINCE75 73 } else { 76 74 // Centering main window … … 78 76 rect.moveCenter(QApplication::desktop()->availableGeometry(this).center()); 79 77 setGeometry(rect); 78 } 79 #else 80 setWindowState(windowState() | Qt::WindowMaximized); 80 81 #endif // Q_OS_WINCE 81 }82 82 83 83 tspmodel = new CTSPModel(this); … … 297 297 //! \todo TODO: Normal about window :-) 298 298 QString title; 299 #if def Q_OS_WINCE299 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) 300 300 title += QString::fromUtf8("<b>TSPSG<br>TSP Solver and Generator</b><br>"); 301 301 #else … … 455 455 output.append("<p> " + solver.getSortedPath() + "</p>"); 456 456 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>"); 458 458 else 459 459 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>"); … … 531 531 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 532 532 settings->beginGroup("MainWindow"); 533 #if ndef Q_OS_WINCE533 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 534 534 settings->setValue("Geometry", saveGeometry()); 535 535 #endif // Q_OS_WINCE … … 555 555 void MainWindow::loadLangList() 556 556 { 557 QSettings langinfo(PATH_I18N"/languages.ini", QSettings::IniFormat);557 QSettings langinfo(PATH_I18N"/languages.ini", QSettings::IniFormat); 558 558 #if QT_VERSION >= 0x040500 559 559 // In Qt < 4.5 QSettings doesn't have method setIniCodec. 560 560 langinfo.setIniCodec("UTF-8"); 561 561 #endif 562 QDir dir(PATH_I18N, "*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);562 QDir dir(PATH_I18N, "*.qm", QDir::Name | QDir::IgnoreCase, QDir::Files); 563 563 if (!dir.exists()) 564 564 return; … … 571 571 if (!lang.completeBaseName().startsWith("qt_") && lang.completeBaseName().compare("en")) { 572 572 #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()); 574 574 #else 575 575 // We use Name if Qt < 4.5 because NativeName is in UTF-8, QSettings 576 576 // 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()); 578 578 #endif 579 579 a->setData(lang.completeBaseName()); 580 580 a->setCheckable(true); 581 581 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())) 583 583 a->setChecked(true); 584 584 } … … 592 592 QString lng = lang; 593 593 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(); 596 596 } 597 597 static QTranslator *qtTranslator; // Qt library translator … … 613 613 // Trying to load system Qt library translation... 614 614 qtTranslator = new QTranslator(this); 615 if (qtTranslator->load("qt_" + lng, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))615 if (qtTranslator->load("qt_" + lng, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) 616 616 qApp->installTranslator(qtTranslator); 617 617 else { 618 618 // 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)) 620 620 qApp->installTranslator(qtTranslator); 621 621 else { … … 628 628 // Now let's load application translation. 629 629 translator = new QTranslator(this); 630 if (translator->load(lng, PATH_I18N))630 if (translator->load(lng, PATH_I18N)) 631 631 qApp->installTranslator(translator); 632 632 else { … … 634 634 translator = NULL; 635 635 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.")); 637 637 return false; 638 638 } … … 761 761 #endif 762 762 763 #if ndef Q_OS_WINCE763 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 764 764 QStatusBar *statusbar = new QStatusBar(this); 765 765 statusbar->setObjectName("statusbar"); … … 771 771 #endif // Q_OS_WINCE 772 772 773 //! \hack HACK: A little hack for toolbar icons to have a sane size. 773 774 #ifdef Q_OS_WINCE 774 //! \hack HACK: A little hack for toolbar icons to have a sane size.775 775 toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 776 #elif defined(Q_OS_SYMBIAN) 777 toolBar->setIconSize(QSize(logicalDpiX() / 5, logicalDpiY() / 5)); 776 778 #endif // Q_OS_WINCE 777 779 -
src/settingsdialog.cpp
r11086c2def r6beb157497 42 42 buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor)); 43 43 44 #if def Q_OS_WINCE44 #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) 45 45 // Layout helper elements 46 46 QVBoxLayout *vbox1; … … 55 55 hbox1->addWidget(buttonHelp); 56 56 hbox1->addStretch(); 57 hbox1->addWidget(buttonBox);58 57 59 58 // Central layout … … 151 150 // setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint); 152 151 setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); 153 #if ndef Q_OS_WINCE152 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 154 153 // Setting initial text of dialog hint label to own status tip text. 155 154 labelHint->setText(labelHint->statusTip()); … … 164 163 cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()); 165 164 #endif // Q_OS_WIN32 166 #if ndef Q_OS_WINCE165 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 167 166 cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool()); 168 167 #endif // Q_OS_WINCE … … 223 222 void SettingsDialog::accept() 224 223 { 225 #if ndef Q_OS_WINCE224 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 226 225 settings->setValue("SavePos", cbSaveState->isChecked()); 227 226 #endif // Q_OS_WINCE … … 282 281 } 283 282 284 #if ndef Q_OS_WINCE283 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 285 284 bool SettingsDialog::event(QEvent *ev) 286 285 { -
src/settingsdialog.h
r11086c2def r6beb157497 59 59 QCheckBox *cbUseTranslucency; 60 60 #endif // Q_OS_WIN32 61 #if ndef Q_OS_WINCE61 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 62 62 QCheckBox *cbSaveState; 63 63 QLabel *imgIcon; 64 QFrame *lineVertical; 64 65 QLabel *labelHint; 65 QFrame *lineVertical;66 66 67 67 bool event(QEvent *ev); -
src/tspsolver.cpp
r11086c2def r6beb157497 106 106 int nRow, nCol; 107 107 bool firstStep = true; 108 double check ;108 double check = INFINITY; 109 109 while (this->route.size() < nCities) { 110 110 // forbidden.clear(); … … 141 141 left->matrix = step->matrix; 142 142 left->matrix[nRow][nCol] = INFINITY; 143 143 left->price = step->price + align(left->matrix); 144 144 145 145 step->candidate.nRow = nRow; -
tspsg.pro
r11086c2def r6beb157497 17 17 DEPENDPATH += . 18 18 INCLUDEPATH += . 19 VERSOIN = 0.1.2 19 20 20 21 # A hack to determine whether we have static or dynamic Qt build … … 49 50 # - docs (none, yet) go to $(INSTALL_ROOT)/share/doc/tspsg 50 51 # Usually, $(INSTALL_ROOT) is /usr or /usr/local 51 unix {52 unix:!symbian { 52 53 target.path = /bin 53 54 share.path = /share/tspsg … … 75 76 # docs.files = docs\* 76 77 INSTALLS += target i18n docs share 78 79 RC_FILE = resources/tspsg.rc 77 80 } 78 81 … … 91 94 } 92 95 93 #Windows resource file 94 win32:RC_FILE = resources/tspsg.rc 96 # Symbian 97 symbian { 98 share.pkg_prerules = \ 99 "\"README\" - \"\", FILETEXT, TEXTCONTINUE" \ 100 "\"COPYING\" - \"\", FILETEXT, TEXTEXIT" 101 share.sources = COPYING README 102 i18n.sources = i18n/languages.ini i18n/*.qm 103 i18n.path = i18n 104 # docs.sources = docs/* 105 # docs.path = help 106 DEPLOYMENT += share i18n # docs 107 108 ICON = resources/tspsg.svg 109 110 appinfo = \ 111 "$$LITERAL_HASH{\"TSPSG\"},(0xEb9dce0e),0,1,2" 112 vendorinfo = \ 113 "%{\"l-homes.org\"}" \ 114 ":\"l-homes.org\"" 115 default_deployment.pkg_prerules = appinfo vendorinfo 116 DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"TSPSG Installer\"},(0xA000D7CE),1,0,0" 117 }
Note: See TracChangeset
for help on using the changeset viewer.