Index: src/defaults.h
===================================================================
--- src/defaults.h	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/defaults.h	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -33,4 +33,5 @@
 
 //////// GENERAL
+
 //! Default for "Automatically resize rows and columns to their contents"
 #define DEF_AUTOSIZE true
@@ -50,4 +51,5 @@
 
 //////// TASK
+
 //! Default for "Accuracy of the fractional values"
 #define DEF_FRACTIONAL_ACCURACY 2
@@ -62,4 +64,5 @@
 
 //////// OUTPUT
+
 //! Default for "Show solution steps' matrices for every solution step"
 #define DEF_SHOW_MATRIX true
@@ -74,9 +77,9 @@
  * \brief Default font name.
  */
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	#define DEF_FONT_FAMILY "Tahoma"
 #else
 	#define DEF_FONT_FAMILY "Courier New"
-#endif
+#endif // Q_OS_WINCE_WM
 /*!
  * \def DEF_FONT_SIZE
Index: src/globals.h
===================================================================
--- src/globals.h	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/globals.h	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -54,5 +54,5 @@
 /*!
  * \def PATH_L10N
- * \brief Bath to internationalization files.
+ * \brief Path to internationalization files.
  */
 #ifndef PATH_L10N
@@ -117,4 +117,9 @@
 #endif // Q_OS_WIN32
 
+#if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN)
+	//! This is defined on handheld (e.g., Windows Mobile, Symbian) devices.
+	#define HANDHELD
+#endif
+
 // Sanity checks
 // Check that default number of cities is sane (<= MAX_NUM_CITIES)
Index: src/mainwindow.cpp
===================================================================
--- src/mainwindow.cpp	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/mainwindow.cpp	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -45,9 +45,9 @@
 #endif // QT_NO_PRINTER
 
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	currentGeometry = QApplication::desktop()->availableGeometry(0);
 	// We need to react to SIP show/hide and resize the window appropriately
 	connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 	connect(actionFileNew,SIGNAL(triggered()),this,SLOT(actionFileNewTriggered()));
 	connect(actionFileOpen,SIGNAL(triggered()),this,SLOT(actionFileOpenTriggered()));
@@ -73,5 +73,5 @@
 	connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(spinCitiesValueChanged(int)));
 
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	// Centering main window
 QRect rect = geometry();
@@ -87,5 +87,5 @@
 #else
 	setWindowState(Qt::WindowMaximized);
-#endif // Q_OS_WINCE
+#endif // HANDHELD
 
 	tspmodel = new CTSPModel(this);
@@ -269,7 +269,7 @@
 		return;
 	if (sd.colorChanged() || sd.fontChanged()) {
-		initDocStyleSheet();
 		if (!solutionText->document()->isEmpty() && sd.colorChanged())
 			QMessageBox::information(this, tr("Settings Changed"), tr("You have changed color settings.\nThey will be applied to the next solution output."));
+		initDocStyleSheet();
 	}
 	if (sd.translucencyChanged() != 0)
@@ -281,5 +281,5 @@
 	if (checked) {
 		settings->remove("Language");
-		QMessageBox::information(this, tr("Language change"), tr("Language will be autodetected on next application start."));
+		QMessageBox::information(this, tr("Language change"), tr("Language will be autodetected on the next application start."));
 	} else
 		settings->setValue("Language", groupSettingsLanguageList->checkedAction()->data().toString());
@@ -309,5 +309,6 @@
 #endif
 		QApplication::restoreOverrideCursor();
-		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."));
+		if (!solutionText->document()->isEmpty())
+			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."));
 	}
 }
@@ -330,16 +331,16 @@
 {
 QString title;
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#ifdef HANDHELD
 	title += QString("<b>TSPSG<br>TSP Solver and Generator</b><br>");
 #else
 	title += QString("<b>TSPSG: TSP Solver and Generator</b><br>");
-#endif // Q_OS_WINCE || Q_OS_SYMBIAN
+#endif // HANDHELD
 	title += QString("%1: <b>%2</b><br>").arg(tr("Version"), QApplication::applicationVersion());
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	title += QString("<b>&copy; 2007-%1 <a href=\"http://%2/\">%3</a></b><br>").arg(QDate::currentDate().toString("yyyy"), QApplication::organizationDomain(), QApplication::organizationName());
 	title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sourceforge.net/</a></b>");
 #else
 	title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b>");
-#endif // Q_OS_WINCE && Q_OS_SYMBIAN
+#endif // Q_OS_WINCE_WM && Q_OS_SYMBIAN
 
 QString about;
@@ -372,7 +373,7 @@
 	*lblTitle = new QLabel(dlg),
 	*lblTranslated = new QLabel(dlg);
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
-QLabel *lblSubTitle = new QLabel(QString("<b>&copy; 2007-%1 Oleksii \"Lёppa\" Serdiuk</b>").arg(QDate::currentDate().toString("yyyy")), dlg);
-#endif // Q_OS_WINCE || Q_OS_SYMBIAN
+#ifdef HANDHELD
+QLabel *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);
+#endif // HANDHELD
 QTextBrowser *txtAbout = new QTextBrowser(dlg);
 QVBoxLayout *vb = new QVBoxLayout();
@@ -381,17 +382,17 @@
 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, dlg);
 
-	lblIcon->setPixmap(QPixmap(":/images/tspsg.png").scaledToWidth(logicalDpiX() * 2 / 3, Qt::SmoothTransformation));
-	lblIcon->setAlignment(Qt::AlignTop);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
-	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()));
-#endif
-
 	lblTitle->setOpenExternalLinks(true);
 	lblTitle->setText(title);
 	lblTitle->setAlignment(Qt::AlignTop);
 	lblTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	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()));
-#endif
+#endif // HANDHELD
+
+	lblIcon->setPixmap(QPixmap(":/images/tspsg.png").scaledToHeight(lblTitle->sizeHint().height(), Qt::SmoothTransformation));
+	lblIcon->setAlignment(Qt::AlignVCenter);
+#ifndef HANDHELD
+	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()));
+#endif // HANDHELD
 
 	hb1->addWidget(lblIcon);
@@ -402,7 +403,7 @@
 	txtAbout->setHtml(about);
 	txtAbout->moveCursor(QTextCursor::Start);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	txtAbout->setStyleSheet(QString("QTextBrowser {border-color: %1; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().shadow().color().name()));
-#endif
+#endif // HANDHELD
 
 	bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
@@ -413,7 +414,7 @@
 	else {
 		lblTranslated->setOpenExternalLinks(true);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 		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()));
-#endif
+#endif // HANDHELD
 		hb2->addWidget(lblTranslated);
 	}
@@ -421,11 +422,11 @@
 	hb2->addWidget(bb);
 
-#if defined(Q_OS_WINCE)
+#ifdef Q_OS_WINCE_WM
 	vb->setMargin(3);
-#endif
+#endif // Q_OS_WINCE_WM
 	vb->addLayout(hb1);
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#ifdef HANDHELD
 	vb->addWidget(lblSubTitle);
-#endif // Q_OS_WINCE || Q_OS_SYMBIAN
+#endif // HANDHELD
 	vb->addWidget(txtAbout);
 	vb->addLayout(hb2);
@@ -486,11 +487,11 @@
 	pb->setFormat(tr("%v of %1 parts found").arg(n));
 	pd.setBar(pb);
-	pd.setMaximum(n * 2 + 3);
-	pd.setMinimumDuration(1000);
+	pd.setMaximum(n);
+	pd.setAutoReset(false);
 	pd.setLabelText(tr("Calculating optimal route..."));
 	pd.setWindowTitle(tr("Solution Progress"));
 	pd.setWindowModality(Qt::ApplicationModal);
 	pd.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
-	pd.setValue(0);
+	pd.show();
 
 CTSPSolver solver;
@@ -506,11 +507,10 @@
 		return;
 	}
-	pb->setFormat("%p%");
+	pb->setFormat(tr("Generating header"));
 	pd.setLabelText(tr("Generating solution output..."));
-	pd.setValue(n + 1);
+	pd.setMaximum(n);
+	pd.setValue(0);
 
 	solutionText->clear();
-	pd.setValue(n + 2);
-
 	solutionText->setDocumentTitle(tr("Solution of Variant #%1 task").arg(spinVariant->value()));
 	solutionText->append("<p>" + tr("Variant #%1").arg(spinVariant->value()) + "</p>");
@@ -520,10 +520,11 @@
 SStep *step = root;
 	n = 1;
-	while (n <= spinCities->value()) {
+	pb->setFormat(tr("Generating step %v"));
+	while (n < spinCities->value()) {
 		if (pd.wasCanceled()) {
 			solutionText->clear();
 			return;
 		}
-		pd.setValue(spinCities->value() + 2 + n);
+		pd.setValue(n);
 
 		if (step->prNode->prNode != NULL || ((step->prNode->prNode == NULL) && (step->plNode->prNode == NULL))) {
@@ -554,5 +555,6 @@
 			break;
 	}
-	pd.setValue(spinCities->value() + 2 + n);
+	pb->setFormat(tr("Generating footer"));
+	pd.setValue(n);
 
 	if (solver.isOptimal())
@@ -579,5 +581,4 @@
 	pd.setMaximum(0);
 	pd.setCancelButton(NULL);
-	pd.adjustSize();
 	QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
 	solver.cleanup(true);
@@ -602,5 +603,5 @@
 }
 
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 void MainWindow::changeEvent(QEvent *ev)
 {
@@ -635,5 +636,5 @@
 	}
 }
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 void MainWindow::numCitiesChanged(int nCities)
@@ -676,7 +677,7 @@
 		if (settings->value("SavePos", DEF_SAVEPOS).toBool()) {
 			settings->beginGroup("MainWindow");
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 			settings->setValue("Geometry", saveGeometry());
-#endif // Q_OS_WINCE
+#endif // HANDHELD
 			settings->setValue("State", saveState());
 			settings->endGroup();
@@ -931,11 +932,11 @@
 #endif
 
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 QStatusBar *statusbar = new QStatusBar(this);
 	statusbar->setObjectName("statusbar");
 	setStatusBar(statusbar);
-#endif // Q_OS_WINCE
-
-#ifdef Q_OS_WINCE
+#endif // HANDHELD
+
+#ifdef Q_OS_WINCE_WM
 	menuBar()->setDefaultAction(menuFile->menuAction());
 
@@ -948,12 +949,12 @@
 #else
 	setCentralWidget(tabWidget);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 	//! \hack HACK: A little hack for toolbar icons to have a sane size.
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4));
 #elif defined(Q_OS_SYMBIAN)
 	toolBar->setIconSize(QSize(logicalDpiX() / 5, logicalDpiY() / 5));
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 	solutionText->document()->setDefaultFont(settings->value("Output/Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>());
Index: src/mainwindow.h
===================================================================
--- src/mainwindow.h	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/mainwindow.h	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -74,8 +74,8 @@
 	void dataChanged();
 	void dataChanged(const QModelIndex &tl, const QModelIndex &br);
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	void changeEvent(QEvent *ev);
 	void desktopResized(int screen);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 	void numCitiesChanged(int nCities);
 #ifndef QT_NO_PRINTER
@@ -97,7 +97,7 @@
 	QSettings *settings;
 	CTSPModel *tspmodel;
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	QRect currentGeometry;
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 	void closeEvent(QCloseEvent *ev);
Index: src/settingsdialog.cpp
===================================================================
--- src/settingsdialog.cpp	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/settingsdialog.cpp	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -42,11 +42,11 @@
 	buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor));
 
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#ifdef HANDHELD
 QVBoxLayout *vbox1; // Layout helper
 
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	// On screens with small height when SIP is shown and the window is resized
 	// there is not enought space for all elements.
-	//  So we show scrollbars to be able to access them.
+	// So we show the scrollbars to be able to access them.
 QScrollArea *scrollArea = new QScrollArea(this);
 	scrollArea->setFrameShape(QFrame::NoFrame);
@@ -56,5 +56,5 @@
 #else
 	buttons->insertStretch(buttons->indexOf(buttonHelp) + 1);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 	bgWhite->layout()->setMargin(0);
@@ -64,12 +64,12 @@
 	vbox1->setMargin(0);
 	vbox1->setSpacing(0);
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	vbox1->addWidget(scrollArea);
 #else
 	vbox1->addWidget(bgWhite);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 	vbox1->addWidget(bgGrey);
 	setLayout(vbox1);
-#else // Q_OS_WINCE || Q_OS_SYMBIAN
+#else // HANDHELD
 	// Layout helper elements
 QVBoxLayout *vbox1, *vbox2;
@@ -147,18 +147,18 @@
 	vbox2->addWidget(bgGrey);
 	setLayout(vbox2);
-#endif // Q_OS_WINCE
-
-#ifdef Q_OS_WINCE
+#endif // HANDHELD
+
+#ifdef Q_OS_WINCE_WM
 	// We need to react to SIP show/hide and resize the window appropriately
 	connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 	connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int)));
 	connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
 	connect(buttonColor,SIGNAL(clicked()),this,SLOT(buttonColorClicked()));
 	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	// Setting initial text of dialog hint label to own status tip text.
 	labelHint->setText(labelHint->statusTip());
-#endif // Q_OS_WINCE
+#endif // HANDHELD
 
 	settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this);
@@ -171,7 +171,7 @@
 		cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool());
 #endif // Q_OS_WIN32
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
-#endif // Q_OS_WINCE
+#endif // HANDHELD
 
 	settings->beginGroup("Task");
@@ -198,7 +198,7 @@
 	settings->endGroup();
 
-#ifndef Q_OS_WINCE
+#ifndef Q_OS_WINCE_WM
 	adjustSize();
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 }
 
@@ -248,7 +248,7 @@
 			return;
 	}
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 	settings->setValue("SavePos", cbSaveState->isChecked());
-#endif // Q_OS_WINCE
+#endif // HANDHELD
 #ifdef Q_OS_WIN32
 	if (QtWin::isCompositionEnabled()) {
@@ -304,5 +304,5 @@
 }
 
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 void SettingsDialog::desktopResized(int screen)
 {
@@ -336,5 +336,5 @@
 	QWidget::showEvent(ev);
 }
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 void SettingsDialog::spinRandMinValueChanged(int val) {
@@ -342,5 +342,5 @@
 }
 
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
+#ifndef HANDHELD
 bool SettingsDialog::event(QEvent *ev)
 {
@@ -358,3 +358,3 @@
 		return QDialog::event(ev);
 }
-#endif // Q_OS_WINCE
+#endif // HANDHELD
Index: src/settingsdialog.h
===================================================================
--- src/settingsdialog.h	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/settingsdialog.h	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -59,5 +59,5 @@
 	QCheckBox *cbUseTranslucency;
 #endif // Q_OS_WIN32
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	QRect currentGeometry;
 #elif !defined(Q_OS_SYMBIAN)
@@ -68,5 +68,5 @@
 
 	bool event(QEvent *ev);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 
 private slots:
@@ -74,8 +74,8 @@
 	void buttonColorClicked();
 	void buttonFontClicked();
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WINCE_WM
 	void desktopResized(int screen);
 	void showEvent(QShowEvent *ev);
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINCE_WM
 	void spinRandMinValueChanged(int val);
 };
Index: src/tspmodel.cpp
===================================================================
--- src/tspmodel.cpp	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/tspmodel.cpp	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -84,5 +84,5 @@
 				return tr(INFSTR);
 			else
-//! \hack HACK: Converting to string to prevent spinbox in edit mode
+				//! \hack HACK: Converting to string to prevent spinbox in edit mode
 				return QVariant(table.at(index.row()).at(index.column())).toString();
 		else
Index: src/version.h
===================================================================
--- src/version.h	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
+++ src/version.h	(revision 1babbd6ba316aa403b08380b75724cc7ded40cb0)
@@ -72,9 +72,15 @@
  * \brief TSPSG build status
  */
-#if !defined(TSPSG_RELEASE_BUILD)
-	#define BUILD_STATUS (dev build)
-#elif !defined(BUILD_STATUS)
-	#define BUILD_STATUS (build BUILD_NUMBER)
-#endif // TSPSG_RELEASE_BUILD
+#ifdef DEBUG
+	#ifndef BUILD_STATUS
+		#define BUILD_STATUS (debug build BUILD_NUMBER)
+	#endif
+#else
+	#if !defined(TSPSG_RELEASE_BUILD)
+		#define BUILD_STATUS (dev build)
+	#elif !defined(BUILD_STATUS)
+		#define BUILD_STATUS (build BUILD_NUMBER)
+	#endif // TSPSG_RELEASE_BUILD
+#endif // DEBUG
 
 //! \internal \brief A helper for QUOTE(x).
