X-Git-Url: http://git.tdb.fi/?p=xinema.git;a=blobdiff_plain;f=remote%2Fsource%2Fxinemacontrol.cpp;h=db349e73685a7d0472a9a9b7dd9cd0dba860389b;hp=63399a6e4a0bcde7bfd9861b2193c9db9570a44d;hb=4dd3070fa50882b7ec7a26f7d0994c064c6b29d6;hpb=a1e6d14ce3a5d5415333a4d3def6c5504f4bc49b diff --git a/remote/source/xinemacontrol.cpp b/remote/source/xinemacontrol.cpp index 63399a6..db349e7 100644 --- a/remote/source/xinemacontrol.cpp +++ b/remote/source/xinemacontrol.cpp @@ -1,6 +1,9 @@ #include "xinemacontrol.h" -XinemaControl::XinemaControl() +XinemaControl::XinemaControl(): + playback_state(STOPPED), + duration(0.0f), + position(0.0f) { QObject::connect(&socket, &QAbstractSocket::connected, this, &XinemaControl::connected); QObject::connect(&socket, &QAbstractSocket::disconnected, this, &XinemaControl::disconnected); @@ -33,6 +36,26 @@ void XinemaControl::play_file(const QString &fn) send_request("play_file "+fn); } +void XinemaControl::play() +{ + send_request("play"); +} + +void XinemaControl::seek(float time) +{ + send_request(QString("seek %1").arg(time)); +} + +void XinemaControl::pause() +{ + send_request("pause"); +} + +void XinemaControl::stop() +{ + send_request("stop"); +} + void XinemaControl::send_request(const QString &req) { socket.write(req.toUtf8()); @@ -77,6 +100,16 @@ void XinemaControl::process_reply(const QString &reply) emit subdirectory_added(args); else if(keyword=="file") emit file_added(args); + else if(keyword=="state") + { + if(args=="STOPPED") + playback_state = STOPPED; + else if(args=="PAUSED") + playback_state = PAUSED; + else if(args=="PLAYING") + playback_state = PLAYING; + emit playback_state_changed(playback_state); + } else if(keyword=="title") { title = args;