pineapple-music/main.cpp

36 lines
808 B
C++
Raw Normal View History

2020-04-06 15:15:13 +08:00
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QUrl>
2020-04-06 15:15:13 +08:00
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// parse commandline arguments
QCommandLineParser parser;
parser.addPositionalArgument("File list", QCoreApplication::translate("main", "File list."));
parser.addHelpOption();
parser.process(a);
QStringList urlStrList = parser.positionalArguments();
QList<QUrl> urlList;
for (const QString & str : urlStrList) {
QUrl url = QUrl::fromLocalFile(str);
if (url.isValid()) {
urlList.append(url);
}
}
2020-04-06 15:15:13 +08:00
MainWindow w;
w.show();
if (!urlList.isEmpty()) {
w.commandlinePlayAudioFiles(urlList);
}
2020-04-06 15:15:13 +08:00
return a.exec();
}