-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
42 lines (31 loc) · 1.02 KB
/
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
37
38
39
40
41
42
// Copyright 2017 Lybros.
#include <gflags/gflags.h>
#include <glog/logging.h>
#include "cli/cli.h"
#include "ui/mainwindow.h"
#include <QApplication>
DEFINE_string(mode, "ui", "Application mode. Choose between ui and cli.");
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
LOG(INFO) << "Logging is enabled.";
if (FLAGS_mode == "ui") {
LOG(INFO) << "Running UI.";
QApplication a(argc, argv);
QtAwesome* awesome = new QtAwesome(&a);
awesome->initFontAwesome();
MainWindow w;
w.SetIcons(awesome);
w.show();
return a.exec();
} else if (FLAGS_mode == "cli") {
// Running in CLI mode means no need in using any code from ui/, as ui/ is
// only a wrapper for a Project object.
// In CLI mode we may simply create a Project and work with it directly.
RunCLI();
return 0;
}
LOG(ERROR) << "'mode' flag must be either 'ui' or 'cli'. "
"If not provided, default value is 'ui'.";
return 0;
}