From ca414b80b675332621a56faa4ec08730a70e0ff5 Mon Sep 17 00:00:00 2001 From: kraxarn Date: Sun, 17 Nov 2024 18:49:58 +0100 Subject: [PATCH] Always attach events --- src/spotifyclient/runner.cpp | 24 ++++++++++++------------ src/spotifyclient/runner.hpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/spotifyclient/runner.cpp b/src/spotifyclient/runner.cpp index 07a673e4..aba426a3 100644 --- a/src/spotifyclient/runner.cpp +++ b/src/spotifyclient/runner.cpp @@ -13,6 +13,18 @@ SpotifyClient::Runner::Runner(const lib::settings &settings, path = QString::fromStdString(settings.spotify.path); process = new QProcess(parent); clientType = SpotifyClient::Helper::clientType(path); + + connect(process, &QProcess::readyReadStandardOutput, + this, &Runner::onReadyReadOutput); + + connect(process, &QProcess::readyReadStandardError, + this, &Runner::onReadyReadError); + + connect(process, &QProcess::started, + this, &Runner::onStarted); + + connect(process, &QProcess::errorOccurred, + this, &Runner::onErrorOccurred); } SpotifyClient::Runner::~Runner() @@ -126,18 +138,6 @@ void SpotifyClient::Runner::start() arguments.append(additional_arguments.split(' ')); } - QProcess::connect(process, &QProcess::readyReadStandardOutput, - this, &Runner::onReadyReadOutput); - - QProcess::connect(process, &QProcess::readyReadStandardError, - this, &Runner::onReadyReadError); - - QProcess::connect(process, &QProcess::started, - this, &Runner::onStarted); - - QProcess::connect(process, &QProcess::errorOccurred, - this, &Runner::onErrorOccurred); - lib::log::debug("starting: {} {}", path.toStdString(), joinArgs(arguments).toStdString()); diff --git a/src/spotifyclient/runner.hpp b/src/spotifyclient/runner.hpp index c5491b61..c46205a7 100644 --- a/src/spotifyclient/runner.hpp +++ b/src/spotifyclient/runner.hpp @@ -40,7 +40,7 @@ namespace SpotifyClient void statusChanged(const QString &status); private: - QProcess *process = nullptr; + QProcess *process; QWidget *parentWidget = nullptr; QString path; static std::vector log;