37 #include <QStringList>
38 #include <QTextStream>
46 mCustomFile = customFile;
72 std::cout <<
"TODO IMPLEMENT: void Presets::remove()" << std::endl;
102 retval = retval.
tryDescend(
"Preset",
"name", presetName);
107 retval = retval.
descend(
"Preset",
"name", presetName);
118 QString presetName = element.attribute(
"name");
119 if(presetName.isEmpty())
123 file = file.
descend(
"Presets");
132 QTextStream stream(stdout);
134 element.save(stream, 4);
virtual void save()
saves the presets to file
Presets(XmlOptionFile presetFile, XmlOptionFile customFile)
QDomElement getElement()
return the current element
XmlOptionFile mPresetFile
< the name of the last custom preset removed
virtual void deleteCustomPreset(QString name)
deletes the custom preset with the given name if it exists
XmlOptionFile getCustomFile()
QString mLastCustomPresetRemoved
< the name of the last custom preset added
QStringList getPresetList(QString tag="")
returns a list of the preset names for the given tag
void addCustomPreset(QDomElement &element)
adds a custom preset
virtual QStringList generatePresetList(QString tag)
internally generate the preset list
bool isDefaultPreset(QString presetName)
Check is the preset is one of the "system presets".
QDomDocument getDocument()
returns the document
QString mLastCustomPresetAdded
void deleteNode()
Delete the current node.
void save()
save entire document.
void addDefaultPreset(QDomElement &element)
bool isNull() const
checks if this is null
void addPreset(XmlOptionFile &file, QDomElement &element)
XmlOptionFile getPresetNode(const QString &presetName)
Look for a preset with the given name. Create one if not found.
XmlOptionFile root() const
set the current element to root
virtual void remove()
removes the presets from file
void print(QDomElement element)
debugging function for printing xml elements
XmlOptionFile tryDescend(QString element, QString attributeName, QString attributeValue) const
Helper class for xml files used to store ssc/cx data.
XmlOptionFile descend(QString element) const
step one level down in the xml tree