-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (42 loc) · 1.03 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
43
#include "mainwindow.h"
#include <QMediaPlayer>
#include <QMediaService>
#include <QMediaServiceProviderPlugin>
#include <QApplication>
#include <QDebug>
#include <QEventLoop>
#include <QLocalSocket>
#include "musicbrainzclient.h"
#include "minilecteur.h"
//#include <id3.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//a.removeLibraryPath(a.libraryPaths().first());
qRegisterMetaType<Song>("Song");
qRegisterMetaTypeStreamOperators<Song>("Song");
MainWindow w;
QStringList args = a.arguments();
QLocalSocket socket;
socket.connectToServer("iniTunes");
QTextStream stream(&socket);
if(socket.waitForConnected(3000))
{
stream <<QString::number(PLAY)<<endl;
stream << args.at(1) <<endl;
socket.waitForBytesWritten();
exit(0);
}
else
{
qDebug()<<"Launch";
w.show();
w.createRemote();
if(args.count()==2)
{
qDebug()<<"Open";
w.open(args.at(1));
}
}
return a.exec();
}