From 0d1493483958c2f00af4975c531b0ab1da75ad42 Mon Sep 17 00:00:00 2001
From: Nicolas Peugnet <nicolas@club1.fr>
Date: Sat, 1 Aug 2026 15:48:33 +0200
Subject: [PATCH] Fix build with mpvqt 1.2.0

Since [b3dbc4b], command() takes a QStringList instead of a
QVariantList. Replace the usage of QVariantList with QStringList for
each call of command(), and do not use a QVariantMap to build the
extraArgs, instead, we now need to build the option list as a string
separated by commas.

[b3dbc4b]: https://github.com/KDE/mpvqt/commit/b3dbc4b1f51121da81865ca051eaa8f8a63e3f15
---
 src/player/PlayerComponent.cpp | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/player/PlayerComponent.cpp b/src/player/PlayerComponent.cpp
index 297c77b0d..424216bf3 100644
--- a/src/player/PlayerComponent.cpp
+++ b/src/player/PlayerComponent.cpp
@@ -299,39 +299,40 @@ void PlayerComponent::queueMedia(const QString& url, const QVariantMap& options,
   QUrl qurl = url;
   QString host = qurl.host();
 
-  QVariantList command;
+  QStringList command;
   command << "loadfile" << qurl.toString(QUrl::FullyEncoded);
   command << "append-play"; // if nothing is playing, play it now, otherwise just enqueue it
 
 #if MPV_CLIENT_API_VERSION >= MPV_MAKE_VERSION(2, 3)
-  command << -1; // insert_at_idx
+  command << "-1"; // insert_at_idx
 #endif
 
-  QVariantMap extraArgs;
+  QString extraArgs;
 
   quint64 startMilliseconds = options["startMilliseconds"].toLongLong();
   if (startMilliseconds != 0)
-    extraArgs.insert("start", "+" + QString::number(startMilliseconds / 1000.0));
+    extraArgs += "start=+" + QString::number(startMilliseconds / 1000.0) + ",";
 
   // we're going to select these streams later, in the preloaded hook
-  extraArgs.insert("aid", "no");
-  extraArgs.insert("sid", "no");
+  extraArgs += "aid=no,";
+  extraArgs += "sid=no,";
 
   m_currentSubtitleStream = subtitleStream;
   m_currentAudioStream = audioStream;
 
   if (metadata["type"] == "music")
-    extraArgs.insert("vid", "no");
+    extraArgs += "vid=no,";
 
-  extraArgs.insert("pause", options["autoplay"].toBool() ? "no" : "yes");
+  QString pause = options["autoplay"].toBool() ? "no" : "yes";
+  extraArgs += "pause=" + pause + ",";
 
   QString userAgent = metadata["headers"].toMap()["User-Agent"].toString();
   if (userAgent.size())
-    extraArgs.insert("user-agent", userAgent);
+    extraArgs += "user-agent=" + userAgent + ",";
 
   // Make sure the list of requested codecs is reset.
-  extraArgs.insert("ad", "");
-  extraArgs.insert("vd", "");
+  extraArgs += "ad=,";
+  extraArgs += "vd="; // Keep last
 
   command << extraArgs;
 
@@ -850,7 +851,7 @@ void PlayerComponent::seekTo(qint64 ms)
     return;
   }
   double timeSecs = ms / 1000.0;
-  QVariantList args = (QVariantList() << "seek" << timeSecs << "absolute+exact");
+  QStringList args = (QStringList() << "seek" << QString::number(timeSecs) << "absolute+exact");
   m_mpv->command( args);
 }
 
