diff --git a/src/openlpclient.cpp b/src/openlpclient.cpp index d2556bb..7207964 100644 --- a/src/openlpclient.cpp +++ b/src/openlpclient.cpp @@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -37,19 +38,19 @@ QString OpenLPClient::getNextSong() { } void OpenLPClient::nextSlide() { - get("/api/controller/live/next"); + post("/api/v2/controller/progress", R"({"action":"next"})"); } void OpenLPClient::prevSlide() { - get("/api/controller/live/previous"); + post("/api/v2/controller/progress", R"({"action":"previous"})"); } void OpenLPClient::nextSong() { - get("/api/service/next"); + post("/api/v2/service/progress", R"({"action":"next"})"); } void OpenLPClient::prevSong() { - get("/api/service/previous"); + post("/api/v2/service/progress", R"({"action":"previous"})"); } void OpenLPClient::blankScreen() { @@ -91,6 +92,12 @@ void OpenLPClient::get(QString const&urlExt) { m_nam->get(rqst); } +void OpenLPClient::post(QString const&url, QString const&data) { + QNetworkRequest rqst(QUrl(m_baseUrl + url)); + rqst.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + m_nam->post(rqst, data.toUtf8()); +} + void OpenLPClient::requestSongList() { QUrl url(m_baseUrl + "/api/service/list?_=1626628079579"); QNetworkRequest rqst(url); diff --git a/src/openlpclient.hpp b/src/openlpclient.hpp index d171fe3..1d64cba 100644 --- a/src/openlpclient.hpp +++ b/src/openlpclient.hpp @@ -60,6 +60,8 @@ class OpenLPClient: public QObject { private: void get(QString const&url); + void post(QString const&url, QString const&data); + void requestSongList(); void requestSlideList();