-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
36 lines (29 loc) · 1023 Bytes
/
main.cpp
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
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "exercise.h"
#include "mainwindow.h"
#include "iostream"
using namespace std;
// The main function
int main(int argc, char *argv[]) {
Q_INIT_RESOURCE(mdi);
QApplication app(argc, argv);
QCoreApplication::setApplicationName("Workout Planner");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription("Workout Planner");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The file to open.");
parser.process(app);
// Reads the file of exercises
Exercise::readExerciseList();
MainWindow mainWin;
const QStringList posArgs = parser.positionalArguments();
for (const QString &fileName : posArgs)
mainWin.openFile(fileName);
mainWin.show();
return app.exec();
}