Polish the QtWidgets/Player example.
Point the file dialog to the Movies folder. Add command proper command line handling. Change the logic to use QUrl everywhere. Change-Id: I1e54e600187153f52a55e3a381a24e4f2eeda3ab Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
@@ -41,13 +41,33 @@
|
||||
#include "player.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QDir>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QCoreApplication::setApplicationName("Player Example");
|
||||
QCoreApplication::setOrganizationName("QtProject");
|
||||
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Qt MultiMedia Player Example");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("url", "The URL to open.");
|
||||
parser.process(app);
|
||||
|
||||
Player player;
|
||||
|
||||
if (!parser.positionalArguments().isEmpty() && player.isPlayerAvailable()) {
|
||||
QList<QUrl> urls;
|
||||
foreach (const QString &a, parser.positionalArguments())
|
||||
urls.append(QUrl::fromUserInput(a, QDir::currentPath(), QUrl::AssumeLocalFile));
|
||||
player.addToPlaylist(urls);
|
||||
}
|
||||
|
||||
#if defined(Q_WS_SIMULATOR)
|
||||
player.setAttribute(Qt::WA_LockLandscapeOrientation);
|
||||
player.showMaximized();
|
||||
|
||||
Reference in New Issue
Block a user