42 #include <boost/property_tree/xml_parser.hpp> 43 #include <boost/property_tree/ptree.hpp> 44 #include <boost/property_tree/json_parser.hpp> 45 #include <boost/algorithm/string/replace.hpp> 46 #include <boost/filesystem.hpp> 47 #include <boost/format.hpp> 48 #include <boost/version.hpp> 50 #include <QApplication> 56 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
58 sett.beginGroup(
"projects");
59 defaultAuthor = sett.value(
"author_name").toString();
60 maxSaved = sett.value(
"recents_history_size").toInt();
66 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
68 sett.beginGroup(
"projects");
69 sett.setValue(
"author_name", defaultAuthor);
70 sett.setValue(
"recents_history_size", maxSaved);
76 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
78 sett.setValue(
"projects/openLastDataSource", openLast);
83 QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
85 QVariant variant = sett.value(
"projects/openLastDataSource");
88 if(variant.isNull() || !variant.isValid())
91 return variant.toBool();
96 boost::property_tree::ptree
p;
101 p.add(
"Project.<xmlattr>.xmlns:xsd",
"http://www.w3.org/2001/XMLSchema-instance");
102 p.add(
"Project.<xmlattr>.xmlns:te_map",
"http://www.terralib.org/schemas/maptools");
103 p.add(
"Project.<xmlattr>.xmlns:te_qt_af",
"http://www.terralib.org/schemas/qt/af");
104 p.add(
"Project.<xmlattr>.xmlns",
"http://www.terralib.org/schemas/qt/af");
105 p.add(
"Project.<xmlattr>.xsd:schemaLocation",
"http://www.terralib.org/schemas/qt/af " + schema_location);
106 p.add(
"Project.<xmlattr>.version", TERRALIB_VERSION_STRING);
109 p.add(
"Project.Title",
"Default project");
110 p.add(
"Project.Author",
"");
111 p.add(
"Project.ComponentList",
"");
112 p.add(
"Project.te_map:LayerList",
"");
115 #if BOOST_VERSION > 105600 116 boost::property_tree::xml_writer_settings<std::string> settings(
'\t', 1);
118 boost::property_tree::xml_writer_settings<char> settings(
'\t', 1);
120 boost::property_tree::write_xml(fileName.toUtf8().data(),
p, std::locale(), settings);
This class models a XML reader object.
bool GetOpenLastProjectFromSettings()
void GetProjectInformationsFromSettings(QString &defaultAuthor, int &maxSaved)
This is a proxy file for the real terralib_version.h file.
void SaveOpenLastProjectOnSettings(bool openLast)
This class models a XML writer object.
This file contains several utility functions for dealing with Boost containers and algorithms...
This is the abstract factory for XML readers.
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
void WriteDefaultProjectFile(const QString &fileName)
Writes the default project file.
void SaveProjectInformationsOnSettings(const QString &defaultAuthor, const int &maxSaved)
This is the abstract factory for XML writers.