2013-09-09 08:59:03 +00:00
|
|
|
/* main.c */
|
|
|
|
#include <locale.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include "qt-gui.h"
|
|
|
|
#include "subsurfacestartup.h"
|
|
|
|
#include "qt-ui/mainwindow.h"
|
2013-10-03 19:56:08 +00:00
|
|
|
#include "qt-ui/diveplanner.h"
|
2013-09-09 08:59:03 +00:00
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
2013-10-09 05:25:02 +00:00
|
|
|
QTranslator *qtTranslator, *ssrfTranslator;
|
|
|
|
|
2013-09-09 08:59:03 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int i;
|
2013-09-22 15:30:25 +00:00
|
|
|
bool no_filenames = true;
|
2013-09-09 08:59:03 +00:00
|
|
|
|
|
|
|
setup_system_prefs();
|
|
|
|
prefs = default_prefs;
|
|
|
|
|
|
|
|
init_ui(&argc, &argv);
|
|
|
|
parse_xml_init();
|
2013-11-02 01:12:42 +00:00
|
|
|
taglist_init_global();
|
2013-09-09 08:59:03 +00:00
|
|
|
|
|
|
|
QStringList files;
|
|
|
|
QStringList importedFiles;
|
2013-10-08 09:48:46 +00:00
|
|
|
QStringList arguments = QCoreApplication::arguments();
|
|
|
|
for (i = 1; i < arguments.length(); i++) {
|
|
|
|
QString a = arguments.at(i);
|
|
|
|
if (a.at(0) == '-') {
|
|
|
|
parse_argument(a.toLocal8Bit().data());
|
2013-09-09 08:59:03 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-09-22 15:30:25 +00:00
|
|
|
if (imported) {
|
2013-10-08 09:48:46 +00:00
|
|
|
importedFiles.push_back(a);
|
2013-09-22 15:30:25 +00:00
|
|
|
} else {
|
|
|
|
no_filenames = false;
|
2013-10-08 09:48:46 +00:00
|
|
|
files.push_back(a);
|
2013-09-22 15:30:25 +00:00
|
|
|
}
|
2013-09-09 08:59:03 +00:00
|
|
|
}
|
|
|
|
if (no_filenames) {
|
2013-10-04 15:12:46 +00:00
|
|
|
QString defaultFile(prefs.default_filename);
|
|
|
|
if (!defaultFile.isEmpty())
|
2014-02-28 04:09:57 +00:00
|
|
|
files.push_back(QString(prefs.default_filename));
|
2013-09-09 08:59:03 +00:00
|
|
|
}
|
|
|
|
parse_xml_exit();
|
2014-02-12 14:22:54 +00:00
|
|
|
MainWindow::instance()->loadFiles(files);
|
|
|
|
MainWindow::instance()->importFiles(importedFiles);
|
2013-11-02 19:00:16 +00:00
|
|
|
if (!quit)
|
|
|
|
run_ui();
|
2013-09-09 08:59:03 +00:00
|
|
|
exit_ui();
|
|
|
|
return 0;
|
|
|
|
}
|