1 // -*- C++ -*-
2 // $Id: main.cpp,v 1.8 2010-06-06 00:49:08 robertl Exp $
3 //------------------------------------------------------------------------
4 //
5 //  Copyright (C) 2009  S. Khai Mong <khai@mangrai.com>.
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License as
9 //  published by the Free Software Foundation; either version 2 of the
10 //  License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
20 //  USA
21 //
22 //------------------------------------------------------------------------
23 #define _CRT_SECURE_NO_DEPRECATE 1
24 #include <QMessageBox>
25 #include <QFile>
26 #include <QCoreApplication>
27 #include <QLibraryInfo>
28 #include <QIcon>
29 
30 #include "mainwindow.h"
31 #include "gmapdlg.h"
32 
33 #ifdef _WIN32
34 const char *pathSeparator = ";";
35 #else
36 const char *pathSeparator = ":";
37 #endif
38 
39 #if defined (Q_OS_MAC)
40 #include <CoreFoundation/CoreFoundation.h>
41 #endif
42 
43 //------------------------------------------------------------------------
main(int argc,char ** argv)44 int main(int argc, char**argv)
45 {
46   QApplication *app;
47   app = new QApplication(argc, argv);
48   app->setWindowIcon(QIcon(":/images/appicon.png"));
49 
50   QString newPath = "PATH=" + QApplication::applicationDirPath() +
51     QString(pathSeparator) + getenv("PATH");
52   char *newPathEnv = new char[newPath.length() + 1];
53   strcpy(newPathEnv, newPath.toStdString().c_str());
54   putenv(newPathEnv);
55 
56   QCoreApplication::setOrganizationName("GPSBabel");
57   QCoreApplication::setOrganizationDomain("gpsbabel.org");
58   QCoreApplication::setApplicationName("GPSBabel");
59 
60   MainWindow mainWindow(0);
61   mainWindow.show();
62   app->exec();
63 
64   return 0;
65 }
66