Changeset 31 in tspsg-svn for trunk/src/mainwindow.cpp
- Timestamp:
- Jun 30, 2009, 1:02:31 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r30 r31 22 22 */ 23 23 24 #include <QtGui>25 #ifndef Q_OS_WINCE26 #include <QPrintDialog>27 #endif // Q_OS_WINCE28 24 #include "mainwindow.h" 29 25 … … 44 40 actionSettingsLanguageAutodetect->setChecked(settings->value("Language","").toString().isEmpty()); 45 41 connect(actionFileNew,SIGNAL(triggered()),this,SLOT(actionFileNewTriggered())); 42 connect(actionFileOpen,SIGNAL(triggered()),this,SLOT(actionFileOpenTriggered())); 43 connect(actionFileSaveTask,SIGNAL(triggered()),this,SLOT(actionFileSaveTaskTriggered())); 46 44 connect(actionSettingsPreferences,SIGNAL(triggered()),this,SLOT(actionSettingsPreferencesTriggered())); 47 45 connect(actionSettingsLanguageAutodetect,SIGNAL(triggered(bool)),this,SLOT(actionSettingsLanguageAutodetectTriggered(bool))); … … 79 77 tspmodel->setNumCities(spinCities->value()); 80 78 taskView->setModel(tspmodel); 79 connect(tspmodel,SIGNAL(numCitiesChanged(int)),this,SLOT(numCitiesChanged(int))); 81 80 #ifdef Q_OS_WINCE 82 81 taskView->resizeColumnsToContents(); … … 153 152 } 154 153 154 void MainWindow::actionFileOpenTriggered() 155 { 156 QFileDialog od(this); 157 od.setAcceptMode(QFileDialog::AcceptOpen); 158 od.setFileMode(QFileDialog::ExistingFile); 159 QStringList filters(trUtf8("All Supported Formats") + " (*.tspt *.zkt)"); 160 filters.append(QString(trUtf8("%1 Task Files")).arg("TSPSG") + " (*.tspt)"); 161 filters.append(QString(trUtf8("%1 Task Files")).arg("ZKomModRd") + " (*.zkt)"); 162 filters.append(trUtf8("All Files") + " (*)"); 163 od.setNameFilters(filters); 164 if (od.exec() != QDialog::Accepted) 165 return; 166 QStringList files = od.selectedFiles(); 167 if (files.size() < 1) 168 return; 169 tspmodel->loadTask(files.first()); 170 } 171 172 void MainWindow::actionFileSaveTaskTriggered() 173 { 174 QFileDialog sd(this); 175 sd.setAcceptMode(QFileDialog::AcceptSave); 176 QStringList filters(QString(trUtf8("%1 Task File")).arg("TSPSG") + " (*.tspt)"); 177 filters.append(trUtf8("All Files") + " (*)"); 178 sd.setNameFilters(filters); 179 sd.setDefaultSuffix("tspt"); 180 if (sd.exec() != QDialog::Accepted) 181 return; 182 QStringList files = sd.selectedFiles(); 183 if (files.size() < 1) 184 return; 185 tspmodel->saveTask(files.first()); 186 } 187 155 188 void MainWindow::actionSettingsPreferencesTriggered() 156 189 { … … 209 242 about += QString::fromUtf8(" Copyright (C) 2007-%1 Lёppa <contacts[at]oleksii[dot]name>\n").arg(QDate::currentDate().toString("yyyy")); 210 243 about += "Qt library versions:\n"; 244 about += QString::fromUtf8(" OS: %1\n").arg(OS); 211 245 about += QString::fromUtf8(" Compile time: %1\n").arg(QT_VERSION_STR); 212 246 about += QString::fromUtf8(" Runtime: %1\n").arg(qVersion()); … … 281 315 QMainWindow::closeEvent(event); 282 316 } 317 318 void MainWindow::numCitiesChanged(int nCities) 319 { 320 spinCities->setValue(nCities); 321 }
Note: See TracChangeset
for help on using the changeset viewer.