2007-09-16 20:50:28 +00:00
|
|
|
/***************************************************************************
|
|
|
|
ms_main.cpp
|
|
|
|
--------------------------------------
|
|
|
|
Date : Sun Sep 16 12:33:58 AKDT 2007
|
|
|
|
Copyright : (C) 2007 by Gary E. Sherman
|
|
|
|
Email : sherman at mrcc dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
2007-01-03 01:48:58 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QTranslator>
|
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QStringList>
|
|
|
|
|
2005-11-19 05:59:30 +00:00
|
|
|
#include "qgsmapserverexport.h"
|
2007-01-27 23:27:39 +00:00
|
|
|
#include "qgsapplication.h"
|
2007-01-03 01:48:58 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2005-11-19 05:59:30 +00:00
|
|
|
int main( int argc, char **argv )
|
|
|
|
{
|
2007-01-03 01:48:58 +00:00
|
|
|
// Using QgsApplication instead of QApplication gives access to the
|
|
|
|
// qgis translation files.
|
2008-08-27 12:57:47 +00:00
|
|
|
QgsApplication a( argc, argv, true );
|
2007-01-03 01:48:58 +00:00
|
|
|
|
|
|
|
// Set up the QSettings environment must be done after a is created
|
2008-08-27 12:57:47 +00:00
|
|
|
QCoreApplication::setOrganizationName( "QuantumGIS" );
|
|
|
|
QCoreApplication::setOrganizationDomain( "qgis.org" );
|
|
|
|
QCoreApplication::setApplicationName( "qgis" );
|
2005-11-19 05:59:30 +00:00
|
|
|
|
2007-01-03 01:48:58 +00:00
|
|
|
// Install translations if available. Based on the code in the Qgis
|
2008-08-27 12:57:47 +00:00
|
|
|
// main.cpp file.
|
2007-01-03 01:48:58 +00:00
|
|
|
|
|
|
|
// Let the user set the locale on the command line. If this program
|
|
|
|
// needs to parse any more arguments, it'll be worthwhile using
|
|
|
|
// something like getopt.
|
|
|
|
QString translationCode;
|
|
|
|
QStringList args = a.arguments();
|
2008-08-27 12:57:47 +00:00
|
|
|
int i = args.lastIndexOf( "-h" );
|
|
|
|
if ( i != -1 )
|
2007-01-03 01:48:58 +00:00
|
|
|
{
|
|
|
|
std::cout << "Usage: msexport [--lang language]\n"
|
2008-08-27 12:57:47 +00:00
|
|
|
"\t[--lang language]\tuse language for interface text (optional)\n";
|
|
|
|
exit( 0 );
|
2007-01-03 01:48:58 +00:00
|
|
|
}
|
|
|
|
|
2008-08-27 12:57:47 +00:00
|
|
|
i = args.lastIndexOf( "--lang" );
|
|
|
|
if ( i != -1 )
|
2007-01-03 01:48:58 +00:00
|
|
|
{
|
2008-08-27 12:57:47 +00:00
|
|
|
if ( args.count() > i + 1 )
|
2007-01-03 01:48:58 +00:00
|
|
|
translationCode = args[i+1];
|
|
|
|
}
|
|
|
|
|
2008-08-27 12:57:47 +00:00
|
|
|
if ( translationCode.isEmpty() )
|
2007-01-03 01:48:58 +00:00
|
|
|
translationCode = QTextCodec::locale();
|
|
|
|
|
|
|
|
QString i18nPath = QgsApplication::i18nPath();
|
|
|
|
|
|
|
|
QTranslator qttor;
|
2008-08-27 12:57:47 +00:00
|
|
|
if ( qttor.load( "qt_" + translationCode, i18nPath ) )
|
|
|
|
a.installTranslator( &qttor );
|
2007-01-03 01:48:58 +00:00
|
|
|
|
|
|
|
QTranslator mstor;
|
2008-08-27 12:57:47 +00:00
|
|
|
if ( mstor.load( "qgis_" + translationCode, i18nPath ) )
|
|
|
|
a.installTranslator( &mstor );
|
2007-01-03 01:48:58 +00:00
|
|
|
|
2005-11-19 05:59:30 +00:00
|
|
|
QgsMapserverExport *mse = new QgsMapserverExport();
|
|
|
|
mse->show();
|
|
|
|
return a.exec();
|
|
|
|
}
|