Changeset 23 in tspsg-svn
- Timestamp:
- Jun 22, 2009, 9:44:00 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defines.h
r22 r23 22 22 */ 23 23 24 #ifndef DEFAULTS_H 25 #define DEFAULTS_H 26 27 // Ini file name 28 #define INI_FILE "tspsg.ini" 24 #ifndef DEFINES_H 25 #define DEFINES_H 29 26 30 27 // Default values … … 36 33 #define DEF_FONT_COLOR Qt::black 37 34 38 #endif // DEF AULTS_H35 #endif // DEFINES_H -
trunk/src/mainwindow.cpp
r21 r23 33 33 { 34 34 setupUi(this); 35 QSettings settings(INI_FILE,QSettings::IniFormat);36 spinCities->setValue(settings .value("NumCities",5).toInt());35 settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg"); 36 spinCities->setValue(settings->value("NumCities",5).toInt()); 37 37 connect(actionSettingsSettings,SIGNAL(triggered()),this,SLOT(ChangeSettings())); 38 38 connect(actionHelpAbout,SIGNAL(triggered()),this,SLOT(showAbout())); … … 50 50 tabWidget->resize(rect.width(),rect.height() - toolBar->size().height()); 51 51 #else 52 if (settings .value("SavePos",false).toBool()) {52 if (settings->value("SavePos",false).toBool()) { 53 53 // Loading of saved window state 54 settings .beginGroup("MainWindow");55 resize(settings .value("Size",size()).toSize());56 move(settings .value("Position",pos()).toPoint());57 if (settings .value("Maximized",false).toBool())54 settings->beginGroup("MainWindow"); 55 resize(settings->value("Size",size()).toSize()); 56 move(settings->value("Position",pos()).toPoint()); 57 if (settings->value("Maximized",false).toBool()) 58 58 setWindowState(windowState() | Qt::WindowMaximized); 59 settings .endGroup();59 settings->endGroup(); 60 60 } else { 61 61 // Centering main window … … 154 154 { 155 155 // Saving windows state 156 QSettings settings(INI_FILE,QSettings::IniFormat); 157 settings.setValue("NumCities",spinCities->value()); 158 if (settings.value("SavePos",false).toBool()) { 159 settings.beginGroup("MainWindow"); 160 settings.setValue("Maximized",isMaximized()); 156 settings->setValue("NumCities",spinCities->value()); 157 if (settings->value("SavePos",false).toBool()) { 158 settings->beginGroup("MainWindow"); 159 settings->setValue("Maximized",isMaximized()); 161 160 if (!isMaximized()) { 162 settings .setValue("Size",size());163 settings .setValue("Position",pos());161 settings->setValue("Size",size()); 162 settings->setValue("Position",pos()); 164 163 } 165 settings .endGroup();164 settings->endGroup(); 166 165 } 167 166 QMainWindow::closeEvent(event); -
trunk/src/mainwindow.h
r21 r23 26 26 27 27 #include <QMainWindow> 28 #include <QSettings> 28 29 #ifdef Q_OS_WINCE 29 30 #include "ui_mainwindow.ce.h" … … 53 54 void CitiesNumberChanged(int n); 54 55 private: 56 QSettings *settings; 55 57 CTSPModel *tspmodel; 56 58 }; -
trunk/src/settingsdialog.cpp
r21 r23 50 50 labelHint->setMinimumHeight(labelHint->height()); 51 51 #endif // Q_OS_WINCE 52 settings = new QSettings( INI_FILE,QSettings::IniFormat);52 settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg"); 53 53 spinRandMin->setValue(settings->value("MinCost",DEF_RAND_MIN).toInt()); 54 54 spinRandMax->setValue(settings->value("MaxCost",DEF_RAND_MAX).toInt()); -
trunk/src/tspmodel.cpp
r21 r23 29 29 : QAbstractTableModel(parent), nCities(0) 30 30 { 31 settings = new QSettings( INI_FILE,QSettings::IniFormat);31 settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,"TSPSG","tspsg"); 32 32 } 33 33
Note: See TracChangeset
for help on using the changeset viewer.