-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmidix.cc
43 lines (34 loc) · 923 Bytes
/
xmidix.cc
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
43
#include "xmidix_player.h"
#include <spdlog/spdlog.h>
#include <QApplication>
#include <QUrl>
#include <QList>
#include <QFileInfo>
typedef struct {
QList<QUrl> files;
} args_t;
args_t parse_args(int argc, char **argv) {
QList<QUrl> files;
for (int i = 1; i < argc; i++) {
auto arg = argv[i];
if (QFileInfo::exists(arg)) {
auto url = QUrl::fromLocalFile(arg);
files.append(url);
} else {
spdlog::warn("file does not exist: {}", arg);
}
}
return {files};
}
int main(int argc, char **argv) {
spdlog::set_level(spdlog::level::debug);
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("xeyes.org");
QCoreApplication::setOrganizationDomain("xeyes.org");
QCoreApplication::setApplicationName("XMIDIX");
auto args = parse_args(argc, argv);
xmidix_player w{nullptr, args.files};
w.show();
bool result = a.exec();
return result;
}