27 #include <terralib_buildconfig.h> 35 #include <QApplication> 36 #if QT_VERSION < 0x050000 37 #include <QDesktopServices> 42 #include <QMessageBox> 44 #if QT_VERSION >= 0x050000 45 #include <QStandardPaths> 50 #include <boost/filesystem.hpp> 56 std::string appConfigFile)
79 QSettings user_settings(QSettings::IniFormat,
81 QApplication::instance()->organizationName(),
82 QApplication::instance()->applicationName());
84 QVariant projPath = user_settings.value(
"projects/most_recent/path",
"");
85 QVariant projTitle = user_settings.value(
"projects/most_recent/title",
"");
89 if(!projPath.toString().isEmpty())
91 QAction* act = mnu->addAction(projPath.toString());
92 act->setData(projPath);
100 user_settings.beginGroup(
"projects");
102 int nrc = user_settings.beginReadArray(
"recents");
104 for(
int i = 0; i != nrc; ++i)
106 user_settings.setArrayIndex(i);
107 QString npath = user_settings.value(
"project/path").toString();
108 QString ntitle = user_settings.value(
"project/title").toString();
111 QAction* act = mnu->addAction(npath);
117 mnu->setEnabled(
true);
121 catch(
const std::exception& e)
125 QString msgErr(tr(
"Error loading the registered projects: %1"));
127 msgErr = msgErr.arg(e.what());
168 mnu->setEnabled(
true);
171 QAction* act = mnu->addAction(recPrj);
172 act->setData(recPrj);
180 act = mnu->addAction(recPrj);
181 act->setData(recPrj);
188 act->setEnabled(
true);
208 QString extensionFilter = appName;
209 extensionFilter += QString(
" (*.");
210 extensionFilter += appProjectExtension +
")";
212 return extensionFilter;
const QString & getAppTitle() const
Returns the application title.
QMenu * getMenu(const QString &id)
Returns a menu registered with key id.
QWidget * getMainWindow() const
Returns main window.
QStringList m_recentProjsTitles
List of the titles of the recent projects.
The base API for TerraLib applications.
A singleton for holding he application splash screen.
virtual void initializeProjectMenus()
Initializes the menus for the most recent open projects.
QString m_appProjectExtension
Application project extension.
The API for controller of TerraView application.
QString getMostRecentProject() const
Returns the most recent project.
const QString & getAppProjectExtension() const
Returns the application project extension.
void GetProjectInformationsFromSettings(QString &defaultAuthor, int &maxSaved)
const QString & getAppName() const
Returns the application name.
static T & getInstance()
It returns a reference to the singleton instance.
QStringList m_recentProjs
List of the recent projects.
virtual ~TerraViewController()
Destructor.
An object that when created shows a cursor during its scope.
te::qt::af::ApplicationController * m_app
QString getExtensionFilter()
Returns the project extension filter .
void updateRecentProjects(const QString &prjFile, const QString &prjTitle)
Update the list of recent projects. This is commonly used when there's a new most recent project...
TerraViewController(te::qt::af::ApplicationController *app, std::string appConfigFile)
Constructor.
QAction * findAction(const QString &id) const
Returns the action identified by id or NULL if there's not an action identified by id...
A singleton for managing application settings applied to the whole system (all users).