summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..2b97c95
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,28 @@
+#include <QApplication>
+#include <fstream>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ // First check parameter count
+ if (argc != 3)
+ return 2;
+
+ // Check if file exists
+ std::fstream f;
+ try
+ {
+ f.open(argv[2], std::ios::in);
+ }
+ catch (std::fstream::failure e)
+ {
+ return 3;
+ }
+ f.close();
+
+ QApplication a(argc, argv);
+ MainWindow w(argv);
+ w.show();
+
+ return a.exec();
+}