1
0
Fork 0
VideoPlayer/src/main.cpp

60 lines
1.6 KiB
C++
Raw Normal View History

2018-10-13 15:38:31 +01:00
#include <stdexcept>
#include <clocale>
2018-10-23 11:37:51 +01:00
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
2018-10-13 15:38:31 +01:00
#include "config.h"
#include "mpvobject.h"
#include <QApplication>
#include <QGuiApplication>
#include <QMainWindow>
#include <QQmlApplicationEngine>
#include <QObject>
#include <QWidget>
#include <QtGui/QOpenGLFramebufferObject>
#include <QQuickView>
2018-10-23 11:37:51 +01:00
#include <QProcessEnvironment>
2018-10-13 15:38:31 +01:00
int main( int argc, char *argv[] )
{
QApplication app(argc, argv);
2018-10-23 11:37:51 +01:00
for (int i = 1; i < argc; ++i) {
if (!qstrcmp(argv[i], "--update")) {
2018-10-23 13:43:27 +01:00
QString program = QProcessEnvironment::systemEnvironment().value("APPDIR", "") + "/usr/bin/appimageupdatetool";
2018-10-23 11:37:51 +01:00
QProcess updater;
updater.setProcessChannelMode(QProcess::ForwardedChannels);
updater.start(program, QStringList() << QProcessEnvironment::systemEnvironment().value("APPIMAGE", ""));
if(!updater.waitForStarted())
qDebug() << "Failed to start updater.";
2018-10-23 12:19:21 +01:00
qDebug() << updater.errorString();
updater.waitForFinished();
2018-10-23 11:37:51 +01:00
qDebug() << program;
exit(0);
}
}
setenv("QT_QUICK_CONTROLS_STYLE","Desktop",1);
2018-10-13 15:38:31 +01:00
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
qmlRegisterType<MpvObject>("player", 1, 0, "MpvObject");
std::setlocale(LC_NUMERIC, "C");
/*QQuickView *view = new QQuickView();
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->setSource(QUrl("qrc:///player/main.qml"));
view->show();*/
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///player/main.qml")));
return app.exec();
}