Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
QIsisApplication.cpp
1#include "QIsisApplication.h"
2
3#include <locale.h>
4
5#include <QDesktopServices>
6#include <QFileInfo>
7#include <QObject>
8#include <QMessageBox>
9#include <QUrl>
10
11#include <gdal_priv.h>
12
13#include "FileName.h"
14#include "Preference.h"
15#include "IException.h"
16#include "IString.h"
17
18namespace Isis {
30 QIsisApplication::QIsisApplication(int &argc, char *argv[]) :
31 QApplication(argc, argv) {
32 // try to use US locale for numbers so we don't end up printing "," instead
33 // of "." where it might count.
34
35 // Setup gdal drivers and error handler
36 try {
37 GDALAllRegister();
38 CPLSetErrorHandler(CPLQuietErrorHandler);
39 }
40 catch(std::exception &e) {
41 QString msg = "Failed to load GDAL Drivers, with error [" + QString(e.what()) + "]";
42 throw IException(IException::Unknown, msg, _FILEINFO_);
43 }
44
45 for (int i = 1; i < argc; i++) {
46 QString arg(argv[i]);
47 if (arg.startsWith("-pref")) {
48
49 // So that we can grab the file located after the current '-pref' flag.
50 int nextIndex = i + 1;
51
52 if (nextIndex < argc) {
53 FileName preferenceFile(argv[nextIndex]);
54 QString filePath = preferenceFile.expanded();
55 Preference::Preferences().clear();
56 Preference::Preferences().Load(filePath);
57 }
58 else {
59 QMessageBox::warning(NULL, "Warning", "Preference flag set but no preference file given.");
60 }
61 }
62 }
63 setlocale(LC_NUMERIC, "en_US.UTF-8");
64
65 QDesktopServices::setUrlHandler("http", this, "openUrl");
66 }
67
68
86 bool QIsisApplication::notify(QObject *rec, QEvent *ev) {
87 try {
88 return QApplication::notify(rec, ev);
89 }
90 catch(IException &e) {
91 QMessageBox::critical(NULL, "Error", e.what());
92 }
93 return false;
94 }
95
96
101 QDesktopServices::openUrl(url);
102 }
103}
void openUrl(QUrl url)
Open a URL in the browser specified by Isis.
QIsisApplication(int &argc, char *argv[])
Constructor.
virtual bool notify(QObject *rec, QEvent *ev)
notify - this function overrides the QApplication notify as QT event handlers do not handle exception...
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16