All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ApplicationController.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/af/ApplicationController.cpp
22 
23  \brief The base API for controllers of TerraLib applications.
24 */
25 
26 // Boost
27 #include <boost/foreach.hpp> // Boost => don't change this include order, otherwise you may have compiling problems!
28 
29 // TerraLib
30 #include "../../common/Exception.h"
31 #include "../../common/Translator.h"
32 #include "../../common/TerraLib.h"
33 #include "../../common/SystemApplicationSettings.h"
34 #include "../../common/UserApplicationSettings.h"
35 #include "../../common/Logger.h"
36 #include "../../dataaccess/serialization/xml/Serializer.h"
37 #include "../../plugin/PluginManager.h"
38 #include "../../plugin/PluginInfo.h"
39 #include "../../srs/Config.h"
40 #include "../widgets/help/AssistantHelpManagerImpl.h"
41 #include "../widgets/help/HelpManager.h"
42 #include "../widgets/Utils.h"
43 #include "../widgets/utils/ScopedCursor.h"
45 #include "ApplicationController.h"
46 #include "ApplicationPlugins.h"
47 #include "Exception.h"
48 #include "Project.h"
49 #include "SplashScreenManager.h"
50 #include "UserPlugins.h"
51 #include "Utils.h"
52 
53 // Qt
54 #include <QtCore/QDir>
55 #include <QtCore/QResource>
56 #include <QtGui/QApplication>
57 #include <QtGui/QIcon>
58 #include <QtGui/QMessageBox>
59 #include <QtGui/QWidget>
60 #include <QtGui/QMenu>
61 
62 // Boost
63 #include <boost/filesystem.hpp>
64 
66 
68  : QObject(/*parent*/),
69  m_msgBoxParentWidget(0),
70  m_defaultSRID(TE_UNKNOWN_SRS),
71  m_selectionColor(QColor(0, 255, 0)),
72  m_initialized(false),
73  m_project(0)
74 {
75  if(sm_instance)
76  throw Exception(TR_QT_AF("Can not start another instance of the TerraLib Application Controller!"));
77 
78  sm_instance = this;
79 }
80 
82 {
83  finalize();
84 
85  sm_instance = 0;
86 }
87 
89 {
90  return *sm_instance;
91 }
92 
93 void te::qt::af::ApplicationController::setConfigFile(const std::string& configFileName)
94 {
95  m_appConfigFile = configFileName;
96 }
97 
99 {
100  m_msgBoxParentWidget = w;
101 }
102 
103 void te::qt::af::ApplicationController::addToolBar(const QString& id, QToolBar* bar)
104 {
105  registerToolBar(id, bar);
106 
107 // send event: tool bar added
109 
110  broadcast(&evt);
111 }
112 
113 void te::qt::af::ApplicationController::registerToolBar(const QString& id, QToolBar* bar)
114 {
115  QToolBar* b = getToolBar(id);
116 
117  if(b != 0)
118  throw Exception(TR_QT_AF("There is already a tool bar registered with the same name!"));
119 
120  m_toolbars[id] = bar;
121 }
122 
123 QToolBar* te::qt::af::ApplicationController::getToolBar(const QString& id) const
124 {
125  std::map<QString, QToolBar*>::const_iterator it = m_toolbars.find(id);
126 
127  return (it != m_toolbars.end()) ? it->second : 0;
128 }
129 
131 {
132  std::vector<QToolBar*> res;
133  std::map<QString, QToolBar*>::const_iterator it;
134 
135  for(it = m_toolbars.begin(); it != m_toolbars.end(); ++it)
136  res.push_back(it->second);
137 
138  return res;
139 }
140 
142 {
143  std::map<QString, QToolBar*>::iterator it = m_toolbars.find(id);
144 
145  if(it != m_toolbars.end())
146  m_toolbars.erase(it);
147 }
148 
150 {
151  m_menus.push_back(mnu);
152 }
153 
154 QMenu* te::qt::af::ApplicationController::findMenu(const QString& id) const
155 {
156  std::vector<QMenu*>::const_iterator it;
157 
158  // Searching in menus vector
159  for(it = m_menus.begin(); it != m_menus.end(); ++it)
160  {
161  QMenu* mnu = te::qt::widgets::FindMenu(id, *it);
162 
163  if(mnu != 0)
164  return mnu;
165  }
166 
167  // Searching in menu bars vector
168  std::vector<QMenuBar*>::const_iterator it_bar;
169 
170  for(it_bar = m_menuBars.begin(); it_bar != m_menuBars.end(); ++it_bar)
171  {
172  QMenu* mnu = te::qt::widgets::FindMenu(id, *it_bar);
173 
174  if(mnu != 0)
175  return mnu;
176  }
177 
178  return 0;
179 }
180 
182 {
183  QMenu* mnu = findMenu(id);
184 
185  if(mnu == 0)
186  {
187  if(!m_menuBars.empty())
188  mnu = te::qt::widgets::GetMenu(id, m_menuBars[0]);
189  else
190  {
191  mnu = new QMenu(id);
192  m_menus.push_back(mnu);
193  }
194  }
195 
196  return mnu;
197 }
198 
200 {
201  m_menuBars.push_back(bar);
202 }
203 
204 QMenuBar* te::qt::af::ApplicationController::findMenuBar(const QString& id) const
205 {
206  throw Exception("Not implemented yet.");
207 }
208 
209 QMenuBar* te::qt::af::ApplicationController::getMenuBar(const QString& id) const
210 {
211  return m_menuBars[0];
212 }
213 
214 QAction* te::qt::af::ApplicationController::findAction(const QString& id) const
215 {
216  for(size_t i=0; i<m_menus.size(); i++)
217  {
218  QAction* act = te::qt::widgets::FindAction(id, m_menus[i]);
219 
220  if (act != 0)
221  return act;
222  }
223 
224  for(size_t i=0; i<m_menuBars.size(); i++)
225  {
226  QAction* act = te::qt::widgets::FindAction(id, m_menuBars[i]);
227 
228  if (act != 0)
229  return act;
230  }
231 
232  return 0;
233 }
234 
236 {
237  std::set<QObject*>::const_iterator it = m_applicationItems.find(obj);
238 
239  if(it != m_applicationItems.end())
240  return;
241 
242  m_applicationItems.insert(obj);
243 
244  obj->connect(this, SIGNAL(triggered(te::qt::af::evt::Event*)), SLOT(onApplicationTriggered(te::qt::af::evt::Event*)));
245 }
246 
248 {
249  std::set<QObject*>::iterator it = m_applicationItems.find(obj);
250 
251  if(it == m_applicationItems.end())
252  return;
253 
254  m_applicationItems.erase(it);
255 
256  disconnect(SIGNAL(triggered(te::qt::af::evt::Event*)), obj, SLOT(onApplicationTriggered(te::qt::af::evt::Event*)));
257 }
258 
260 {
261  if(m_initialized)
262  return;
263 
264  te::qt::widgets::ScopedCursor cursor(Qt::WaitCursor);
265 
266  SplashScreenManager::getInstance().showMessage(tr("Loading TerraLib Modules..."));
267 
269 
270  SplashScreenManager::getInstance().showMessage(tr("TerraLib Modules loaded!"));
271 
272  SplashScreenManager::getInstance().showMessage(tr("Loading the application configuration file..."));
273 
274  if(m_appConfigFile.empty())
275  m_appConfigFile = TERRALIB_APPLICATION_CONFIG_FILE;
276 
278 
279 // general application info
280  SplashScreenManager::getInstance().showMessage(tr("Application configuration file loaded!"));
281 
282  m_appName = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.Name"));
283  m_appTitle = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.Title"));
284  m_appIconName = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.IconName"));
285 
286  qApp->setApplicationName(m_appName);
287 
288  m_appOrganization = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.Organization"));
289 
290  qApp->setOrganizationName(m_appOrganization);
291 
292 // read used config data
293  SplashScreenManager::getInstance().showMessage(tr("Reading user settings..."));
294 
295  m_appUserSettingsFile = te::common::SystemApplicationSettings::getInstance().getValue("Application.UserSettingsFile.<xmlattr>.xlink:href");
296 
298 
299  SplashScreenManager::getInstance().showMessage(tr("User settings read!"));
300 
301 // read application resources
302  {
303  SplashScreenManager::getInstance().showMessage(tr("Loading application resources..."));
304 
305  //boost::property_tree::ptree& p = te::common::SystemApplicationSettings::getInstance().getAllSettings();
306 
307  //BOOST_FOREACH(boost::property_tree::ptree::value_type& v, p.get_child("Application.Resources"))
308  //{
309  // const std::string& resourceFile = v.second.get<std::string>("<xmlattr>.xlink:href");
310 
311  // QResource::registerResource(resourceFile.c_str());
312  //}
313 
314  SplashScreenManager::getInstance().showMessage(tr("Application resources loaded!"));
315  }
316 
317 // load help system
318  try
319  {
320  m_appHelpFile = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.HelpFile.<xmlattr>.xlink:href"));
321 
322  if(!m_appHelpFile.isEmpty())
323  {
324  SplashScreenManager::getInstance().showMessage(tr("Loading application help system..."));
325 
327 
328  te::qt::widgets::HelpManager::getInstance().setImpl(helpImpl);
329 
330  SplashScreenManager::getInstance().showMessage(tr("Application help system loaded!"));
331  }
332  }
333  catch(const std::exception& e)
334  {
335  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
336 
337  QString msgErr(tr("Error loading application help system: %1"));
338 
339  msgErr = msgErr.arg(e.what());
340 
341  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
342  }
343 
344 // load icon theme
345  try
346  {
347  SplashScreenManager::getInstance().showMessage(tr("Loading application icon theme..."));
348 
349  m_appIconThemeDir = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.IconThemeInfo.BaseDirectory.<xmlattr>.xlink:href"));
350 
351  if(!m_appIconThemeDir.isEmpty())
352  {
353  QStringList ithemes = QIcon::themeSearchPaths();
354 
355  ithemes.push_back(m_appIconThemeDir);
356 
357  QIcon::setThemeSearchPaths(ithemes);
358  }
359 
360  m_appDefaultIconTheme = QString::fromStdString(te::common::SystemApplicationSettings::getInstance().getValue("Application.IconThemeInfo.DefaultTheme"));
361 
362  QString iconTheme = QString::fromStdString(te::common::UserApplicationSettings::getInstance().getValue("UserSettings.SelectedIconTheme"));
363 
364  if(iconTheme.isEmpty())
365  QIcon::setThemeName(m_appDefaultIconTheme);
366  else
367  QIcon::setThemeName(iconTheme);
368 
369  std::string iconSize = te::common::UserApplicationSettings::getInstance().getValue("UserSettings.ToolBarIconSize");
370 
371  if(iconSize.empty())
372  iconSize = te::common::SystemApplicationSettings::getInstance().getValue("Application.ToolBarDefaultIconSize");
373  if(!iconSize.empty())
374  {
375  QString sh = QString("QToolBar { qproperty-iconSize: ") + iconSize.c_str() + "px " + iconSize.c_str() + "px; }";
376  qApp->setStyleSheet(sh);
377  }
378 
379  // Default SRID
380  QString srid = te::common::UserApplicationSettings::getInstance().getValue("UserSettings.DefaultSRID").c_str();
381  if(srid.isEmpty())
382  srid = te::common::SystemApplicationSettings::getInstance().getValue("Application.DefaultSRID").c_str();
383 
384  if(!srid.isEmpty())
385  m_defaultSRID = srid.toInt();
386 
387  // Selection Color
388  QString selectionColor = te::common::UserApplicationSettings::getInstance().getValue("UserSettings.SelectionColor").c_str();
389  if(selectionColor.isEmpty())
390  selectionColor = te::common::SystemApplicationSettings::getInstance().getValue("Application.DefaultSelectionColor").c_str();
391 
392  if(!selectionColor.isEmpty())
393  m_selectionColor = QColor(selectionColor);
394 
395  SplashScreenManager::getInstance().showMessage(tr("Application icon theme loaded!"));
396  }
397  catch(const std::exception& e)
398  {
399  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
400 
401  QString msgErr(tr("Error loading application icon theme: %1"));
402 
403  msgErr = msgErr.arg(e.what());
404 
405  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
406  }
407 
408 // load registered data sources
409  try
410  {
411  m_appDatasourcesFile = te::common::UserApplicationSettings::getInstance().getValue("UserSettings.DataSourcesFile");
412 
413  if(!m_appDatasourcesFile.empty())
414  {
415  SplashScreenManager::getInstance().showMessage(tr("Loading user registered data sources..."));
416 
417  te::serialize::xml::ReadDataSourceInfo(m_appDatasourcesFile);
418 
419  SplashScreenManager::getInstance().showMessage(tr("Known data sources loaded!"));
420  }
421  }
422  catch(const std::exception& e)
423  {
424  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
425 
426  QString msgErr(tr("Error loading the registered data sources: %1"));
427 
428  msgErr = msgErr.arg(e.what());
429 
430  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
431  }
432 
433  QSettings s(QSettings::IniFormat, QSettings::UserScope, m_appOrganization, m_appName);
434 
435  QFileInfo info(s.fileName());
436 
437  if(!info.exists())
439 
440  m_initialized = true;
441 }
442 
444 {
445  te::qt::widgets::ScopedCursor cursor(Qt::WaitCursor);
446 
447  bool loadPlugins = true;
448 
449  try
450  {
451  SplashScreenManager::getInstance().showMessage(tr("Reading application plugins list..."));
452 
453  std::string appPlugins = te::common::SystemApplicationSettings::getInstance().getValue("Application.PluginsFile.<xmlattr>.xlink:href");
454 
456 
457  SplashScreenManager::getInstance().showMessage(tr("Plugins list read!"));
458  }
459  catch(const std::exception& e)
460  {
461  loadPlugins = false;
462 
463  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
464 
465  QString msgErr(tr("Error reading application's plugin list: %1"));
466 
467  msgErr = msgErr.arg(e.what());
468 
469  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
470  }
471 
472  if(!loadPlugins)
473  return;
474 
475  try
476  {
477  SplashScreenManager::getInstance().showMessage(tr("Loading plugins..."));
478 
480 
481  SplashScreenManager::getInstance().showMessage(tr("Plugins loaded successfully!"));
482  }
483  catch(const std::exception& e)
484  {
485  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
486 
488 
489  QString msgErr(tr("Some plugins couldn't be loaded. %1\n\n"
490  "Please, refer to plugin manager to fix the problem."));
491 
492  msgErr = msgErr.arg(e.what());
493 
494  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
495 
496  //const std::vector<te::plugin::PluginInfo*>& bps = te::plugin::PluginManager::getInstance().getBrokenPlugins();
497 
498  //for(int kk = 0; kk < bps.size(); ++kk)
499  //{
500  // QMessageBox::warning(sm_instance,
501  // tr(SystemApplicationSettings::getInstance().getValue("Application.Title").c_str()),
502  // tr(bps[kk]->m_name.c_str()));
503  //}
504  }
505 }
506 
508 {
509  SplashScreenManager::getInstance().showMessage("Loading recent projects...");
510 
511  try
512  {
513  boost::property_tree::ptree p = te::common::UserApplicationSettings::getInstance().getAllSettings().get_child("UserSettings");
514  std::string projPath, projTitle;
515 
516  bool hasProjects = p.count("MostRecentProject") > 0;
517 
518  if(hasProjects)
519  {
520  projPath = p.get<std::string>("MostRecentProject.<xmlattr>.xlink:href");
521  projTitle = p.get<std::string>("MostRecentProject.<xmlattr>.title");
522  }
523 
524  QMenu* mnu = getMenu("File.Recent Projects");
525 
526  if(!projPath.empty())
527  {
528  QString pp = projPath.c_str();
529  QAction* act = mnu->addAction(pp);
530  act->setData(pp);
531 
532  mnu->addSeparator();
533 
534  m_recentProjs.append(pp);
535  m_recentProjsTitles.append(projTitle.c_str());
536  }
537 
538  hasProjects = p.count("RecentProjects") > 0;
539 
540  if(hasProjects)
541  {
542  BOOST_FOREACH(boost::property_tree::ptree::value_type& v, p.get_child("RecentProjects"))
543  {
544  QString pp = v.second.get<std::string>("<xmlattr>.xlink:href").c_str();
545  QString pt = v.second.get<std::string>("<xmlattr>.title").c_str();
546  QAction* act = mnu->addAction(pp);
547  act->setData(pp);
548  m_recentProjs.append(pp);
549  m_recentProjsTitles.append(pt);
550  }
551  }
552 
553  SplashScreenManager::getInstance().showMessage("Recent projects loaded!");
554  }
555  catch(const std::exception& e)
556  {
557  te::qt::widgets::ScopedCursor acursor(Qt::ArrowCursor);
558 
559  QString msgErr(tr("Error loading the registered projects: %1"));
560 
561  msgErr = msgErr.arg(e.what());
562 
563  QMessageBox::warning(m_msgBoxParentWidget, m_appTitle, msgErr);
564  }
565 }
566 
567 void te::qt::af::ApplicationController::updateRecentProjects(const QString& prjFile, const QString& prjTitle)
568 {
569  int pos = m_recentProjs.indexOf(prjFile);
570 
571  QString author;
572  int maxSaved;
573 
574  GetProjectInformationsFromSettings(author, maxSaved);
575 
576  if(pos != 0)
577  {
578  if(pos < 0)
579  {
580  if(m_recentProjs.size() >= maxSaved) // TODO: Size of the list must be configurable.
581  {
582  m_recentProjs.removeLast();
583  m_recentProjsTitles.removeLast();
584  }
585 
586  m_recentProjs.prepend(prjFile);
587  m_recentProjsTitles.prepend(prjTitle);
588  }
589  else
590  {
591  m_recentProjs.move(pos, 0);
592  m_recentProjsTitles.move(pos, 0);
593  }
594 
595  QMenu* mnu = getMenu("File.Recent Projects");
596 
597  mnu->clear();
598 
599  QString recPrj = m_recentProjs.at(0);
600  QAction* act = mnu->addAction(recPrj);
601  act->setData(recPrj);
602 
603  mnu->addSeparator();
604 
605  if(m_recentProjs.size() > 1)
606  for(int i=1; i<m_recentProjs.size(); i++)
607  {
608  recPrj = m_recentProjs.at(i);
609  act = mnu->addAction(recPrj);
610  act->setData(recPrj);
611  }
612  }
613 
614  QAction* act = findAction("File.Save Project As");
615 
616  if(act != 0)
617  act->setEnabled(true);
618 }
619 
621 {
622  m_project = prj;
623 }
624 
626 {
627  return m_project;
628 }
629 
631 {
632  if(!m_initialized)
633  return;
634 
636 
637  UpdateUserSettings(m_recentProjs, m_recentProjsTitles, m_appUserSettingsFile);
638 
640 
642 
644 
646 
647  m_appConfigFile.clear();
648 
649  m_initialized = false;
650 }
651 
653 {
654  return m_appSettings;
655 }
656 
658 {
659  // Need to check event send to prevent loops
660  // -----------------------------------------
661 
662  emit triggered(evt);
663 }
664 
666 {
667  return m_appTitle;
668 }
669 
671 {
672  return m_appIconName;
673 }
674 
676 {
677  return m_recentProjs.isEmpty() ? QString("") : m_recentProjs.front();
678 }
679 
681 {
682  return m_defaultSRID;
683 }
684 
686 {
687  return m_selectionColor;
688 }
689 
691 {
692  return m_msgBoxParentWidget;
693 }
void load()
It starts all the plugins enabled by the user.
Definition: UserPlugins.cpp:47
virtual void initializePlugins()
Load the plugin list and initialize the plugins enabled by the user.
void registerMenu(QMenu *mnu)
Register the mnu.
QMenu * findMenu(const QString &id) const
Returns the menu registered with key id.
A singleton for holding he application splash screen.
void registerMenuBar(QMenuBar *bar)
Register the bar.
QColor getSelectionColor() const
Returns the application selection color.
#define TERRALIB_APPLICATION_CONFIG_FILE
The file that contains the application plugins.
Definition: Config.h:37
void finalize()
It finalizes the TerraLib Platform.
Definition: TerraLib.cpp:64
Utility routines for the TerraLib Application Framework module.
The base API for controllers of TerraLib applications.
const boost::property_tree::ptree & getAllSettings() const
It return a reading reference to the internal settings.
const QString & getAppTitle() const
Returns the application title.
std::string getValue(const std::string &key)
It returns the value for a given key or empty.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
Definition: Config.h:72
static ApplicationController * sm_instance
There can be only one object of class Application.
The base API for TerraLib applications.
static ApplicationController & getInstance()
It gives access to the controller singleton.
void registerToolBar(const QString &id, QToolBar *bar)
Register the toolbar in the list of the known toolbars.
void removeToolBar(const QString &id)
Removes the toolbar identified by id.
int getDefaultSRID() const
Returns the application default SRID value.
TEQTWIDGETSEXPORT QAction * FindAction(const QString &actText, QMenu *mnu)
Definition: Utils.cpp:131
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
QSettings & getSettings()
Return the QSettings of the application. This can be used to add settings from external sources...
TEQTAFEXPORT void SaveDataSourcesFile()
Saves data sources file.
Definition: Utils.cpp:283
This class models the concept of a project for the TerraLib Application Framework.
Definition: Project.h:50
void removeListener(QObject *obj)
Remove the obj from the list of event listeners.
void showMessage(const QString &message)
This will cause the text to be drawn on the splash screen and a call to Application::processEvents() ...
void addToolBar(const QString &id, QToolBar *bar)
Register the toolbar in the list of the known toolbars and dispatch an event.
A singleton for managing the application plugins.
A singleton for managing the plugins enabled by a specific user.
QString getMostRecentProject() const
Returns the most recent project.
virtual void setConfigFile(const std::string &configFileName)
Tells wich configuration file to be used by the controller during its initialization.
virtual void setMsgBoxParentWidget(QWidget *w)
Tells the widget to be used as the parent of messages showned in a QMessageBox.
void set(te::qt::af::Project *prj)
Set the current project.
TEQTAFEXPORT void UpdateUserSettings(const QStringList &prjFiles, const QStringList &prjTitles, const std::string &userConfigFile)
Updates user settings file section about information of the projects.
Definition: Utils.cpp:234
std::vector< QToolBar * > getToolBars() const
Return the list of registered toolbars.
TEQTWIDGETSEXPORT QMenu * GetMenu(const QString &mnuText, QMenu *mnu)
Gets a menu or submenu contained in the mnu object.
Definition: Utils.cpp:176
This event signals that a new toolbar was added.
virtual void initialize()
Initializes the application framework.
virtual void finalize()
Finalize the application framework.
TEQTAFEXPORT void CreateDefaultSettings()
Creates a default QSettings.
Definition: Utils.cpp:509
void addListener(QObject *obj)
Insert an application item that will listen to framework events.
virtual void initializeProjectMenus()
Initializes the menus for the most recent open projects.
A base class for application events.
Definition: Event.h:59
#define TR_QT_AF(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:77
A help manager that uses the QAssistant to manage help files.
static SplashScreenManager & getInstance()
It returns a reference to the singleton instance.
QToolBar * getToolBar(const QString &id) const
Return the toolbar identified by id or NULL if none is found.
void load()
It tries to find a default config file based on system macros and default condigurations.
This class models the concept of a project for the TerraLib Application Framework.
void updateRecentProjects(const QString &prjFile, const QString &prjTitle)
Update the list of recent projects. This is commonly used when there&#39;s a new most recent project...
QWidget * getMainWindow() const
Returns main window.
TEQTAFEXPORT void UpdateApplicationPlugins()
Update plugins file.
Definition: Utils.cpp:293
QMenuBar * findMenuBar(const QString &id) const
Returns the menu bar registered with key id.
QMenuBar * getMenuBar(const QString &id) const
Returns a menu bar registered with key id.
void broadcast(te::qt::af::evt::Event *evt)
Send events in broadcast for all registered components.
Contains the list of the application events.
void initialize()
It initializes the TerraLib Platform.
Definition: TerraLib.cpp:33
QAction * findAction(const QString &id) const
Returns the action identified by id or NULL if there&#39;s not an action identified by id...
te::qt::af::Project * getProject()
Get the current project.
TEQTAFEXPORT void GetProjectInformationsFromSettings(QString &defaultAuthor, int &maxSaved)
Definition: Utils.cpp:455
TEDATAACCESSEXPORT void ReadDataSourceInfo(const std::string &datasourcesFileName)
Definition: Serializer.cpp:83
const QString & getAppIconName() const
Returns the application icon.
void close()
Closes the splash screen.
An object that when created shows a cursor during its scope.
Definition: ScopedCursor.h:48
TEQTWIDGETSEXPORT QMenu * FindMenu(const QString &mnuText, QMenu *mnu)
Finds a menu item in the mnu object.
Definition: Utils.cpp:121
QMenu * getMenu(const QString &id)
Returns a menu registered with key id.