27 #include <boost/foreach.hpp>  
   30 #include "../../common/BoostUtils.h" 
   31 #include "../../common/PlatformUtils.h" 
   32 #include "../../common/SystemApplicationSettings.h" 
   33 #include "../../common/UserApplicationSettings.h" 
   34 #include "../../dataaccess/datasource/DataSourceInfo.h" 
   35 #include "../../dataaccess/datasource/DataSourceInfoManager.h" 
   36 #include "../../dataaccess/serialization/xml/Serializer.h" 
   37 #include "../../maptools/AbstractLayer.h" 
   38 #include "../../plugin/PluginManager.h" 
   39 #include "../../plugin/PluginInfo.h" 
   40 #include "../../maptools/serialization/xml/Layer.h" 
   41 #include "../../xml/AbstractWriter.h" 
   42 #include "../../xml/AbstractWriterFactory.h" 
   43 #include "../../xml/Reader.h" 
   44 #include "../../xml/ReaderFactory.h" 
   45 #include "../../Version.h" 
   58 #include <boost/property_tree/ptree.hpp> 
   59 #include <boost/property_tree/json_parser.hpp> 
   60 #include <boost/algorithm/string/replace.hpp> 
   61 #include <boost/filesystem.hpp> 
   62 #include <boost/format.hpp> 
   69 #include <QTextStream> 
   70 #include <QApplication> 
   72 #include <QMainWindow> 
   73 #include <QMessageBox> 
   79   boost::filesystem::path furi(uri);
 
   81   if (!boost::filesystem::exists(furi) || !boost::filesystem::is_regular_file(furi))   
 
   82     throw Exception((boost::format(
TE_TR(
"Could not read project file: %1%.")) % uri).str());
 
   85   xmlReader->setValidationScheme(
false);
 
   89   if(!xmlReader->next())
 
   90     throw Exception((boost::format(
TE_TR(
"Could not read project information in the file: %1%.")) % uri).str());
 
   93     throw Exception((boost::format(
TE_TR(
"Error reading the document %1%, the start element wasn't found.")) % uri).str());
 
   95   if(xmlReader->getElementLocalName() != 
"Project")
 
   96     throw Exception((boost::format(
TE_TR(
"The first tag in the document %1% is not 'Project'.")) % uri).str());
 
  102   XMLFormatter::format(proj, 
false);
 
  112   std::auto_ptr<Project> project(
new Project);
 
  189   project->setProjectAsChanged(
false);
 
  191   return project.release();
 
  203   Save(p, *writer.get());
 
  229   boost::replace_all(schema_loc, 
" ", 
"%20");
 
  231   writer.
writeAttribute(
"xmlns:xsd", 
"http://www.w3.org/2001/XMLSchema-instance");
 
  232   writer.
writeAttribute(
"xmlns:te_da", 
"http://www.terralib.org/schemas/dataaccess");
 
  233   writer.
writeAttribute(
"xmlns:te_map", 
"http://www.terralib.org/schemas/maptools");
 
  234   writer.
writeAttribute(
"xmlns:te_qt_af", 
"http://www.terralib.org/schemas/common/af");
 
  238   writer.
writeAttribute(
"xmlns:xlink", 
"http://www.w3.org/1999/xlink");
 
  240   writer.
writeAttribute(
"xmlns", 
"http://www.terralib.org/schemas/qt/af");
 
  241   writer.
writeAttribute(
"xsd:schemaLocation", 
"http://www.terralib.org/schemas/qt/af " + schema_loc);
 
  250   writer.
writeAttribute(
"xmlns:te_common", 
"http://www.terralib.org/schemas/common");
 
  256   for(it=itBegin; it!=itEnd; ++it)
 
  258     bool ogrDsrc = it->second->getAccessDriver() == 
"OGR";
 
  264     writer.
writeAttribute(
"access_driver", it->second->getAccessDriver());
 
  275     std::map<std::string, std::string> info = it->second->getConnInfo();
 
  276     std::map<std::string, std::string>::iterator conIt;
 
  278     for(conIt=info.begin(); conIt!=info.end(); ++conIt)
 
  307   for(std::list<te::map::AbstractLayerPtr>::const_iterator it = project.
getTopLayers().begin();
 
  310     lserial.
write(it->get(), writer);
 
  322   QSettings user_settings(QSettings::IniFormat,
 
  323                           QSettings::UserScope,
 
  324                           QApplication::instance()->organizationName(),
 
  325                           QApplication::instance()->applicationName());
 
  328   if(!prjFiles.empty() && !prjTitles.empty() && (prjFiles.size() == prjTitles.size()))
 
  330     user_settings.setValue(
"projects/most_recent/path", prjFiles.at(0));
 
  331     user_settings.setValue(
"projects/most_recent/title", prjTitles.at(0));
 
  333     if(prjFiles.size() > 1)
 
  335       user_settings.beginGroup(
"projects");
 
  337       user_settings.beginWriteArray(
"recents");
 
  339       for(
int i = 1; i != prjFiles.size(); ++i)
 
  341         user_settings.setArrayIndex(i - 1);
 
  342         user_settings.setValue(
"projects/path", prjFiles.at(i));
 
  343         user_settings.setValue(
"projects/title", prjTitles.at(i));
 
  346       user_settings.endArray();
 
  348       user_settings.endGroup();
 
  353   user_settings.remove(
"plugins/enabled");
 
  355   user_settings.beginGroup(
"plugins");
 
  356   user_settings.remove(
"enabled");
 
  357   user_settings.remove(
"unloaded");
 
  358   user_settings.remove(
"broken");
 
  360   user_settings.beginWriteArray(
"enabled");
 
  366   for(std::size_t i = 0; i != plugins.size(); ++i)
 
  371     user_settings.setArrayIndex(aidx++);
 
  373     user_settings.setValue(
"name", plugins[i].c_str());
 
  376   user_settings.endArray();
 
  379   user_settings.beginWriteArray(
"unloaded");
 
  383   for (std::size_t i = 0; i != plugins.size(); ++i)
 
  388     user_settings.setArrayIndex(unloadedidx++);
 
  389     user_settings.setValue(
"name", plugins[i].c_str());
 
  392   user_settings.endArray();
 
  395   user_settings.beginWriteArray(
"broken");
 
  399   for (std::size_t i = 0; i != plugins.size(); ++i)
 
  404     user_settings.setArrayIndex(brokenidx++);
 
  405     user_settings.setValue(
"name", plugins[i].c_str());
 
  408   user_settings.endArray();
 
  410   user_settings.endGroup();
 
  415   QSettings usettings(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  417   QVariant fileName = usettings.value(
"data_sources/data_file");
 
  419   if(fileName.isNull())
 
  421     const QString& udir = ApplicationController::getInstance().getUserDataDir();
 
  425     usettings.setValue(
"data_sources/data_file", fileName);
 
  434   sett.beginGroup(bar->objectName());
 
  436   sett.setValue(
"name", bar->objectName());
 
  438   sett.beginWriteArray(
"Actions");
 
  440   QList<QAction*> acts = bar->actions();
 
  442   for(
int i=0; i<acts.size(); i++)
 
  444     sett.setArrayIndex(i);
 
  445     sett.setValue(
"action", acts.at(i)->objectName());
 
  456   std::vector<QToolBar*>::const_iterator it;
 
  457   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  459   sett.beginGroup(
"toolbars");
 
  461   for (it = bars.begin(); it != bars.end(); ++it)
 
  465     sett.remove(bar->objectName());
 
  475   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  477   sett.beginGroup(
"toolbars");
 
  486   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  488   sett.beginGroup(
"toolbars");
 
  489   sett.remove(bar->objectName());
 
  495   std::vector<QToolBar*> bars;
 
  497   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  499   sett.beginGroup(
"toolbars");
 
  500   QStringList lst = sett.childGroups();
 
  502   QStringList::iterator it;
 
  504   for(it=lst.begin(); it != lst.end(); ++it)
 
  510     QString grName = sett.value(
"name").toString();
 
  512     int size = sett.beginReadArray(
"Actions");
 
  514     QToolBar* toolbar = 
new QToolBar(barsParent);
 
  515     toolbar->setObjectName(grName);
 
  516     toolbar->setWindowTitle(grName);
 
  518     for(
int i=0; i<size; i++)
 
  520       sett.setArrayIndex(i);
 
  521       QString act = sett.value(
"action").toString();
 
  525         toolbar->addSeparator();
 
  529         QAction* a = ApplicationController::getInstance().findAction(act);
 
  532           toolbar->addAction(a);
 
  539     bars.push_back(toolbar);
 
  549   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  551   sett.beginGroup(
"mainWindow");
 
  552   sett.setValue(
"geometry", mainWindow->saveGeometry());
 
  553   sett.setValue(
"windowState", mainWindow->saveState());
 
  559   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  561   sett.beginGroup(
"mainWindow");
 
  562   mainWindow->restoreGeometry(sett.value(
"geometry").toByteArray());
 
  563   mainWindow->restoreState(sett.value(
"windowState").toByteArray());
 
  569   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  571   sett.beginGroup(
"projects");
 
  572   defaultAuthor = sett.value(
"author_name").toString();
 
  573   maxSaved = sett.value(
"recents_history_size").toInt();
 
  579   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  581   sett.beginGroup(
"projects");
 
  582   sett.setValue(
"author_name", defaultAuthor);
 
  583   sett.setValue(
"recents_history_size", maxSaved);
 
  589   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  591   sett.setValue(
"projects/last datasource used", dsType);
 
  596   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  598   sett.setValue(
"projects/openLastDataSource", openLast);
 
  603   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  605   return sett.value(
"projects/last datasource used").toString();
 
  610   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  612   QVariant variant = sett.value(
"projects/openLastDataSource");
 
  615   if(variant.isNull() || !variant.isValid())
 
  618   return variant.toBool();
 
  623   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  625   sett.beginGroup(
"toolbars");
 
  627   sett.beginGroup(
"File Tool Bar");
 
  628   sett.setValue(
"name", 
"File Tool Bar");
 
  629   sett.beginWriteArray(
"Actions");
 
  630   sett.setArrayIndex(0);
 
  631   sett.setValue(
"action", 
"File.New Project");
 
  632   sett.setArrayIndex(1);
 
  633   sett.setValue(
"action", 
"File.Open Project");
 
  634   sett.setArrayIndex(2);
 
  635   sett.setValue(
"action", 
"File.Save Project");
 
  636   sett.setArrayIndex(3);
 
  637   sett.setValue(
"action", 
"");
 
  638   sett.setArrayIndex(4);
 
  639   sett.setValue(
"action", 
"Project.New Folder");
 
  640   sett.setArrayIndex(5);
 
  641   sett.setValue(
"action", 
"Project.Add Layer.All Sources");
 
  645   sett.beginGroup(
"View Tool Bar");
 
  646   sett.setValue(
"name", 
"View Tool Bar");
 
  647   sett.beginWriteArray(
"Actions");
 
  648   sett.setArrayIndex(0);
 
  649   sett.setValue(
"action", 
"View.Layer Explorer");
 
  650   sett.setArrayIndex(1);
 
  651   sett.setValue(
"action", 
"View.Map Display");
 
  652   sett.setArrayIndex(2);
 
  653   sett.setValue(
"action", 
"View.Data Table");
 
  654   sett.setArrayIndex(3);
 
  655   sett.setValue(
"action", 
"View.Style Explorer");
 
  659   sett.beginGroup(
"Map Tool Bar");
 
  660   sett.setValue(
"name", 
"Map Tool Bar");
 
  661   sett.beginWriteArray(
"Actions");  
 
  662   sett.setArrayIndex(0);
 
  663   sett.setValue(
"action", 
"Map.Draw");
 
  664   sett.setArrayIndex(1);
 
  665   sett.setValue(
"action", 
"Map.Previous Extent");
 
  666   sett.setArrayIndex(2);
 
  667   sett.setValue(
"action", 
"Map.Next Extent");
 
  668   sett.setArrayIndex(3);
 
  669   sett.setValue(
"action", 
"Map.Zoom Extent");
 
  670   sett.setArrayIndex(4);
 
  671   sett.setValue(
"action", 
"");
 
  672   sett.setArrayIndex(5);
 
  673   sett.setValue(
"action", 
"Map.Zoom In");
 
  674   sett.setArrayIndex(6);
 
  675   sett.setValue(
"action", 
"Map.Zoom Out");
 
  676   sett.setArrayIndex(7);
 
  677   sett.setValue(
"action", 
"Map.Pan");
 
  678   sett.setArrayIndex(8);
 
  679   sett.setValue(
"action", 
"");
 
  680   sett.setArrayIndex(9);
 
  681   sett.setValue(
"action", 
"Map.Info");
 
  682   sett.setArrayIndex(10);
 
  683   sett.setValue(
"action", 
"Map.Selection");
 
  689   sett.beginGroup(
"projects");
 
  691   sett.setValue(
"author_name", 
"");
 
  692   sett.setValue(
"recents_history_size", 
"8");
 
  699   QString result(windowTitle);
 
  703     if(result.at(result.count()-1) != 
'*')
 
  708     if(result.at(result.count()-1) == 
'*')
 
  709       result.remove((result.count()-1), 1);
 
  717   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  718   QString hexColor = sett.value(
"display/defaultDisplayColor").toString();  
 
  720   defaultColor.setNamedColor(hexColor);
 
  721   if(!defaultColor.isValid())
 
  729   QString sty(
"alternate-background-color: ");
 
  730   sty += 
"rgb(" + QString::number(secondaryColor.red()) + 
", " + QString::number(secondaryColor.green());
 
  731   sty += 
", " + QString::number(secondaryColor.blue()) + 
")";
 
  732   sty += 
";background-color: rgb(" + QString::number(primaryColor.red()) + 
", " + QString::number(primaryColor.green());
 
  733   sty += 
", " + QString::number(primaryColor.blue()) + 
");";
 
  740   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  743   pColor.setNamedColor(sett.value(
"table/primaryColor").toString());
 
  745   sColor.setNamedColor(sett.value(
"table/secondaryColor").toString());
 
  747   if(!pColor.isValid())
 
  749   if(!sColor.isValid())
 
  757   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  758   bool isChecked = sett.value(
"table/tableAlternateColors").toBool();
 
  765   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  767   sett.beginGroup(
"toolbars");
 
  768   QStringList lst = sett.childGroups();
 
  769   QStringList::iterator it;
 
  771   for(it=lst.begin(); it!=lst.end(); ++it)
 
  773     int size = sett.beginReadArray(*it+
"/Actions");
 
  775     for(
int i=0; i<size; i++)
 
  777       sett.setArrayIndex(i);
 
  779       QString v = sett.value(
"action").toString(); 
 
  781       if (v == act->objectName())
 
  783         ApplicationController::getInstance().getToolBar(*it)->addAction(act);
 
  796   std::vector<std::string> res;
 
  800   filters << 
"*.teplg";
 
  804   QFileInfoList files = d.entryInfoList(filters, QDir::Files);
 
  806   foreach(QFileInfo file, files)
 
  808     res.push_back(file.absoluteFilePath().toStdString());
 
  816   std::vector<std::string> res;
 
  821   if (pluginsPath == 
"")
 
  825   boost::property_tree::ptree pt;
 
  826   boost::property_tree::json_parser::read_json(pluginsPath, pt);
 
  828   BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child(
"plugins"))
 
  830     res.push_back(v.second.get<std::string>(
"plugin"));
 
  838   std::vector<std::string> res;
 
  839   std::vector<std::string>::const_iterator it;
 
  841   for(it=plgFiles.begin(); it!=plgFiles.end(); ++it)
 
  843     boost::property_tree::ptree p;
 
  844     boost::property_tree::read_xml(*it, p, boost::property_tree::xml_parser::trim_whitespace);
 
  846     res.push_back(p.get<std::string>(
"PluginInfo.Name"));
 
  854   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  856   return sett.value(
"configuration/generation").toString();
 
  861   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  863   sett.setValue(
"configuration/generation", dateTime);
 
  868   QSettings sett(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
 
  870   QFileInfo info(sett.fileName());
 
  872   return info.absolutePath();
 
  877   QFileInfo info(fileName);
 
  882     info.dir().remove(info.fileName());
 
  884   std::string olderFile = appSett.
getValue(
"Application.UserSettingsFile.<xmlattr>.xlink:href");
 
  886   appSett.
setValue(
"Application.UserSettingsFile.<xmlattr>.xlink:href", fileName.toStdString());
 
  890     info.setFile(olderFile.c_str());
 
  891     info.dir().remove(info.fileName());
 
  894   info.setFile(fileName);
 
  898 #if BOOST_VERSION > 105600 
  899     boost::property_tree::xml_writer_settings<std::string> settings(
'\t', 1);
 
  901     boost::property_tree::xml_writer_settings<char> settings(
'\t', 1);
 
  903     boost::property_tree::write_xml(fileName.toStdString(), usrSett.
getAllSettings(), std::locale(), settings);
 
  906   usrSett.
load(fileName.toStdString());
 
  911   boost::property_tree::ptree p;
 
  916   p.add(
"Project.<xmlattr>.xmlns:xsd", 
"http://www.w3.org/2001/XMLSchema-instance");
 
  917   p.add(
"Project.<xmlattr>.xmlns:te_map", 
"http://www.terralib.org/schemas/maptools");
 
  918   p.add(
"Project.<xmlattr>.xmlns:te_qt_af", 
"http://www.terralib.org/schemas/qt/af");
 
  919   p.add(
"Project.<xmlattr>.xmlns", 
"http://www.terralib.org/schemas/qt/af");
 
  920   p.add(
"Project.<xmlattr>.xsd:schemaLocation", 
"http://www.terralib.org/schemas/qt/af " + schema_location);
 
  921   p.add(
"Project.<xmlattr>.version", TERRALIB_VERSION_STRING);
 
  924   p.add(
"Project.Title", 
"Default project");
 
  925   p.add(
"Project.Author", 
"");
 
  926   p.add(
"Project.ComponentList", 
"");
 
  927   p.add(
"Project.te_map:LayerList", 
"");
 
  930 #if BOOST_VERSION > 105600 
  931   boost::property_tree::xml_writer_settings<std::string> settings(
'\t', 1);
 
  933   boost::property_tree::xml_writer_settings<char> settings(
'\t', 1);
 
  935   boost::property_tree::write_xml(fileName.toStdString(), p, std::locale(), settings);
 
  940   QString fileName = qApp->applicationDirPath() + 
"/../.generated";
 
  943   if (!f.open(QFile::ReadOnly | QFile::Text))
 
  947   QString s = in.readAll();
 
  957   title += 
TE_TR(
"Project:");
 
  959   title += project.
getTitle().c_str();
 
  964   std::string filename = p.filename().string();
 
  966   title += filename.c_str();
 
  975   QString extensionFilter = appName;
 
  976   extensionFilter += QString(
" (*.");
 
  977   extensionFilter += appProjectExtension + 
")";
 
  979   return extensionFilter;
 
TEQTAFEXPORT void RemoveToolBarFromSettings(QToolBar *bar)
Removes a tool bar from the settings. 
 
TECOMMONEXPORT std::string ConvertLatin1UTFString(const std::string &data, const bool &toUtf=true)
Converts a string from latin1 to utf8 and vice-versa. 
 
TEQTAFEXPORT void UpdateToolBarsInTheSettings()
Update plugins file. 
 
std::map< std::string, DataSourceInfoPtr >::iterator iterator
 
TEQTAFEXPORT QColor GetDefaultDisplayColorFromSettings()
 
TEQTAFEXPORT std::vector< std::string > GetPluginsFiles()
 
const std::string & getTitle() const 
It gets the title of the project. 
 
This class models a XML reader object. 
 
TEQTAFEXPORT void CreateDefaultSettings()
Creates a default QSettings. 
 
virtual void writeStartElement(const std::string &qName)=0
 
TECOMMONEXPORT std::string FindInTerraLibPath(const std::string &p)
Returns the path relative to a directory or file in the context of TerraLib. 
 
TEQTAFEXPORT void SaveOpenLastProjectOnSettings(bool openLast)
 
TEQTAFEXPORT QString GetWindowTitle(const Project &project)
Return a QString with the new window title based on the project informations. 
 
virtual void writeValue(const std::string &value)=0
 
A singleton for managing application settings applied to a single user. 
 
TEQTAFEXPORT void SetDateTime(const QString &dateTime)
 
TEQTAFEXPORT std::vector< QToolBar * > ReadToolBarsFromSettings(QWidget *barsParent=0)
Returns a vector of tool bars registered in the QSettings. 
 
This class models the concept of a project for the TerraLib Application Framework. 
 
static te::xml::AbstractWriter * make()
It creates a new XML writer using the dafault implementation. 
 
TEQTAFEXPORT QString UnsavedStar(const QString windowTitle, bool isUnsaved)
Unsaved star. 
 
void setValue(const std::string &key, const std::string &value)
It stores the value according to the key. 
 
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation. 
 
TEQTAFEXPORT void SaveLastDatasourceOnSettings(const QString &dsType)
 
This class models a XML writer object. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
TEQTAFEXPORT void SaveState(QMainWindow *mainWindow)
 
TEQTAFEXPORT void UpdateUserSettings(const QStringList &prjFiles, const QStringList &prjTitles, const std::string &userConfigFile)
Updates user settings file section about information of the projects. 
 
TEQTAFEXPORT bool GetAlternateRowColorsFromSettings()
 
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node. 
 
TEQTAFEXPORT void SaveDataSourcesFile()
Saves data sources file. 
 
TEQTAFEXPORT void AddToolBarToSettings(QToolBar *bar)
Update settings with a new tool bar. 
 
const std::list< te::map::AbstractLayerPtr > & getTopLayers() const 
It gets all the top layers of the project (folder and single layers). 
 
virtual void writeElement(const std::string &qName, const std::string &value)=0
 
te::map::AbstractLayer * read(te::xml::Reader &reader) const 
 
TEQTAFEXPORT void UpdateUserSettingsFile(const QString &fileName, const bool &removeOlder=true)
Changes the user settings file location. 
 
TEQTAFEXPORT void AddActionToCustomToolbars(QAction *act)
Check QSettings for existance of act and adds it if necessary. 
 
TEQTAFEXPORT void SaveProjectInformationsOnSettings(const QString &defaultAuthor, const int &maxSaved)
 
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance. 
 
TEQTAFEXPORT std::vector< std::string > GetDefaultPluginsNames()
 
virtual void writeToFile()=0
 
TEQTAFEXPORT QString GetDefaultConfigFileOutputDir()
Returns the default path for output of configuration file. 
 
TEQTAFEXPORT QString GetStyleSheetFromColors(QColor primaryColor, QColor secondaryColor)
 
void setProjectAsChanged(const bool &changed)
It sets the project status as changed or not. 
 
A singleton for managing application settings applied to the whole system (all users). 
 
TEDATAACCESSEXPORT void Save(const std::string &fileName)
 
TEQTAFEXPORT void GetProjectInformationsFromSettings(QString &defaultAuthor, int &maxSaved)
 
An exception class for the TerraLib Application Framework. 
 
TEQTAFEXPORT void RestoreState(QMainWindow *mainWindow)
 
TEQTAFEXPORT QString GetGenerationDate()
Returns the date and time of generated binary. 
 
TEQTAFEXPORT QString GetDateTime()
 
TEQTAFEXPORT QString GetExtensionFilter()
Return extension filter string. 
 
TEQTAFEXPORT void WriteDefaultProjectFile(const QString &fileName)
Writes the configuration file. It updates the application settings. 
 
void setFileName(const std::string &fName)
It sets the filename where the project will be saved. 
 
TEQTAFEXPORT QString GetStyleSheetFromSettings()
 
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
 
const std::string & getAuthor() const 
It gets the author of the project. 
 
TEQTAFEXPORT Project * ReadProject(const std::string &uri)
Reads and return a te::qt::af::Project from the file. 
 
This class models the concept of a project for the TerraLib Application Framework. 
 
void write(const te::map::AbstractLayer *alayer, te::xml::AbstractWriter &writer) const 
 
virtual NodeType getNodeType() const =0
It return the type of node read. 
 
void load(const std::string &fileName)
It tries to find a default config file based on system macros and default condigurations. 
 
void AddToolbarAndActions(QToolBar *bar, QSettings &sett)
 
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node. 
 
virtual void writeEndElement(const std::string &qName)=0
 
virtual void writeStartDocument(const std::string &encoding, const std::string &standalone)=0
 
Utility routines for the TerraLib Application Framework module. 
 
TEQTAFEXPORT bool GetOpenLastProjectFromSettings()
 
const boost::property_tree::ptree & getAllSettings() const 
It return a reading reference to the internal settings. 
 
std::string getValue(const std::string &key)
It returns the value for a given key or empty. 
 
const std::string & getFileName() const 
It gets the filename where the project is saved. 
 
#define TERRALIB_APPLICATION_DATASOURCE_FILE_NAME
The default name for the application file containing the list of data sources. 
 
TEQTAFEXPORT void Save(const Project &project, const std::string &uri)
Saves the informations of the project in the uri file. 
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
virtual bool next()=0
It gets the next event to be read. 
 
TEQTAFEXPORT std::vector< std::string > GetPluginsNames(const std::vector< std::string > &plgFiles)
 
The base API for controllers of TerraLib applications. 
 
TEQTAFEXPORT QString GetLastDatasourceFromSettings()
 
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
 
TEDATAACCESSEXPORT void ReadDataSourceInfo(const std::string &datasourcesFileName)