Index: trunk/src/defines.h
===================================================================
--- trunk/src/defines.h	(revision 22)
+++ trunk/src/defines.h	(revision 23)
@@ -22,9 +22,6 @@
  */
 
-#ifndef DEFAULTS_H
-#define DEFAULTS_H
-
-// Ini file name
-#define INI_FILE "tspsg.ini"
+#ifndef DEFINES_H
+#define DEFINES_H
 
 // Default values
@@ -36,3 +33,3 @@
 #define DEF_FONT_COLOR Qt::black
 
-#endif // DEFAULTS_H
+#endif // DEFINES_H
Index: trunk/src/mainwindow.cpp
===================================================================
--- trunk/src/mainwindow.cpp	(revision 22)
+++ trunk/src/mainwindow.cpp	(revision 23)
@@ -33,6 +33,6 @@
 {
 	setupUi(this);
-QSettings settings(INI_FILE,QSettings::IniFormat);
-	spinCities->setValue(settings.value("NumCities",5).toInt());
+	settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg");
+	spinCities->setValue(settings->value("NumCities",5).toInt());
 	connect(actionSettingsSettings,SIGNAL(triggered()),this,SLOT(ChangeSettings()));
 	connect(actionHelpAbout,SIGNAL(triggered()),this,SLOT(showAbout()));
@@ -50,12 +50,12 @@
 	tabWidget->resize(rect.width(),rect.height() - toolBar->size().height());
 #else
-	if (settings.value("SavePos",false).toBool()) {
+	if (settings->value("SavePos",false).toBool()) {
 		// Loading of saved window state
-		settings.beginGroup("MainWindow");
-		resize(settings.value("Size",size()).toSize());
-		move(settings.value("Position",pos()).toPoint());
-		if (settings.value("Maximized",false).toBool())
+		settings->beginGroup("MainWindow");
+		resize(settings->value("Size",size()).toSize());
+		move(settings->value("Position",pos()).toPoint());
+		if (settings->value("Maximized",false).toBool())
 			setWindowState(windowState() | Qt::WindowMaximized);
-		settings.endGroup();
+		settings->endGroup();
 	} else {
 		// Centering main window
@@ -154,14 +154,13 @@
 {
 	// Saving windows state
-QSettings settings(INI_FILE,QSettings::IniFormat);
-	settings.setValue("NumCities",spinCities->value());
-	if (settings.value("SavePos",false).toBool()) {
-		settings.beginGroup("MainWindow");
-		settings.setValue("Maximized",isMaximized());
+	settings->setValue("NumCities",spinCities->value());
+	if (settings->value("SavePos",false).toBool()) {
+		settings->beginGroup("MainWindow");
+		settings->setValue("Maximized",isMaximized());
 		if (!isMaximized()) {
-			settings.setValue("Size",size());
-			settings.setValue("Position",pos());
+			settings->setValue("Size",size());
+			settings->setValue("Position",pos());
 		}
-		settings.endGroup();
+		settings->endGroup();
 	}
 	QMainWindow::closeEvent(event);
Index: trunk/src/mainwindow.h
===================================================================
--- trunk/src/mainwindow.h	(revision 22)
+++ trunk/src/mainwindow.h	(revision 23)
@@ -26,4 +26,5 @@
 
 #include <QMainWindow>
+#include <QSettings>
 #ifdef Q_OS_WINCE
 	#include "ui_mainwindow.ce.h"
@@ -53,4 +54,5 @@
 	void CitiesNumberChanged(int n);
 private:
+	QSettings *settings;
 	CTSPModel *tspmodel;
 };
Index: trunk/src/settingsdialog.cpp
===================================================================
--- trunk/src/settingsdialog.cpp	(revision 22)
+++ trunk/src/settingsdialog.cpp	(revision 23)
@@ -50,5 +50,5 @@
 	labelHint->setMinimumHeight(labelHint->height());
 #endif // Q_OS_WINCE
-	settings = new QSettings(INI_FILE,QSettings::IniFormat);
+	settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg");
 	spinRandMin->setValue(settings->value("MinCost",DEF_RAND_MIN).toInt());
 	spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt());
Index: trunk/src/tspmodel.cpp
===================================================================
--- trunk/src/tspmodel.cpp	(revision 22)
+++ trunk/src/tspmodel.cpp	(revision 23)
@@ -29,5 +29,5 @@
 	: QAbstractTableModel(parent), nCities(0)
 {
-	settings = new QSettings(INI_FILE,QSettings::IniFormat);
+	settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg");
 }
 
