#include <QQmlApplicationEngine>
#include <QQmlContext>
+#include "player.h"
#include "timeformatter.h"
Q_LOGGING_CATEGORY(imCategory, "InstanceManager")
QQmlApplicationEngine engine;
+ player = new Player{this};
+ Q_CHECK_PTR(player);
+
if (!positionalArgs.empty())
- player.setNextSource(QUrl::fromUserInput(positionalArgs[0]));
+ player->setNextSource(QUrl::fromUserInput(positionalArgs[0]));
qCDebug(imCategory, "Player Created");
TimeFormatter timeFormatter;
- engine.rootContext()->setContextProperty("player", &player);
+ engine.rootContext()->setContextProperty("player", player);
engine.rootContext()->setContextProperty("timeFormatter", &timeFormatter);
qCDebug(imCategory, "Player Added");
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
qCInfo(imCategory()) << "No new file to open";
return;
}
-
- player.loadAndPlay(QUrl::fromUserInput(positionalArgs[0]));
+ Q_ASSERT(player);
+ player->loadAndPlay(QUrl::fromUserInput(positionalArgs[0]));
}
#include <QCommandLineOption>
#include <QCommandLineParser>
-#include "player.h"
+class Player;
class InstanceManager : public QObject {
Q_OBJECT
"Start playback specific position",
"position in seconds", "0"};
QCommandLineParser parser;
- Player player;
+ Player *player;
};
#endif // INSTANCEMANAGER_H