Changeset 20015b41e7 in tspsg for src/settingsdialog.cpp


Ignore:
Timestamp:
Apr 27, 2010, 9:12:55 AM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
5d401f2c50
Parents:
ca3d2a30fa
git-author:
Oleksii Serdiuk <contacts@…> (04/27/10 09:12:55)
git-committer:
Oleksii Serdiuk <contacts@…> (06/29/12 19:41:31)
Message:

+ Added the ability to select in what format to save the graph when saving solution as HTML.

  • Moved all installation and deployment rules to a separate install.pri file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/settingsdialog.cpp

    rca3d2a30fa r20015b41e7  
    195195        settings->beginGroup("Output");
    196196        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).
     204QStringList 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
    197217        cbShowMatrix->setChecked(settings->value("ShowMatrix", DEF_SHOW_MATRIX).toBool());
    198218        cbCitiesLimit->setEnabled(cbShowMatrix->isChecked());
     
    252272                        settings->setValue("SettingsReset", true);
    253273                        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."));
    255275                        return;
    256276                } else
     
    282302        settings->beginGroup("Output");
    283303        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        }
    284310        settings->setValue("ShowMatrix", cbShowMatrix->isChecked());
    285311        settings->setValue("UseShowMatrixLimit", cbShowMatrix->isChecked() && cbCitiesLimit->isChecked());
Note: See TracChangeset for help on using the changeset viewer.