All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TerraView.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of TerraView - A Free and Open Source GIS Application.
4 
5  TerraView is free software: you can redistribute it and/or modify
6  it under the terms of the GNU 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  TerraView 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 General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib Code Editor. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@dpi.inpe.br>.
18  */
19 
20 /*!
21  \file terraview/TerraView.cpp
22 
23  \brief The main class of TerraView.
24 */
25 
26 // TerraView
27 #include "AboutDialog.h"
28 #include "TerraView.h"
29 
30 // TerraLib
34 
35 // STL
36 #include <memory>
37 
38 // Qt
39 #include <QAction>
40 #include <QApplication>
41 #include <QMenu>
42 
43 TerraView::TerraView(QWidget* parent)
44  : te::qt::af::BaseApplication(parent),
45  m_helpManager(0)
46 {
47 }
48 
50 {
51 }
52 
54 {
56 }
57 
58 void TerraView::init(const std::string& configFile)
59 {
61 
62 //set application icon
63  std::string tvIcon = te::qt::af::ApplicationController::getInstance().getAppIconName().toStdString();
64  QPixmap pix(tvIcon.c_str());
65  pix = pix.scaled(16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation);
66  QIcon icon(pix);
67 
68  this->setWindowIcon(icon);
69 }
70 
72 {
74 
75  QMenu* hmenu = te::qt::af::ApplicationController::getInstance().getMenu("Help");
76 
77  QAction* helpAbout = hmenu->addAction(tr("&About..."));
78 
79  helpAbout->setObjectName("Help.About");
80  helpAbout->setIcon(QIcon::fromTheme("help-about-browser"));
81 
82  connect(helpAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
83 }
84 
86 {
87  std::auto_ptr<AboutDialog> dialog(new AboutDialog(this));
88 
89  dialog->exec();
90 }
91 
93 {
94  te::qt::widgets::HelpManager::getInstance().showHelp("terraview/index.html", "dpi.inpe.br.terraview");
95 }
96 
97 void TerraView::startProject(const QString& projectFileName)
98 {
99  openProject(projectFileName);
100 }
101 
102 
This file is a wrapper around platform specific include files.
TECOMMONEXPORT std::string FindInTerraLibPath(const std::string &p)
Returns the path relative to a directory or file in the context of TerraLib.
void makeDialog()
Definition: TerraView.cpp:71
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
void startProject(const QString &projectFileName)
Definition: TerraView.cpp:97
#define TERRALIB_APPLICATION_CONFIG_FILE
The file that contains the application plugins.
Definition: Config.h:37
A Qt dialog showing MGis about window.
A singleton that contains a pointer to a help manager implementation.
void showAboutDialog()
Definition: TerraView.cpp:85
TerraView(QWidget *parent=0)
Definition: TerraView.cpp:43
The main class of TerraView.
void onHelpTriggered()
Definition: TerraView.cpp:92
virtual void openProject(const QString &projectFileName)
The base API for controllers of TerraLib applications.
void init()
Definition: TerraView.cpp:53