QtInitializer.h
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 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 QtInitializer.h
22 
23  \brief
24 */
25 
28 
29 // Qt
30 #include <QApplication>
31 #include <QIcon>
32 #include <qresource.h>
33 
34 #include <iostream>
35 
37 {
38  public:
39 
40  QtInitializer() { std::cout << std::endl << "C++: QtInitializer::constructor()" << std::endl; }
41 
42  void begin() throw (te::common::Exception);
43 
44  void end();
45 
46 };
47 
48 inline void QtInitializer::begin() throw (te::common::Exception)
49 {
50  std::cout << std::endl << "C++: QtInitializer::begin() 1.0" << std::endl;
51 
52  char* argv[] = {"JAVA", NULL};
53  int argc = 1;
54 
55  QApplication* app = new QApplication(argc, argv);
56 
57  std::cout << std::endl << "C++: QtInitializer::begin() 1.1" << std::endl;
58 
59  std::string th_path = te::core::FindInTerraLibPath("share/terralib/icons");
60 
61  Q_INIT_RESOURCE(tlib);
62 
63  std::cout << std::endl << "C++: QtInitializer::begin() 1.2" << std::endl;
64 
65  QStringList ithemes = QIcon::themeSearchPaths();
66 
67  ithemes.push_back(th_path.c_str());
68 
69  QIcon::setThemeSearchPaths(ithemes);
70 
71  QIcon::setThemeName("terralib");
72 
73  std::cout << std::endl << "C++: QtInitializer::begin() 1.3" << std::endl;
74 }
75 
76 inline void QtInitializer::end()
77 {
78  delete qApp;
79 }
This file is a wrapper around platform specific include files.
URI C++ Library.
Definition: Attributes.h:37
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...