diff options
-rw-r--r-- | src/maingui/main.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/maingui/main.cpp b/src/maingui/main.cpp index 53aa68f..c22ad7b 100644 --- a/src/maingui/main.cpp +++ b/src/maingui/main.cpp @@ -1,4 +1,5 @@ #include <QApplication> +#include <QMessageBox> #include <fstream> #include "printergui.h" #include <fcntl.h> @@ -11,16 +12,23 @@ int main(int argc, char *argv[]) return 2; } - // Check if file exists - int fh = open(argv[2], O_RDONLY); - if (fh < 0) { - fprintf(stderr, "ERROR: Could not open %s for reading..\n", argv[2]); - return 2; - } - close(fh); - QApplication a(argc, argv); - PrinterGui w(argv); - w.show(); + + if (strcmp(argv[1], "--error") == 0) { + QMessageBox::critical(NULL, "Verarbeitungsfehler", argv[2]); + return 0; + } else { + // Check if file exists + int fh = open(argv[2], O_RDONLY); + if (fh < 0) { + fprintf(stderr, "ERROR: Could not open %s for reading..\n", argv[2]); + return 2; + } + close(fh); + + PrinterGui *w = new PrinterGui(argv); + w->show(); + } return a.exec(); } + |