From 9888ba9d68c47cac5d207a25407b16da4defeb23 Mon Sep 17 00:00:00 2001 From: Kevin Whitaker Date: Mon, 8 Apr 2019 18:17:51 -0400 Subject: [PATCH] Add TcpServer and have it broadcast itself over DNSSD. --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 ++ src/simplecastengine.cpp | 3 ++- src/simplecastengine.h | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75a8e6b..1563569 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Multimedia) +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Multimedia Network) find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS CoreAddons diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7777591..467a266 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ set( simplecastengine_SRCS simplecastengine.cpp minimediaplayer.cpp simplecastservice.cpp + simplecasttcpservice.cpp ) add_library(plasma_engine_simplecast ${simplecastengine_SRCS}) @@ -12,6 +13,7 @@ kcoreaddons_desktop_to_json(plasma_engine_simplecast plasma-dataengine-simplecas target_link_libraries( plasma_engine_simplecast Qt5::Core Qt5::Multimedia + Qt5::Network KF5::Plasma KF5::Service KF5::I18n diff --git a/src/simplecastengine.cpp b/src/simplecastengine.cpp index 13af3c6..d24e548 100644 --- a/src/simplecastengine.cpp +++ b/src/simplecastengine.cpp @@ -22,7 +22,7 @@ #include "simplecastservice.h" SimpleCastEngine::SimpleCastEngine(QObject *parent, const QVariantList &args) - : Plasma::DataEngine(parent,args), player(new MiniMediaPlayer(this)) + : Plasma::DataEngine(parent,args), player(new MiniMediaPlayer(this)), tcpService(player,this) { Q_UNUSED(args) setMinimumPollingInterval(333); @@ -30,6 +30,7 @@ SimpleCastEngine::SimpleCastEngine(QObject *parent, const QVariantList &args) connect(player,SIGNAL(trackDurationChanged(qint64)),this,SLOT(durationChanged(qint64))); connect(player,SIGNAL(trackPositionChanged(qint64)),this,SLOT(positionChanged(qint64))); connect(player,SIGNAL(playlistChanged(QStringList)),this,SLOT(playlistChanged(QStringList))); + tcpService.listen(); } void SimpleCastEngine::durationChanged(qint64 length) diff --git a/src/simplecastengine.h b/src/simplecastengine.h index 8972921..a7ed0cd 100644 --- a/src/simplecastengine.h +++ b/src/simplecastengine.h @@ -25,6 +25,7 @@ #include #include #include "minimediaplayer.h" +#include "simplecasttcpservice.h" /** * Simple Cast Engine is a Plasma DataEngine that conveys that status on the media player casting to to other code like Plasmoids. @@ -46,7 +47,7 @@ protected: bool sourceRequestEvent(const QString &source) override; bool updateSourceEvent(const QString &source) override; MiniMediaPlayer *player; - + SimpleCastTcpService tcpService; }; #endif // SIMPLECASTENGINE_H -- GitLab