38 lines
992 B
C++
38 lines
992 B
C++
#include "logger.hpp"
|
|
#include "playlist-controller.hpp"
|
|
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlContext>
|
|
#include <QUrl>
|
|
#include <filesystem>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
qInstallMessageHandler(MessageHandler);
|
|
std::filesystem::path cwd = std::filesystem::current_path();
|
|
Logger::info(cwd.string());
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
// qmlRegisterType<PlaylistController>("MediaSystem", 1, 0,
|
|
// "PlaylistController");
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
// engine.addImportPath(app.applicationDirPath());
|
|
|
|
PlaylistController playlist;
|
|
engine.rootContext()->setContextProperty("playlist", &playlist);
|
|
|
|
const QUrl url(QStringLiteral("qrc:/App/ui/main.qml"));
|
|
|
|
QObject::connect(
|
|
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
|
|
[]() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
|
|
|
|
engine.load(url);
|
|
|
|
Logger::info("Engine loaded");
|
|
|
|
return app.exec();
|
|
}
|