|
|
@ -10,6 +10,7 @@ |
|
|
|
#include <QtCore/QSettings> |
|
|
|
#include <QtCore/QSettings> |
|
|
|
#include <QtCore/QMap> |
|
|
|
#include <QtCore/QMap> |
|
|
|
#include <QtCore/QList> |
|
|
|
#include <QtCore/QList> |
|
|
|
|
|
|
|
#include <QtGui/QLineEdit> |
|
|
|
|
|
|
|
|
|
|
|
#include <cassert> |
|
|
|
#include <cassert> |
|
|
|
#include <QtCore/QDebug> |
|
|
|
#include <QtCore/QDebug> |
|
|
@ -113,6 +114,11 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
return _checkboxes[name].second; |
|
|
|
return _checkboxes[name].second; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QString& text(const QString& name) { |
|
|
|
|
|
|
|
assert(_lineedits.find(name)!=_lineedits.end()); |
|
|
|
|
|
|
|
return _lineedits[name].second; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const MimeTypes& mimetypes() const { |
|
|
|
const MimeTypes& mimetypes() const { |
|
|
|
return _mimetypes; |
|
|
|
return _mimetypes; |
|
|
|
} |
|
|
|
} |
|
|
@ -155,6 +161,11 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
_settings->setValue |
|
|
|
_settings->setValue |
|
|
|
(QString("Flags/%1").arg(it->first), it->second.second); |
|
|
|
(QString("Flags/%1").arg(it->first), it->second.second); |
|
|
|
|
|
|
|
// LineEdits
|
|
|
|
|
|
|
|
for (LineEdits::iterator it(_lineedits.begin()); |
|
|
|
|
|
|
|
it!=_lineedits.end(); ++it) |
|
|
|
|
|
|
|
_settings->setValue |
|
|
|
|
|
|
|
(QString("Texts/%1").arg(it->first), it->second.second); |
|
|
|
// MimeTypes
|
|
|
|
// MimeTypes
|
|
|
|
_settings->setValue("QWebSettings/MimeTypes", _mimetypes); |
|
|
|
_settings->setValue("QWebSettings/MimeTypes", _mimetypes); |
|
|
|
// Search Engines
|
|
|
|
// Search Engines
|
|
|
@ -186,6 +197,17 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
it->second.second = val.toBool(); |
|
|
|
it->second.second = val.toBool(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// LineEdits
|
|
|
|
|
|
|
|
for (LineEdits::iterator it(_lineedits.begin()); |
|
|
|
|
|
|
|
it!=_lineedits.end(); ++it) { |
|
|
|
|
|
|
|
QVariant val |
|
|
|
|
|
|
|
(_settings->value |
|
|
|
|
|
|
|
(QString("Texts/%1").arg(it->first), it->second.second)); |
|
|
|
|
|
|
|
if (val.isValid() && val.canConvert(QVariant::String)) { |
|
|
|
|
|
|
|
it->second.first->setText(val.toString()); |
|
|
|
|
|
|
|
it->second.second = val.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// MimeTypes
|
|
|
|
// MimeTypes
|
|
|
|
if (overwriteMimeTypes) { |
|
|
|
if (overwriteMimeTypes) { |
|
|
|
QVariant val(_settings->value("QWebSettings/MimeTypes")); |
|
|
|
QVariant val(_settings->value("QWebSettings/MimeTypes")); |
|
|
@ -212,6 +234,10 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
for (CheckBoxes::iterator it(_checkboxes.begin()); |
|
|
|
for (CheckBoxes::iterator it(_checkboxes.begin()); |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
it->second.second = it->second.first->isChecked(); |
|
|
|
it->second.second = it->second.first->isChecked(); |
|
|
|
|
|
|
|
// LineEdits
|
|
|
|
|
|
|
|
for (LineEdits::iterator it(_lineedits.begin()); |
|
|
|
|
|
|
|
it!=_lineedits.end(); ++it) |
|
|
|
|
|
|
|
it->second.second = it->second.first->text(); |
|
|
|
// MimeTypes
|
|
|
|
// MimeTypes
|
|
|
|
_mimetypes.clear(); |
|
|
|
_mimetypes.clear(); |
|
|
|
for (int row(_mimeTypeTable->rowCount()); row--;) |
|
|
|
for (int row(_mimeTypeTable->rowCount()); row--;) |
|
|
@ -239,6 +265,10 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
for (CheckBoxes::iterator it(_checkboxes.begin()); |
|
|
|
for (CheckBoxes::iterator it(_checkboxes.begin()); |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
it!=_checkboxes.end(); ++it) |
|
|
|
it->second.first->setChecked(it->second.second); |
|
|
|
it->second.first->setChecked(it->second.second); |
|
|
|
|
|
|
|
// LineEdits
|
|
|
|
|
|
|
|
for (LineEdits::iterator it(_lineedits.begin()); |
|
|
|
|
|
|
|
it!=_lineedits.end(); ++it) |
|
|
|
|
|
|
|
it->second.first->setText(it->second.second); |
|
|
|
// MimeTypes
|
|
|
|
// MimeTypes
|
|
|
|
_mimeTypeTable->setRowCount(_mimetypes.size()); |
|
|
|
_mimeTypeTable->setRowCount(_mimetypes.size()); |
|
|
|
_mimeTypeTable->verticalHeader()->show(); |
|
|
|
_mimeTypeTable->verticalHeader()->show(); |
|
|
@ -315,6 +345,8 @@ class Settings: public QDialog, protected Ui::Settings { |
|
|
|
Attributes _attributes; |
|
|
|
Attributes _attributes; |
|
|
|
typedef std::map<QString, std::pair<QCheckBox*, bool> > CheckBoxes; |
|
|
|
typedef std::map<QString, std::pair<QCheckBox*, bool> > CheckBoxes; |
|
|
|
CheckBoxes _checkboxes; |
|
|
|
CheckBoxes _checkboxes; |
|
|
|
|
|
|
|
typedef std::map<QString, std::pair<QLineEdit*, QString> > LineEdits; |
|
|
|
|
|
|
|
LineEdits _lineedits; |
|
|
|
QSettings* _settings; |
|
|
|
QSettings* _settings; |
|
|
|
bool _autoWrite; |
|
|
|
bool _autoWrite; |
|
|
|
MimeTypes _mimetypes; |
|
|
|
MimeTypes _mimetypes; |
|
|
|