-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (32 loc) · 1.18 KB
/
main.cpp
File metadata and controls
41 lines (32 loc) · 1.18 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
#include <QApplication>
#include "XunoPlayerMPV.h"
#include "DarkStyle.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Qt sets the locale in the QApplication constructor, but libmpv requires
// the LC_NUMERIC category to be set to "C", so change it back.
QCoreApplication::setApplicationName("XunoPlayer-MPV");
QCoreApplication::setOrganizationName("Aaex Corp. www.xuno.com.");
QCoreApplication::setApplicationVersion(VERGIT);
QCommandLineParser parser;
parser.setApplicationDescription("XunoPlayer-MPV. Aaex Corp. www.xuno.com.");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("url", "The URL to open.");
parser.process(a);
// style our application with custom dark style
a.setStyle(new DarkStyle);
#ifdef unix
setlocale(LC_NUMERIC, "C");
#endif
XunoPlayerMpv w;
w.show();
if (!parser.positionalArguments().isEmpty()) {
QList<QUrl> urls;
foreach (const QString &a, parser.positionalArguments())
urls.append(QUrl::fromUserInput(a, QDir::currentPath(), QUrl::DefaultResolution));
w.OpenAndPlay(urls.at(0));
}
return a.exec();
}