Let command line version not open an X window

So we can run it on a headless system

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-06-07 11:00:38 +02:00 committed by Dirk Hohndel
parent 22612831bb
commit 6963b52d96
3 changed files with 10 additions and 1 deletions

View file

@ -35,7 +35,7 @@ if ($q->upload("uploaded_file")) {
-size => 50, -size => 50,
-maxlength => 200); -maxlength => 200);
print $q->submit(); print $q->submit();
print $q-end_form(); print $q->end_form();
# Here we could print some footer stuff as above # Here we could print some footer stuff as above

View file

@ -3,6 +3,8 @@
project(smtk2ssrf) project(smtk2ssrf)
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
option(COMMANDLINE "Build command line version")
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

View file

@ -5,6 +5,7 @@
#include "smrtk2ssrfc_window.h" #include "smrtk2ssrfc_window.h"
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#define COMMANDLINE 1
extern "C" void smartrak_import(const char *file, struct dive_table *table); extern "C" void smartrak_import(const char *file, struct dive_table *table);
@ -17,13 +18,19 @@ int main(int argc, char *argv[])
{ {
char *infile, *outfile; char *infile, *outfile;
int i; int i;
#ifndef COMMANDLINE
QApplication a(argc, argv); QApplication a(argc, argv);
Smrtk2ssrfcWindow w; Smrtk2ssrfcWindow w;
#else
QCoreApplication a(argc, argv);
#endif
switch (argc) { switch (argc) {
case 1: case 1:
#ifndef COMMANDLINE
w.show(); w.show();
return a.exec(); return a.exec();
#endif
break; break;
case 2: case 2:
qDebug() << "\nUsage:\n"; qDebug() << "\nUsage:\n";