subsurface/main.cpp
Tomaz Canabrava 9cc942376e Only anim if not first dive when openning subsurface with a divelog.
The animation appeared when the user started subsurface with a default
file, wich was a little annoying since it didn't had a 'from' position
to go and it was also increasing it's size on some window managers
that do subtle windows animations when a program starts. This patch
treats the first dive opened when the program loads with a divelog pa
rameter differently as the following ones storing the velocity value
on a temporary, and reassigning it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:42:42 -07:00

59 lines
1.2 KiB
C++

/* 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"
#include "qt-ui/diveplanner.h"
#include <QStringList>
QTranslator *qtTranslator, *ssrfTranslator;
int main(int argc, char **argv)
{
int i;
bool no_filenames = true;
setup_system_prefs();
prefs = default_prefs;
fill_profile_color();
init_ui(&argc, &argv);
parse_xml_init();
taglist_init_global();
QStringList files;
QStringList importedFiles;
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());
continue;
}
if (imported) {
importedFiles.push_back(a);
} else {
no_filenames = false;
files.push_back(a);
}
}
if (no_filenames) {
QString defaultFile(prefs.default_filename);
if (!defaultFile.isEmpty())
files.push_back(QString(prefs.default_filename));
}
parse_xml_exit();
MainWindow *m = MainWindow::instance();
m->setLoadedWithFiles( !files.isEmpty() || !importedFiles.isEmpty());
m->loadFiles(files);
m->importFiles(importedFiles);
if (!quit)
run_ui();
exit_ui();
return 0;
}