2222
2323#include " utils_mediaplayer.h"
2424
25- #include < QDebug>
26- #include < QLoggingCategory>
27-
2825#include " ../sources/config.h"
29-
30- static Q_LOGGING_CATEGORY (CLASS_LC, " mediaplayer utils" );
26+ #include " ../sources/logging.h"
3127
3228MediaPlayerUtils::MediaPlayerUtils (QObject *parent) : QObject(parent) {
3329 // ADD IMAGE PROVIDER
@@ -36,7 +32,7 @@ MediaPlayerUtils::MediaPlayerUtils(QObject *parent) : QObject(parent) {
3632 m_imageProviderId = QUuid::createUuid ().toString ().replace (" {" , " " ).replace (" }" , " " );
3733 m_imageProvider = new MediaPlayerUtilsImageProvider ();
3834 m_engine->addImageProvider (m_imageProviderId, m_imageProvider);
39- qCDebug (CLASS_LC () ) << this << " Image provider added:" << m_imageProviderId << m_imageProvider;
35+ qCDebug (lcMediaPlayer ) << this << " Image provider added:" << m_imageProviderId << m_imageProvider;
4036
4137 m_startTimer = new QTimer (this );
4238 m_startTimer->setSingleShot (true );
@@ -52,31 +48,31 @@ MediaPlayerUtils::MediaPlayerUtils(QObject *parent) : QObject(parent) {
5248}
5349
5450MediaPlayerUtils::~MediaPlayerUtils () {
55- qCDebug (CLASS_LC () ) << this << " Destructor called" ;
51+ qCDebug (lcMediaPlayer ) << this << " Destructor called" ;
5652 m_engine->removeImageProvider (m_imageProviderId);
57- qCDebug (CLASS_LC () ) << this << " Destructor: Image provider removed:" << m_imageProviderId;
53+ qCDebug (lcMediaPlayer ) << this << " Destructor: Image provider removed:" << m_imageProviderId;
5854
5955 if (m_worker != nullptr ) {
60- qCDebug (CLASS_LC () ) << this << " Destructor: Worker was not null" ;
56+ qCDebug (lcMediaPlayer ) << this << " Destructor: Worker was not null" ;
6157 m_worker->disconnect ();
62- qCDebug (CLASS_LC () ) << this << " Destructor: Signal disconnected from Worker class" ;
58+ qCDebug (lcMediaPlayer ) << this << " Destructor: Signal disconnected from Worker class" ;
6359 m_worker->deleteLater ();
6460 m_worker = nullptr ;
65- qCDebug (CLASS_LC () ) << this << " Destructor: Worker deleted" ;
61+ qCDebug (lcMediaPlayer ) << this << " Destructor: Worker deleted" ;
6662 }
6763
6864 if (m_workerThread != nullptr ) {
69- qCDebug (CLASS_LC () ) << this << " Destructor: WorkerThread was not null" ;
65+ qCDebug (lcMediaPlayer ) << this << " Destructor: WorkerThread was not null" ;
7066 if (m_workerThread->isRunning ()) {
71- qCDebug (CLASS_LC () ) << this << " Destructor: WorkerThread is running" ;
67+ qCDebug (lcMediaPlayer ) << this << " Destructor: WorkerThread is running" ;
7268 m_workerThread->quit ();
73- qCDebug (CLASS_LC () ) << this << " Destructor: WorkerThread exit was called" ;
69+ qCDebug (lcMediaPlayer ) << this << " Destructor: WorkerThread exit was called" ;
7470 m_workerThread->wait ();
75- qCDebug (CLASS_LC () ) << this << " Destructor: WorkerThread wait" ;
71+ qCDebug (lcMediaPlayer ) << this << " Destructor: WorkerThread wait" ;
7672 }
7773 m_workerThread->deleteLater ();
7874 m_workerThread = nullptr ;
79- qCDebug (CLASS_LC () ) << this << " Destructor: WorkerThread was deleted" ;
75+ qCDebug (lcMediaPlayer ) << this << " Destructor: WorkerThread was deleted" ;
8076 }
8177
8278 if (m_startTimer->isActive ()) {
@@ -89,7 +85,7 @@ MediaPlayerUtils::~MediaPlayerUtils() {
8985 m_imageProvider = nullptr ;
9086 m_imageProvider->deleteLater ();
9187
92- qCDebug (CLASS_LC () ) << this << " Destructor end" ;
88+ qCDebug (lcMediaPlayer ) << this << " Destructor end" ;
9389}
9490
9591void MediaPlayerUtils::setImageURL (QString url) {
@@ -122,12 +118,12 @@ void MediaPlayerUtils::onProcessingDone(const QColor &pixelColor, const QImage &
122118 m_pixelColor = pixelColor;
123119 emit pixelColorChanged ();
124120
125- qCDebug (CLASS_LC () ) << this << " Processing done" ;
121+ qCDebug (lcMediaPlayer ) << this << " Processing done" ;
126122}
127123
128124void MediaPlayerUtils::generateImages (const QString &url) {
129125 if (url != m_prevImageURL) {
130- qCDebug (CLASS_LC () ) << this << " Generate images for" << url;
126+ qCDebug (lcMediaPlayer ) << this << " Generate images for" << url;
131127
132128 m_prevImageURL = url;
133129 emit processingStarted ();
@@ -141,11 +137,11 @@ MediaPlayerUtilsWorker::MediaPlayerUtilsWorker(QObject *parent) : QObject(parent
141137}
142138
143139MediaPlayerUtilsWorker::~MediaPlayerUtilsWorker () {
144- qCDebug (CLASS_LC () ) << this << " Worker destructor" ;
140+ qCDebug (lcMediaPlayer ) << this << " Worker destructor" ;
145141 if (m_manager != nullptr ) {
146142 m_manager->deleteLater ();
147143 m_manager = nullptr ;
148- qCDebug (CLASS_LC () ) << this << " Worker destructor: Manager deleted." ;
144+ qCDebug (lcMediaPlayer ) << this << " Worker destructor: Manager deleted." ;
149145 }
150146}
151147
@@ -164,7 +160,7 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
164160 image.fill (Qt::black);
165161
166162 if (!image.load (m_reply, nullptr )) {
167- qCWarning (CLASS_LC ) << " ERROR LOADING IMAGE" ;
163+ qCWarning (lcMediaPlayer ) << " ERROR LOADING IMAGE" ;
168164 if (m_reply) {
169165 m_reply->deleteLater ();
170166 m_reply = nullptr ;
@@ -174,7 +170,7 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
174170 // //////////////////////////////////////////////////////////////////
175171 // / GET DOMINANT COLOR
176172 // //////////////////////////////////////////////////////////////////
177- qCDebug (CLASS_LC () ) << this << " Getting dominant color" ;
173+ qCDebug (lcMediaPlayer ) << this << " Getting dominant color" ;
178174 QColor pixelColor = dominantColor (image);
179175
180176 // change the brightness of the color if it's too bright
@@ -190,7 +186,7 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
190186 // //////////////////////////////////////////////////////////////////
191187 // / CREATE LARGE BACKGROUND IMAGE
192188 // //////////////////////////////////////////////////////////////////
193- qCDebug (CLASS_LC () ) << this << " Creating image" ;
189+ qCDebug (lcMediaPlayer ) << this << " Creating image" ;
194190 // resize image
195191 image.scaledToHeight (280 , Qt::SmoothTransformation);
196192
@@ -204,18 +200,18 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
204200 painter.drawImage (image.rect (), noise);
205201 painter.end ();
206202
207- qCDebug (CLASS_LC () ) << this << " Creating image DONE" ;
203+ qCDebug (lcMediaPlayer ) << this << " Creating image DONE" ;
208204
209205 emit processingDone (pixelColor, image);
210206 }
211207 } else {
212- qCWarning (CLASS_LC ) << this << " NETWORK REPLY ERROR" << m_reply->errorString ();
208+ qCWarning (lcMediaPlayer ) << this << " NETWORK REPLY ERROR" << m_reply->errorString ();
213209 emit processingDone (QColor (" black" ), QImage ());
214210 }
215211
216212 m_reply->deleteLater ();
217213 m_reply = nullptr ;
218- qCDebug (CLASS_LC () ) << this << " Network reply deleted" ;
214+ qCDebug (lcMediaPlayer ) << this << " Network reply deleted" ;
219215 }
220216}
221217
0 commit comments