Changeset 109 in tspsg-svn for trunk/src/settingsdialog.cpp
- Timestamp:
- Apr 27, 2010, 9:12:55 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/settingsdialog.cpp
r107 r109 195 195 settings->beginGroup("Output"); 196 196 cbShowGraph->setChecked(settings->value("ShowGraph", DEF_SHOW_GRAPH).toBool()); 197 198 #if !defined(NOSVG) && (QT_VERSION >= 0x040500) 199 comboGraphImageFormat->addItem("svg"); 200 #endif // NOSVG && QT_VERSION >= 0x040500 201 // We create a whitelist of formats, supported by the most popular web browsers according to 202 // http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support 203 // + TIFF format (there are plugins to support it). 204 QStringList whitelist; 205 whitelist << "bmp" << "jpeg" << "png" << "tiff" << "xbm"; 206 foreach (QByteArray format, QImageWriter::supportedImageFormats()) { 207 if (whitelist.contains(format)) 208 comboGraphImageFormat->addItem(format); 209 } 210 comboGraphImageFormat->model()->sort(0); 211 comboGraphImageFormat->setCurrentIndex(comboGraphImageFormat->findText(settings->value("GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT).toString(), Qt::MatchFixedString)); 212 if (comboGraphImageFormat->currentIndex() < 0) 213 comboGraphImageFormat->setCurrentIndex(comboGraphImageFormat->findText(DEF_GRAPH_IMAGE_FORMAT, Qt::MatchFixedString)); 214 labelGraphImageFormat->setEnabled(cbShowGraph->isChecked()); 215 comboGraphImageFormat->setEnabled(cbShowGraph->isChecked()); 216 197 217 cbShowMatrix->setChecked(settings->value("ShowMatrix", DEF_SHOW_MATRIX).toBool()); 198 218 cbCitiesLimit->setEnabled(cbShowMatrix->isChecked()); … … 252 272 settings->setValue("SettingsReset", true); 253 273 QDialog::accept(); 254 QMessageBox::information(this , tr("Settings Reset"), tr("All settings where successfully reset to their defaults.\nIt is recommended to restart the application now."));274 QMessageBox::information(this->parentWidget(), tr("Settings Reset"), tr("All settings where successfully reset to their defaults.\nIt is recommended to restart the application now.")); 255 275 return; 256 276 } else … … 282 302 settings->beginGroup("Output"); 283 303 settings->setValue("ShowGraph", cbShowGraph->isChecked()); 304 if (cbShowGraph->isChecked()) { 305 if (comboGraphImageFormat->currentIndex() >= 0) 306 settings->setValue("GraphImageFormat", comboGraphImageFormat->currentText()); 307 else 308 settings->setValue("GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT); 309 } 284 310 settings->setValue("ShowMatrix", cbShowMatrix->isChecked()); 285 311 settings->setValue("UseShowMatrixLimit", cbShowMatrix->isChecked() && cbCitiesLimit->isChecked());
Note: See TracChangeset
for help on using the changeset viewer.