29 #include "../terralib/Defines.h" 46 #include <QApplication> 49 #include <QLibraryInfo> 51 #include <QMessageBox> 52 #include <QSplashScreen> 54 #include <QTranslator> 57 #if TE_PLATFORM == TE_PLATFORMCODE_APPLE 58 #include <CoreFoundation/CoreFoundation.h> 62 int main(
int argc,
char** argv)
67 QDir dir(QLibraryInfo::location(QLibraryInfo::TranslationsPath));
70 filters <<
"*" + QLocale::system().name().toLower() +
".qm";
72 QFileInfoList lst = dir.entryInfoList(filters, QDir::Files);
74 for(
int i=0; i<lst.size(); ++i)
76 QTranslator* trans =
new QTranslator;
77 trans->load(lst.at(i).baseName(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
78 app.installTranslator(trans);
81 setlocale(LC_ALL,
"C");
83 #if QT_VERSION >= 0x050000 84 QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
86 QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
89 int waitVal = EXIT_FAILURE;
91 const int RESTART_CODE = 1000;
98 QPixmap pixmap(splash_pix.c_str());
100 QSplashScreen* splash =
new QSplashScreen(pixmap);
104 splash->setStyleSheet(
"QWidget { font-size: 12px; font-weight: bold }");
114 #if TE_PLATFORM == TE_PLATFORMCODE_APPLE 115 CFBundleRef mainBundle = CFBundleGetMainBundle();
116 CFURLRef execPath = CFBundleCopyBundleURL(mainBundle);
120 if (!CFURLGetFileSystemRepresentation(execPath, TRUE, (UInt8 *)path, PATH_MAX))
127 dPath.cd(
"Contents");
129 chdir(dPath.path().toUtf8().data());
134 splash->setParent(&tview);
136 splash->finish(&tview);
138 tview.showMaximized();
145 std::string projPath = argv[1];
147 if(!projPath.empty())
151 waitVal = app.exec();
153 }
while(waitVal == RESTART_CODE);
155 catch(
const boost::exception& e)
157 if(
const std::string*
d =
158 boost::get_error_info<te::ErrorDescription>(e))
159 QMessageBox::warning(
nullptr,
"TerraView",
d->c_str());
161 QMessageBox::warning(
nullptr,
"TerraView",
"An unknown error has occurred");
164 catch(
const std::exception& e)
166 QMessageBox::warning(
nullptr,
"TerraView", e.what());
The main class of TerraView.
static std::string asString()
#define TERRAVIEW_APPLICATION_CONFIG_FILE
A singleton for holding he application splash screen.
Utility class for system versioning.
static SplashScreenManager & getInstance()
It returns a reference to the singleton instance.
void startProject(const QString &projectFileName)
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
void init(const QString &cfgFile)
Utility routines for the TerraLib Application Framework module.
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
The main class of TerraView.
Proxy configuration file for TerraView (see terraview_config.h).
int main(int argc, char **argv)