diff --git a/scripts/makeappimage.sh b/scripts/makeappimage.sh index 747ac8b..f3233e2 100755 --- a/scripts/makeappimage.sh +++ b/scripts/makeappimage.sh @@ -21,6 +21,7 @@ if [ "$ARCH" == "" ]; then ARCH="x86_64" fi +wget "https://github.com/AppImage/AppImageUpdate/releases/download/continuous/appimageupdatetool-382-b61bee3-x86_64.AppImage" -O appdir/usr/bin/appimageupdatetool cp -f /usr/lib/*/libjack.so.0 appdir/usr/lib export UPD_INFO="gh-releases-zsync|NamedKitten|KittehPlayer|continuous|KittehPlayer-$ARCH.AppImage.zsync" diff --git a/src/main.cpp b/src/main.cpp index d8f2d4a..f02038b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,8 @@ #include #include +#include +#include +#include #include "config.h" #include "mpvobject.h" @@ -15,12 +18,28 @@ #include #include #include +#include int main( int argc, char *argv[] ) { - setenv("QT_QUICK_CONTROLS_STYLE","Desktop",1); QApplication app(argc, argv); + + for (int i = 1; i < argc; ++i) { + if (!qstrcmp(argv[i], "--update")) { + QString program = QProcessEnvironment::systemEnvironment().value("APPDIR", "/usr/bin") + "/appimageupdatetool"; + QProcess updater; + updater.setProcessChannelMode(QProcess::ForwardedChannels); + updater.start(program, QStringList() << QProcessEnvironment::systemEnvironment().value("APPIMAGE", "")); + if(!updater.waitForStarted()) + qDebug() << "Failed to start updater."; + qDebug() << program; + exit(0); + } + } + + + setenv("QT_QUICK_CONTROLS_STYLE","Desktop",1); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); qmlRegisterType("player", 1, 0, "MpvObject");