diff --git a/src/MpvPlayerBackend.cpp b/src/MpvPlayerBackend.cpp index 0fb8fd8..e640057 100644 --- a/src/MpvPlayerBackend.cpp +++ b/src/MpvPlayerBackend.cpp @@ -163,7 +163,6 @@ MpvPlayerBackend::on_update(void* ctx) emit self->onUpdate(); } -// connected to onUpdate(); signal makes sure it runs on the GUI thread void MpvPlayerBackend::doUpdate() { @@ -322,6 +321,12 @@ MpvPlayerBackend::toggleOnTop() AlwaysOnTop(window()->winId(), onTop); } +void +MpvPlayerBackend::toggleStats() +{ + command(QVariantList() << "script-binding" << "stats/display-stats-toggle"); +} + void MpvPlayerBackend::addSpeed(const QVariant& speed) { diff --git a/src/MpvPlayerBackend.h b/src/MpvPlayerBackend.h index 4236b49..e795bd8 100644 --- a/src/MpvPlayerBackend.h +++ b/src/MpvPlayerBackend.h @@ -37,6 +37,7 @@ public slots: void prevPlaylistItem(); void nextPlaylistItem(); void toggleOnTop(); + void toggleStats(); void updateDurationStringText(); QVariant getTracks() const; void updatePrev(const QVariant& val); diff --git a/src/qml/main.qml b/src/qml/main.qml index 717c386..65f8cba 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -665,8 +665,7 @@ ApplicationWindow { Action { text: translate.getTranslation("STATS", i18n.language) onTriggered: { - player.command( - ["script-binding", "stats/display-stats-toggle"]) + player.toggleStats() } shortcut: keybinds.statsForNerds }