mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
8f35b7324e
No point in having it defined in each main program's .cpp. Especially since the unit tests don't define them. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
74 lines
1.9 KiB
C++
74 lines
1.9 KiB
C++
/* Dirk Hohndel, 2015 */
|
|
|
|
#include <QString>
|
|
#include <QCommandLineParser>
|
|
#include <QDebug>
|
|
|
|
#include "qt-gui.h"
|
|
#include "qthelper.h"
|
|
#include "dive.h"
|
|
#include "save-html.h"
|
|
#include "stdio.h"
|
|
#include "git2.h"
|
|
#include "subsurfacestartup.h"
|
|
#include "divelogexportlogic.h"
|
|
#include "windowtitleupdate.h"
|
|
#include "statistics.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
QApplication *application = new QApplication(argc, argv);
|
|
git_libgit2_init();
|
|
copy_prefs(&default_prefs, &prefs);
|
|
init_qt_late();
|
|
|
|
QCommandLineParser parser;
|
|
QCommandLineOption sourceDirectoryOption(QStringList() << "s" << "source",
|
|
"Read git repository from <directory>",
|
|
"directory");
|
|
parser.addOption(sourceDirectoryOption);
|
|
QCommandLineOption outputDirectoryOption(QStringList() << "u" << "output",
|
|
"Write HTML files into <directory>",
|
|
"directory");
|
|
parser.addOption(outputDirectoryOption);
|
|
|
|
parser.process(*application);
|
|
|
|
QString source = parser.value(sourceDirectoryOption);
|
|
QString output = parser.value(outputDirectoryOption);
|
|
|
|
if (source.isEmpty() || output.isEmpty()) {
|
|
qDebug() << "need --source and --output";
|
|
exit(1);
|
|
}
|
|
WindowTitleUpdate *wtu = new WindowTitleUpdate();
|
|
int ret = parse_file(qPrintable(source));
|
|
if (ret) {
|
|
fprintf(stderr, "parse_file returned %d\n", ret);
|
|
exit(1);
|
|
}
|
|
|
|
// this should have set up the informational preferences - let's grab
|
|
// the units from there
|
|
|
|
prefs.unit_system = informational_prefs.unit_system;
|
|
prefs.units = informational_prefs.units;
|
|
|
|
// populate the statistics
|
|
struct dive *d = get_dive(0);
|
|
struct dive *pd;
|
|
if (d) {
|
|
process_all_dives(d, &pd);
|
|
}
|
|
|
|
// now set up the export settings to create the HTML export
|
|
struct htmlExportSetting hes;
|
|
hes.themeFile = "sand.css";
|
|
hes.exportPhotos = true;
|
|
hes.selectedOnly = false;
|
|
hes.listOnly = false;
|
|
hes.yearlyStatistics = true;
|
|
hes.subsurfaceNumbers = true;
|
|
exportHtmlInitLogic(output, hes);
|
|
exit(0);
|
|
}
|