2020-04-06 15:15:13 +08:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
2020-04-11 19:54:51 +08:00
|
|
|
#include "singleapplicationmanager.h"
|
|
|
|
|
2020-04-06 15:15:13 +08:00
|
|
|
#include <QApplication>
|
2020-04-07 19:09:08 +08:00
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QUrl>
|
2020-04-11 19:54:51 +08:00
|
|
|
#include <QDebug>
|
2020-04-06 15:15:13 +08:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
2020-04-07 19:09:08 +08:00
|
|
|
|
|
|
|
// parse commandline arguments
|
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.addPositionalArgument("File list", QCoreApplication::translate("main", "File list."));
|
|
|
|
parser.addHelpOption();
|
|
|
|
|
|
|
|
parser.process(a);
|
|
|
|
|
|
|
|
QStringList urlStrList = parser.positionalArguments();
|
2020-04-11 19:54:51 +08:00
|
|
|
|
|
|
|
SingleApplicationManager sam("_pineapple_music_owo_");
|
|
|
|
if (sam.checkSingleInstance(QVariant::fromValue(urlStrList))) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
sam.createSingleInstance();
|
2020-04-07 19:09:08 +08:00
|
|
|
}
|
|
|
|
|
2020-04-06 15:15:13 +08:00
|
|
|
MainWindow w;
|
|
|
|
w.show();
|
2020-04-07 19:09:08 +08:00
|
|
|
|
2020-04-11 19:54:51 +08:00
|
|
|
if (!urlStrList.isEmpty()) {
|
|
|
|
w.commandlinePlayAudioFiles(urlStrList);
|
2020-04-07 19:09:08 +08:00
|
|
|
}
|
|
|
|
|
2020-04-11 19:54:51 +08:00
|
|
|
QObject::connect(&sam, &SingleApplicationManager::dataReached, &w, &MainWindow::localSocketPlayAudioFiles);
|
|
|
|
|
2020-04-06 15:15:13 +08:00
|
|
|
return a.exec();
|
|
|
|
}
|