-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (37 loc) · 1.29 KB
/
Copy pathmain.cpp
File metadata and controls
42 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "gcodesimplerwidget.h"
#include <QApplication>
#include <QTranslator>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator translator;
translator.load("GCodeSimpler_zh_CN.qm");
a.installTranslator(&translator);
QString titleMessage = QObject::tr("\nGCodeSimpler\n(C)2014 Shaanxi Hengtong\n");
GCodeSimpler::consoleWrite(titleMessage);
// if some arguments given
if (argc > 1)
{
if (argc >= 3)
{
QString option(argv[1]);
if (option == "-c" || option == "--convert")
{
QStringList filelist;
for (int i = 2; i < argc; ++i)
filelist.append(QString(argv[i]));
GCodeSimpler simpler;
simpler.processGCode(filelist);
return 0;
}
}
//TODO: any better solution to write string to console?
QString helpMessage = QObject::tr("=======================\n\nUsage: GcodeSimpler [OPTION] [FILE]\nOptions:\n--help\t\t\t-h\t\tDisplay this help\n--convert <filepath>\t-c <filepath>\tProcess GCode file\n");
GCodeSimpler::consoleWrite(helpMessage);
return 1;
}
// if no extra arguments given, then show the GUI.
GCodeSimplerWidget w;
w.show();
return a.exec();
}