diff --git a/CHANGELOG.md b/CHANGELOG.md index d50841becc..8e8c060fd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,8 +48,8 @@ 1000 movie directories, the time improvements were: - 3.8s -> 1.3s (SSD) - 4.1s -> 1.4s (HDD) - - Fix unuseful log warning "[KodiXml] NFO file could not be opened for reading" for TV shows that do not have a NFO file. - + - Fix unuseful log warning `[KodiXml] NFO file could not be opened for reading` for TV shows that do not have a NFO file. + - MediaElch now uses Qt's logging categories ## 2.8.6 - Coridian (2021-01-22) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fea6817c3..41bb808fae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,10 @@ mediaelch_post_target_defaults(mediaelch) install(TARGETS mediaelch RUNTIME DESTINATION bin RENAME MediaElch) install(FILES data/desktop/MediaElch.desktop DESTINATION share/applications) install(FILES data/desktop/MediaElch.png DESTINATION share/pixmaps) -install(FILES data/desktop/com.kvibes.MediaElch.metainfo.xml DESTINATION share/metainfo) +install( + FILES data/desktop/com.kvibes.MediaElch.metainfo.xml + DESTINATION share/metainfo +) # ------------------------------------------------------------------------------ # Testing diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake index 874c3b06ca..a3255bc540 100644 --- a/cmake/warnings.cmake +++ b/cmake/warnings.cmake @@ -45,6 +45,7 @@ function(enable_warnings warning_target) -Wdocumentation # Warns about doxygen variable # name mismatches, etc. > + -Wno-gnu-zero-variadic-macro-arguments # false positive for qCDebug $<$: /W3> ) diff --git a/src/concerts/Concert.cpp b/src/concerts/Concert.cpp index f1a2d6561e..ab16b122cc 100644 --- a/src/concerts/Concert.cpp +++ b/src/concerts/Concert.cpp @@ -1,16 +1,15 @@ #include "Concert.h" -#include -#include -#include -#include - #include "data/StreamDetails.h" #include "file/NameFormatter.h" #include "globals/Helper.h" #include "media_centers/MediaCenterInterface.h" #include "settings/Settings.h" +#include +#include +#include + using namespace std::chrono_literals; /** diff --git a/src/concerts/ConcertFileSearcher.cpp b/src/concerts/ConcertFileSearcher.cpp index c9c836cca1..9bb9d4d286 100644 --- a/src/concerts/ConcertFileSearcher.cpp +++ b/src/concerts/ConcertFileSearcher.cpp @@ -3,9 +3,9 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "globals/MessageIds.h" +#include "log/Log.h" #include -#include #include #include #include @@ -21,18 +21,18 @@ void ConcertFileSearcher::setConcertDirectories(QVector directories for (const auto& dir : directories) { if (Settings::instance()->advanced()->isFolderExcluded(dir.path.dirName())) { - qWarning() << "[ConcertFileSearcher] Concert directory is excluded by advanced settings! " - "Is this intended? Directory:" - << dir.path.path(); + qCWarning(generic) << "[ConcertFileSearcher] Concert directory is excluded by advanced settings! " + "Is this intended? Directory:" + << dir.path.path(); continue; } if (!dir.path.isReadable()) { - qDebug() << "[ConcertFileSearcher] Concert directory is not redable, skipping:" << dir.path.path(); + qCDebug(generic) << "[ConcertFileSearcher] Concert directory is not redable, skipping:" << dir.path.path(); continue; } - qDebug() << "[ConcertFileSearcher] Adding concert directory" << dir.path.path(); + qCDebug(generic) << "[ConcertFileSearcher] Adding concert directory" << dir.path.path(); m_directories.append(dir); } } @@ -58,7 +58,7 @@ void ConcertFileSearcher::reload(bool force) addConcertsToGui(loadConcertsFromDatabase()); - qDebug() << "Searching for concerts done"; + qCDebug(generic) << "Searching for concerts done"; if (!m_aborted) { emit concertsLoaded(); } diff --git a/src/concerts/ConcertProxyModel.cpp b/src/concerts/ConcertProxyModel.cpp index 637b3e80c3..3b8119bfe0 100644 --- a/src/concerts/ConcertProxyModel.cpp +++ b/src/concerts/ConcertProxyModel.cpp @@ -1,10 +1,9 @@ #include "ConcertProxyModel.h" -#include - #include "globals/Filter.h" #include "globals/Globals.h" #include "globals/Manager.h" +#include "log/Log.h" /** * \brief ConcertProxyModel::ConcertProxyModel diff --git a/src/data/Database.cpp b/src/data/Database.cpp index 3b2308a04e..8e34c2825e 100644 --- a/src/data/Database.cpp +++ b/src/data/Database.cpp @@ -5,6 +5,7 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "globals/Meta.h" +#include "log/Log.h" #include "media_centers/KodiXml.h" #include "media_centers/kodi/EpisodeXmlWriter.h" #include "movies/Movie.h" @@ -13,7 +14,6 @@ #include "settings/Settings.h" #include "tv_shows/TvShow.h" -#include #include #include #include @@ -32,7 +32,7 @@ Database::Database(QObject* parent) : QObject(parent) m_db = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE", "mediaDb")); m_db->setDatabaseName(dataLocation.filePath("MediaElch.sqlite")); if (!m_db->open()) { - qWarning() << "Could not open cache database"; + qCWarning(generic) << "Could not open cache database"; } else { QSqlQuery query(*m_db); @@ -420,7 +420,7 @@ QVector Database::moviesInDirectory(DirectoryPath path) movie = movies.value(query.value(query.record().indexOf("idMovie")).toInt()); if (movie == nullptr) { // This *must* not happen because we just inserted it. - qCritical() << "[Database] Movie is undefined but should exist!"; + qCCritical(generic) << "[Database] Movie is undefined but should exist!"; continue; } diff --git a/src/data/ImageCache.cpp b/src/data/ImageCache.cpp index 089dbf1faa..c72b2b8666 100644 --- a/src/data/ImageCache.cpp +++ b/src/data/ImageCache.cpp @@ -2,12 +2,12 @@ #include #include -#include #include #include #include "globals/Globals.h" #include "globals/Helper.h" +#include "log/Log.h" #include "settings/Settings.h" ImageCache::ImageCache(QObject* parent) : QObject(parent) @@ -26,7 +26,7 @@ ImageCache::ImageCache(QObject* parent) : QObject(parent) if (exists) { m_cacheDir = location; } - qDebug() << "[ImageCache] Using cache dir:" << m_cacheDir; + qCDebug(generic) << "[ImageCache] Using cache dir:" << m_cacheDir; m_forceCache = Settings::instance()->advanced()->forceCache(); } diff --git a/src/data/Locale.cpp b/src/data/Locale.cpp index e8607d245b..eae3796438 100644 --- a/src/data/Locale.cpp +++ b/src/data/Locale.cpp @@ -1,6 +1,6 @@ #include "data/Locale.h" -#include +#include "log/Log.h" namespace mediaelch { @@ -19,7 +19,7 @@ Locale::Locale(const QString& locale) m_country = split[1]; } if (split.size() > 2) { - qWarning() << "[Locale] Invalid locale format:" << locale; + qCWarning(generic) << "[Locale] Invalid locale format:" << locale; } } @@ -134,7 +134,7 @@ QString Locale::languageTranslated() const } return localeTextMap[m_lang]; } - qDebug() << "[Locale] Missing name for" << locale; + qCDebug(generic) << "[Locale] Missing name for" << locale; return locale; } diff --git a/src/data/MediaInfoFile.cpp b/src/data/MediaInfoFile.cpp index d079b2a075..e5e4352853 100644 --- a/src/data/MediaInfoFile.cpp +++ b/src/data/MediaInfoFile.cpp @@ -1,6 +1,7 @@ #include "data/MediaInfoFile.h" #include "globals/Helper.h" +#include "log/Log.h" #include "settings/Settings.h" #include "MediaInfoDLL/MediaInfoDLL.h" @@ -8,7 +9,6 @@ #include #include -#include #include #include @@ -28,7 +28,7 @@ MediaInfoFile::MediaInfoFile(const QString& filepath) : m_mediaInfo{std::make_un m_mediaInfo->Option(__T("Complete"), __T("1")); m_mediaInfo->Open(QString2MI(filepath)); if (!m_mediaInfo->IsReady()) { - qCritical() << "[MediaInfo] Unable to load libmediainfo!"; + qCCritical(generic) << "[MediaInfo] Unable to load libmediainfo!"; } } @@ -320,7 +320,7 @@ QString MediaInfoFile::parseVideoFormat(QString format, QString version) const QString MediaInfoFile::getGeneral(int streamIndex, const char* parameter) const { if (streamIndex < 0) { - qWarning() << "[MediaInfoFile][General] Negative streamIndex! Invalid value:" << streamIndex; + qCWarning(generic) << "[MediaInfoFile][General] Negative streamIndex! Invalid value:" << streamIndex; return {}; } return MI2QString( @@ -330,7 +330,7 @@ QString MediaInfoFile::getGeneral(int streamIndex, const char* parameter) const QString MediaInfoFile::getAudio(int streamIndex, const char* parameter) const { if (streamIndex < 0) { - qWarning() << "[MediaInfoFile][Audio] Negative streamIndex! Invalid value:" << streamIndex; + qCWarning(generic) << "[MediaInfoFile][Audio] Negative streamIndex! Invalid value:" << streamIndex; return {}; } return MI2QString( @@ -340,7 +340,7 @@ QString MediaInfoFile::getAudio(int streamIndex, const char* parameter) const QStringList MediaInfoFile::getAudio(int streamIndex, QStringList parameters) const { if (streamIndex < 0) { - qWarning() << "[MediaInfoFile][Video] Negative streamIndex! Invalid value:" << streamIndex; + qCWarning(generic) << "[MediaInfoFile][Video] Negative streamIndex! Invalid value:" << streamIndex; return {}; } @@ -357,7 +357,7 @@ QStringList MediaInfoFile::getAudio(int streamIndex, QStringList parameters) con QString MediaInfoFile::getVideo(int streamIndex, const char* parameter) const { if (streamIndex < 0) { - qWarning() << "[MediaInfoFile][Video] Negative streamIndex! Invalid value:" << streamIndex; + qCWarning(generic) << "[MediaInfoFile][Video] Negative streamIndex! Invalid value:" << streamIndex; return {}; } return MI2QString( @@ -367,7 +367,7 @@ QString MediaInfoFile::getVideo(int streamIndex, const char* parameter) const QString MediaInfoFile::getText(int streamIndex, const char* parameter) const { if (streamIndex < 0) { - qWarning() << "[MediaInfoFile][Text] Negative streamIndex! Invalid value:" << streamIndex; + qCWarning(generic) << "[MediaInfoFile][Text] Negative streamIndex! Invalid value:" << streamIndex; return {}; } return MI2QString( diff --git a/src/data/StreamDetails.cpp b/src/data/StreamDetails.cpp index 030c8b6d8e..da2cc98a51 100644 --- a/src/data/StreamDetails.cpp +++ b/src/data/StreamDetails.cpp @@ -1,14 +1,14 @@ #include "StreamDetails.h" +#include "data/MediaInfoFile.h" +#include "log/Log.h" + #include -#include #include #include #include #include -#include "data/MediaInfoFile.h" - StreamDetails::StreamDetails(QObject* parent, mediaelch::FileList files) : QObject(parent), m_files(std::move(files)), @@ -29,7 +29,7 @@ QString StreamDetails::detailToString(VideoDetails details) case VideoDetails::ScanType: return "scantype"; case VideoDetails::StereoMode: return "stereomode"; } - qWarning() << "Undefined video detail: no string representation"; + qCWarning(generic) << "Undefined video detail: no string representation"; return "undefined"; } @@ -40,7 +40,7 @@ QString StreamDetails::detailToString(AudioDetails details) case StreamDetails::AudioDetails::Language: return "language"; case StreamDetails::AudioDetails::Channels: return "channels"; } - qWarning() << "Undefined audio detail: no string representation"; + qCWarning(generic) << "Undefined audio detail: no string representation"; return "undefined"; } @@ -49,7 +49,7 @@ QString StreamDetails::detailToString(SubtitleDetails details) switch (details) { case StreamDetails::SubtitleDetails::Language: return "language"; } - qWarning() << "Undefined subtitle detail: no string representation"; + qCWarning(generic) << "Undefined subtitle detail: no string representation"; return "undefined"; } diff --git a/src/export/ExportTemplate.cpp b/src/export/ExportTemplate.cpp index 9a162a585a..687c134856 100644 --- a/src/export/ExportTemplate.cpp +++ b/src/export/ExportTemplate.cpp @@ -313,7 +313,7 @@ bool ExportTemplate::copyDir(const QString& srcPath, const QString& dstPath) return false; } } else { - qDebug() << "Unhandled item" << info.filePath() << "in cpDir"; + qCDebug(generic) << "Unhandled item" << info.filePath() << "in cpDir"; } } return true; diff --git a/src/export/ExportTemplateLoader.cpp b/src/export/ExportTemplateLoader.cpp index b981b343f5..c05322d5e0 100644 --- a/src/export/ExportTemplateLoader.cpp +++ b/src/export/ExportTemplateLoader.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #endif #include "globals/VersionInfo.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "settings/Settings.h" @@ -49,7 +49,7 @@ void ExportTemplateLoader::onLoadRemoteTemplatesFinished() reply->deleteLater(); if (reply->error() != QNetworkReply::NoError) { - qWarning() << "[ExportTemplateLoader] Network Error" << reply->errorString(); + qCWarning(generic) << "[ExportTemplateLoader] Network Error" << reply->errorString(); emit sigTemplatesLoaded(mergeTemplates(m_localTemplates, m_remoteTemplates)); return; } @@ -58,7 +58,7 @@ void ExportTemplateLoader::onLoadRemoteTemplatesFinished() QXmlStreamReader xml(msg); if (!xml.readNextStartElement() || xml.name() != QLatin1String("themes")) { - qWarning() << "[ExportTemplateLoader] export_themes.xml does not have a root element"; + qCWarning(generic) << "[ExportTemplateLoader] export_themes.xml does not have a root element"; emit sigTemplatesLoaded(mergeTemplates(m_localTemplates, m_remoteTemplates)); return; } @@ -68,7 +68,7 @@ void ExportTemplateLoader::onLoadRemoteTemplatesFinished() if (xml.name() == QLatin1String("theme")) { templates << parseTemplate(xml); } else { - qWarning() << "[ExportTemplateLoader] Found unknown XML tag in theme list:" << xml.name(); + qCWarning(generic) << "[ExportTemplateLoader] Found unknown XML tag in theme list:" << xml.name(); xml.skipCurrentElement(); } } @@ -83,7 +83,7 @@ void ExportTemplateLoader::loadLocalTemplates() mediaelch::DirectoryPath location = Settings::instance()->exportTemplatesDir(); QDir storageDir(location.dir()); if (!storageDir.exists() && !storageDir.mkpath(location.toString())) { - qCritical() << "[ExportTemplateLoader] Could not create storage location"; + qCCritical(generic) << "[ExportTemplateLoader] Could not create storage location"; return; } @@ -96,8 +96,8 @@ void ExportTemplateLoader::loadLocalTemplates() QFile file(infos.first().absoluteFilePath()); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[ExportTemplateLoader] File" << infos.first().absoluteFilePath() - << "could not be opened for reading"; + qCWarning(generic) << "[ExportTemplateLoader] File" << infos.first().absoluteFilePath() + << "could not be opened for reading"; continue; } @@ -107,7 +107,7 @@ void ExportTemplateLoader::loadLocalTemplates() QXmlStreamReader xml(content); if (!xml.readNextStartElement()) { - qWarning() << "[ExportTemplateLoader] Couldn't read XML root element of local template"; + qCWarning(generic) << "[ExportTemplateLoader] Couldn't read XML root element of local template"; continue; } @@ -158,8 +158,8 @@ ExportTemplate* ExportTemplateLoader::parseTemplate(QXmlStreamReader& xml) } else if (xml.name() == QLatin1String("checksum")) { if (xml.attributes().value("format") != QLatin1String("sha256")) { // Assume name is set first. If not, its just an empty string. - qWarning() << "[ExportTemplateLoader] Unsupported checksum type; default to sha256 for" - << exportTemplate->name(); + qCWarning(generic) << "[ExportTemplateLoader] Unsupported checksum type; default to sha256 for" + << exportTemplate->name(); } exportTemplate->setRemoteFileChecksum(xml.readElementText().trimmed()); } else if (xml.name() == QLatin1String("version")) { @@ -192,7 +192,7 @@ ExportTemplate* ExportTemplateLoader::parseTemplate(QXmlStreamReader& xml) bool ExportTemplateLoader::validateChecksum(const QByteArray& data, const ExportTemplate& exportTemplate) { if (exportTemplate.remoteFileChecksum().isEmpty()) { - qWarning() << "[ExportTemplateLoader] No checksum found for template" << exportTemplate.name(); + qCWarning(generic) << "[ExportTemplateLoader] No checksum found for template" << exportTemplate.name(); return true; // TODO: Expect there to be a checksum } @@ -200,8 +200,8 @@ bool ExportTemplateLoader::validateChecksum(const QByteArray& data, const Export QString epected = exportTemplate.remoteFileChecksum().toLower(); QByteArray actual = QCryptographicHash::hash(data, QCryptographicHash::Algorithm::Sha256).toHex(); if (epected != actual) { - qWarning() << "[ExportTemplateLoader] SHA256 check fail for template" << exportTemplate.name() - << " | Expected:" << epected << "but found:" << actual; + qCWarning(generic) << "[ExportTemplateLoader] SHA256 check fail for template" << exportTemplate.name() + << " | Expected:" << epected << "but found:" << actual; return false; } @@ -229,7 +229,7 @@ void ExportTemplateLoader::onDownloadTemplateFinished() ExportTemplate* exportTemplate = reply->property("storage").value(); reply->deleteLater(); if (reply->error() != QNetworkReply::NoError) { - qWarning() << "[ExportTemplateLoader] Network Error" << reply->errorString(); + qCWarning(generic) << "[ExportTemplateLoader] Network Error" << reply->errorString(); emit sigTemplateInstalled(exportTemplate, false); return; } @@ -242,7 +242,7 @@ void ExportTemplateLoader::onDownloadTemplateFinished() QBuffer buffer(&ba); if (!unpackTemplate(buffer, exportTemplate)) { - qDebug() << "[ExportTemplateLoader] Could not unpack template"; + qCDebug(generic) << "[ExportTemplateLoader] Could not unpack template"; emit sigTemplateInstalled(exportTemplate, false); return; } @@ -274,29 +274,29 @@ bool ExportTemplateLoader::unpackTemplate(QBuffer& buffer, ExportTemplate* expor mediaelch::DirectoryPath location = Settings::instance()->exportTemplatesDir(); QDir storageDir(location.dir()); if (!storageDir.exists() && !storageDir.mkpath(location.toString())) { - qWarning() << "[ExportTemplateLoader] Could not create storage location"; + qCWarning(generic) << "[ExportTemplateLoader] Could not create storage location"; return false; } storageDir.setPath(location.subDir(exportTemplate->identifier()).toString()); if ((exportTemplate->isInstalled() || storageDir.exists()) && !uninstallTemplate(exportTemplate)) { - qWarning() << "[ExportTemplateLoader] Could not uninstall template"; + qCWarning(generic) << "[ExportTemplateLoader] Could not uninstall template"; return false; } if (!storageDir.mkpath(storageDir.absolutePath())) { - qWarning() << "[ExportTemplateLoader] Could not create storage path"; + qCWarning(generic) << "[ExportTemplateLoader] Could not create storage path"; return false; } QuaZip zip(&buffer); if (!zip.open(QuaZip::mdUnzip)) { - qWarning() << "[ExportTemplateLoader] Zip file could not be opened"; + qCWarning(generic) << "[ExportTemplateLoader] Zip file could not be opened"; return false; } if (zip.getEntriesCount() == 0) { - qWarning() << "[ExportTemplateLoader] Zip file does not contain any entries!"; + qCWarning(generic) << "[ExportTemplateLoader] Zip file does not contain any entries!"; zip.close(); return false; } @@ -335,7 +335,7 @@ bool ExportTemplateLoader::unpackTemplate(QBuffer& buffer, ExportTemplate* expor } if (filename.endsWith("/")) { if (!storageDir.mkdir(filename)) { - qWarning() << "[ExportTemplateLoader] Could not create subdirectory"; + qCWarning(generic) << "[ExportTemplateLoader] Could not create subdirectory"; return false; } continue; @@ -351,7 +351,7 @@ bool ExportTemplateLoader::unpackTemplate(QBuffer& buffer, ExportTemplate* expor } } if (zip.getZipError() != UNZ_OK) { - qWarning() << "There was an error while uncompressing the file"; + qCWarning(generic) << "There was an error while uncompressing the file"; return false; } diff --git a/src/export/MediaExport.cpp b/src/export/MediaExport.cpp index 166bb25f4a..993f68e6dd 100644 --- a/src/export/MediaExport.cpp +++ b/src/export/MediaExport.cpp @@ -4,12 +4,12 @@ #include "data/StreamDetails.h" #include "export/SimpleEngine.h" #include "globals/Manager.h" +#include "log/Log.h" #include "movies/Movie.h" #include "tv_shows/TvShow.h" #include "tv_shows/TvShowEpisode.h" #include -#include #include namespace mediaelch { @@ -42,7 +42,7 @@ void MediaExport::doExport(ExportTemplate& exportTemplate, } return; } - qCritical() << "[MediaExport] Unknown template engine!"; + qCCritical(generic) << "[MediaExport] Unknown template engine!"; } } // namespace mediaelch diff --git a/src/export/SimpleEngine.cpp b/src/export/SimpleEngine.cpp index c3824dca2a..419cc89b08 100644 --- a/src/export/SimpleEngine.cpp +++ b/src/export/SimpleEngine.cpp @@ -532,7 +532,7 @@ void SimpleEngine::saveImage(QSize size, QString imageFile, QString destinationF QImage img(imageFile); if (img.isNull()) { - qWarning() << "[Export][SimpleEngine] Cannot load image:" << imageFile; + qCWarning(generic) << "[Export][SimpleEngine] Cannot load image:" << imageFile; return; } @@ -541,7 +541,7 @@ void SimpleEngine::saveImage(QSize size, QString imageFile, QString destinationF if (!img.isNull()) { img.save(destinationFile); } else { - qWarning() << "[Export][SimpleEngine] Could not scale (result was empty):" << imageFile; + qCWarning(generic) << "[Export][SimpleEngine] Could not scale (result was empty):" << imageFile; } } diff --git a/src/globals/ComboDelegate.cpp b/src/globals/ComboDelegate.cpp index f642f58557..eb46a151c4 100644 --- a/src/globals/ComboDelegate.cpp +++ b/src/globals/ComboDelegate.cpp @@ -1,11 +1,11 @@ #include "ComboDelegate.h" -#include -#include -#include - #include "globals/LocaleStringCompare.h" #include "globals/Manager.h" +#include "log/Log.h" + +#include +#include ComboDelegate::ComboDelegate(QObject* parent, MainWidgets widget, ComboDelegateType type) : QItemDelegate(parent), m_widget{widget}, m_type{type} diff --git a/src/globals/DownloadManager.cpp b/src/globals/DownloadManager.cpp index 4644427fed..0a1ff47093 100644 --- a/src/globals/DownloadManager.cpp +++ b/src/globals/DownloadManager.cpp @@ -1,16 +1,16 @@ #include "globals/DownloadManager.h" -#include -#include -#include - #include "globals/DownloadManagerElement.h" +#include "log/Log.h" #include "music/Album.h" #include "music/Artist.h" #include "network/NetworkReplyWatcher.h" #include "network/NetworkRequest.h" #include "tv_shows/TvShow.h" +#include +#include + static constexpr char PROP_DOWNLOAD_ELEMENT[] = "downloadElement"; DownloadManager::DownloadManager(QObject* parent) : QObject(parent) @@ -75,7 +75,7 @@ void DownloadManager::addDownload(DownloadManagerElement elem) // The mutexes have been removed but the code still needs to be refactored. // - qDebug() << "[DownloadManager] Enqueue download at pos " << downloadQueueSize() << "|" << elem.url; + qCDebug(generic) << "[DownloadManager] Enqueue download at pos " << downloadQueueSize() << "|" << elem.url; m_queue.enqueue(elem); @@ -167,7 +167,7 @@ void DownloadManager::startNextDownload() } } - qDebug() << "[DownloadManager] Start next download | Files left:" << m_queue.size(); + qCDebug(generic) << "[DownloadManager] Start next download | Files left:" << m_queue.size(); if (DownloadManager::isLocalFile(download.url)) { QFile file(download.url.toString()); @@ -205,7 +205,7 @@ void DownloadManager::downloadProgress(qint64 received, qint64 total) { auto* reply = dynamic_cast(QObject::sender()); if (reply == nullptr) { - qCritical() << "[DownloadManager] dynamic_cast failed for downloadProgress!"; + qCCritical(generic) << "[DownloadManager] dynamic_cast failed for downloadProgress!"; return; } @@ -222,14 +222,14 @@ void DownloadManager::restartDownloadAfterTimeout(QNetworkReply* reply) ++download.retries; reply->deleteLater(); - qWarning() << "[DownloadManager] Download timed out:" << download.url; + qCWarning(generic) << "[DownloadManager] Download timed out:" << download.url; if (download.retries < 3) { - qDebug() << "[DownloadManager] Re-enqueuing the download, tries:" << download.retries << "/ 3"; + qCDebug(generic) << "[DownloadManager] Re-enqueuing the download, tries:" << download.retries << "/ 3"; m_queue.prepend(download); } else { - qDebug() << "[DownloadManager] Giving up on this file, tried 3 times"; + qCDebug(generic) << "[DownloadManager] Giving up on this file, tried 3 times"; } // Should always be true because we're replacing the previous request @@ -243,13 +243,13 @@ void DownloadManager::downloadFinished() { auto* reply = dynamic_cast(QObject::sender()); if (reply == nullptr) { - qCritical() << "[DownloadManager] dynamic_cast failed for downloadFinished!"; + qCCritical(generic) << "[DownloadManager] dynamic_cast failed for downloadFinished!"; return; } bool wasRemoved = m_currentReplies.removeOne(reply); if (!wasRemoved) { - qCritical() << "[DownloadManager] downloadFinished() called for reply which wasn't tracked"; + qCCritical(generic) << "[DownloadManager] downloadFinished() called for reply which wasn't tracked"; } QByteArray data; @@ -258,7 +258,7 @@ void DownloadManager::downloadFinished() restartDownloadAfterTimeout(reply); // also deletes the reply return; } - qWarning() << "[DownloadManager] Network Error:" << reply->errorString() << "|" << reply->url(); + qCWarning(generic) << "[DownloadManager] Network Error:" << reply->errorString() << "|" << reply->url(); } else { data = reply->readAll(); @@ -315,7 +315,7 @@ int DownloadManager::downloadQueueSize() int DownloadManager::downloadsLeftForShow(TvShow* show) { if (show == nullptr) { - qCritical() << "[DownloadManager] Cannot count downloads left for nullptr show"; + qCCritical(generic) << "[DownloadManager] Cannot count downloads left for nullptr show"; return 0; } return numberOfDownloadsLeft(show); diff --git a/src/globals/ImageDialog.cpp b/src/globals/ImageDialog.cpp index be63880788..a9809c6564 100644 --- a/src/globals/ImageDialog.cpp +++ b/src/globals/ImageDialog.cpp @@ -5,6 +5,7 @@ #include "file/NameFormatter.h" #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "movies/Movie.h" #include "music/Album.h" #include "music/Artist.h" @@ -16,7 +17,6 @@ #include "ui/small_widgets/ImageLabel.h" #include -#include #include #include #include @@ -300,7 +300,7 @@ void ImageDialog::resizeAndReposition() void ImageDialog::startNextDownload() { - qDebug() << "[ImageDialog] Start next download"; + qCDebug(generic) << "[ImageDialog] Start next download"; int nextIndex = -1; for (int i = 0, n = m_elements.size(); i < n; i++) { @@ -344,8 +344,8 @@ void ImageDialog::downloadFinished() } else { showError(tr("Error while downloading one or more images: %1").arg(m_currentDownloadReply->errorString())); - qWarning() << "Network Error: " << m_currentDownloadReply->errorString() << " | " - << m_currentDownloadReply->url(); + qCWarning(generic) << "Network Error: " << m_currentDownloadReply->errorString() << " | " + << m_currentDownloadReply->url(); } // It is possible that m_elements has been cleared by aborting all downloads @@ -419,7 +419,7 @@ int ImageDialog::getColumnWidth() void ImageDialog::imageClicked(int row, int col) { if (ui->table->item(row, col) == nullptr) { - qDebug() << "[ImageDialog] Invalid item"; + qCDebug(generic) << "[ImageDialog] Invalid item"; return; } QUrl url = ui->table->item(row, col)->data(Qt::UserRole).toUrl(); @@ -518,7 +518,7 @@ void ImageDialog::chooseLocalImage() return; } - qWarning() << fileName; + qCWarning(generic) << fileName; QFileInfo fi(fileName); Settings::instance()->setLastImagePath(mediaelch::DirectoryPath(fi.absoluteDir().canonicalPath())); @@ -559,7 +559,7 @@ void ImageDialog::chooseLocalImage() */ void ImageDialog::onImageDropped(QUrl url) { - qDebug() << "[ImageDialog] Dropped Image with url:" << url; + qCDebug(generic) << "[ImageDialog] Dropped Image with url:" << url; const int index = m_elements.size(); @@ -929,7 +929,7 @@ void ImageDialog::onResultClicked(QTableWidgetItem* item) void ImageDialog::onProviderImagesLoaded(QVector images, mediaelch::ScraperError error) { if (error.hasError()) { - qDebug() << "Error while querying image provider:" << error.message; + qCDebug(generic) << "Error while querying image provider:" << error.message; showError(tr("Error while querying image provider: %1").arg(error.message)); } setAndStartDownloads(images); diff --git a/src/globals/ImagePreviewDialog.cpp b/src/globals/ImagePreviewDialog.cpp index bfcb0a01e0..3772cf7381 100644 --- a/src/globals/ImagePreviewDialog.cpp +++ b/src/globals/ImagePreviewDialog.cpp @@ -2,9 +2,9 @@ #include "ui_ImagePreviewDialog.h" #include "globals/Helper.h" +#include "log/Log.h" #include "ui/main/MainWindow.h" -#include #include ImagePreviewDialog::ImagePreviewDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ImagePreviewDialog) @@ -34,7 +34,7 @@ void ImagePreviewDialog::setImage(QPixmap img) int ImagePreviewDialog::exec() { - qDebug() << "[ImagePreviewDialog] Open image preview dialog"; + qCDebug(generic) << "[ImagePreviewDialog] Open image preview dialog"; ui->scrollArea->verticalScrollBar()->setValue(0); ui->scrollArea->horizontalScrollBar()->setValue(0); diff --git a/src/globals/ScraperManager.cpp b/src/globals/ScraperManager.cpp index 7b54f580cb..e0ebfb551d 100644 --- a/src/globals/ScraperManager.cpp +++ b/src/globals/ScraperManager.cpp @@ -1,5 +1,6 @@ #include "globals/ScraperManager.h" +#include "log/Log.h" #include "scrapers/ScraperInterface.h" #include "scrapers/concert/ConcertScraper.h" #include "scrapers/concert/tmdb/TmdbConcert.h" @@ -140,7 +141,7 @@ void ScraperManager::initTvScrapers() if (wasSuccessful) { qInfo() << "[TvScraper] Initialized:" << tv->meta().name; } else { - qWarning() << "[TvScraper] Initialization failed:" << tv->meta().name; + qCWarning(generic) << "[TvScraper] Initialization failed:" << tv->meta().name; } }); scraper->initialize(); diff --git a/src/globals/TrailerDialog.cpp b/src/globals/TrailerDialog.cpp index dd153a773f..a2869fc00e 100644 --- a/src/globals/TrailerDialog.cpp +++ b/src/globals/TrailerDialog.cpp @@ -125,7 +125,7 @@ void TrailerDialog::search() void TrailerDialog::searchIndex(int comboIndex) { if (comboIndex < 0 || comboIndex >= Manager::instance()->trailerProviders().size()) { - qWarning() << "[Trailer] Invalid Index, cannot start search."; + qCWarning(generic) << "[Trailer] Invalid Index, cannot start search."; return; } diff --git a/src/image/ImageCapture.cpp b/src/image/ImageCapture.cpp index 07a48e538b..67c0fc18a1 100644 --- a/src/image/ImageCapture.cpp +++ b/src/image/ImageCapture.cpp @@ -2,10 +2,10 @@ #include "globals/Random.h" #include "globals/Time.h" +#include "log/Log.h" #include "ui/notifications/NotificationBox.h" #include -#include #include #include diff --git a/src/image/ImageModel.cpp b/src/image/ImageModel.cpp index 587281c915..029ebb31f4 100644 --- a/src/image/ImageModel.cpp +++ b/src/image/ImageModel.cpp @@ -1,13 +1,13 @@ #include "ImageModel.h" +#include "log/Log.h" +#include "settings/Settings.h" + #include -#include #include #include #include -#include "settings/Settings.h" - ImageModel::ImageModel(QObject* parent) : QAbstractListModel(parent), m_hasChanged{false} { } diff --git a/src/imports/Extractor.cpp b/src/imports/Extractor.cpp index 171a24d920..0d5431a71d 100644 --- a/src/imports/Extractor.cpp +++ b/src/imports/Extractor.cpp @@ -1,8 +1,8 @@ #include "imports/Extractor.h" +#include "log/Log.h" #include "settings/Settings.h" -#include #include #include #include @@ -82,7 +82,7 @@ void Extractor::onReadyReadError() { auto* process = dynamic_cast(QObject::sender()); QString msg = process->readAllStandardError(); - qDebug() << "ERROR" << msg; + qCDebug(generic) << "ERROR" << msg; process->setProperty("hasError", true); process->kill(); emit sigError(process->property("baseName").toString(), msg); diff --git a/src/imports/FileWorker.cpp b/src/imports/FileWorker.cpp index 22ea790db5..a235642deb 100644 --- a/src/imports/FileWorker.cpp +++ b/src/imports/FileWorker.cpp @@ -1,6 +1,7 @@ #include "FileWorker.h" -#include +#include "log/Log.h" + #include FileWorker::FileWorker(QObject* parent) : QObject(parent) diff --git a/src/imports/MakeMkvCon.cpp b/src/imports/MakeMkvCon.cpp index 532cf3aa3a..c9e28e908c 100644 --- a/src/imports/MakeMkvCon.cpp +++ b/src/imports/MakeMkvCon.cpp @@ -114,7 +114,7 @@ void MakeMkvCon::onReadyRead() void MakeMkvCon::onReadyReadError() { auto* process = dynamic_cast(QObject::sender()); - qWarning() << process->readAllStandardError(); + qCWarning(generic) << process->readAllStandardError(); } void MakeMkvCon::onFinished(int exitCode, QProcess::ExitStatus status) diff --git a/src/imports/MyFile.cpp b/src/imports/MyFile.cpp index 479880b06c..8666c1cd08 100644 --- a/src/imports/MyFile.cpp +++ b/src/imports/MyFile.cpp @@ -1,6 +1,7 @@ #include "MyFile.h" -#include +#include "log/Log.h" + #include MyFile::MyFile(const QString& name) : QFile(name) @@ -10,7 +11,7 @@ MyFile::MyFile(const QString& name) : QFile(name) bool MyFile::copy(const QString& newName) { if (fileName().isEmpty()) { - qWarning() << "QFile::copy: Empty or null file name"; + qCWarning(generic) << "QFile::copy: Empty or null file name"; return false; } if (QFile(newName).exists()) { diff --git a/src/log/Log.cpp b/src/log/Log.cpp index e364b71205..2c1070633d 100644 --- a/src/log/Log.cpp +++ b/src/log/Log.cpp @@ -4,6 +4,9 @@ #include +Q_LOGGING_CATEGORY(generic, "generic") + + static QFile data; #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) diff --git a/src/log/Log.h b/src/log/Log.h index a3bb89c11a..e213232661 100644 --- a/src/log/Log.h +++ b/src/log/Log.h @@ -1,6 +1,12 @@ #pragma once #include +#include + +// There is currently only one logging category. +// We plan on adding more put to make the switch from qCDebug(generic) to qCDebug() easier, +// we create a common category that can be used by all modules. +Q_DECLARE_LOGGING_CATEGORY(generic) namespace mediaelch { diff --git a/src/main.cpp b/src/main.cpp index aae577e710..c7fada09ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ static void loadStylesheet(QApplication& app, const QString& customStylesheet) file.close(); } else { - qCritical() << "The stylesheet could not be openend for reading:" << filename; + qCCritical(generic) << "The stylesheet could not be openend for reading:" << filename; const QString heading = QObject::tr("Stylesheet could not be opened!"); const QString body = customStylesheet.isEmpty() ? QObject::tr("The default stylesheet could not be openend for reading.") @@ -84,7 +84,7 @@ static void installTranslations(const QLocale& locale) if (i18nLoaded) { QApplication::installTranslator(&mediaelchTranslator); } else { - qWarning() << "Could NOT find MediaElch's translations for " << locale; + qCWarning(generic) << "Could NOT find MediaElch's translations for " << locale; } } diff --git a/src/media_centers/KodiXml.cpp b/src/media_centers/KodiXml.cpp index dedb51e177..b0f847cb38 100644 --- a/src/media_centers/KodiXml.cpp +++ b/src/media_centers/KodiXml.cpp @@ -4,6 +4,7 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "image/Image.h" +#include "log/Log.h" #include "media_centers/kodi/AlbumXmlReader.h" #include "media_centers/kodi/AlbumXmlWriter.h" #include "media_centers/kodi/ArtistXmlReader.h" @@ -23,7 +24,6 @@ #include #include -#include #include #include #include @@ -60,11 +60,11 @@ QByteArray KodiXml::getMovieXml(Movie* movie) /// \see KodiXml::writeMovieXml bool KodiXml::saveMovie(Movie* movie) { - qDebug() << "Save movie as Kodi NFO file; movie: " << movie->name(); + qCDebug(generic) << "Save movie as Kodi NFO file; movie: " << movie->name(); QByteArray xmlContent = getMovieXml(movie); if (movie->files().isEmpty()) { - qWarning() << "Movie has no files"; + qCWarning(generic) << "Movie has no files"; return false; } @@ -80,9 +80,9 @@ bool KodiXml::saveMovie(Movie* movie) saveFileDir.mkpath("."); } QFile file(saveFilePath); - qDebug() << "Saving to" << file.fileName(); + qCDebug(generic) << "Saving to" << file.fileName(); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "File could not be openend"; + qCWarning(generic) << "File could not be openend"; } else { file.write(xmlContent); file.close(); @@ -173,8 +173,8 @@ bool KodiXml::saveMovie(Movie* movie) if (f.rename(fi.absolutePath() + "/" + newFileName)) { newFiles << newFileName; } else { - qWarning() << "Could not rename" << subFi.absoluteFilePath() << "to" - << fi.absolutePath() + "/" + newFileName; + qCWarning(generic) << "Could not rename" << subFi.absoluteFilePath() << "to" + << fi.absolutePath() + "/" + newFileName; newFiles << subFi.fileName(); } } @@ -196,12 +196,12 @@ QString KodiXml::nfoFilePath(Movie* movie) { QString nfoFile; if (movie->files().isEmpty()) { - qWarning() << "Movie has no files"; + qCWarning(generic) << "Movie has no files"; return nfoFile; } QFileInfo fi(movie->files().first().toString()); if (!fi.isFile()) { - qWarning() << "First file of the movie is not readable" << movie->files().at(0); + qCWarning(generic) << "First file of the movie is not readable" << movie->files().at(0); return nfoFile; } @@ -221,12 +221,12 @@ QString KodiXml::nfoFilePath(TvShowEpisode* episode) { QString nfoFile; if (episode->files().isEmpty()) { - qWarning() << "[KodiXml] Episode has no files"; + qCWarning(generic) << "[KodiXml] Episode has no files"; return nfoFile; } QFileInfo fi(episode->files().first().toString()); if (!fi.isFile()) { - qWarning() << "[KodiXml] First file of the episode is not readable" << episode->files().first(); + qCWarning(generic) << "[KodiXml] First file of the episode is not readable" << episode->files().first(); return nfoFile; } @@ -246,7 +246,7 @@ QString KodiXml::nfoFilePath(TvShow* show) { QString nfoFile; if (!show->dir().isValid()) { - qWarning() << "[KodiXml] Show dir is empty"; + qCWarning(generic) << "[KodiXml] Show dir is empty"; return nfoFile; } @@ -270,12 +270,12 @@ QString KodiXml::nfoFilePath(Concert* concert) { QString nfoFile; if (concert->files().isEmpty()) { - qWarning() << "[KodiXml] Concert has no files"; + qCWarning(generic) << "[KodiXml] Concert has no files"; return nfoFile; } QFileInfo fi(concert->files().first().toString()); if (!fi.isFile()) { - qWarning() << "[KodiXml] First file of the concert is not readable" << concert->files().at(0); + qCWarning(generic) << "[KodiXml] First file of the concert is not readable" << concert->files().at(0); return nfoFile; } @@ -310,7 +310,7 @@ bool KodiXml::loadMovie(Movie* movie, QString initialNfoContent) QFile file(nfoFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File" << nfoFile << "could not be opened for reading"; + qCWarning(generic) << "[KodiXml] File" << nfoFile << "could not be opened for reading"; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -544,7 +544,7 @@ bool KodiXml::saveConcert(Concert* concert) QByteArray xmlContent = getConcertXml(concert); if (concert->files().isEmpty()) { - qWarning() << "[KodiXml] Concert has no files"; + qCWarning(generic) << "[KodiXml] Concert has no files"; return false; } @@ -562,9 +562,9 @@ bool KodiXml::saveConcert(Concert* concert) saveFileDir.mkpath("."); } QFile file(saveFilePath); - qDebug() << "[KodiXml] Saving to" << file.fileName(); + qCDebug(generic) << "[KodiXml] Saving to" << file.fileName(); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File could not be openend"; + qCWarning(generic) << "[KodiXml] File could not be openend"; } else { file.write(xmlContent); file.close(); @@ -648,7 +648,7 @@ bool KodiXml::loadConcert(Concert* concert, QString initialNfoContent) QFile file(nfoFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File" << nfoFile << "could not be opened for reading"; + qCWarning(generic) << "[KodiXml] File" << nfoFile << "could not be opened for reading"; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -663,7 +663,7 @@ bool KodiXml::loadConcert(Concert* concert, QString initialNfoContent) mediaelch::kodi::ConcertXmlReader concertReader(*concert); concertReader.parse(reader); if (reader.hasError()) { - qCritical() << "[KodiXml] Error parsing NFO file" << reader.errorString(); + qCCritical(generic) << "[KodiXml] Error parsing NFO file" << reader.errorString(); } } @@ -744,7 +744,7 @@ bool KodiXml::loadTvShow(TvShow* show, QString initialNfoContent) } QFile file(nfoFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] NFO file could not be opened for reading" << nfoFile; + qCWarning(generic) << "[KodiXml] NFO file could not be opened for reading" << nfoFile; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -771,7 +771,7 @@ bool KodiXml::loadTvShow(TvShow* show, QString initialNfoContent) bool KodiXml::loadTvShowEpisode(TvShowEpisode* episode, QString initialNfoContent) { if (episode == nullptr) { - qWarning() << "[KodiXml] Passed an empty (null) episode to loadTvShowEpisode"; + qCWarning(generic) << "[KodiXml] Passed an empty (null) episode to loadTvShowEpisode"; return false; } episode->clear(); @@ -786,7 +786,7 @@ bool KodiXml::loadTvShowEpisode(TvShowEpisode* episode, QString initialNfoConten QFile file(nfoFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File" << nfoFile << "could not be opened for reading"; + qCWarning(generic) << "[KodiXml] File" << nfoFile << "could not be opened for reading"; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -866,7 +866,7 @@ bool KodiXml::saveTvShow(TvShow* show) } QFile file(saveFilePath); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] NFO file could not be openend for writing" << file.fileName(); + qCWarning(generic) << "[KodiXml] NFO file could not be openend for writing" << file.fileName(); return false; } file.write(xmlContent); @@ -957,7 +957,7 @@ bool KodiXml::saveTvShowEpisode(TvShowEpisode* episode) } if (episode->files().isEmpty()) { - qWarning() << "[KodiXml] Episode has no files"; + qCWarning(generic) << "[KodiXml] Episode has no files"; return false; } @@ -980,7 +980,7 @@ bool KodiXml::saveTvShowEpisode(TvShowEpisode* episode) } QFile file(saveFilePath); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] NFO file could not be opened for writing" << saveFileName; + qCWarning(generic) << "[KodiXml] NFO file could not be opened for writing" << saveFileName; return false; } file.write(xmlContent); @@ -1270,7 +1270,7 @@ QString KodiXml::imageFileName(const Movie* movie, ImageType type, QVectorfiles().isEmpty()) { - qWarning() << "Movie has no files"; + qCWarning(generic) << "Movie has no files"; return ""; } @@ -1313,7 +1313,7 @@ QString KodiXml::imageFileName(const Concert* concert, ImageType type, QVectorfiles().isEmpty()) { - qWarning() << "[KodiXml] Concert has no files"; + qCWarning(generic) << "[KodiXml] Concert has no files"; return ""; } @@ -1451,7 +1451,7 @@ bool KodiXml::loadArtist(Artist* artist, QString initialNfoContent) return false; } if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File" << nfoFile << "could not be opened for reading"; + qCWarning(generic) << "[KodiXml] File" << nfoFile << "could not be opened for reading"; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -1490,7 +1490,7 @@ bool KodiXml::loadAlbum(Album* album, QString initialNfoContent) return false; } if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File" << nfoFile << "could not be opened for reading"; + qCWarning(generic) << "[KodiXml] File" << nfoFile << "could not be opened for reading"; return false; } nfoContent = QString::fromUtf8(file.readAll()); @@ -1591,7 +1591,7 @@ bool KodiXml::saveArtist(Artist* artist) { QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File could not be openend"; + qCWarning(generic) << "[KodiXml] File could not be openend"; return false; } file.write(xmlContent); @@ -1657,7 +1657,7 @@ bool KodiXml::saveAlbum(Album* album) } QFile nfo(nfoFileName); if (!nfo.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "[KodiXml] File could not be openend"; + qCWarning(generic) << "[KodiXml] File could not be openend"; return false; } nfo.write(xmlContent); diff --git a/src/media_centers/kodi/EpisodeXmlReader.cpp b/src/media_centers/kodi/EpisodeXmlReader.cpp index 43c0d618c5..3625253f6e 100644 --- a/src/media_centers/kodi/EpisodeXmlReader.cpp +++ b/src/media_centers/kodi/EpisodeXmlReader.cpp @@ -1,6 +1,7 @@ #include "EpisodeXmlReader.h" #include "globals/Globals.h" +#include "log/Log.h" #include "tv_shows/TvShowEpisode.h" #include @@ -52,7 +53,7 @@ void EpisodeXmlReader::parseNfoDom(QDomElement episodeDetails) } else if (type == "tvmaze") { m_episode.setTvMazeId(TvMazeId(value)); } else { - qWarning() << "[EpisodeXmlReader] Unsupported unique id type:" << type; + qCWarning(generic) << "[EpisodeXmlReader] Unsupported unique id type:" << type; } } diff --git a/src/media_centers/kodi/MovieXmlReader.cpp b/src/media_centers/kodi/MovieXmlReader.cpp index 4865749aa0..8324f4253d 100644 --- a/src/media_centers/kodi/MovieXmlReader.cpp +++ b/src/media_centers/kodi/MovieXmlReader.cpp @@ -1,5 +1,6 @@ #include "media_centers/kodi/MovieXmlReader.h" +#include "log/Log.h" #include "media_centers/kodi/KodiXmlWriter.h" #include "movies/Movie.h" @@ -27,7 +28,7 @@ MovieXmlReader::MovieXmlReader(Movie& movie) : m_movie{movie} void MovieXmlReader::parseNfoDom(QDomDocument domDoc) { if (domDoc.elementsByTagName("movie").isEmpty()) { - qWarning() << "[MovieXmlReader] No tag in the document"; + qCWarning(generic) << "[MovieXmlReader] No tag in the document"; return; } QDomElement movieElement = domDoc.elementsByTagName("movie").at(0).toElement(); diff --git a/src/media_centers/kodi/TvShowXmlReader.cpp b/src/media_centers/kodi/TvShowXmlReader.cpp index f1566ed07b..b0e00a9cea 100644 --- a/src/media_centers/kodi/TvShowXmlReader.cpp +++ b/src/media_centers/kodi/TvShowXmlReader.cpp @@ -1,6 +1,7 @@ #include "TvShowXmlReader.h" #include "globals/Poster.h" +#include "log/Log.h" #include "tv_shows/TvShow.h" #include @@ -50,7 +51,7 @@ void TvShowXmlReader::parseNfoDom(QDomDocument domDoc) } else if (type == "tvmaze") { m_show.setTvMazeId(TvMazeId(value)); } else if (type != "mediaelch_fallback") { - qWarning() << "[TvShowXmlReader] Unsupported unique id type:" << type; + qCWarning(generic) << "[TvShowXmlReader] Unsupported unique id type:" << type; } } if (!domDoc.elementsByTagName("title").isEmpty()) { diff --git a/src/movies/Movie.cpp b/src/movies/Movie.cpp index 6b6248de23..aa33002088 100644 --- a/src/movies/Movie.cpp +++ b/src/movies/Movie.cpp @@ -1,13 +1,13 @@ #include "Movie.h" #include -#include #include #include #include #include "data/ImageCache.h" #include "globals/Helper.h" +#include "log/Log.h" #include "media_centers/MediaCenterInterface.h" #include "settings/Settings.h" diff --git a/src/movies/MovieController.cpp b/src/movies/MovieController.cpp index fa446e625f..2a4142b0e2 100644 --- a/src/movies/MovieController.cpp +++ b/src/movies/MovieController.cpp @@ -52,7 +52,7 @@ bool MovieController::saveData(MediaCenterInterface* mediaCenterInterface) } bool saved = mediaCenterInterface->saveMovie(m_movie); - qDebug() << "[MovieController] Saved movie? =>" << saved; + qCDebug(generic) << "[MovieController] Saved movie? =>" << saved; if (!m_infoLoaded) { m_infoLoaded = saved; } diff --git a/src/movies/MovieFilesOrganizer.cpp b/src/movies/MovieFilesOrganizer.cpp index 8ee33a4784..d4727a8e30 100644 --- a/src/movies/MovieFilesOrganizer.cpp +++ b/src/movies/MovieFilesOrganizer.cpp @@ -1,10 +1,10 @@ #include "MovieFilesOrganizer.h" #include "file/NameFormatter.h" +#include "log/Log.h" #include "movies/file_searcher/MovieFileSearcher.h" #include "settings/Settings.h" #include -#include #include #include @@ -39,7 +39,7 @@ void MovieFilesOrganizer::moveToDirs(mediaelch::DirectoryPath dir) for (const QStringList& movie : contents) { const int movieIndex = movie.at(0).lastIndexOf(QDir::separator()); if (!(movie.at(0).left(movieIndex).endsWith(dirName))) { - qDebug() << "[MovieFilesOrganizer] skipping " << movie.at(0); + qCDebug(generic) << "[MovieFilesOrganizer] skipping " << movie.at(0); continue; } @@ -64,7 +64,7 @@ void MovieFilesOrganizer::moveToDirs(mediaelch::DirectoryPath dir) if (!dir2.rename(file, newFolder + QDir::separator() + file.right(file.length() - file.lastIndexOf(QDir::separator()) - 1))) { - qWarning() << "Moving " << file << "to " << newFolder << " failed."; + qCWarning(generic) << "Moving " << file << "to " << newFolder << " failed."; } } } diff --git a/src/movies/MovieProxyModel.cpp b/src/movies/MovieProxyModel.cpp index 1ecdd25338..836a071b17 100644 --- a/src/movies/MovieProxyModel.cpp +++ b/src/movies/MovieProxyModel.cpp @@ -1,6 +1,6 @@ #include "MovieProxyModel.h" -#include +#include "log/Log.h" #include "globals/Filter.h" #include "globals/Globals.h" diff --git a/src/movies/file_searcher/MovieDirectorySearcher.cpp b/src/movies/file_searcher/MovieDirectorySearcher.cpp index e17644324a..dca7c5cb9b 100644 --- a/src/movies/file_searcher/MovieDirectorySearcher.cpp +++ b/src/movies/file_searcher/MovieDirectorySearcher.cpp @@ -30,13 +30,13 @@ void MovieDirectorySearcher::load() return; } - qDebug() << "[MovieDirectorySearcher] Scanning directory:" << QDir::toNativeSeparators(m_dir.path.path()); + qCDebug(generic) << "[MovieDirectorySearcher] Scanning directory:" << QDir::toNativeSeparators(m_dir.path.path()); loadMovieContents(); const int approximateMovieCount = m_inSeparateFolders ? m_contents.size() : 0; emit startLoading(approximateMovieCount); - qDebug() << "[MovieDirectorySearcher] Creating movies for" << QDir::toNativeSeparators(m_dir.path.path()); + qCDebug(generic) << "[MovieDirectorySearcher] Creating movies for" << QDir::toNativeSeparators(m_dir.path.path()); createMovies(); } @@ -129,7 +129,7 @@ void MovieDirectorySearcher::loadMovieContents() } if (isFile && QString::compare("index.bdmv", fileName, Qt::CaseInsensitive) == 0) { - qDebug() << "[MovieDirectorySearcher] Found BluRay structure"; + qCDebug(generic) << "[MovieDirectorySearcher] Found BluRay structure"; QDir bluRayDir(it.fileInfo().dir()); if (QString::compare(bluRayDir.dirName(), "BDMV", Qt::CaseInsensitive) == 0) { bluRayDir.cdUp(); @@ -138,7 +138,7 @@ void MovieDirectorySearcher::loadMovieContents() isSpecialDir = true; } if (QString::compare("VIDEO_TS.IFO", fileName, Qt::CaseInsensitive) == 0) { - qDebug() << "[MovieDirectorySearcher] Found DVD structure"; + qCDebug(generic) << "[MovieDirectorySearcher] Found DVD structure"; QDir videoDir(it.fileInfo().dir()); if (QString::compare(videoDir.dirName(), "VIDEO_TS", Qt::CaseInsensitive) == 0) { videoDir.cdUp(); @@ -197,7 +197,7 @@ QVector MovieDirectorySearcher::createMovie(QStringList files) } files = f; discType = DiscType::BluRay; - qDebug() << "It's a BluRay structure"; + qCDebug(generic) << "It's a BluRay structure"; } } @@ -212,7 +212,7 @@ QVector MovieDirectorySearcher::createMovie(QStringList files) } files = f; discType = DiscType::Dvd; - qDebug() << "It's a DVD structure"; + qCDebug(generic) << "It's a DVD structure"; } } diff --git a/src/movies/file_searcher/MovieFileSearcher.cpp b/src/movies/file_searcher/MovieFileSearcher.cpp index f7f49eae41..bd2ee6157c 100644 --- a/src/movies/file_searcher/MovieFileSearcher.cpp +++ b/src/movies/file_searcher/MovieFileSearcher.cpp @@ -5,9 +5,9 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "globals/MessageIds.h" +#include "log/Log.h" #include -#include #include #include #include @@ -19,7 +19,7 @@ MovieFileSearcher::MovieFileSearcher(QObject* parent) : QObject(parent), m_abort { connect(this, &MovieFileSearcher::searchStarted, this, [this]() { m_reloadTimer.start(); }); connect(this, &MovieFileSearcher::moviesLoaded, this, [this]() { - qDebug() << "[MovieFileSearcher] Reloading took" << m_reloadTimer.elapsed() << "ms"; + qCDebug(generic) << "[MovieFileSearcher] Reloading took" << m_reloadTimer.elapsed() << "ms"; m_reloadTimer.invalidate(); }); } @@ -35,16 +35,16 @@ void MovieFileSearcher::setMovieDirectories(const QVector& director m_directories.clear(); for (const auto& dir : directories) { if (Settings::instance()->advanced()->isFolderExcluded(dir.path.dirName())) { - qWarning() << "[MovieFileSearcher] Movie directory is excluded by advanced settings:" << dir.path; + qCWarning(generic) << "[MovieFileSearcher] Movie directory is excluded by advanced settings:" << dir.path; continue; } if (!dir.path.isReadable()) { - qDebug() << "[MovieFileSearcher] Movie directory is not readable, skipping:" << dir.path.path(); + qCDebug(generic) << "[MovieFileSearcher] Movie directory is not readable, skipping:" << dir.path.path(); continue; } - qDebug() << "[MovieFileSearcher] Adding movie directory" << dir.path.path(); + qCDebug(generic) << "[MovieFileSearcher] Adding movie directory" << dir.path.path(); m_directories.append(dir); } } @@ -52,7 +52,7 @@ void MovieFileSearcher::setMovieDirectories(const QVector& director void MovieFileSearcher::reload(bool force) { if (m_running) { - qCritical() << "[MovieFileSearcher] Search already in progress"; + qCCritical(generic) << "[MovieFileSearcher] Search already in progress"; return; } @@ -119,7 +119,8 @@ void MovieFileSearcher::reload(bool force) void MovieFileSearcher::onDirectoryLoaded(MovieDirectorySearcher* searcher) { ++m_directoriesProcessed; - qDebug() << "[MovieFileSearcher] Directory loaded:" << QDir::toNativeSeparators(searcher->directory().path.path()); + qCDebug(generic) << "[MovieFileSearcher] Directory loaded:" + << QDir::toNativeSeparators(searcher->directory().path.path()); if (m_aborted) { return; diff --git a/src/music/ArtistController.cpp b/src/music/ArtistController.cpp index 078d08edae..d43ee2170f 100644 --- a/src/music/ArtistController.cpp +++ b/src/music/ArtistController.cpp @@ -4,12 +4,12 @@ #include "globals/DownloadManager.h" #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "media_centers/MediaCenterInterface.h" #include "music/Artist.h" #include "scrapers/image/FanartTvMusic.h" #include "scrapers/music/MusicScraper.h" -#include #include ArtistController::ArtistController(Artist* parent) : diff --git a/src/music/MusicFileSearcher.cpp b/src/music/MusicFileSearcher.cpp index b7b3678518..eebba15c83 100644 --- a/src/music/MusicFileSearcher.cpp +++ b/src/music/MusicFileSearcher.cpp @@ -1,15 +1,15 @@ #include "MusicFileSearcher.h" -#include -#include -#include -#include - #include "globals/Manager.h" #include "globals/MessageIds.h" +#include "log/Log.h" #include "music/Album.h" #include "music/Artist.h" +#include +#include +#include + MusicFileSearcher::MusicFileSearcher(QObject* parent) : QObject(parent), m_progressMessageId{Constants::MusicFileSearcherProgressMessageId}, m_aborted{false} { @@ -20,18 +20,18 @@ void MusicFileSearcher::setMusicDirectories(QVector directories) m_directories.clear(); for (const SettingsDir& dir : directories) { if (Settings::instance()->advanced()->isFolderExcluded(dir.path.dirName())) { - qWarning() << "[MusicFileSearcher] Music directory is excluded by advanced settings! " - "Is this intended? Directory:" - << dir.path.path(); + qCWarning(generic) << "[MusicFileSearcher] Music directory is excluded by advanced settings! " + "Is this intended? Directory:" + << dir.path.path(); continue; } if (!dir.path.isReadable()) { - qDebug() << "[MusicFileSearcher] Music directory is not redable, skipping:" << dir.path.path(); + qCDebug(generic) << "[MusicFileSearcher] Music directory is not redable, skipping:" << dir.path.path(); continue; } - qDebug() << "[MusicFileSearcher] Adding music directory" << dir.path.path(); + qCDebug(generic) << "[MusicFileSearcher] Adding music directory" << dir.path.path(); m_directories.append(dir); } } @@ -169,7 +169,7 @@ void MusicFileSearcher::reload(bool force) for (Album* album : albums) { MusicModelItem* artistItem = artistModelItems.value(album->artistObj(), nullptr); if (artistItem == nullptr) { - qWarning() << "Artist item was not found for album" << album->path(); + qCWarning(generic) << "Artist item was not found for album" << album->path(); continue; } artistItem->appendChild(album); diff --git a/src/network/NetworkReplyWatcher.cpp b/src/network/NetworkReplyWatcher.cpp index 696080fea4..d636589dc8 100644 --- a/src/network/NetworkReplyWatcher.cpp +++ b/src/network/NetworkReplyWatcher.cpp @@ -1,6 +1,6 @@ #include "network/NetworkReplyWatcher.h" -#include +#include "log/Log.h" constexpr char NetworkReplyWatcher::TIMEOUT_PROP[]; diff --git a/src/qml/AlbumImageProvider.cpp b/src/qml/AlbumImageProvider.cpp index fa74cc9781..0f41cd51e2 100644 --- a/src/qml/AlbumImageProvider.cpp +++ b/src/qml/AlbumImageProvider.cpp @@ -1,6 +1,6 @@ #include "AlbumImageProvider.h" -#include +#include "log/Log.h" #include "globals/Manager.h" diff --git a/src/renamer/Renamer.cpp b/src/renamer/Renamer.cpp index 0e06f764e4..576f5fe872 100644 --- a/src/renamer/Renamer.cpp +++ b/src/renamer/Renamer.cpp @@ -32,7 +32,7 @@ QString Renamer::typeToString(Renamer::RenameType type) case Renamer::RenameType::Concerts: return "Concerts"; case Renamer::RenameType::TvShows: return "TvShows"; } - qWarning() << "Unknown RenamerType"; + qCWarning(generic) << "Unknown RenamerType"; return "unknown"; } diff --git a/src/renamer/RenamerDialog.cpp b/src/renamer/RenamerDialog.cpp index 31dabb4753..6418a0f169 100644 --- a/src/renamer/RenamerDialog.cpp +++ b/src/renamer/RenamerDialog.cpp @@ -52,14 +52,14 @@ int RenamerDialog::exec() const QString infoLabel = [&]() { switch (m_renameType) { - case Renamer::RenameType::All: qWarning() << "Unknown Rename Type All"; return QString(""); + case Renamer::RenameType::All: qCWarning(generic) << "Unknown Rename Type All"; return QString(""); case Renamer::RenameType::Concerts: return tr("%n concerts will be renamed", "", m_concerts.count()); case Renamer::RenameType::Movies: return tr("%n movies will be renamed", "", m_movies.count()); case Renamer::RenameType::TvShows: return tr("%n TV shows and %1", "", m_shows.count()) .arg(tr("%n episodes will be renamed", "", m_episodes.count())); } - qCritical() << "[RenamerDialog] RenamerType: Missing case."; + qCCritical(generic) << "[RenamerDialog] RenamerType: Missing case."; return QString(""); }(); ui->infoLabel->setText(infoLabel); @@ -358,7 +358,7 @@ int RenamerDialog::addResultToTable(const QString& oldFileName, case Renamer::RenameOperation::Move: return tr("Move"); case Renamer::RenameOperation::Rename: return tr("Rename"); } - qCritical() << "[RenamerDialog] RenameOperation: Missing case."; + qCCritical(generic) << "[RenamerDialog] RenameOperation: Missing case."; return QString(""); }(); diff --git a/src/scrapers/concert/tmdb/TmdbConcert.cpp b/src/scrapers/concert/tmdb/TmdbConcert.cpp index 5ec4c0af61..58b36dd45a 100644 --- a/src/scrapers/concert/tmdb/TmdbConcert.cpp +++ b/src/scrapers/concert/tmdb/TmdbConcert.cpp @@ -2,11 +2,11 @@ #include "globals/Globals.h" #include "globals/Helper.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/concert/tmdb/TmdbConcertSearchJob.h" #include "ui/main/MainWindow.h" -#include #include #include #include @@ -292,13 +292,13 @@ void TmdbConcert::setupFinished() const auto parsedJson = QJsonDocument::fromJson(reply->readAll(), &parseError).object(); reply->deleteLater(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing TMDb setup json " << parseError.errorString(); + qCWarning(generic) << "Error parsing TMDb setup json " << parseError.errorString(); return; } const auto imagesObject = parsedJson.value("images").toObject(); m_baseUrl = imagesObject.value("base_url").toString(); - qDebug() << "TMDb base url:" << m_baseUrl; + qCDebug(generic) << "TMDb base url:" << m_baseUrl; } /** @@ -314,7 +314,7 @@ void TmdbConcert::setupFinished() */ void TmdbConcert::loadData(TmdbId id, Concert* concert, QSet infos) { - qDebug() << "Entered, id=" << id << "concert=" << concert->title(); + qCDebug(generic) << "Entered, id=" << id << "concert=" << concert->title(); concert->setTmdbId(id); concert->clear(infos); @@ -388,7 +388,7 @@ void TmdbConcert::loadFinished() QString msg = QString::fromUtf8(reply->readAll()); parseAndAssignInfos(msg, concert, infos); } else { - qWarning() << "Network Error (load)" << reply->errorString(); + qCWarning(generic) << "Network Error (load)" << reply->errorString(); } concert->controller()->removeFromLoadsLeft(ScraperData::Infos); } @@ -411,7 +411,7 @@ void TmdbConcert::loadTrailersFinished() QString msg = QString::fromUtf8(reply->readAll()); parseAndAssignInfos(msg, concert, infos); } else { - qDebug() << "Network Error (trailers)" << reply->errorString(); + qCDebug(generic) << "Network Error (trailers)" << reply->errorString(); } concert->controller()->removeFromLoadsLeft(ScraperData::Trailers); } @@ -434,7 +434,7 @@ void TmdbConcert::loadImagesFinished() QString msg = QString::fromUtf8(reply->readAll()); parseAndAssignInfos(msg, concert, infos); } else { - qWarning() << "Network Error (images)" << reply->errorString(); + qCWarning(generic) << "Network Error (images)" << reply->errorString(); } concert->controller()->removeFromLoadsLeft(ScraperData::Images); } @@ -457,7 +457,7 @@ void TmdbConcert::loadReleasesFinished() QString msg = QString::fromUtf8(reply->readAll()); parseAndAssignInfos(msg, concert, infos); } else { - qWarning() << "Network Error (releases)" << reply->errorString(); + qCWarning(generic) << "Network Error (releases)" << reply->errorString(); } concert->controller()->removeFromLoadsLeft(ScraperData::Releases); } @@ -474,7 +474,7 @@ void TmdbConcert::parseAndAssignInfos(QString json, Concert* concert, QSet #include #include #include @@ -10,6 +9,7 @@ #include "data/Storage.h" #include "globals/Manager.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/movie/tmdb/TmdbMovie.h" #include "scrapers/tv_show/thetvdb/TheTvDb.h" @@ -305,7 +305,7 @@ void FanartTv::loadMovieData(TmdbId tmdbId, ImageType type) QUrl url = QStringLiteral("https://webservice.fanart.tv/v3/movies/%1?%2").arg(tmdbId.toString(), keyParameter()); QNetworkRequest request = mediaelch::network::jsonRequestWithDefaults(url); - qDebug() << "[FanartTv] Load movie data:" << url; + qCDebug(generic) << "[FanartTv] Load movie data:" << url; QNetworkReply* reply = network()->get(request); reply->setProperty("infoToLoad", static_cast(type)); @@ -317,8 +317,8 @@ void FanartTv::loadMovieData(TmdbId tmdbId, QVector types, Movie* mov QUrl url = QStringLiteral("https://webservice.fanart.tv/v3/movies/%1?%2").arg(tmdbId.toString(), keyParameter()); QNetworkRequest request = mediaelch::network::jsonRequestWithDefaults(url); - qDebug() << "[FanartTv] Load movie data with image types:" - << url.toString(QUrl::RemoveQuery); // query not relevant as it only contains the API key + qCDebug(generic) << "[FanartTv] Load movie data with image types:" + << url.toString(QUrl::RemoveQuery); // query not relevant as it only contains the API key QNetworkReply* reply = network()->get(request); reply->setProperty("storage", Storage::toVariant(reply, movie)); @@ -331,7 +331,7 @@ void FanartTv::loadConcertData(TmdbId tmdbId, QVector types, Concert* QUrl url = QStringLiteral("https://webservice.fanart.tv/v3/movies/%1?%2").arg(tmdbId.toString(), keyParameter()); QNetworkRequest request = mediaelch::network::jsonRequestWithDefaults(url); - qDebug() << "[FanartTv] Load concert data with image types:" << url; + qCDebug(generic) << "[FanartTv] Load concert data with image types:" << url; QNetworkReply* reply = network()->get(request); reply->setProperty("infosToLoad", Storage::toVariant(reply, types)); @@ -440,7 +440,7 @@ QVector FanartTv::parseMovieData(QString json, ImageType type) const auto parsedJson = QJsonDocument::fromJson(json.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing fanart movie json " << parseError.errorString(); + qCWarning(generic) << "Error parsing fanart movie json " << parseError.errorString(); return posters; } @@ -737,7 +737,7 @@ QVector FanartTv::parseTvShowData(QString json, ImageType type, SeasonNu const auto parsedJson = QJsonDocument::fromJson(json.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing fanart TV show json " << parseError.errorString(); + qCWarning(generic) << "Error parsing fanart TV show json " << parseError.errorString(); return posters; } diff --git a/src/scrapers/image/FanartTvMusic.cpp b/src/scrapers/image/FanartTvMusic.cpp index e8c564a45a..c83f844df0 100644 --- a/src/scrapers/image/FanartTvMusic.cpp +++ b/src/scrapers/image/FanartTvMusic.cpp @@ -1,7 +1,6 @@ #include "FanartTvMusic.h" #include -#include #include #include #include @@ -9,6 +8,7 @@ #include #include "data/Storage.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/image/FanartTv.h" #include "scrapers/movie/tmdb/TmdbMovie.h" @@ -161,7 +161,7 @@ void FanartTvMusic::onSearchArtistFinished() if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302 || reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) { QUrl url = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); - qDebug() << "[FanartTvMusic] Got redirect" << url; + qCDebug(generic) << "[FanartTvMusic] Got redirect" << url; QNetworkRequest request = mediaelch::network::requestWithDefaults(url); reply = network()->getWithWatcher(request); connect(reply, &QNetworkReply::finished, this, &FanartTvMusic::onSearchArtistFinished); @@ -292,7 +292,7 @@ QVector FanartTvMusic::parseData(QString json, ImageType type) const const auto parsedJson = QJsonDocument::fromJson(json.toUtf8(), &parseError); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing fanart music json: " << parseError.errorString(); + qCWarning(generic) << "Error parsing fanart music json: " << parseError.errorString(); return posters; } diff --git a/src/scrapers/image/FanartTvMusicArtists.cpp b/src/scrapers/image/FanartTvMusicArtists.cpp index 1ae01d1e84..130b0acf57 100644 --- a/src/scrapers/image/FanartTvMusicArtists.cpp +++ b/src/scrapers/image/FanartTvMusicArtists.cpp @@ -1,6 +1,5 @@ #include "FanartTvMusicArtists.h" -#include #include #include #include @@ -8,6 +7,7 @@ #include #include "data/Storage.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/image/FanartTv.h" #include "scrapers/movie/tmdb/TmdbMovie.h" @@ -170,7 +170,7 @@ QVector FanartTvMusicArtists::parseData(QString json, ImageType type) const auto parsedJson = QJsonDocument::fromJson(json.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing fanart music json: " << parseError.errorString(); + qCWarning(generic) << "Error parsing fanart music json: " << parseError.errorString(); return posters; } diff --git a/src/scrapers/imdb/ImdbApi.cpp b/src/scrapers/imdb/ImdbApi.cpp index 14c48c4f9d..e9ef1a3f0d 100644 --- a/src/scrapers/imdb/ImdbApi.cpp +++ b/src/scrapers/imdb/ImdbApi.cpp @@ -2,6 +2,7 @@ #include "Version.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include @@ -53,7 +54,7 @@ void ImdbApi::sendGetRequest(const Locale& locale, const QUrl& url, ImdbApi::Api m_cache.addElement(reply->url(), locale, html); } } else { - qWarning() << "[ImdbTv][Api] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[ImdbTv][Api] Network Error:" << reply->errorString() << "for URL" << reply->url(); } ScraperError error = makeScraperError(html, *reply, {}); diff --git a/src/scrapers/movie/adultdvdempire/AdultDvdEmpire.cpp b/src/scrapers/movie/adultdvdempire/AdultDvdEmpire.cpp index cc766afc65..e7b8295282 100644 --- a/src/scrapers/movie/adultdvdempire/AdultDvdEmpire.cpp +++ b/src/scrapers/movie/adultdvdempire/AdultDvdEmpire.cpp @@ -1,9 +1,9 @@ #include "AdultDvdEmpire.h" -#include #include #include "data/Storage.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/movie/adultdvdempire/AdultDvdEmpireSearchJob.h" #include "settings/Settings.h" diff --git a/src/scrapers/movie/adultdvdempire/AdultDvdEmpireApi.cpp b/src/scrapers/movie/adultdvdempire/AdultDvdEmpireApi.cpp index cb614a56bd..fdca8e7565 100644 --- a/src/scrapers/movie/adultdvdempire/AdultDvdEmpireApi.cpp +++ b/src/scrapers/movie/adultdvdempire/AdultDvdEmpireApi.cpp @@ -1,6 +1,7 @@ #include "AdultDvdEmpireApi.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" namespace mediaelch { @@ -36,7 +37,8 @@ void AdultDvdEmpireApi::sendGetRequest(const QUrl& url, AdultDvdEmpireApi::ApiCa data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[AdultDvdEmpireApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[AdultDvdEmpireApi] Network Error:" << reply->errorString() << "for URL" + << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/movie/aebn/AEBN.cpp b/src/scrapers/movie/aebn/AEBN.cpp index c2a3548ee2..6fbbc5f4cd 100644 --- a/src/scrapers/movie/aebn/AEBN.cpp +++ b/src/scrapers/movie/aebn/AEBN.cpp @@ -1,11 +1,11 @@ #include "AEBN.h" #include "data/Storage.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/movie/aebn/AebnSearchJob.h" #include "ui/main/MainWindow.h" -#include #include #include diff --git a/src/scrapers/movie/aebn/AebnApi.cpp b/src/scrapers/movie/aebn/AebnApi.cpp index bdff198a14..24eec5ca94 100644 --- a/src/scrapers/movie/aebn/AebnApi.cpp +++ b/src/scrapers/movie/aebn/AebnApi.cpp @@ -1,6 +1,7 @@ #include "AebnApi.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" namespace mediaelch { @@ -32,7 +33,7 @@ void AebnApi::sendGetRequest(const QUrl& url, const Locale& locale, AebnApi::Api data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[AebnApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[AebnApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/movie/custom/CustomMovieScraper.cpp b/src/scrapers/movie/custom/CustomMovieScraper.cpp index dcde377ecc..aad5fe04ff 100644 --- a/src/scrapers/movie/custom/CustomMovieScraper.cpp +++ b/src/scrapers/movie/custom/CustomMovieScraper.cpp @@ -172,7 +172,7 @@ void CustomMovieScraper::loadData(QHashreadAll(), &parseError).object(); reply->deleteLater(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing TMDb json " << parseError.errorString(); + qCWarning(generic) << "Error parsing TMDb json " << parseError.errorString(); return; } if (!parsedJson.value("imdb_id").toString().isEmpty()) { imdbId = ImdbId(parsedJson.value("imdb_id").toString()); } else { - qWarning() << "No IMDB id available"; + qCWarning(generic) << "No IMDB id available"; movie->controller()->scraperLoadDone(this, {}); // silent error return; } diff --git a/src/scrapers/movie/hotmovies/HotMovies.cpp b/src/scrapers/movie/hotmovies/HotMovies.cpp index 036d421130..47dab04b67 100644 --- a/src/scrapers/movie/hotmovies/HotMovies.cpp +++ b/src/scrapers/movie/hotmovies/HotMovies.cpp @@ -2,11 +2,11 @@ #include "data/Storage.h" #include "globals/Helper.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/movie/hotmovies/HotMoviesSearchJob.h" #include "ui/main/MainWindow.h" -#include #include #include #include diff --git a/src/scrapers/movie/hotmovies/HotMoviesApi.cpp b/src/scrapers/movie/hotmovies/HotMoviesApi.cpp index 39da9ee67b..7b1bc928f9 100644 --- a/src/scrapers/movie/hotmovies/HotMoviesApi.cpp +++ b/src/scrapers/movie/hotmovies/HotMoviesApi.cpp @@ -1,6 +1,7 @@ #include "HotMoviesApi.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" namespace mediaelch { @@ -32,7 +33,7 @@ void HotMoviesApi::sendGetRequest(const QUrl& url, HotMoviesApi::ApiCallback cal data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[HotMoviesApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[HotMoviesApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/movie/imdb/ImdbMovieScraper.cpp b/src/scrapers/movie/imdb/ImdbMovieScraper.cpp index d19b14fa30..4c4f23b92d 100644 --- a/src/scrapers/movie/imdb/ImdbMovieScraper.cpp +++ b/src/scrapers/movie/imdb/ImdbMovieScraper.cpp @@ -1,6 +1,7 @@ #include "scrapers/movie/imdb/ImdbMovieScraper.h" #include "globals/Helper.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/imdb/ImdbApi.h" #include "scrapers/movie/imdb/ImdbMovie.h" @@ -62,7 +63,7 @@ void ImdbMovieLoader::load() void ImdbMovieLoader::loadPoster(const QUrl& posterViewerUrl) { - qDebug() << "[ImdbMovieLoader] Loading movie poster detail view"; + qCDebug(generic) << "[ImdbMovieLoader] Loading movie poster detail view"; m_api.sendGetRequest(Locale("en"), posterViewerUrl, [this](QString html, ScraperError error) { if (!error.hasError()) { parseAndAssignPoster(html); diff --git a/src/scrapers/movie/ofdb/OFDb.cpp b/src/scrapers/movie/ofdb/OFDb.cpp index 8c94ba4f99..2ac8322c72 100644 --- a/src/scrapers/movie/ofdb/OFDb.cpp +++ b/src/scrapers/movie/ofdb/OFDb.cpp @@ -137,7 +137,7 @@ void OFDb::loadFinished() } if (reply->error() == QNetworkReply::ContentNotFoundError && notFoundCounter < 3) { - qWarning() << "Got 404"; + qCWarning(generic) << "Got 404"; notFoundCounter++; reply->deleteLater(); QUrl url(QString("http://ofdbgw.metawave.ch/movie/%1").arg(ofdbId)); @@ -174,7 +174,7 @@ void OFDb::parseAndAssignInfos(QString data, Movie* movie, QSet #include #include #include @@ -368,7 +368,7 @@ void TmdbMovie::loadFinished() } else { showNetworkError(*reply); - qWarning() << "Network Error (load)" << reply->errorString(); + qCWarning(generic) << "Network Error (load)" << reply->errorString(); } movie->controller()->removeFromLoadsLeft(ScraperData::Infos); @@ -403,14 +403,14 @@ void TmdbMovie::loadCollectionFinished() QJsonParseError parseError{}; const auto parsedJson = QJsonDocument::fromJson(msg.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing info json " << parseError.errorString(); + qCWarning(generic) << "Error parsing info json " << parseError.errorString(); return; } movie->controller()->removeFromLoadsLeft(ScraperData::Infos); if (parsedJson.keys().contains("success") && !parsedJson.value("success").toBool()) { - qWarning() << "[TMDb] Error message from TMDb:" << parsedJson.value("status_message"); + qCWarning(generic) << "[TMDb] Error message from TMDb:" << parsedJson.value("status_message"); return; } @@ -440,7 +440,7 @@ void TmdbMovie::loadCastsFinished() parseAndAssignInfos(msg, movie, infos); } else { showNetworkError(*reply); - qWarning() << "Network Error (casts)" << reply->errorString(); + qCWarning(generic) << "Network Error (casts)" << reply->errorString(); } movie->controller()->removeFromLoadsLeft(ScraperData::Casts); } @@ -464,7 +464,7 @@ void TmdbMovie::loadTrailersFinished() parseAndAssignInfos(msg, movie, infos); } else { showNetworkError(*reply); - qDebug() << "Network Error (trailers)" << reply->errorString(); + qCDebug(generic) << "Network Error (trailers)" << reply->errorString(); } movie->controller()->removeFromLoadsLeft(ScraperData::Trailers); } @@ -488,7 +488,7 @@ void TmdbMovie::loadImagesFinished() parseAndAssignInfos(msg, movie, infos); } else { showNetworkError(*reply); - qWarning() << "Network Error (images)" << reply->errorString(); + qCWarning(generic) << "Network Error (images)" << reply->errorString(); } movie->controller()->removeFromLoadsLeft(ScraperData::Images); } @@ -512,7 +512,7 @@ void TmdbMovie::loadReleasesFinished() parseAndAssignInfos(msg, movie, infos); } else { showNetworkError(*reply); - qWarning() << "Network Error (releases)" << reply->errorString(); + qCWarning(generic) << "Network Error (releases)" << reply->errorString(); } movie->controller()->removeFromLoadsLeft(ScraperData::Releases); } @@ -529,7 +529,7 @@ void TmdbMovie::parseAndAssignInfos(QString json, Movie* movie, QSet infos) { - qDebug() << "[VideoBuster] Parse and assign movie details"; + qCDebug(generic) << "[VideoBuster] Parse and assign movie details"; movie->clear(infos); QRegularExpression rx; diff --git a/src/scrapers/movie/videobuster/VideoBusterApi.cpp b/src/scrapers/movie/videobuster/VideoBusterApi.cpp index ab3127e35b..166e8d31f3 100644 --- a/src/scrapers/movie/videobuster/VideoBusterApi.cpp +++ b/src/scrapers/movie/videobuster/VideoBusterApi.cpp @@ -2,6 +2,7 @@ #include "globals/Helper.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" namespace mediaelch { @@ -33,7 +34,8 @@ void VideoBusterApi::sendGetRequest(const QUrl& url, VideoBusterApi::ApiCallback data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[VideoBusterApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[VideoBusterApi] Network Error:" << reply->errorString() << "for URL" + << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/music/MusicBrainz.cpp b/src/scrapers/music/MusicBrainz.cpp index 71e06d8317..da804fb4f3 100644 --- a/src/scrapers/music/MusicBrainz.cpp +++ b/src/scrapers/music/MusicBrainz.cpp @@ -1,6 +1,7 @@ #include "scrapers/music/MusicBrainz.h" #include "globals/Meta.h" +#include "log/Log.h" #include "music/Album.h" #include "network/NetworkRequest.h" #include "scrapers/music/UniversalMusicScraper.h" @@ -38,7 +39,7 @@ void MusicBrainzApi::sendGetRequest(const Locale& locale, const QUrl& url, Music data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[MusicBrainz] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[MusicBrainz] Network Error:" << reply->errorString() << "for URL" << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/music/TheAudioDb.cpp b/src/scrapers/music/TheAudioDb.cpp index c3d110dad9..29a1fdf7e0 100644 --- a/src/scrapers/music/TheAudioDb.cpp +++ b/src/scrapers/music/TheAudioDb.cpp @@ -1,6 +1,7 @@ #include "scrapers/music/TheAudioDb.h" #include "globals/Meta.h" +#include "log/Log.h" #include "music/Album.h" #include "music/Artist.h" #include "network/NetworkRequest.h" @@ -38,7 +39,7 @@ void TheAudioDbApi::sendGetRequest(const Locale& locale, const QUrl& url, TheAud data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[MusicBrainz] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[MusicBrainz] Network Error:" << reply->errorString() << "for URL" << reply->url(); } if (!data.isEmpty()) { diff --git a/src/scrapers/music/TvTunes.cpp b/src/scrapers/music/TvTunes.cpp index e09eb3cc57..3c689c5e31 100644 --- a/src/scrapers/music/TvTunes.cpp +++ b/src/scrapers/music/TvTunes.cpp @@ -5,6 +5,7 @@ #include #include "globals/Helper.h" +#include "log/Log.h" #include "network/NetworkRequest.h" namespace mediaelch { @@ -38,7 +39,7 @@ void TvTunes::onSearchFinished() reply->deleteLater(); QVector results; if (reply->error() != QNetworkReply::NoError) { - qWarning() << "[TvTunes] Network Error:" << reply->errorString(); + qCWarning(generic) << "[TvTunes] Network Error:" << reply->errorString(); emit sigSearchDone(results); return; } diff --git a/src/scrapers/music/UniversalMusicScraper.cpp b/src/scrapers/music/UniversalMusicScraper.cpp index 553846abb5..14dac762d4 100644 --- a/src/scrapers/music/UniversalMusicScraper.cpp +++ b/src/scrapers/music/UniversalMusicScraper.cpp @@ -208,7 +208,7 @@ void UniversalMusicScraper::onArtistLoadFinished() if (reply->error() == QNetworkReply::NoError) { m_artistDownloads[artist][index].contents = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "Network Error (load)" << reply->errorString(); + qCWarning(generic) << "Network Error (load)" << reply->errorString(); } m_artistDownloads[artist][index].downloaded = true; @@ -247,7 +247,7 @@ void UniversalMusicScraper::processDownloadElement(DownloadElement elem, Artist* QJsonParseError parseError{}; const auto parsedJson = QJsonDocument::fromJson(elem.contents.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing music json: " << parseError.errorString(); + qCWarning(generic) << "Error parsing music json: " << parseError.errorString(); return; } @@ -465,7 +465,7 @@ void UniversalMusicScraper::onAlbumLoadFinished() if (reply->error() == QNetworkReply::NoError) { m_albumDownloads[album][index].contents = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "Network Error (load)" << reply->errorString(); + qCWarning(generic) << "Network Error (load)" << reply->errorString(); } m_albumDownloads[album][index].downloaded = true; @@ -504,7 +504,7 @@ void UniversalMusicScraper::processDownloadElement(DownloadElement elem, Album* QJsonParseError parseError{}; const auto parsedJson = QJsonDocument::fromJson(elem.contents.toUtf8(), &parseError).object(); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "Error parsing music json: " << parseError.errorString(); + qCWarning(generic) << "Error parsing music json: " << parseError.errorString(); return; } diff --git a/src/scrapers/tmdb/TmdbApi.cpp b/src/scrapers/tmdb/TmdbApi.cpp index aa8e569c85..6c7a68a427 100644 --- a/src/scrapers/tmdb/TmdbApi.cpp +++ b/src/scrapers/tmdb/TmdbApi.cpp @@ -3,6 +3,7 @@ #include "Version.h" #include "data/ImdbId.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/HttpStatusCodes.h" #include "tv_shows/TvDbId.h" @@ -36,7 +37,7 @@ void TmdbApi::initialize() m_config = TmdbApiConfiguration::from(QJsonDocument::fromJson(data.toUtf8())); } else { - qWarning() << "[TmdbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[TmdbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); m_isInitialized = false; } @@ -78,7 +79,7 @@ void TmdbApi::sendGetRequest(const Locale& locale, const QUrl& url, TmdbApi::Api data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[TmdbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[TmdbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); } QJsonParseError parseError{}; @@ -245,7 +246,7 @@ QString TmdbApi::apiUrlParameterString(TmdbApi::ApiUrlParameter parameter) const case ApiUrlParameter::PAGE: return QStringLiteral("page"); case ApiUrlParameter::INCLUDE_ADULT: return QStringLiteral("include_adult"); } - qCritical() << "[TMDb] ApiUrlParameter: Unhandled enum case."; + qCCritical(generic) << "[TMDb] ApiUrlParameter: Unhandled enum case."; return QStringLiteral("unknown"); } diff --git a/src/scrapers/tv_show/ShowMerger.cpp b/src/scrapers/tv_show/ShowMerger.cpp index b0463e4732..c9530f1307 100644 --- a/src/scrapers/tv_show/ShowMerger.cpp +++ b/src/scrapers/tv_show/ShowMerger.cpp @@ -3,7 +3,7 @@ #include "tv_shows/TvShow.h" #include "tv_shows/TvShowEpisode.h" -#include +#include "log/Log.h" namespace mediaelch { namespace scraper { @@ -23,7 +23,7 @@ static void copyDetailToShow(TvShow& target, TvShow& source, ShowScraperInfo det target.setTvMazeId(source.tvmazeId()); } switch (detail) { - case ShowScraperInfo::Invalid: qCritical() << "[ShowMerger] Cannot copy details 'invalid'"; break; + case ShowScraperInfo::Invalid: qCCritical(generic) << "[ShowMerger] Cannot copy details 'invalid'"; break; case ShowScraperInfo::Title: { target.setTitle(source.title()); target.setOriginalTitle(source.originalTitle()); @@ -164,7 +164,7 @@ static void copyDetailToEpisode(TvShowEpisode& target, const TvShowEpisode& sour } switch (detail) { case EpisodeScraperInfo::Invalid: { - qCritical() << "[ShowMerger] Cannot copy details 'invalid'"; + qCCritical(generic) << "[ShowMerger] Cannot copy details 'invalid'"; break; } case EpisodeScraperInfo::Actors: { @@ -256,8 +256,8 @@ void copyDetailsToShowEpisodes(TvShow& target, if (scraped != nullptr) { copyDetailsToEpisode(*episode, *scraped, details); } else if (!episode->isDummy()) { - qCritical() << "[TvShow] Cannot merge episode that wasn't scraped. This should not happen! For:" - << episode->seasonNumber() << "," << episode->episodeNumber(); + qCCritical(generic) << "[TvShow] Cannot merge episode that wasn't scraped. This should not happen! For:" + << episode->seasonNumber() << "," << episode->episodeNumber(); } } } diff --git a/src/scrapers/tv_show/custom/CustomEpisodeScrapeJob.cpp b/src/scrapers/tv_show/custom/CustomEpisodeScrapeJob.cpp index ddf92ea7b0..d5b45018fa 100644 --- a/src/scrapers/tv_show/custom/CustomEpisodeScrapeJob.cpp +++ b/src/scrapers/tv_show/custom/CustomEpisodeScrapeJob.cpp @@ -74,7 +74,7 @@ void CustomEpisodeScrapeJob::loadWithScraper(const QString& scraperId, const Epi TvScraper* scraper = m_customConfig.scraperForId(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomEpisodeScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; + qCCritical(generic) << "[CustomEpisodeScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; decreaseCounterAndCheckIfFinished(); return; } @@ -121,7 +121,7 @@ Locale CustomEpisodeScrapeJob::localeFor(const QString& scraperId) const ScraperSettings* settings = Settings::instance()->scraperSettings(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomEpisodeScrapeJob] Scraper not supported:" << scraperId; + qCCritical(generic) << "[CustomEpisodeScrapeJob] Scraper not supported:" << scraperId; return mediaelch::Locale::English; } if (settings == nullptr) { diff --git a/src/scrapers/tv_show/custom/CustomSeasonScrapeJob.cpp b/src/scrapers/tv_show/custom/CustomSeasonScrapeJob.cpp index a8ce978d4a..7024ed530a 100644 --- a/src/scrapers/tv_show/custom/CustomSeasonScrapeJob.cpp +++ b/src/scrapers/tv_show/custom/CustomSeasonScrapeJob.cpp @@ -84,7 +84,7 @@ void CustomSeasonScrapeJob::loadWithScraper(const QString& scraperId, const Show TvScraper* scraper = m_customConfig.scraperForId(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomSeasonScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; + qCCritical(generic) << "[CustomSeasonScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; decreaseCounterAndCheckIfFinished(); return; } @@ -131,7 +131,7 @@ Locale CustomSeasonScrapeJob::localeFor(const QString& scraperId) const ScraperSettings* settings = Settings::instance()->scraperSettings(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomSeasonScrapeJob] Scraper not supported:" << scraperId; + qCCritical(generic) << "[CustomSeasonScrapeJob] Scraper not supported:" << scraperId; return mediaelch::Locale::English; } if (settings == nullptr) { diff --git a/src/scrapers/tv_show/custom/CustomShowScrapeJob.cpp b/src/scrapers/tv_show/custom/CustomShowScrapeJob.cpp index 9f4118cbc3..1cd31b6992 100644 --- a/src/scrapers/tv_show/custom/CustomShowScrapeJob.cpp +++ b/src/scrapers/tv_show/custom/CustomShowScrapeJob.cpp @@ -74,7 +74,7 @@ void CustomShowScrapeJob::loadWithScraper(const QString& scraperId, const ShowId TvScraper* scraper = m_customConfig.scraperForId(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomShowScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; + qCCritical(generic) << "[CustomShowScrapeJob] Invalid scraper ID for custom tv scraper:" << scraperId; decreaseCounterAndCheckIfFinished(); return; } @@ -121,7 +121,7 @@ Locale CustomShowScrapeJob::localeFor(const QString& scraperId) const ScraperSettings* settings = Settings::instance()->scraperSettings(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomShowScrapeJob] Scraper not supported:" << scraperId; + qCCritical(generic) << "[CustomShowScrapeJob] Scraper not supported:" << scraperId; return mediaelch::Locale::English; } if (settings == nullptr) { diff --git a/src/scrapers/tv_show/imdb/ImdbTv.cpp b/src/scrapers/tv_show/imdb/ImdbTv.cpp index 6b4cb8da75..4f5d817feb 100644 --- a/src/scrapers/tv_show/imdb/ImdbTv.cpp +++ b/src/scrapers/tv_show/imdb/ImdbTv.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/imdb/ImdbTv.h" +#include "log/Log.h" #include "scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.h" #include "scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.h" #include "scrapers/tv_show/imdb/ImdbTvShowScrapeJob.h" @@ -84,7 +85,7 @@ SeasonScrapeJob* ImdbTv::loadSeasons(SeasonScrapeJob::Config config) EpisodeScrapeJob* ImdbTv::loadEpisode(EpisodeScrapeJob::Config config) { - qDebug() << "[ImdbTv] Load single episode of TV show with id:" << config.identifier; + qCDebug(generic) << "[ImdbTv] Load single episode of TV show with id:" << config.identifier; return new ImdbTvEpisodeScrapeJob(m_api, config, this); } diff --git a/src/scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.cpp b/src/scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.cpp index a4ed83a5ba..561cb7cef8 100644 --- a/src/scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.cpp +++ b/src/scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/imdb/ImdbTvEpisodeScrapeJob.h" +#include "log/Log.h" #include "scrapers/imdb/ImdbApi.h" #include "scrapers/tv_show/imdb/ImdbTvEpisodeParser.h" #include "tv_shows/TvShowEpisode.h" @@ -25,12 +26,12 @@ void ImdbTvEpisodeScrapeJob::execute() void ImdbTvEpisodeScrapeJob::loadSeason() { - qDebug() << "[ImdbTvEpisodeScrapeJob] Have to load season first."; + qCDebug(generic) << "[ImdbTvEpisodeScrapeJob] Have to load season first."; ImdbId showId(config().identifier.showIdentifier); if (!showId.isValid()) { - qWarning() << "[ImdbTvEpisodeScrapeJob] Invalid IMDb ID for TV show, cannot scrape episode!"; + qCWarning(generic) << "[ImdbTvEpisodeScrapeJob] Invalid IMDb ID for TV show, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Neither IMDb show ID nor episode ID are valid! Cannot load requested episode."); emit sigFinished(this); @@ -51,7 +52,7 @@ void ImdbTvEpisodeScrapeJob::loadSeason() } ImdbTvEpisodeParser::parseIdFromSeason(episode(), html); if (!episode().imdbId().isValid()) { - qWarning() << "[ImdbTvEpisodeScrapeJob] Could not parse IMDb ID for episode from season page!"; + qCWarning(generic) << "[ImdbTvEpisodeScrapeJob] Could not parse IMDb ID for episode from season page!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("IMDb ID could not be loaded from season page! Cannot load requested episode."); emit sigFinished(this); @@ -64,7 +65,7 @@ void ImdbTvEpisodeScrapeJob::loadSeason() void ImdbTvEpisodeScrapeJob::loadEpisode(const ImdbId& episodeId) { if (!episodeId.isValid()) { - qWarning() << "[ImdbTvEpisodeScrapeJob] Invalid IMDb ID, cannot scrape episode!"; + qCWarning(generic) << "[ImdbTvEpisodeScrapeJob] Invalid IMDb ID, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("IMDb ID is invalid! Cannot load requested episode."); emit sigFinished(this); @@ -76,7 +77,7 @@ void ImdbTvEpisodeScrapeJob::loadEpisode(const ImdbId& episodeId) if (error.hasError()) { m_error = error; } else if (html.isEmpty()) { - qWarning() << "[ImdbTvEpisodeScrapeJob] Empty episode HTML!"; + qCWarning(generic) << "[ImdbTvEpisodeScrapeJob] Empty episode HTML!"; m_error.error = ScraperError::Type::NetworkError; m_error.message = tr("Loaded IMDb content is empty. Cannot load requested episode."); } else { diff --git a/src/scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.cpp b/src/scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.cpp index 26bca716c8..0e490a3442 100644 --- a/src/scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.cpp +++ b/src/scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/imdb/ImdbTvSeasonScrapeJob.h" +#include "log/Log.h" #include "scrapers/imdb/ImdbApi.h" #include "scrapers/tv_show/imdb/ImdbTvSeasonParser.h" #include "tv_shows/TvShowEpisode.h" @@ -18,7 +19,7 @@ ImdbTvSeasonScrapeJob::ImdbTvSeasonScrapeJob(ImdbApi& api, SeasonScrapeJob::Conf void ImdbTvSeasonScrapeJob::execute() { if (!m_showId.isValid()) { - qWarning() << "[ImdbTv] Provided IMDb id is invalid:" << config().showIdentifier; + qCWarning(generic) << "[ImdbTv] Provided IMDb id is invalid:" << config().showIdentifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing an IMDb id"); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); diff --git a/src/scrapers/tv_show/imdb/ImdbTvShowParser.cpp b/src/scrapers/tv_show/imdb/ImdbTvShowParser.cpp index 4ace914b23..b61b727d76 100644 --- a/src/scrapers/tv_show/imdb/ImdbTvShowParser.cpp +++ b/src/scrapers/tv_show/imdb/ImdbTvShowParser.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/imdb/ImdbTvShowParser.h" +#include "log/Log.h" #include "scrapers/ScraperInterface.h" #include "tv_shows/TvShow.h" @@ -77,7 +78,7 @@ QJsonDocument ImdbTvShowParser::extractMetaJson(const QString& html) if (!match.hasMatch()) { m_error.error = ScraperError::Type::InternalError; m_error.message = tr("Could not extract JSON details from IMDb page!"); - qWarning() << "[ImdbTvShowParser] Could not extract JSON details from IMDb page!"; + qCWarning(generic) << "[ImdbTvShowParser] Could not extract JSON details from IMDb page!"; return {}; } @@ -87,13 +88,13 @@ QJsonDocument ImdbTvShowParser::extractMetaJson(const QString& html) if (parseError.error != QJsonParseError::NoError) { m_error.error = ScraperError::Type::InternalError; m_error.message = tr("Could not parse JSON from IMDb page!"); - qWarning() << "[ImdbTvShowParser] Could not parse IMDb json:" << parseError.errorString() // - << "at offset" << parseError.offset; + qCWarning(generic) << "[ImdbTvShowParser] Could not parse IMDb json:" << parseError.errorString() // + << "at offset" << parseError.offset; } else if (!parsedJson.isObject()) { m_error.error = ScraperError::Type::InternalError; m_error.message = tr("Expected parsed IMDb JSON to be an object!"); - qWarning() << "[ImdbTvShowParser] IMDb json is not an object!"; + qCWarning(generic) << "[ImdbTvShowParser] IMDb json is not an object!"; } return parsedJson; diff --git a/src/scrapers/tv_show/imdb/ImdbTvShowScrapeJob.cpp b/src/scrapers/tv_show/imdb/ImdbTvShowScrapeJob.cpp index 6de4373056..f5edd9c2a2 100644 --- a/src/scrapers/tv_show/imdb/ImdbTvShowScrapeJob.cpp +++ b/src/scrapers/tv_show/imdb/ImdbTvShowScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/imdb/ImdbTvShowScrapeJob.h" +#include "log/Log.h" #include "tv_shows/TvShow.h" #include @@ -27,7 +28,7 @@ ImdbTvShowScrapeJob::ImdbTvShowScrapeJob(ImdbApi& api, ShowScrapeJob::Config _co void ImdbTvShowScrapeJob::execute() { if (!m_id.isValid()) { - qWarning() << "[ImdbTv] Provided IMDb id is invalid:" << config().identifier; + qCWarning(generic) << "[ImdbTv] Provided IMDb id is invalid:" << config().identifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing an IMDb id"); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); @@ -82,7 +83,8 @@ void ImdbTvShowScrapeJob::setIsLoaded(ShowScraperInfo info) if (m_notLoaded.contains(info)) { m_notLoaded.remove(info); } else { - qCritical() << "[ImdbTvShowScrapeJob] Loaded detail that should not be loaded?" << static_cast(info); + qCCritical(generic) << "[ImdbTvShowScrapeJob] Loaded detail that should not be loaded?" + << static_cast(info); } } diff --git a/src/scrapers/tv_show/thetvdb/TheTvDb.cpp b/src/scrapers/tv_show/thetvdb/TheTvDb.cpp index 05a993e205..5c0debbf99 100644 --- a/src/scrapers/tv_show/thetvdb/TheTvDb.cpp +++ b/src/scrapers/tv_show/thetvdb/TheTvDb.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/thetvdb/TheTvDb.h" +#include "log/Log.h" #include "scrapers/tv_show/thetvdb/TheTvDbEpisodeScrapeJob.h" #include "scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.h" #include "scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.h" @@ -123,7 +124,7 @@ SeasonScrapeJob* TheTvDb::loadSeasons(SeasonScrapeJob::Config config) EpisodeScrapeJob* TheTvDb::loadEpisode(EpisodeScrapeJob::Config config) { - qDebug() << "[TheTvDb] Load single episode of TV show with id:" << config.identifier; + qCDebug(generic) << "[TheTvDb] Load single episode of TV show with id:" << config.identifier; auto* loader = new TheTvDbEpisodeScrapeJob(m_api, config, this); return loader; } diff --git a/src/scrapers/tv_show/thetvdb/TheTvDbApi.cpp b/src/scrapers/tv_show/thetvdb/TheTvDbApi.cpp index 2965617df2..1190ada28e 100644 --- a/src/scrapers/tv_show/thetvdb/TheTvDbApi.cpp +++ b/src/scrapers/tv_show/thetvdb/TheTvDbApi.cpp @@ -2,6 +2,7 @@ #include "Version.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include @@ -33,11 +34,11 @@ void TheTvDbApi::initialize() parsedJson = QJsonDocument::fromJson(reply->readAll(), &parseError); if (parseError.error != QJsonParseError::NoError) { - qWarning() << "[JsonPostRequest] Error while parsing JSON"; + qCWarning(generic) << "[JsonPostRequest] Error while parsing JSON"; } } else { - qWarning() << "[JsonPostRequest] Network Error:" << reply->errorString(); + qCWarning(generic) << "[JsonPostRequest] Network Error:" << reply->errorString(); } reply->deleteLater(); @@ -47,7 +48,7 @@ void TheTvDbApi::initialize() return; } - qDebug() << "[TheTvDbApi] Received JSON web token"; + qCDebug(generic) << "[TheTvDbApi] Received JSON web token"; ApiToken token(parsedJson.object().value("token").toString()); if (token.isValid()) { @@ -88,7 +89,7 @@ void TheTvDbApi::sendGetRequest(const Locale& locale, const QUrl& url, TheTvDbAp data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[TheTvDbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[TheTvDbApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); } QJsonParseError parseError{}; @@ -201,7 +202,7 @@ QUrl TheTvDbApi::getShowUrl(ApiShowDetails type, const TvDbId& id) const case ApiShowDetails::ACTORS: return QStringLiteral("/actors"); case ApiShowDetails::INFOS: return QString{}; } - qWarning() << "[TheTvDbApi] Unknown ApiShowDetails"; + qCWarning(generic) << "[TheTvDbApi] Unknown ApiShowDetails"; return QString{}; }(); @@ -217,7 +218,7 @@ QUrl TheTvDbApi::getImagesUrl(ShowScraperInfo type, const TvDbId& id) const case ShowScraperInfo::SeasonPoster: return QStringLiteral("season"); case ShowScraperInfo::SeasonBanner: return QStringLiteral("seasonwide"); case ShowScraperInfo::Banner: return QStringLiteral("series"); - default: qWarning() << "[TheTvDbApi] Invalid image type"; return QStringLiteral("invalid"); + default: qCWarning(generic) << "[TheTvDbApi] Invalid image type"; return QStringLiteral("invalid"); } }(); @@ -248,7 +249,7 @@ QString TheTvDbApi::seasonOrderToUrlArg(SeasonOrder order) const case SeasonOrder::Dvd: return "dvdSeason"; case SeasonOrder::Aired: return "airedSeason"; } - qCritical() << "[TheTvDbApi] Unhandled SeasonOrder case!"; + qCCritical(generic) << "[TheTvDbApi] Unhandled SeasonOrder case!"; return "airedSeason"; } diff --git a/src/scrapers/tv_show/thetvdb/TheTvDbEpisodeScrapeJob.cpp b/src/scrapers/tv_show/thetvdb/TheTvDbEpisodeScrapeJob.cpp index c7f86c657c..ead364f3fd 100644 --- a/src/scrapers/tv_show/thetvdb/TheTvDbEpisodeScrapeJob.cpp +++ b/src/scrapers/tv_show/thetvdb/TheTvDbEpisodeScrapeJob.cpp @@ -30,7 +30,8 @@ void TheTvDbEpisodeScrapeJob::execute() void TheTvDbEpisodeScrapeJob::loadSeason() { - qDebug() << "[TheTvDbEpisodeScrapeJob] Have to load season first for show:" << config().identifier.showIdentifier; + qCDebug(generic) << "[TheTvDbEpisodeScrapeJob] Have to load season first for show:" + << config().identifier.showIdentifier; // The episode parser requires season/episode to be set when // calling parseIdFromSeason() @@ -57,14 +58,14 @@ void TheTvDbEpisodeScrapeJob::loadSeason() void TheTvDbEpisodeScrapeJob::loadEpisode(const TvDbId& episodeId) { if (!episodeId.isValid()) { - qWarning() << "[TheTvDbEpisodeScrapeJob] Invalid TheTvDb ID, cannot scrape episode!"; + qCWarning(generic) << "[TheTvDbEpisodeScrapeJob] Invalid TheTvDb ID, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("TheTvDb ID is invalid! Cannot load requested episode."); emit sigFinished(this); return; } - qDebug() << "[TheTvDbEpisodeScrapeJob] Loading episode with id:" << episodeId; + qCDebug(generic) << "[TheTvDbEpisodeScrapeJob] Loading episode with id:" << episodeId; m_api.loadEpisode(config().locale, episodeId, [this](QJsonDocument json, ScraperError error) { if (!error.hasError()) { TheTvDbEpisodeParser parser(episode(), config().identifier.seasonOrder); diff --git a/src/scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.cpp b/src/scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.cpp index ff0cc34fe6..c98c25bcdb 100644 --- a/src/scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.cpp +++ b/src/scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.cpp @@ -1,5 +1,6 @@ #include "TheTvDbSeasonScrapeJob.h" +#include "log/Log.h" #include "scrapers/tv_show/thetvdb/TheTvDb.h" #include "scrapers/tv_show/thetvdb/TheTvDbApi.h" #include "scrapers/tv_show/thetvdb/TheTvDbSeasonScrapeJob.h" @@ -19,7 +20,7 @@ TheTvDbSeasonScrapeJob::TheTvDbSeasonScrapeJob(TheTvDbApi& api, Config _config, void TheTvDbSeasonScrapeJob::execute() { if (!m_showId.isValid()) { - qWarning() << "[TheTvDb] Provided TheTvDb id is invalid:" << config().showIdentifier; + qCWarning(generic) << "[TheTvDb] Provided TheTvDb id is invalid:" << config().showIdentifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing a TheTvDb id"); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); diff --git a/src/scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.cpp b/src/scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.cpp index a60c91ab0f..b4c361fb88 100644 --- a/src/scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.cpp +++ b/src/scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.cpp @@ -1,5 +1,6 @@ #include "TheTvDbShowScrapeJob.h" +#include "log/Log.h" #include "scrapers/tv_show/thetvdb/TheTvDb.h" #include "scrapers/tv_show/thetvdb/TheTvDbApi.h" #include "scrapers/tv_show/thetvdb/TheTvDbShowScrapeJob.h" @@ -39,7 +40,7 @@ TheTvDbShowScrapeJob::TheTvDbShowScrapeJob(TheTvDbApi& api, Config _config, QObj void TheTvDbShowScrapeJob::execute() { if (!m_id.isValid()) { - qWarning() << "[TheTvDb] Provided TheTvDb id is invalid:" << config().identifier; + qCWarning(generic) << "[TheTvDb] Provided TheTvDb id is invalid:" << config().identifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing a TheTvDb id"); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); @@ -144,7 +145,8 @@ void TheTvDbShowScrapeJob::setIsLoaded(ShowScraperInfo info) if (m_notLoaded.contains(info)) { m_notLoaded.remove(info); } else { - qCritical() << "[TheTvDbShowScrapeJob] Loaded detail that should not be loaded?" << static_cast(info); + qCCritical(generic) << "[TheTvDbShowScrapeJob] Loaded detail that should not be loaded?" + << static_cast(info); } } diff --git a/src/scrapers/tv_show/tmdb/TmdbTv.cpp b/src/scrapers/tv_show/tmdb/TmdbTv.cpp index 2c3939fdfa..4e3bf67304 100644 --- a/src/scrapers/tv_show/tmdb/TmdbTv.cpp +++ b/src/scrapers/tv_show/tmdb/TmdbTv.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tmdb/TmdbTv.h" +#include "log/Log.h" #include "scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.h" #include "scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.h" #include "scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.h" @@ -162,7 +163,7 @@ SeasonScrapeJob* TmdbTv::loadSeasons(SeasonScrapeJob::Config config) EpisodeScrapeJob* TmdbTv::loadEpisode(EpisodeScrapeJob::Config config) { - qDebug() << "[TmdbTv] Load single episode of TV show with id:" << config.identifier; + qCDebug(generic) << "[TmdbTv] Load single episode of TV show with id:" << config.identifier; return new TmdbTvEpisodeScrapeJob(m_api, config, this); } diff --git a/src/scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.cpp b/src/scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.cpp index b8a3a700a7..eca278ed7c 100644 --- a/src/scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.cpp +++ b/src/scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tmdb/TmdbTvEpisodeScrapeJob.h" +#include "log/Log.h" #include "scrapers/tmdb/TmdbApi.h" #include "scrapers/tv_show/tmdb/TmdbTvEpisodeParser.h" #include "tv_shows/TvShowEpisode.h" @@ -19,7 +20,7 @@ void TmdbTvEpisodeScrapeJob::execute() TmdbId showId(config().identifier.showIdentifier); if (!showId.isValid()) { - qWarning() << "[TmdbTvEpisodeScrapeJob] Invalid TMDb ID for TV show, cannot scrape episode!"; + qCWarning(generic) << "[TmdbTvEpisodeScrapeJob] Invalid TMDb ID for TV show, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("TMDb show ID is invalid! Cannot load requested episode."); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); diff --git a/src/scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.cpp b/src/scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.cpp index d7b87bf815..dd96c39da0 100644 --- a/src/scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.cpp +++ b/src/scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tmdb/TmdbTvSeasonScrapeJob.h" +#include "log/Log.h" #include "scrapers/tmdb/TmdbApi.h" #include "scrapers/tv_show/tmdb/TmdbTvSeasonParser.h" #include "tv_shows/TvShowEpisode.h" @@ -18,7 +19,7 @@ TmdbTvSeasonScrapeJob::TmdbTvSeasonScrapeJob(TmdbApi& api, SeasonScrapeJob::Conf void TmdbTvSeasonScrapeJob::execute() { if (!m_showId.isValid()) { - qWarning() << "[TmdbTv] Provided Tmdb id is invalid:" << config().showIdentifier; + qCWarning(generic) << "[TmdbTv] Provided Tmdb id is invalid:" << config().showIdentifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing a TMDb id"); emit sigFinished(this); diff --git a/src/scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.cpp b/src/scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.cpp index cddce0045a..457496d167 100644 --- a/src/scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.cpp +++ b/src/scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tmdb/TmdbTvShowScrapeJob.h" +#include "log/Log.h" #include "scrapers/tmdb/TmdbApi.h" #include "tv_shows/TvShow.h" @@ -16,7 +17,7 @@ TmdbTvShowScrapeJob::TmdbTvShowScrapeJob(TmdbApi& api, ShowScrapeJob::Config _co void TmdbTvShowScrapeJob::execute() { if (!m_id.isValid()) { - qWarning() << "[TmdbTv] Provided TMDb id is invalid:" << config().identifier; + qCWarning(generic) << "[TmdbTv] Provided TMDb id is invalid:" << config().identifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing a TMDb id"); QTimer::singleShot(0, [this]() { emit sigFinished(this); }); diff --git a/src/scrapers/tv_show/tvmaze/TvMaze.cpp b/src/scrapers/tv_show/tvmaze/TvMaze.cpp index 6eb3aa33be..4e6f05b4cc 100644 --- a/src/scrapers/tv_show/tvmaze/TvMaze.cpp +++ b/src/scrapers/tv_show/tvmaze/TvMaze.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tvmaze/TvMaze.h" +#include "log/Log.h" #include "scrapers/tv_show/tvmaze/TvMazeEpisodeScrapeJob.h" #include "scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.h" #include "scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.h" @@ -85,7 +86,7 @@ SeasonScrapeJob* TvMaze::loadSeasons(SeasonScrapeJob::Config config) EpisodeScrapeJob* TvMaze::loadEpisode(EpisodeScrapeJob::Config config) { - qDebug() << "[TvMaze] Load single episode of TV show with id:" << config.identifier; + qCDebug(generic) << "[TvMaze] Load single episode of TV show with id:" << config.identifier; auto* loader = new TvMazeEpisodeScrapeJob(m_api, config, this); return loader; } diff --git a/src/scrapers/tv_show/tvmaze/TvMazeApi.cpp b/src/scrapers/tv_show/tvmaze/TvMazeApi.cpp index b4c2ba15b7..45f60c636b 100644 --- a/src/scrapers/tv_show/tvmaze/TvMazeApi.cpp +++ b/src/scrapers/tv_show/tvmaze/TvMazeApi.cpp @@ -1,6 +1,7 @@ #include "scrapers/tv_show/tvmaze/TvMazeApi.h" #include "globals/Meta.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include @@ -49,7 +50,7 @@ void TvMazeApi::sendGetRequest(const QUrl& url, TvMazeApi::ApiCallback callback) data = QString::fromUtf8(reply->readAll()); } else { - qWarning() << "[TvMazeApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); + qCWarning(generic) << "[TvMazeApi] Network Error:" << reply->errorString() << "for URL" << reply->url(); } QJsonParseError parseError{}; diff --git a/src/scrapers/tv_show/tvmaze/TvMazeEpisodeScrapeJob.cpp b/src/scrapers/tv_show/tvmaze/TvMazeEpisodeScrapeJob.cpp index 700be75f1b..1156161699 100644 --- a/src/scrapers/tv_show/tvmaze/TvMazeEpisodeScrapeJob.cpp +++ b/src/scrapers/tv_show/tvmaze/TvMazeEpisodeScrapeJob.cpp @@ -32,7 +32,7 @@ void TvMazeEpisodeScrapeJob::execute() void TvMazeEpisodeScrapeJob::loadAllEpisodes(const TvMazeId& showId) { if (!showId.isValid()) { - qWarning() << "[TvMazeEpisodeScrapeJob] Invalid TVmaze ID for TV show, cannot scrape episode!"; + qCWarning(generic) << "[TvMazeEpisodeScrapeJob] Invalid TVmaze ID for TV show, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("TVmaze show ID are valid! Cannot load requested episode."); emit sigFinished(this); @@ -57,7 +57,7 @@ void TvMazeEpisodeScrapeJob::loadAllEpisodes(const TvMazeId& showId) void TvMazeEpisodeScrapeJob::loadEpisode(const TvMazeId& episodeId) { if (!episodeId.isValid()) { - qWarning() << "[TvMazeEpisodeScrapeJob] Invalid TVmaze ID, cannot scrape episode!"; + qCWarning(generic) << "[TvMazeEpisodeScrapeJob] Invalid TVmaze ID, cannot scrape episode!"; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("TVmaze ID is invalid! Cannot load requested episode."); emit sigFinished(this); diff --git a/src/scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.cpp b/src/scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.cpp index 73ea242948..cecdcffbf0 100644 --- a/src/scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.cpp +++ b/src/scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.cpp @@ -1,5 +1,6 @@ #include "scrapers/tv_show/tvmaze/TvMazeSeasonScrapeJob.h" +#include "log/Log.h" #include "scrapers/tv_show/tvmaze/TvMazeApi.h" #include "scrapers/tv_show/tvmaze/TvMazeEpisodeParser.h" #include "tv_shows/TvShowEpisode.h" @@ -18,7 +19,7 @@ TvMazeSeasonScrapeJob::TvMazeSeasonScrapeJob(TvMazeApi& api, SeasonScrapeJob::Co void TvMazeSeasonScrapeJob::execute() { if (!m_showId.isValid()) { - qWarning() << "[TmdbTv] Provided Tmdb id is invalid:" << config().showIdentifier; + qCWarning(generic) << "[TmdbTv] Provided Tmdb id is invalid:" << config().showIdentifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("Show is missing a TMDb id"); emit sigFinished(this); diff --git a/src/scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.cpp b/src/scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.cpp index 9020be59a1..5810ba5d1a 100644 --- a/src/scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.cpp +++ b/src/scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.cpp @@ -1,5 +1,6 @@ #include "TvMazeShowScrapeJob.h" +#include "log/Log.h" #include "scrapers/tv_show/tvmaze/TvMaze.h" #include "scrapers/tv_show/tvmaze/TvMazeApi.h" #include "scrapers/tv_show/tvmaze/TvMazeShowScrapeJob.h" @@ -22,7 +23,7 @@ void TvMazeShowScrapeJob::execute() TvMazeId id{config().identifier.str()}; if (!id.isValid()) { - qWarning() << "[TvMaze] Provided TvMaze ID is invalid:" << config().identifier; + qCWarning(generic) << "[TvMaze] Provided TvMaze ID is invalid:" << config().identifier; m_error.error = ScraperError::Type::ConfigError; m_error.message = tr("TV show is missing a TVmaze ID"); emit sigFinished(this); diff --git a/src/settings/AdvancedSettings.cpp b/src/settings/AdvancedSettings.cpp index 22768f170b..4d1ef2d909 100644 --- a/src/settings/AdvancedSettings.cpp +++ b/src/settings/AdvancedSettings.cpp @@ -1,9 +1,9 @@ #include "AdvancedSettings.h" -#include #include #include "Settings.h" +#include "log/Log.h" AdvancedSettings::AdvancedSettings() { diff --git a/src/settings/AdvancedSettings.h b/src/settings/AdvancedSettings.h index 4e0814c788..13408aa4f3 100644 --- a/src/settings/AdvancedSettings.h +++ b/src/settings/AdvancedSettings.h @@ -3,6 +3,7 @@ #include "file/FileFilter.h" #include "globals/Globals.h" #include "image/ThumbnailDimensions.h" +#include "log/Log.h" #include #include @@ -58,7 +59,7 @@ class FileSearchExclude case ExcludeType::File: return "file"; case ExcludeType::Folder: return "folder"; } - qCritical() << "[ExcludeType] Unhandled switch/case"; + qCCritical(generic) << "[ExcludeType] Unhandled switch/case"; return ""; } diff --git a/src/settings/AdvancedSettingsXmlReader.cpp b/src/settings/AdvancedSettingsXmlReader.cpp index e272a28f60..26de215016 100644 --- a/src/settings/AdvancedSettingsXmlReader.cpp +++ b/src/settings/AdvancedSettingsXmlReader.cpp @@ -1,8 +1,8 @@ #include "settings/AdvancedSettingsXmlReader.h" +#include "log/Log.h" #include "settings/Settings.h" -#include #include #include #include @@ -20,7 +20,7 @@ QPair AdvancedS AdvancedSettingsXmlReader reader; mediaelch::FilePath path = reader.getFilePath(); - qDebug() << "Loading advanced settings from:" << path; + qCDebug(generic) << "Loading advanced settings from:" << path; // Only parse the xml if the file exists. Otherwise use defaults. if (QFile(path.toString()).exists()) { @@ -30,7 +30,7 @@ QPair AdvancedS } reader.m_settings.m_userDefined = true; } else { - qWarning() << "[AdvancedSettings] advancedsettings.xml not found at " << path.toString(); + qCWarning(generic) << "[AdvancedSettings] advancedsettings.xml not found at " << path.toString(); reader.m_settings.m_userDefined = false; reader.addWarning("advancedsettings.xml", ParseErrorType::FileNotFound); } @@ -69,7 +69,7 @@ QByteArray AdvancedSettingsXmlReader::getAdvancedSettingsXml(const mediaelch::Fi xmlStr = file.readAll(); file.close(); } else { - qWarning() << "[AdvancedSettings] Cannot open advancedsettings.xml in read-only mode"; + qCWarning(generic) << "[AdvancedSettings] Cannot open advancedsettings.xml in read-only mode"; addError("advancedsettings.xml", ParseErrorType::FileIsReadOnly); } @@ -82,7 +82,7 @@ void AdvancedSettingsXmlReader::parseSettings(const QString& xmlSource) m_xml.addData(xmlSource); if (!m_xml.readNextStartElement() || m_xml.name().toString() != "advancedsettings") { - qWarning() << "[AdvancedSettings] Couldn't find an tag!"; + qCWarning(generic) << "[AdvancedSettings] Couldn't find an tag!"; addError("advancedsettings", ParseErrorType::NoMainTag); return; } @@ -257,7 +257,8 @@ void AdvancedSettingsXmlReader::loadExcludePatterns() QString applyTo = m_xml.attributes().value("applyTo").toString(); QRegularExpression pattern(m_xml.readElementText().trimmed()); if (!pattern.isValid()) { - qCritical() << "[AdvancedSettings] Invalid regular expression! Message:" << pattern.errorString(); + qCCritical(generic) << "[AdvancedSettings] Invalid regular expression! Message:" + << pattern.errorString(); addError("pattern", ParseErrorType::InvalidValue); return; } @@ -268,8 +269,8 @@ void AdvancedSettingsXmlReader::loadExcludePatterns() } else if (applyTo == "folders") { m_settings.m_excludePatterns << FileSearchExclude::excludeFolderPattern(pattern); } else { - qWarning() << "[AdvancedSettings] Unknown value for 'applyTo' attribute of element at" - << currentLocation(); + qCWarning(generic) << "[AdvancedSettings] Unknown value for 'applyTo' attribute of element at" + << currentLocation(); addError("pattern", ParseErrorType::InvalidAttributeValue); } @@ -291,14 +292,14 @@ void AdvancedSettingsXmlReader::addWarning(QString tag, ParseErrorType type) void AdvancedSettingsXmlReader::skipUnsupportedTag() { - qWarning() << "[AdvancedSettings] Found unsupported xml tag" << m_xml.name() << "at" << currentLocation(); + qCWarning(generic) << "[AdvancedSettings] Found unsupported xml tag" << m_xml.name() << "at" << currentLocation(); addError(m_xml.name().toString(), ParseErrorType::UnsupportedTag); m_xml.skipCurrentElement(); } void AdvancedSettingsXmlReader::invalidValue() { - qWarning() << "[AdvancedSettings] Invalid value for xml tag" << m_xml.name() << "at" << currentLocation(); + qCWarning(generic) << "[AdvancedSettings] Invalid value for xml tag" << m_xml.name() << "at" << currentLocation(); addError(m_xml.name().toString(), ParseErrorType::InvalidValue); } diff --git a/src/settings/DataFile.cpp b/src/settings/DataFile.cpp index 3455bb6876..daedfab741 100644 --- a/src/settings/DataFile.cpp +++ b/src/settings/DataFile.cpp @@ -1,6 +1,5 @@ #include "DataFile.h" -#include #include #include #include @@ -8,6 +7,7 @@ #include "file/FilenameUtils.h" #include "globals/Globals.h" #include "globals/Helper.h" +#include "log/Log.h" /** * \brief DataFile::DataFile diff --git a/src/settings/KodiSettings.cpp b/src/settings/KodiSettings.cpp index 6ad3d4e972..f3c39b9d0a 100644 --- a/src/settings/KodiSettings.cpp +++ b/src/settings/KodiSettings.cpp @@ -1,6 +1,6 @@ #include "settings/KodiSettings.h" -#include +#include "log/Log.h" using namespace mediaelch; @@ -16,8 +16,8 @@ void KodiSettings::loadSettings() const int version = m_settings->value("kodi/version").toInt(); if (!KodiVersion::isValid(version)) { - qWarning() << "Found invalid Kodi version" << version - << "in settings; default is:" << KodiVersion::latest().toInt(); + qCWarning(generic) << "Found invalid Kodi version" << version + << "in settings; default is:" << KodiVersion::latest().toInt(); setKodiVersion(KodiVersion::latest()); } else { setKodiVersion(KodiVersion(version)); diff --git a/src/settings/Settings.cpp b/src/settings/Settings.cpp index 7a15426592..fd72b7acb2 100644 --- a/src/settings/Settings.cpp +++ b/src/settings/Settings.cpp @@ -79,10 +79,10 @@ Settings::Settings(QObject* parent) : QObject(parent) auto advancedSettingsPair = AdvancedSettingsXmlReader::loadFromDefaultPath(); m_advancedSettings = std::move(advancedSettingsPair.first); - qDebug() << m_advancedSettings; + qCDebug(generic) << m_advancedSettings; if (m_advancedSettings.portableMode()) { - qDebug() << "[Windows] Using portable mode!"; + qCDebug(generic) << "[Windows] Using portable mode!"; m_settings = new QSettings(Settings::applicationDir() + "/MediaElch.ini", QSettings::IniFormat, this); } else { m_settings = new QSettings(this); @@ -155,7 +155,7 @@ ScraperSettings* Settings::scraperSettings(const QString& id) { std::string idStd = id.toStdString(); if (m_scraperSettings.find(idStd) == m_scraperSettings.cend()) { - qCritical() << "[TvScraperSettingsWidget] Missing settings entry in settings map!"; + qCCritical(generic) << "[TvScraperSettingsWidget] Missing settings entry in settings map!"; return nullptr; } return m_scraperSettings[idStd].get(); diff --git a/src/tv_shows/EpisodeNumber.cpp b/src/tv_shows/EpisodeNumber.cpp index 87c8f22ad2..e5b2d6220f 100644 --- a/src/tv_shows/EpisodeNumber.cpp +++ b/src/tv_shows/EpisodeNumber.cpp @@ -1,6 +1,7 @@ #include "src/tv_shows/EpisodeNumber.h" -#include +#include "log/Log.h" + #include EpisodeNumber::EpisodeNumber(int episodeNumber) noexcept : diff --git a/src/tv_shows/SeasonNumber.cpp b/src/tv_shows/SeasonNumber.cpp index 81736f66d9..f1fc0c4d12 100644 --- a/src/tv_shows/SeasonNumber.cpp +++ b/src/tv_shows/SeasonNumber.cpp @@ -1,6 +1,7 @@ #include "SeasonNumber.h" -#include +#include "log/Log.h" + #include SeasonNumber::SeasonNumber(int seasonNumber) noexcept : diff --git a/src/tv_shows/TvShow.cpp b/src/tv_shows/TvShow.cpp index 92a94d62fa..d85de0c67a 100644 --- a/src/tv_shows/TvShow.cpp +++ b/src/tv_shows/TvShow.cpp @@ -2,7 +2,6 @@ #include "globals/Globals.h" #include -#include #include #include #include @@ -11,6 +10,7 @@ #include "globals/Globals.h" #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "media_centers/MediaCenterInterface.h" #include "scrapers/tv_show/ShowMerger.h" #include "scrapers/tv_show/TvScraper.h" @@ -1061,7 +1061,7 @@ void TvShow::setChanged(bool changed) void TvShow::setModelItem(TvShowModelItem* item) { if (item == nullptr) { - qCritical() << "[TvShow] Tried to set nullptr model item"; + qCCritical(generic) << "[TvShow] Tried to set nullptr model item"; return; } m_modelItem = item; @@ -1418,7 +1418,7 @@ void TvShow::fillMissingEpisodes() QVector episodes = Manager::instance()->database()->showsEpisodes(this); for (TvShowEpisode* episode : episodes) { if (episode == nullptr) { - qCritical() << "[TvShow] Episode loaded from database is a nullptr"; + qCCritical(generic) << "[TvShow] Episode loaded from database is a nullptr"; continue; } diff --git a/src/tv_shows/TvShowEpisode.cpp b/src/tv_shows/TvShowEpisode.cpp index 50f4355959..e91c4d2084 100644 --- a/src/tv_shows/TvShowEpisode.cpp +++ b/src/tv_shows/TvShowEpisode.cpp @@ -135,7 +135,7 @@ QSet TvShowEpisode::infosToLoad() bool TvShowEpisode::loadData(MediaCenterInterface* mediaCenterInterface, bool reloadFromNfo, bool forceReload) { if (mediaCenterInterface == nullptr) { - qWarning() << "Passed an empty (null) mediaCenterInterface to loadData"; + qCWarning(generic) << "Passed an empty (null) mediaCenterInterface to loadData"; return false; } @@ -178,7 +178,7 @@ bool TvShowEpisode::saveData(MediaCenterInterface* mediaCenterInterface) loadStreamDetailsFromFile(); } bool saved = mediaCenterInterface->saveTvShowEpisode(this); - qDebug() << "Saving episode" << (saved ? "successful" : "not successful"); + qCDebug(generic) << "Saving episode" << (saved ? "successful" : "not successful"); if (!m_infoLoaded) { m_infoLoaded = saved; } diff --git a/src/tv_shows/TvShowFileSearcher.cpp b/src/tv_shows/TvShowFileSearcher.cpp index dfdc5f3785..e0db9ef77b 100644 --- a/src/tv_shows/TvShowFileSearcher.cpp +++ b/src/tv_shows/TvShowFileSearcher.cpp @@ -26,18 +26,18 @@ void TvShowFileSearcher::setTvShowDirectories(QVector directories) m_directories.clear(); for (auto& dir : directories) { if (Settings::instance()->advanced()->isFolderExcluded(dir.path.dirName())) { - qWarning() << "[TvShowFileSearcher] TV show directory is excluded by advanced settings! " - "Is this intended? Directory:" - << dir.path.path(); + qCWarning(generic) << "[TvShowFileSearcher] TV show directory is excluded by advanced settings! " + "Is this intended? Directory:" + << dir.path.path(); continue; } if (!dir.path.isReadable()) { - qDebug() << "[TvShowFileSearcher] TV show directory is not readable, skipping:" << dir.path.path(); + qCDebug(generic) << "[TvShowFileSearcher] TV show directory is not readable, skipping:" << dir.path.path(); continue; } - qDebug() << "[TvShowFileSearcher] Adding TV show directory" << dir.path.path(); + qCDebug(generic) << "[TvShowFileSearcher] Adding TV show directory" << dir.path.path(); m_directories.append(dir); } } @@ -70,7 +70,7 @@ void TvShowFileSearcher::reload(bool force) } } - qDebug() << "[TvShowFileSearcher] Searching for TV shows done"; + qCDebug(generic) << "[TvShowFileSearcher] Searching for TV shows done"; if (!m_aborted) { emit tvShowsLoaded(); } diff --git a/src/tv_shows/TvShowModel.cpp b/src/tv_shows/TvShowModel.cpp index 615e49d034..6ab68298bc 100644 --- a/src/tv_shows/TvShowModel.cpp +++ b/src/tv_shows/TvShowModel.cpp @@ -1,11 +1,12 @@ -#include +#include "tv_shows/TvShowModel.h" + #include #include #include "globals/Globals.h" #include "globals/Helper.h" #include "globals/Manager.h" -#include "tv_shows/TvShowModel.h" +#include "log/Log.h" #include "tv_shows/model/EpisodeModelItem.h" #include "tv_shows/model/SeasonModelItem.h" #include "tv_shows/model/TvShowModelItem.h" diff --git a/src/tv_shows/TvShowProxyModel.cpp b/src/tv_shows/TvShowProxyModel.cpp index d50d40e610..10c3ae7bcb 100644 --- a/src/tv_shows/TvShowProxyModel.cpp +++ b/src/tv_shows/TvShowProxyModel.cpp @@ -58,7 +58,7 @@ bool TvShowProxyModel::hasAcceptedChildren(int source_row, const QModelIndex& so { QModelIndex item = sourceModel()->index(source_row, 0, source_parent); if (!item.isValid()) { - // qDebug() << "item invalid" << source_parent << source_row; + // qCDebug(generic) << "item invalid" << source_parent << source_row; return false; } diff --git a/src/tv_shows/TvShowUpdater.cpp b/src/tv_shows/TvShowUpdater.cpp index df3e4e3145..e9a73a497d 100644 --- a/src/tv_shows/TvShowUpdater.cpp +++ b/src/tv_shows/TvShowUpdater.cpp @@ -5,12 +5,12 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "globals/MessageIds.h" +#include "log/Log.h" #include "scrapers/tv_show/thetvdb/TheTvDb.h" #include "tv_shows/TvShow.h" #include "ui/notifications/NotificationBox.h" #include -#include using namespace mediaelch; @@ -18,7 +18,7 @@ TvShowUpdater::TvShowUpdater(QObject* parent) : QObject(parent), m_tvdb{nullptr} { m_tvdb = dynamic_cast(Manager::instance()->scrapers().tvScraper(scraper::TheTvDb::ID)); if (m_tvdb == nullptr) { - qCritical() << "[TvShowUpdater] Failing cast to TheTvDb scraper"; + qCCritical(generic) << "[TvShowUpdater] Failing cast to TheTvDb scraper"; } } diff --git a/src/ui/concerts/ConcertFilesWidget.cpp b/src/ui/concerts/ConcertFilesWidget.cpp index 5e0f20b3f7..4077ce635e 100644 --- a/src/ui/concerts/ConcertFilesWidget.cpp +++ b/src/ui/concerts/ConcertFilesWidget.cpp @@ -218,7 +218,7 @@ void ConcertFilesWidget::openNfo() void ConcertFilesWidget::itemActivated(QModelIndex index, QModelIndex previous) { if (!index.isValid()) { - qDebug() << "Index is invalid"; + qCDebug(generic) << "Index is invalid"; m_lastConcert = nullptr; emit noConcertSelected(); return; diff --git a/src/ui/concerts/ConcertInfoWidget.cpp b/src/ui/concerts/ConcertInfoWidget.cpp index 17a427ba48..af04b06b84 100644 --- a/src/ui/concerts/ConcertInfoWidget.cpp +++ b/src/ui/concerts/ConcertInfoWidget.cpp @@ -60,7 +60,7 @@ void ConcertInfoWidget::setConcertController(ConcertController* controller) void ConcertInfoWidget::updateConcertInfo() { if ((m_concertController == nullptr) || (m_concertController->concert() == nullptr)) { - qDebug() << "My concert is invalid"; + qCDebug(generic) << "My concert is invalid"; return; } diff --git a/src/ui/concerts/ConcertSearch.cpp b/src/ui/concerts/ConcertSearch.cpp index 68de1c2cf1..0984295a52 100644 --- a/src/ui/concerts/ConcertSearch.cpp +++ b/src/ui/concerts/ConcertSearch.cpp @@ -1,7 +1,7 @@ #include "ConcertSearch.h" #include "ui_ConcertSearch.h" -#include +#include "log/Log.h" #include "globals/Manager.h" diff --git a/src/ui/concerts/ConcertSearchWidget.cpp b/src/ui/concerts/ConcertSearchWidget.cpp index 9e80ca5377..d724044bd6 100644 --- a/src/ui/concerts/ConcertSearchWidget.cpp +++ b/src/ui/concerts/ConcertSearchWidget.cpp @@ -2,6 +2,7 @@ #include "ui_ConcertSearchWidget.h" #include "globals/Manager.h" +#include "log/Log.h" #include "scrapers/concert/ConcertScraper.h" #include "scrapers/concert/ConcertSearchJob.h" #include "settings/Settings.h" @@ -130,13 +131,13 @@ void ConcertSearchWidget::startSearch() void ConcertSearchWidget::onConcertResults(ConcertSearchJob* searchJob) { if (searchJob->hasError()) { - qDebug() << "[ConcertSearch] Got error while searching for concert" << searchJob->error().message; + qCDebug(generic) << "[ConcertSearch] Got error while searching for concert" << searchJob->error().message; showError(searchJob->error().message); searchJob->deleteLater(); return; } - qDebug() << "[ConcertSearch] Result count:" << searchJob->results().count(); + qCDebug(generic) << "[ConcertSearch] Result count:" << searchJob->results().count(); showSuccess(tr("Found %n results", "", searchJob->results().count())); for (const auto& result : searchJob->results()) { @@ -221,13 +222,13 @@ void ConcertSearchWidget::onChkAllConcertInfosToggled() void ConcertSearchWidget::onScraperChanged(int index) { if (index < 0 || index >= Manager::instance()->scrapers().concertScrapers().size()) { - qCritical() << "[ConcertSearchWidget] Selected invalid scraper:" << index; + qCCritical(generic) << "[ConcertSearchWidget] Selected invalid scraper:" << index; showError(tr("Internal inconsistency: Selected an invalid scraper!")); return; } const QString scraperId = ui->comboScraper->itemData(index, Qt::UserRole).toString(); - qDebug() << "[ConcertSearchWidget] Selected scraper:" << scraperId; + qCDebug(generic) << "[ConcertSearchWidget] Selected scraper:" << scraperId; m_currentScraper = Manager::instance()->scrapers().concertScraper(scraperId); if (m_currentScraper == nullptr) { diff --git a/src/ui/concerts/ConcertStreamDetailsWidget.cpp b/src/ui/concerts/ConcertStreamDetailsWidget.cpp index 4e831d3bc1..44bd057e7e 100644 --- a/src/ui/concerts/ConcertStreamDetailsWidget.cpp +++ b/src/ui/concerts/ConcertStreamDetailsWidget.cpp @@ -4,6 +4,7 @@ #include "concerts/Concert.h" #include "data/StreamDetails.h" #include "globals/Helper.h" +#include "log/Log.h" #include #include @@ -42,7 +43,7 @@ void ConcertStreamDetailsWidget::setConcertController(ConcertController* control void ConcertStreamDetailsWidget::updateConcertInfo() { if ((m_concertController == nullptr) || (m_concertController->concert() == nullptr)) { - qDebug() << "My concert is invalid"; + qCDebug(generic) << "My concert is invalid"; return; } clear(); diff --git a/src/ui/concerts/ConcertWidget.cpp b/src/ui/concerts/ConcertWidget.cpp index 5adbd0f318..41cb037e17 100644 --- a/src/ui/concerts/ConcertWidget.cpp +++ b/src/ui/concerts/ConcertWidget.cpp @@ -196,10 +196,10 @@ void ConcertWidget::concertNameChanged(QString text) void ConcertWidget::setEnabledTrue(Concert* concert) { if (concert != nullptr) { - qDebug() << concert->title(); + qCDebug(generic) << concert->title(); } if ((concert != nullptr) && concert->controller()->downloadsInProgress()) { - qDebug() << "Downloads are in progress"; + qCDebug(generic) << "Downloads are in progress"; return; } ui->groupBox_3->setEnabled(true); @@ -223,7 +223,7 @@ void ConcertWidget::setDisabledTrue() */ void ConcertWidget::setConcert(Concert* concert) { - qDebug() << "Entered, concert=" << concert->title(); + qCDebug(generic) << "Entered, concert=" << concert->title(); concert->controller()->loadData(Manager::instance()->mediaCenterInterfaceConcert()); m_concert = concert; if (!concert->streamDetailsLoaded() && Settings::instance()->autoLoadStreamDetails()) { @@ -262,7 +262,7 @@ void ConcertWidget::setConcert(Concert* concert) void ConcertWidget::onStartScraperSearch() { if (m_concert == nullptr) { - qDebug() << "My concert is invalid"; + qCDebug(generic) << "My concert is invalid"; return; } emit setActionSearchEnabled(false, MainWidgets::Concerts); @@ -367,7 +367,7 @@ void ConcertWidget::onDownloadProgress(Concert* concert, int current, int maximu void ConcertWidget::updateConcertInfo() { if (m_concert == nullptr) { - qWarning() << "[ConcertWidget] Concert is invalid; can't update"; + qCWarning(generic) << "[ConcertWidget] Concert is invalid; can't update"; return; } diff --git a/src/ui/export/ExportDialog.cpp b/src/ui/export/ExportDialog.cpp index ca05accdb4..a02704d418 100644 --- a/src/ui/export/ExportDialog.cpp +++ b/src/ui/export/ExportDialog.cpp @@ -4,8 +4,8 @@ #include "export/ExportTemplateLoader.h" #include "export/MediaExport.h" #include "globals/Manager.h" +#include "log/Log.h" -#include #include #include #include @@ -141,7 +141,7 @@ void ExportDialog::resetProgress() void ExportDialog::warnAboutInvalidTheme() { - qCritical() << "[ExportDialog] Internal Error: Couldn't find selected theme:" << themeName(); + qCCritical(generic) << "[ExportDialog] Internal Error: Couldn't find selected theme:" << themeName(); ui->message->setErrorMessage(tr("Selected theme not found! Try to restart MediaElch.")); } diff --git a/src/ui/imports/DownloadsWidget.cpp b/src/ui/imports/DownloadsWidget.cpp index af47021e61..c372be8389 100644 --- a/src/ui/imports/DownloadsWidget.cpp +++ b/src/ui/imports/DownloadsWidget.cpp @@ -347,7 +347,7 @@ void DownloadsWidget::onChangeImportType(int currentIndex) void DownloadsWidget::onChangeImportType(int currentIndex, QComboBox* box) { if (box == nullptr) { - qCritical() << "[DownloadsWidget] Import type change: Cannot get QComboBox from sender"; + qCCritical(generic) << "[DownloadsWidget] Import type change: Cannot get QComboBox from sender"; return; } @@ -370,7 +370,7 @@ void DownloadsWidget::onChangeImportType(int currentIndex, QComboBox* box) auto* detailBox = dynamic_cast(ui->tableImports->cellWidget(row, 4)); if (detailBox == nullptr) { - qCritical() << "[DownloadsWidget] Import type change: Cannot get QComboBox from download table"; + qCCritical(generic) << "[DownloadsWidget] Import type change: Cannot get QComboBox from download table"; return; } @@ -396,7 +396,7 @@ void DownloadsWidget::onChangeImportType(int currentIndex, QComboBox* box) auto* actions = dynamic_cast(ui->tableImports->cellWidget(row, 5)); if (actions == nullptr) { - qCritical() << "[DownloadsWidget] Import type change: Cannot get ImportActions from download table"; + qCCritical(generic) << "[DownloadsWidget] Import type change: Cannot get ImportActions from download table"; return; } diff --git a/src/ui/imports/ImportActions.cpp b/src/ui/imports/ImportActions.cpp index c28d394cc5..bb6c39428d 100644 --- a/src/ui/imports/ImportActions.cpp +++ b/src/ui/imports/ImportActions.cpp @@ -1,13 +1,13 @@ #include "ImportActions.h" #include "ui_ImportActions.h" -#include -#include - #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "ui/imports/ImportDialog.h" +#include + ImportActions::ImportActions(QWidget* parent) : QWidget(parent), ui(new Ui::ImportActions) { ui->setupUi(this); diff --git a/src/ui/imports/ImportDialog.cpp b/src/ui/imports/ImportDialog.cpp index 0f706c6da0..c0e3b3f9ae 100644 --- a/src/ui/imports/ImportDialog.cpp +++ b/src/ui/imports/ImportDialog.cpp @@ -431,7 +431,7 @@ void ImportDialog::onEpisodeLoadDone(TvShowEpisode* episode) void ImportDialog::onEpisodeDownloadFinished(DownloadManagerElement elem) { - qDebug() << "got image"; + qCDebug(generic) << "got image"; if (m_episode == nullptr) { return; } diff --git a/src/ui/imports/MakeMkvDialog.cpp b/src/ui/imports/MakeMkvDialog.cpp index 3cc5090807..5739a39606 100644 --- a/src/ui/imports/MakeMkvDialog.cpp +++ b/src/ui/imports/MakeMkvDialog.cpp @@ -1,16 +1,16 @@ #include "MakeMkvDialog.h" #include "ui_MakeMkvDialog.h" -#include -#include -#include - #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "renamer/RenamerDialog.h" #include "scrapers/movie/custom/CustomMovieScraper.h" #include "ui/notifications/Notificator.h" +#include +#include + MakeMkvDialog::MakeMkvDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MakeMkvDialog) { ui->setupUi(this); diff --git a/src/ui/main/MainWindow.cpp b/src/ui/main/MainWindow.cpp index 2177d1fdde..9d18c996cb 100644 --- a/src/ui/main/MainWindow.cpp +++ b/src/ui/main/MainWindow.cpp @@ -8,6 +8,7 @@ #include "globals/ImageDialog.h" #include "globals/ImagePreviewDialog.h" #include "globals/Manager.h" +#include "log/Log.h" #include "media_centers/MediaCenterInterface.h" #include "scrapers/movie/MovieScraper.h" #include "settings/Settings.h" @@ -25,7 +26,6 @@ #include "ui/notifications/Notificator.h" #include -#include #include #include #include @@ -358,7 +358,7 @@ void MainWindow::setupToolbar() */ void MainWindow::progressStarted(QString msg, int id) { - qDebug() << "Entered, msg=" << msg << "id=" << id; + qCDebug(generic) << "Entered, msg=" << msg << "id=" << id; NotificationBox::instance()->showProgressBar(msg, id); } @@ -423,7 +423,7 @@ void MainWindow::onActionSearch() */ void MainWindow::onActionSave() { - qDebug() << "Entered, currentIndex=" << ui->stackedWidget->currentIndex(); + qCDebug(generic) << "Entered, currentIndex=" << ui->stackedWidget->currentIndex(); switch (currentTab()) { case MainWidgets::Movies: ui->movieWidget->saveInformation(); break; @@ -784,7 +784,7 @@ MainWidgets MainWindow::currentTab() const if (currentWidget == ui->duplicatesPage) { return MainWidgets::Duplicates; } - qCritical() << "[MainWindow] Unknown tab is selected! Index:" << ui->stackedWidget->currentIndex(); + qCCritical(generic) << "[MainWindow] Unknown tab is selected! Index:" << ui->stackedWidget->currentIndex(); return MainWidgets::Movies; } @@ -855,7 +855,7 @@ void MainWindow::onMenu(QToolButton* button) // Duplicates widget = MainWidgets::Duplicates; break; - default: qWarning() << "Unhandled page in main window." << page; break; + default: qCWarning(generic) << "Unhandled page in main window." << page; break; } ui->navbar->setActionSearchEnabled(m_actions[widget][MainActions::Search]); diff --git a/src/ui/main/Message.cpp b/src/ui/main/Message.cpp index abdbbd3cf0..12af97c7c6 100644 --- a/src/ui/main/Message.cpp +++ b/src/ui/main/Message.cpp @@ -1,13 +1,13 @@ #include "Message.h" #include "ui_Message.h" -#include -#include - #include "globals/Globals.h" #include "globals/Helper.h" +#include "log/Log.h" #include "ui/notifications/NotificationBox.h" +#include + Message::Message(QWidget* parent) : QWidget(parent), ui(new Ui::Message) { ui->setupUi(this); @@ -113,7 +113,7 @@ void Message::setMessage(QString message, int timeout) */ void Message::timeout() { - qDebug() << "Entered, m_id=" << m_id; + qCDebug(generic) << "Entered, m_id=" << m_id; emit sigHideMessage(m_id); } diff --git a/src/ui/main/MyIconFont.cpp b/src/ui/main/MyIconFont.cpp index 1014be6f1b..7862cfb8f1 100644 --- a/src/ui/main/MyIconFont.cpp +++ b/src/ui/main/MyIconFont.cpp @@ -7,7 +7,8 @@ * It has been renamed and adjusted to match another font than FontAwesome */ -#include +#include "log/Log.h" + #include #include #include @@ -298,7 +299,7 @@ bool MyIconFont::initFontAwesome() // load the font file QFile res(":/fonts/Pe-icon-7-stroke.ttf"); if (!res.open(QIODevice::ReadOnly)) { - qDebug() << "Font awesome font could not be loaded!"; + qCDebug(generic) << "Font awesome font could not be loaded!"; return false; } QByteArray fontData(res.readAll()); @@ -312,7 +313,7 @@ bool MyIconFont::initFontAwesome() if (!loadedFontFamilies.isEmpty()) { fontName_ = loadedFontFamilies.at(0); } else { - qDebug() << "Font awesome font is empty?!"; + qCDebug(generic) << "Font awesome font is empty?!"; fontAwesomeFontId = -1; // restore the font-awesome id return false; } diff --git a/src/ui/main/Update.cpp b/src/ui/main/Update.cpp index eba9eadd08..58d0084ecd 100644 --- a/src/ui/main/Update.cpp +++ b/src/ui/main/Update.cpp @@ -41,11 +41,11 @@ void Update::onCheckFinished() { auto* reply = dynamic_cast(QObject::sender()); if (reply == nullptr) { - qCritical() << "[Updater] Dynamic Cast Failed"; + qCCritical(generic) << "[Updater] Dynamic Cast Failed"; } reply->deleteLater(); if (reply->error() != QNetworkReply::NoError) { - qWarning() << "[Updater] Network Error:" << reply->errorString(); + qCWarning(generic) << "[Updater] Network Error:" << reply->errorString(); return; } diff --git a/src/ui/media_centers/KodiSync.cpp b/src/ui/media_centers/KodiSync.cpp index 8511c9a810..18d016e4d8 100644 --- a/src/ui/media_centers/KodiSync.cpp +++ b/src/ui/media_centers/KodiSync.cpp @@ -232,7 +232,7 @@ void KodiSync::onMovieListFinished() { auto* reply = dynamic_cast(sender()); if (reply == nullptr) { - qDebug() << "invalid response received"; + qCDebug(generic) << "invalid response received"; return; } reply->deleteLater(); @@ -262,7 +262,7 @@ void KodiSync::onConcertListFinished() { auto* reply = dynamic_cast(sender()); if (reply == nullptr) { - qDebug() << "invalid response received"; + qCDebug(generic) << "invalid response received"; return; } reply->deleteLater(); @@ -292,7 +292,7 @@ void KodiSync::onTvShowListFinished() { auto* reply = dynamic_cast(sender()); if (reply == nullptr) { - qDebug() << "invalid response received"; + qCDebug(generic) << "invalid response received"; return; } reply->deleteLater(); @@ -322,7 +322,7 @@ void KodiSync::onEpisodeListFinished() { auto* reply = dynamic_cast(sender()); if (reply == nullptr) { - qDebug() << "invalid response received"; + qCDebug(generic) << "invalid response received"; return; } reply->deleteLater(); @@ -560,7 +560,7 @@ void KodiSync::updateWatched() movie->setLastPlayed(m_xbmcMovies.value(id).lastPlayed); movie->blockSignals(false); } else { - qDebug() << "Movie not found" << movie->name(); + qCDebug(generic) << "Movie not found" << movie->name(); } movie->setSyncNeeded(false); } @@ -573,7 +573,7 @@ void KodiSync::updateWatched() concert->setLastPlayed(m_xbmcConcerts.value(id).lastPlayed); concert->blockSignals(false); } else { - qDebug() << "Concert not found" << concert->title(); + qCDebug(generic) << "Concert not found" << concert->title(); } concert->setSyncNeeded(false); } @@ -586,7 +586,7 @@ void KodiSync::updateWatched() episode->setLastPlayed(m_xbmcEpisodes.value(id).lastPlayed); episode->blockSignals(false); } else { - qDebug() << "Episode not found" << episode->title(); + qCDebug(generic) << "Episode not found" << episode->title(); } episode->setSyncNeeded(false); } @@ -731,7 +731,7 @@ void KodiSync::updateFolderLastModified(const QDir& dir) if (!file.exists() && file.open(QIODevice::WriteOnly)) { file.close(); if (!file.remove()) { - qWarning() << "[KodiSync] Could not remove .update file in:" << dir.absolutePath(); + qCWarning(generic) << "[KodiSync] Could not remove .update file in:" << dir.absolutePath(); } } } diff --git a/src/ui/movie_sets/SetsWidget.cpp b/src/ui/movie_sets/SetsWidget.cpp index 9abedede7f..027abf3aad 100644 --- a/src/ui/movie_sets/SetsWidget.cpp +++ b/src/ui/movie_sets/SetsWidget.cpp @@ -1,20 +1,20 @@ #include "SetsWidget.h" #include "ui_SetsWidget.h" -#include -#include -#include - #include "globals/DownloadManager.h" #include "globals/Globals.h" #include "globals/Helper.h" #include "globals/ImageDialog.h" #include "globals/ImagePreviewDialog.h" #include "globals/Manager.h" +#include "log/Log.h" #include "movies/Movie.h" #include "ui/movie_sets/MovieListDialog.h" #include "ui/notifications/NotificationBox.h" +#include +#include + SetsWidget::SetsWidget(QWidget* parent) : QWidget(parent), ui(new Ui::SetsWidget) { ui->setupUi(this); @@ -165,7 +165,7 @@ void SetsWidget::loadSets() void SetsWidget::onSetSelected() { int row = ui->sets->currentRow(); - qDebug() << "row=" << row << "rowCount=" << ui->sets->rowCount(); + qCDebug(generic) << "row=" << row << "rowCount=" << ui->sets->rowCount(); if (row < 0 || row >= ui->sets->rowCount()) { clear(); return; @@ -196,7 +196,7 @@ void SetsWidget::clear() */ void SetsWidget::loadSet(QString set) { - qDebug() << "Entered, set=" << set; + qCDebug(generic) << "Entered, set=" << set; clear(); ui->setName->setText(set); ui->buttonPreviewBackdrop->setEnabled(false); @@ -277,9 +277,9 @@ void SetsWidget::loadSet(QString set) */ void SetsWidget::onSortTitleChanged(QTableWidgetItem* item) { - qDebug() << "Entered, item->row=" << item->row() << "rowCount=" << ui->movies->rowCount(); + qCDebug(generic) << "Entered, item->row=" << item->row() << "rowCount=" << ui->movies->rowCount(); if (item->row() < 0 || item->row() >= ui->movies->rowCount() || item->column() != 1) { - qDebug() << "Invalid row"; + qCDebug(generic) << "Invalid row"; return; } auto* movie = ui->movies->item(item->row(), 0)->data(Qt::UserRole).value(); @@ -297,7 +297,7 @@ void SetsWidget::onSortTitleChanged(QTableWidgetItem* item) void SetsWidget::onAddMovie() { if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qDebug() << "[SetsWidget] Invalid current row"; + qCDebug(generic) << "[SetsWidget] Invalid current row"; return; } @@ -338,11 +338,11 @@ void SetsWidget::onAddMovie() void SetsWidget::onRemoveMovie() { if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qDebug() << "Invalid current row in sets"; + qCDebug(generic) << "Invalid current row in sets"; return; } if (ui->movies->currentRow() < 0 || ui->movies->currentRow() >= ui->movies->rowCount()) { - qDebug() << "Invalid current row in movies"; + qCDebug(generic) << "Invalid current row in movies"; return; } auto* movie = ui->movies->item(ui->movies->currentRow(), 0)->data(Qt::UserRole).value(); @@ -361,7 +361,7 @@ void SetsWidget::onRemoveMovie() void SetsWidget::chooseSetPoster() { if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qDebug() << "[SetsWidget] Invalid current row in sets"; + qCDebug(generic) << "[SetsWidget] Invalid current row in sets"; return; } @@ -395,7 +395,7 @@ void SetsWidget::chooseSetPoster() void SetsWidget::chooseSetBackdrop() { if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qDebug() << "Invalid current row in sets"; + qCDebug(generic) << "Invalid current row in sets"; return; } @@ -429,7 +429,7 @@ void SetsWidget::chooseSetBackdrop() void SetsWidget::saveSet() { if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qDebug() << "Invalid current row in sets"; + qCDebug(generic) << "Invalid current row in sets"; return; } @@ -523,7 +523,7 @@ void SetsWidget::onRemoveMovieSet() { m_tableContextMenu->close(); if (ui->sets->currentRow() < 0 || ui->sets->currentRow() >= ui->sets->rowCount()) { - qWarning() << "Invalid row" << ui->sets->currentRow(); + qCWarning(generic) << "Invalid row" << ui->sets->currentRow(); return; } diff --git a/src/ui/movies/CertificationWidget.cpp b/src/ui/movies/CertificationWidget.cpp index 6fcbad1413..7c74d80159 100644 --- a/src/ui/movies/CertificationWidget.cpp +++ b/src/ui/movies/CertificationWidget.cpp @@ -124,7 +124,7 @@ void CertificationWidget::loadCertifications() void CertificationWidget::onCertificationSelected() { if (ui->certifications->currentRow() < 0 || ui->certifications->currentRow() >= ui->certifications->rowCount()) { - qWarning() << "Invalid row" << ui->certifications->currentRow(); + qCWarning(generic) << "Invalid row" << ui->certifications->currentRow(); return; } @@ -218,7 +218,7 @@ void CertificationWidget::deleteCertification() { m_tableContextMenu->close(); if (ui->certifications->currentRow() < 0 || ui->certifications->currentRow() >= ui->certifications->rowCount()) { - qWarning() << "Invalid row" << ui->certifications->currentRow(); + qCWarning(generic) << "Invalid row" << ui->certifications->currentRow(); return; } @@ -240,11 +240,11 @@ void CertificationWidget::deleteCertification() void CertificationWidget::removeMovie() { if (ui->movies->currentRow() < 0 || ui->movies->currentRow() >= ui->movies->rowCount()) { - qWarning() << "Invalid row" << ui->movies->currentRow(); + qCWarning(generic) << "Invalid row" << ui->movies->currentRow(); return; } if (ui->certifications->currentRow() < 0 || ui->certifications->currentRow() >= ui->certifications->rowCount()) { - qWarning() << "Invalid certifications row" << ui->certifications->currentRow(); + qCWarning(generic) << "Invalid certifications row" << ui->certifications->currentRow(); return; } @@ -256,7 +256,7 @@ void CertificationWidget::removeMovie() void CertificationWidget::addMovie() { if (ui->certifications->currentRow() < 0 || ui->certifications->currentRow() >= ui->certifications->rowCount()) { - qWarning() << "Invalid certification row" << ui->certifications->currentRow(); + qCWarning(generic) << "Invalid certification row" << ui->certifications->currentRow(); return; } diff --git a/src/ui/movies/GenreWidget.cpp b/src/ui/movies/GenreWidget.cpp index 59a97bb0d9..a07c957d39 100644 --- a/src/ui/movies/GenreWidget.cpp +++ b/src/ui/movies/GenreWidget.cpp @@ -121,7 +121,7 @@ void GenreWidget::loadGenres() void GenreWidget::onGenreSelected() { if (ui->genres->currentRow() < 0 || ui->genres->currentRow() >= ui->genres->rowCount()) { - qWarning() << "Invalid row" << ui->genres->currentRow(); + qCWarning(generic) << "Invalid row" << ui->genres->currentRow(); return; } @@ -215,7 +215,7 @@ void GenreWidget::deleteGenre() { m_tableContextMenu->close(); if (ui->genres->currentRow() < 0 || ui->genres->currentRow() >= ui->genres->rowCount()) { - qWarning() << "Invalid row" << ui->genres->currentRow(); + qCWarning(generic) << "Invalid row" << ui->genres->currentRow(); return; } @@ -238,11 +238,11 @@ void GenreWidget::deleteGenre() void GenreWidget::removeMovie() { if (ui->movies->currentRow() < 0 || ui->movies->currentRow() >= ui->movies->rowCount()) { - qWarning() << "Invalid row" << ui->movies->currentRow(); + qCWarning(generic) << "Invalid row" << ui->movies->currentRow(); return; } if (ui->genres->currentRow() < 0 || ui->genres->currentRow() >= ui->genres->rowCount()) { - qWarning() << "Invalid genre row" << ui->genres->currentRow(); + qCWarning(generic) << "Invalid genre row" << ui->genres->currentRow(); return; } @@ -255,7 +255,7 @@ void GenreWidget::removeMovie() void GenreWidget::addMovie() { if (ui->genres->currentRow() < 0 || ui->genres->currentRow() >= ui->genres->rowCount()) { - qWarning() << "[GenreWidget] Invalid genre row" << ui->genres->currentRow(); + qCWarning(generic) << "[GenreWidget] Invalid genre row" << ui->genres->currentRow(); return; } diff --git a/src/ui/movies/MovieDuplicateItem.cpp b/src/ui/movies/MovieDuplicateItem.cpp index b1a2182e93..9ab3b2d8c5 100644 --- a/src/ui/movies/MovieDuplicateItem.cpp +++ b/src/ui/movies/MovieDuplicateItem.cpp @@ -4,7 +4,7 @@ #include "globals/Manager.h" #include "movies/Movie.h" -#include +#include "log/Log.h" MovieDuplicateItem::MovieDuplicateItem(QWidget* parent) : QWidget(parent), ui(new Ui::MovieDuplicateItem) { diff --git a/src/ui/movies/MovieDuplicates.cpp b/src/ui/movies/MovieDuplicates.cpp index eff2eb1146..0c0918f97c 100644 --- a/src/ui/movies/MovieDuplicates.cpp +++ b/src/ui/movies/MovieDuplicates.cpp @@ -4,12 +4,12 @@ #include "globals/Helper.h" #include "globals/Manager.h" #include "globals/MessageIds.h" +#include "log/Log.h" #include "movies/Movie.h" #include "movies/MovieProxyModel.h" #include "ui/movies/MovieDuplicateItem.h" #include "ui/notifications/NotificationBox.h" -#include #include #include @@ -64,7 +64,7 @@ MovieDuplicates::~MovieDuplicates() void MovieDuplicates::detectDuplicates() { - qDebug() << "Detecting duplicates"; + qCDebug(generic) << "Detecting duplicates"; ui->duplicates->clear(); ui->duplicates->setRowCount(0); diff --git a/src/ui/movies/MovieFilesWidget.cpp b/src/ui/movies/MovieFilesWidget.cpp index 43f5d732fc..a29af52b18 100644 --- a/src/ui/movies/MovieFilesWidget.cpp +++ b/src/ui/movies/MovieFilesWidget.cpp @@ -311,7 +311,7 @@ void MovieFilesWidget::openNfoFile() void MovieFilesWidget::itemActivated(QModelIndex index, QModelIndex previous) { if (!index.isValid()) { - qDebug() << "[MovieFilesWidget] Index is invalid"; + qCDebug(generic) << "[MovieFilesWidget] Index is invalid"; m_lastMovie = nullptr; emit noMovieSelected(); return; diff --git a/src/ui/movies/MovieMultiScrapeDialog.cpp b/src/ui/movies/MovieMultiScrapeDialog.cpp index daf6fd6a47..df738e5eb0 100644 --- a/src/ui/movies/MovieMultiScrapeDialog.cpp +++ b/src/ui/movies/MovieMultiScrapeDialog.cpp @@ -300,13 +300,14 @@ void MovieMultiScrapeDialog::onSearchFinished(mediaelch::scraper::MovieSearchJob if (m_scraperInterface->meta().identifier == CustomMovieScraper::ID) { if (!searchJob->property("scraper").isValid()) { - qCritical() << "[MovieMultiScraperDialog] Could not get scraper from search job! Invalid QVariant"; + qCCritical(generic) << "[MovieMultiScraperDialog] Could not get scraper from search job! Invalid QVariant"; scrapeNext(); return; } auto* scraper = searchJob->property("scraper").value(); if (scraper == nullptr) { - qCritical() << "[MovieMultiScraperDialog] Could not get scraper from search job! Scraper is nullptr"; + qCCritical(generic) + << "[MovieMultiScraperDialog] Could not get scraper from search job! Scraper is nullptr"; scrapeNext(); return; } diff --git a/src/ui/movies/MovieSearch.cpp b/src/ui/movies/MovieSearch.cpp index a41a03c384..ff3aed879b 100644 --- a/src/ui/movies/MovieSearch.cpp +++ b/src/ui/movies/MovieSearch.cpp @@ -3,7 +3,7 @@ #include "scrapers/movie/MovieScraper.h" -#include +#include "log/Log.h" MovieSearch::MovieSearch(QWidget* parent) : QDialog(parent), ui(new Ui::MovieSearch) { @@ -31,7 +31,7 @@ MovieSearch::~MovieSearch() */ int MovieSearch::execWithSearch(QString searchString, ImdbId id, TmdbId tmdbId) { - qDebug() << "[MovieSearch] Open window"; + qCDebug(generic) << "[MovieSearch] Open window"; QSize newSize; newSize.setHeight(parentWidget()->size().height() - 200); newSize.setWidth(qMin(600, parentWidget()->size().width() - 400)); diff --git a/src/ui/movies/MovieSearchWidget.cpp b/src/ui/movies/MovieSearchWidget.cpp index e3df905512..15e4a2754d 100644 --- a/src/ui/movies/MovieSearchWidget.cpp +++ b/src/ui/movies/MovieSearchWidget.cpp @@ -10,7 +10,7 @@ #include "scrapers/movie/tmdb/TmdbMovie.h" #include "settings/Settings.h" -#include +#include "log/Log.h" MovieSearchWidget::MovieSearchWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MovieSearchWidget) { @@ -71,7 +71,7 @@ void MovieSearchWidget::startSearch() { using namespace mediaelch::scraper; if (m_currentScraper == nullptr) { - qWarning() << "Tried to search for movie without active scraper!"; + qCWarning(generic) << "Tried to search for movie without active scraper!"; showError(tr("Cannot scrape a movie without an active scraper!")); return; } @@ -147,7 +147,7 @@ void MovieSearchWidget::setupLanguageDropdown() { if (m_currentScraper == nullptr) { ui->comboLanguage->setInvalid(); - qCritical() << "[MovieSearchWidget] Cannot set language dropdown in movie search widget"; + qCCritical(generic) << "[MovieSearchWidget] Cannot set language dropdown in movie search widget"; showError(tr("Internal inconsistency: Cannot set language dropdown in movie search widget!")); return; } @@ -165,11 +165,11 @@ void MovieSearchWidget::showResults(mediaelch::scraper::MovieSearchJob* searchJo using namespace mediaelch::scraper; auto dls = makeDeleteLaterScope(searchJob); if (searchJob->hasError()) { - qDebug() << "[Search Results] Error" << searchJob->error().technical; + qCDebug(generic) << "[Search Results] Error" << searchJob->error().technical; showError(searchJob->error().message); } else { - qDebug() << "[Search Results] Count: " << searchJob->results().size(); + qCDebug(generic) << "[Search Results] Count: " << searchJob->results().size(); showSuccess(tr("Found %n results", "", searchJob->results().size())); } @@ -304,7 +304,7 @@ void MovieSearchWidget::onScraperChanged() { int index = ui->comboScraper->currentIndex(); if (index < 0 || index >= Manager::instance()->scrapers().movieScrapers().size()) { - qCritical() << "[Movie Search] Selected invalid scraper:" << index; + qCCritical(generic) << "[Movie Search] Selected invalid scraper:" << index; showError(tr("Internal inconsistency: Selected an invalid scraper!")); return; } diff --git a/src/ui/movies/MovieWidget.cpp b/src/ui/movies/MovieWidget.cpp index c0addaf37c..11b44c4601 100644 --- a/src/ui/movies/MovieWidget.cpp +++ b/src/ui/movies/MovieWidget.cpp @@ -328,10 +328,10 @@ void MovieWidget::movieNameChanged(QString text) void MovieWidget::setEnabledTrue(Movie* movie) { if (movie != nullptr) { - qDebug() << movie->name(); + qCDebug(generic) << movie->name(); } if ((movie != nullptr) && movie->controller()->downloadsInProgress()) { - qDebug() << "Downloads are in progress"; + qCDebug(generic) << "Downloads are in progress"; return; } ui->groupBox_3->setEnabled(true); @@ -356,7 +356,7 @@ void MovieWidget::setDisabledTrue() void MovieWidget::setMovie(Movie* movie) { using namespace std::chrono; - qDebug() << "Entered, movie=" << movie->name(); + qCDebug(generic) << "Entered, movie=" << movie->name(); movie->controller()->loadData(Manager::instance()->mediaCenterInterface()); if (!movie->streamDetailsLoaded() && Settings::instance()->autoLoadStreamDetails()) { movie->controller()->loadStreamDetailsFromFile(); @@ -415,7 +415,7 @@ void MovieWidget::startScraperSearch() using namespace mediaelch::scraper; if (m_movie == nullptr) { - qDebug() << "My movie is invalid"; + qCDebug(generic) << "My movie is invalid"; return; } @@ -875,7 +875,7 @@ void MovieWidget::onPlayLocalTrailer() void MovieWidget::saveInformation() { - qDebug() << "[Movie] Save movie"; + qCDebug(generic) << "[Movie] Save movie"; setDisabledTrue(); QVector movies = MovieFilesWidget::instance()->selectedMovies(); @@ -924,7 +924,7 @@ void MovieWidget::saveInformation() */ void MovieWidget::saveAll() { - qDebug() << "[Movies] Save all movies"; + qCDebug(generic) << "[Movies] Save all movies"; setDisabledTrue(); m_savingWidget->show(); @@ -1488,8 +1488,8 @@ void MovieWidget::onCaptureImage(ImageType type) return; } if (type != ImageType::MoviePoster && type != ImageType::MovieBackdrop) { - qWarning() << "[MovieWidget] Screenshot capturing only supported for movie posters and backdrops!" - "Please report this inconsistency."; + qCWarning(generic) << "[MovieWidget] Screenshot capturing only supported for movie posters and backdrops!" + "Please report this inconsistency."; return; } diff --git a/src/ui/music/MusicFilesWidget.cpp b/src/ui/music/MusicFilesWidget.cpp index 1a190e9373..ba2fb7b606 100644 --- a/src/ui/music/MusicFilesWidget.cpp +++ b/src/ui/music/MusicFilesWidget.cpp @@ -1,11 +1,11 @@ #include "MusicFilesWidget.h" #include "ui_MusicFilesWidget.h" -#include #include #include "MusicMultiScrapeDialog.h" #include "globals/Manager.h" +#include "log/Log.h" MusicFilesWidget* MusicFilesWidget::m_instance; diff --git a/src/ui/music/MusicSearchWidget.cpp b/src/ui/music/MusicSearchWidget.cpp index 9985636e0b..ef08684a2c 100644 --- a/src/ui/music/MusicSearchWidget.cpp +++ b/src/ui/music/MusicSearchWidget.cpp @@ -2,9 +2,9 @@ #include "ui_MusicSearchWidget.h" #include "globals/Manager.h" +#include "log/Log.h" #include "scrapers/music/MusicScraper.h" #include "ui/small_widgets/MyLabel.h" -#include MusicSearchWidget::MusicSearchWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MusicSearchWidget) { diff --git a/src/ui/music/MusicWidget.cpp b/src/ui/music/MusicWidget.cpp index 2dd5454a36..35d7348482 100644 --- a/src/ui/music/MusicWidget.cpp +++ b/src/ui/music/MusicWidget.cpp @@ -7,7 +7,7 @@ #include "music/Artist.h" #include "ui/notifications/NotificationBox.h" -#include +#include "log/Log.h" MusicWidget::MusicWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MusicWidget) { diff --git a/src/ui/notifications/MacNotificationHandler.mm b/src/ui/notifications/MacNotificationHandler.mm index 9fd3b6a474..7550a9d570 100644 --- a/src/ui/notifications/MacNotificationHandler.mm +++ b/src/ui/notifications/MacNotificationHandler.mm @@ -2,7 +2,7 @@ #undef slots #include -#include +#include "log/Log.h" void MacNotificationHandler::showNotification(const QString &title, const QString &text) { diff --git a/src/ui/notifications/NotificationBox.cpp b/src/ui/notifications/NotificationBox.cpp index 41fff12c5b..08a3ae5ad1 100644 --- a/src/ui/notifications/NotificationBox.cpp +++ b/src/ui/notifications/NotificationBox.cpp @@ -1,7 +1,8 @@ #include "ui/notifications/NotificationBox.h" #include "ui_NotificationBox.h" -#include +#include "log/Log.h" + #include NotificationBox::NotificationBox(QWidget* parent) : QWidget(parent), ui(new Ui::NotificationBox) @@ -70,7 +71,7 @@ int NotificationBox::showMessage(QString message, NotificationType type, std::ch void NotificationBox::removeMessage(int id) { - qDebug() << "[NotificationBox] Removing message with ID:" << id; + qCDebug(generic) << "[NotificationBox] Removing message with ID:" << id; for (int i = 0; i < m_messages.count();) { auto* msg = m_messages[i]; if (msg->id() == id) { @@ -103,7 +104,7 @@ void NotificationBox::removeMessage(int id) */ void NotificationBox::showProgressBar(QString message, int id, bool unique) { - qDebug() << "Entered, message=" << message << "id=" << id; + qCDebug(generic) << "Entered, message=" << message << "id=" << id; if (unique) { for (Message* msg : m_messages) { if (msg->id() == id) { @@ -152,7 +153,7 @@ void NotificationBox::progressBarProgress(int current, int max, int id) */ void NotificationBox::hideProgressBar(int id) { - qDebug() << "[NotificationBox] Hide Progress bar with id" << id; + qCDebug(generic) << "[NotificationBox] Hide Progress bar with id" << id; removeMessage(id); } diff --git a/src/ui/settings/CustomTvScraperSettingsWidget.cpp b/src/ui/settings/CustomTvScraperSettingsWidget.cpp index 60cf3a258f..e44aeef9ee 100644 --- a/src/ui/settings/CustomTvScraperSettingsWidget.cpp +++ b/src/ui/settings/CustomTvScraperSettingsWidget.cpp @@ -135,7 +135,7 @@ QComboBox* CustomTvScraperSettingsWidget::comboForTvScraperInfo(ShowScraperInfo auto* scraper = Manager::instance()->scrapers().tvScraper(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomTvScraperSettingsWidget] Could not get scraper with ID:" << scraperId; + qCCritical(generic) << "[CustomTvScraperSettingsWidget] Could not get scraper with ID:" << scraperId; } else if (scraper->meta().supportedShowDetails.contains(info)) { box->addItem(scraper->meta().name, scraperId); @@ -169,7 +169,7 @@ QComboBox* CustomTvScraperSettingsWidget::comboForEpisodeInfo(EpisodeScraperInfo auto* scraper = Manager::instance()->scrapers().tvScraper(scraperId); if (scraper == nullptr) { - qCritical() << "[CustomTvScraperSettingsWidget] Could not get scraper with ID:" << scraperId; + qCCritical(generic) << "[CustomTvScraperSettingsWidget] Could not get scraper with ID:" << scraperId; } else if (scraper->meta().supportedEpisodeDetails.contains(info)) { box->addItem(scraper->meta().name, scraper->meta().identifier); diff --git a/src/ui/settings/KodiSettingsWidget.cpp b/src/ui/settings/KodiSettingsWidget.cpp index 04655971c0..6ea5d864cc 100644 --- a/src/ui/settings/KodiSettingsWidget.cpp +++ b/src/ui/settings/KodiSettingsWidget.cpp @@ -56,7 +56,7 @@ void KodiSettingsWidget::loadSettings() if (index != -1) { ui->kodiVersion->setCurrentIndex(index); } else { - qWarning() << "[KodiSettings] The GUI doesn't provide an entry for" << version << "; this is a bug"; + qCWarning(generic) << "[KodiSettings] The GUI doesn't provide an entry for" << version << "; this is a bug"; } } @@ -71,6 +71,6 @@ void KodiSettingsWidget::saveSettings() if (KodiVersion::isValid(version)) { m_settings->kodiSettings().setKodiVersion(KodiVersion(version)); } else { - qWarning() << "[KodiSettings] Selected invalid Kodi version. The GUI shouldn't allow that."; + qCWarning(generic) << "[KodiSettings] Selected invalid Kodi version. The GUI shouldn't allow that."; } } diff --git a/src/ui/settings/SettingsWindow.cpp b/src/ui/settings/SettingsWindow.cpp index a42cc13abe..55b165b059 100644 --- a/src/ui/settings/SettingsWindow.cpp +++ b/src/ui/settings/SettingsWindow.cpp @@ -1,16 +1,16 @@ #include "SettingsWindow.h" #include "ui_SettingsWindow.h" -#include -#include - #include "globals/Globals.h" #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "settings/DataFile.h" #include "settings/Settings.h" #include "ui/notifications/NotificationBox.h" +#include + SettingsWindow::SettingsWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::SettingsWindow), diff --git a/src/ui/settings/TvScraperSettingsWidget.cpp b/src/ui/settings/TvScraperSettingsWidget.cpp index fd8ebf49be..9e30462bc1 100644 --- a/src/ui/settings/TvScraperSettingsWidget.cpp +++ b/src/ui/settings/TvScraperSettingsWidget.cpp @@ -46,7 +46,8 @@ void TvScraperSettingsWidget::loadSettings() if (m_settings == nullptr) { ui->tvScraperList->blockSignals(false); - qCritical() << "[TvScraperSettingsWidget] Cannot set up TV scraper widget because settings are undefined."; + qCCritical(generic) + << "[TvScraperSettingsWidget] Cannot set up TV scraper widget because settings are undefined."; return; } @@ -81,7 +82,7 @@ void TvScraperSettingsWidget::scraperChanged(QListWidgetItem* current, QListWidg m_currentScraper = scraper; setupScraperDetails(); } else { - qCritical() << "[TvScraperSettingsWidget] Could not load scraper for settings!"; + qCCritical(generic) << "[TvScraperSettingsWidget] Could not load scraper for settings!"; } } @@ -116,7 +117,7 @@ void TvScraperSettingsWidget::setupLanguageBox() { if (m_currentScraper == nullptr) { ui->comboLanguage->setInvalid(); - qCritical() << "[TvScraperSettingsWidget] Cannot set language dropdown in TV show search widget"; + qCCritical(generic) << "[TvScraperSettingsWidget] Cannot set language dropdown in TV show search widget"; return; } diff --git a/src/ui/small_widgets/AlphabeticalList.cpp b/src/ui/small_widgets/AlphabeticalList.cpp index eb3487ebb3..bc0c98bf18 100644 --- a/src/ui/small_widgets/AlphabeticalList.cpp +++ b/src/ui/small_widgets/AlphabeticalList.cpp @@ -1,6 +1,7 @@ #include "AlphabeticalList.h" -#include +#include "log/Log.h" + #include #include #include diff --git a/src/ui/small_widgets/ClosableImage.cpp b/src/ui/small_widgets/ClosableImage.cpp index df3bfe94e4..88c58ca682 100644 --- a/src/ui/small_widgets/ClosableImage.cpp +++ b/src/ui/small_widgets/ClosableImage.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include "data/ImageCache.h" #include "globals/Helper.h" #include "globals/ImagePreviewDialog.h" +#include "log/Log.h" #include "settings/Settings.h" ClosableImage::ClosableImage(QWidget* parent) : QLabel(parent) diff --git a/src/ui/small_widgets/ImageGallery.cpp b/src/ui/small_widgets/ImageGallery.cpp index c269c2462b..32c13b0a15 100644 --- a/src/ui/small_widgets/ImageGallery.cpp +++ b/src/ui/small_widgets/ImageGallery.cpp @@ -1,6 +1,5 @@ #include "ImageGallery.h" -#include #include #include #include @@ -8,6 +7,7 @@ #include #include "globals/ImagePreviewDialog.h" +#include "log/Log.h" #include "settings/Settings.h" ImageGallery::ImageGallery(QWidget* parent) : @@ -205,7 +205,7 @@ void ImageGallery::onCloseImage() { auto* label = dynamic_cast(QObject::sender()); if (label == nullptr) { - qCritical() << "[ImageGallery] Dynamic cast failed for ClosableImage"; + qCCritical(generic) << "[ImageGallery] Dynamic cast failed for ClosableImage"; return; } label->hide(); diff --git a/src/ui/small_widgets/LanguageCombo.cpp b/src/ui/small_widgets/LanguageCombo.cpp index bd3731371d..4cceac8c82 100644 --- a/src/ui/small_widgets/LanguageCombo.cpp +++ b/src/ui/small_widgets/LanguageCombo.cpp @@ -2,7 +2,7 @@ #include "globals/Meta.h" -#include +#include "log/Log.h" static QString LANG_INVALID_STATE = QStringLiteral("error"); @@ -22,7 +22,7 @@ void LanguageCombo::setupLanguages(const QVector& locales, co } const int index = findData(selected.toString(), Qt::UserRole); if (index < 0) { - qWarning() << "[LanguageCombo] Selected language not found in provided languages:" << selected; + qCWarning(generic) << "[LanguageCombo] Selected language not found in provided languages:" << selected; } setCurrentIndex(index > 0 ? index : 0); // If only one language is available, "make it grey" diff --git a/src/ui/small_widgets/MediaFlags.cpp b/src/ui/small_widgets/MediaFlags.cpp index 25e9893712..b258e5b45b 100644 --- a/src/ui/small_widgets/MediaFlags.cpp +++ b/src/ui/small_widgets/MediaFlags.cpp @@ -1,10 +1,10 @@ #include "MediaFlags.h" #include "ui_MediaFlags.h" -#include #include #include "globals/Helper.h" +#include "log/Log.h" MediaFlags::MediaFlags(QWidget* parent) : QWidget(parent), ui(new Ui::MediaFlags) { diff --git a/src/ui/small_widgets/MusicTreeView.cpp b/src/ui/small_widgets/MusicTreeView.cpp index 434ce490ec..1700358c5c 100644 --- a/src/ui/small_widgets/MusicTreeView.cpp +++ b/src/ui/small_widgets/MusicTreeView.cpp @@ -1,6 +1,6 @@ #include "MusicTreeView.h" -#include +#include "log/Log.h" #include "globals/Globals.h" #include "globals/Manager.h" diff --git a/src/ui/small_widgets/MyLineEdit.cpp b/src/ui/small_widgets/MyLineEdit.cpp index 9d7bb7744c..f071a2943b 100644 --- a/src/ui/small_widgets/MyLineEdit.cpp +++ b/src/ui/small_widgets/MyLineEdit.cpp @@ -1,6 +1,5 @@ #include "MyLineEdit.h" -#include #include #include #include @@ -8,6 +7,7 @@ #include "globals/Globals.h" #include "globals/Helper.h" +#include "log/Log.h" /** * \brief MyLineEdit::MyLineEdit diff --git a/src/ui/small_widgets/MyTableView.cpp b/src/ui/small_widgets/MyTableView.cpp index 65a4139696..9208763fac 100644 --- a/src/ui/small_widgets/MyTableView.cpp +++ b/src/ui/small_widgets/MyTableView.cpp @@ -1,6 +1,6 @@ #include "MyTableView.h" -#include +#include "log/Log.h" MyTableView::MyTableView(QWidget* parent) : QTableView(parent), m_searchOverlay{new SearchOverlay(this)} { diff --git a/src/ui/small_widgets/MyTableWidget.cpp b/src/ui/small_widgets/MyTableWidget.cpp index 9d2fdc0728..c00e4d126e 100644 --- a/src/ui/small_widgets/MyTableWidget.cpp +++ b/src/ui/small_widgets/MyTableWidget.cpp @@ -1,9 +1,9 @@ #include "MyTableWidget.h" -#include #include #include "globals/Globals.h" +#include "log/Log.h" MyTableWidget::MyTableWidget(QWidget* parent) : QTableWidget(parent) { diff --git a/src/ui/small_widgets/MyTableWidgetItem.cpp b/src/ui/small_widgets/MyTableWidgetItem.cpp index ee5d04dade..cc07add848 100644 --- a/src/ui/small_widgets/MyTableWidgetItem.cpp +++ b/src/ui/small_widgets/MyTableWidgetItem.cpp @@ -1,6 +1,6 @@ #include "MyTableWidgetItem.h" -#include +#include "log/Log.h" #include "globals/Helper.h" #include "settings/Settings.h" diff --git a/src/ui/small_widgets/RatingsWidget.cpp b/src/ui/small_widgets/RatingsWidget.cpp index edb56a06c7..aad5be57a9 100644 --- a/src/ui/small_widgets/RatingsWidget.cpp +++ b/src/ui/small_widgets/RatingsWidget.cpp @@ -5,7 +5,7 @@ #include "ui/small_widgets/RatingSourceDelegate.h" #include "ui/small_widgets/SpinBoxDelegate.h" -#include +#include "log/Log.h" RatingsWidget::RatingsWidget(QWidget* parent) : QWidget(parent), ui(new Ui::RatingsWidget) { diff --git a/src/ui/small_widgets/TagCloud.cpp b/src/ui/small_widgets/TagCloud.cpp index cbf54b51ce..5fe8f35a6d 100644 --- a/src/ui/small_widgets/TagCloud.cpp +++ b/src/ui/small_widgets/TagCloud.cpp @@ -1,7 +1,7 @@ #include "TagCloud.h" #include "ui_TagCloud.h" -#include +#include "log/Log.h" #include "Badge.h" #include "globals/LocaleStringCompare.h" diff --git a/src/ui/small_widgets/TvShowTreeView.cpp b/src/ui/small_widgets/TvShowTreeView.cpp index db44fcac43..0dcf56fcbc 100644 --- a/src/ui/small_widgets/TvShowTreeView.cpp +++ b/src/ui/small_widgets/TvShowTreeView.cpp @@ -2,8 +2,8 @@ #include "globals/Globals.h" #include "globals/Manager.h" +#include "log/Log.h" -#include #include TvShowTreeView::TvShowTreeView(QWidget* parent) : diff --git a/src/ui/tv_show/TvShowCommonWidgets.cpp b/src/ui/tv_show/TvShowCommonWidgets.cpp index 1e29c2bfb1..b12886a2d4 100644 --- a/src/ui/tv_show/TvShowCommonWidgets.cpp +++ b/src/ui/tv_show/TvShowCommonWidgets.cpp @@ -66,7 +66,7 @@ SeasonOrder TvShowCommonWidgets::setupSeasonOrderComboBox(const mediaelch::scrap comboSeasonOrder->setCurrentIndex(index); } else { defaultSeasonOrder = SeasonOrder::Aired; - qCritical() << "[TvShowSearch] Couldn't find season order element in combo box"; + qCCritical(generic) << "[TvShowSearch] Couldn't find season order element in combo box"; } comboSeasonOrder->blockSignals(blocked); diff --git a/src/ui/tv_show/TvShowFilesWidget.cpp b/src/ui/tv_show/TvShowFilesWidget.cpp index 1aac85f43e..32f2862dc3 100644 --- a/src/ui/tv_show/TvShowFilesWidget.cpp +++ b/src/ui/tv_show/TvShowFilesWidget.cpp @@ -2,12 +2,12 @@ #include "ui_TvShowFilesWidget.h" #include -#include #include #include #include "globals/Globals.h" #include "globals/Manager.h" +#include "log/Log.h" #include "tv_shows/TvShowUpdater.h" #include "tv_shows/model/EpisodeModelItem.h" #include "tv_shows/model/SeasonModelItem.h" @@ -380,7 +380,7 @@ void TvShowFilesWidget::openFolder() return fi.absolutePath(); } } - qCritical() << "[TvShowFilesWidget] Unhandled case"; + qCCritical(generic) << "[TvShowFilesWidget] Unhandled case"; return QString{}; }(); @@ -499,7 +499,7 @@ void TvShowFilesWidget::setFilter(const QVector& filters, QString text) /// \brief Renews the model (necessary after searching for TV shows) void TvShowFilesWidget::renewModel(bool force) { - qDebug() << "[TvShowFilesWidget] Renewing model | Forced:" << force; + qCDebug(generic) << "[TvShowFilesWidget] Renewing model | Forced:" << force; if (!force) { // When not forced, just update the view. @@ -537,7 +537,7 @@ void TvShowFilesWidget::onItemSelected(const QModelIndex& current, const QModelI return; } - qDebug() << "[TvShowFilesWidget] Selected item at row" << current.row() << "and column" << current.column(); + qCDebug(generic) << "[TvShowFilesWidget] Selected item at row" << current.row() << "and column" << current.column(); const QModelIndex sourceIndex = m_tvShowProxyModel->mapToSource(current); m_lastItem = &Manager::instance()->tvShowModel()->getItem(sourceIndex); @@ -548,7 +548,7 @@ void TvShowFilesWidget::onItemSelected(const QModelIndex& current, const QModelI void TvShowFilesWidget::emitLastSelection() { if (m_lastItem == nullptr) { - qWarning() << "[TvShowFilesWidget] Can't emit last selection without selected item!"; + qCWarning(generic) << "[TvShowFilesWidget] Can't emit last selection without selected item!"; return; } const auto showType = m_lastItem->type(); @@ -699,12 +699,12 @@ void TvShowFilesWidget::multiScrape() QVector episodes = selectedEpisodes(false); if (shows.isEmpty() && episodes.isEmpty()) { - qDebug() << "[TvShowFilesWidget] Multi Scrape: Nothing selected"; + qCDebug(generic) << "[TvShowFilesWidget] Multi Scrape: Nothing selected"; return; } - qDebug() << "[TvShowFilesWidget] Multi Scrape: Selected" << shows.count() << "shows and" << episodes.count() - << "episodes"; + qCDebug(generic) << "[TvShowFilesWidget] Multi Scrape: Selected" << shows.count() << "shows and" << episodes.count() + << "episodes"; if (shows.count() + episodes.count() == 1) { emit sigStartSearch(); return; diff --git a/src/ui/tv_show/TvShowMultiScrapeDialog.cpp b/src/ui/tv_show/TvShowMultiScrapeDialog.cpp index 29b22e32db..745a81fdc5 100644 --- a/src/ui/tv_show/TvShowMultiScrapeDialog.cpp +++ b/src/ui/tv_show/TvShowMultiScrapeDialog.cpp @@ -4,6 +4,7 @@ #include "data/ImageCache.h" #include "globals/Helper.h" #include "globals/Manager.h" +#include "log/Log.h" #include "scrapers/tv_show/TvScraper.h" #include "scrapers/tv_show/custom/CustomTvScraper.h" #include "scrapers/tv_show/imdb/ImdbTv.h" @@ -12,7 +13,6 @@ #include "scrapers/tv_show/tvmaze/TvMaze.h" #include "ui/tv_show/TvShowCommonWidgets.h" -#include #include using namespace mediaelch; @@ -310,7 +310,7 @@ void TvShowMultiScrapeDialog::onStartScraping() void TvShowMultiScrapeDialog::scrapeNext() { - qDebug() << "[TvShowMultiScrapeDialog] Scrape next item"; + qCDebug(generic) << "[TvShowMultiScrapeDialog] Scrape next item"; using namespace mediaelch::scraper; saveCurrentItem(); @@ -421,8 +421,9 @@ void TvShowMultiScrapeDialog::scrapeNext() } } else { - qCritical() << "[TvShowMultiScrapeDialog] Cannot scrape next! No further items to process but initial check " - "did not notice it!"; + qCCritical(generic) + << "[TvShowMultiScrapeDialog] Cannot scrape next! No further items to process but initial check " + "did not notice it!"; onScrapingFinished(); } } @@ -547,7 +548,7 @@ void TvShowMultiScrapeDialog::onInfoLoadDone(TvShow* show, QSet Q_UNUSED(details); if (show != m_currentShow) { - qCritical() << "[TvShowMultiScrapeDialog] TV show has changed mid-scrape-process!"; + qCCritical(generic) << "[TvShowMultiScrapeDialog] TV show has changed mid-scrape-process!"; return; } @@ -582,7 +583,7 @@ void TvShowMultiScrapeDialog::onInfoLoadDone(TvShow* show, QSet void TvShowMultiScrapeDialog::onLoadDone(TvShow* show, QMap> posters) { if (show != m_currentShow) { - qCritical() << "[TvShowMultiScrapeDialog] TV show has changed mid-scrape-process!"; + qCCritical(generic) << "[TvShowMultiScrapeDialog] TV show has changed mid-scrape-process!"; return; } @@ -706,7 +707,7 @@ void TvShowMultiScrapeDialog::onDownloadFinished(DownloadManagerElement elem) if (elem.show != nullptr) { int left = m_downloadManager->downloadsLeftForShow(m_currentShow); ui->progressItem->setValue(ui->progressItem->maximum() - left); - qDebug() << "Download finished" << left << ui->progressItem->maximum(); + qCDebug(generic) << "Download finished" << left << ui->progressItem->maximum(); if (TvShow::seasonImageTypes().contains(elem.imageType)) { if (elem.imageType == ImageType::TvShowSeasonBackdrop) { @@ -747,13 +748,13 @@ void TvShowMultiScrapeDialog::updateCheckBoxes() void TvShowMultiScrapeDialog::onScraperChanged(int index) { if (index < 0 || index >= Manager::instance()->scrapers().movieScrapers().size()) { - qCritical() << "[TvShowMultiScrapeDialog] Selected invalid scraper:" << index; + qCCritical(generic) << "[TvShowMultiScrapeDialog] Selected invalid scraper:" << index; showError(tr("Internal inconsistency: Selected an invalid scraper!")); return; } const QString scraperId = ui->comboScraper->itemData(index, Qt::UserRole).toString(); - qDebug() << "[TvShowMultiScrapeDialog] Selected scraper:" << scraperId; + qCDebug(generic) << "[TvShowMultiScrapeDialog] Selected scraper:" << scraperId; m_currentScraper = Manager::instance()->scrapers().tvScraper(scraperId); if (m_currentScraper == nullptr) { @@ -784,7 +785,7 @@ void TvShowMultiScrapeDialog::onSeasonOrderChanged(int index) bool ok = false; const int order = ui->comboSeasonOrder->itemData(index, Qt::UserRole).toInt(&ok); if (!ok) { - qCritical() << "[TvShowMultiScrapeDialog] Invalid index for SeasonOrder"; + qCCritical(generic) << "[TvShowMultiScrapeDialog] Invalid index for SeasonOrder"; return; } m_seasonOrder = SeasonOrder(order); @@ -826,7 +827,7 @@ void TvShowMultiScrapeDialog::setupLanguageDropdown() { if (m_currentScraper == nullptr) { ui->comboLanguage->setInvalid(); - qCritical() << "[TvShowSearch] Cannot set language dropdown in TV show search widget"; + qCCritical(generic) << "[TvShowSearch] Cannot set language dropdown in TV show search widget"; showError(tr("Internal inconsistency: Cannot set language dropdown in TV show search widget!")); return; } diff --git a/src/ui/tv_show/TvShowSearchEpisode.cpp b/src/ui/tv_show/TvShowSearchEpisode.cpp index c6bc943fdb..b01aa6e211 100644 --- a/src/ui/tv_show/TvShowSearchEpisode.cpp +++ b/src/ui/tv_show/TvShowSearchEpisode.cpp @@ -4,7 +4,7 @@ #include "globals/Manager.h" #include "scrapers/tv_show/TvScraperInterface.h" -#include +#include "log/Log.h" TvShowSearchEpisode::TvShowSearchEpisode(QWidget* parent) : QWidget(parent), ui(new Ui::TvShowSearchEpisode) { diff --git a/src/ui/tv_show/TvShowSearchWidget.cpp b/src/ui/tv_show/TvShowSearchWidget.cpp index 7d39114449..46523e4778 100644 --- a/src/ui/tv_show/TvShowSearchWidget.cpp +++ b/src/ui/tv_show/TvShowSearchWidget.cpp @@ -173,13 +173,13 @@ void TvShowSearchWidget::startSearch() void TvShowSearchWidget::onShowResults(ShowSearchJob* searchJob) { if (searchJob->hasError()) { - qDebug() << "[TvShowSearch] Got error while searching for show" << searchJob->error().message; + qCDebug(generic) << "[TvShowSearch] Got error while searching for show" << searchJob->error().message; showError(searchJob->error().message); searchJob->deleteLater(); return; } - qDebug() << "[TvShowSearch] Result count:" << searchJob->results().count(); + qCDebug(generic) << "[TvShowSearch] Result count:" << searchJob->results().count(); showSuccess(tr("Found %n results", "", searchJob->results().count())); for (const auto& result : searchJob->results()) { @@ -340,13 +340,13 @@ void TvShowSearchWidget::onChkAllEpisodeInfosToggled() void TvShowSearchWidget::onScraperChanged(int index) { if (index < 0 || index >= Manager::instance()->scrapers().tvScrapers().size()) { - qCritical() << "[TvShowSearchWidget] Selected invalid scraper:" << index; + qCCritical(generic) << "[TvShowSearchWidget] Selected invalid scraper:" << index; showError(tr("Internal inconsistency: Selected an invalid scraper!")); return; } const QString scraperId = ui->comboScraper->itemData(index, Qt::UserRole).toString(); - qDebug() << "[TvShowSearchWidget] Selected scraper:" << scraperId; + qCDebug(generic) << "[TvShowSearchWidget] Selected scraper:" << scraperId; m_currentScraper = Manager::instance()->scrapers().tvScraper(scraperId); if (m_currentScraper == nullptr) { @@ -423,7 +423,7 @@ void TvShowSearchWidget::onSeasonOrderChanged(int index) bool ok = false; const int order = ui->comboSeasonOrder->itemData(index, Qt::UserRole).toInt(&ok); if (!ok) { - qCritical() << "[TvShowSearch] Invalid index for SeasonOrder"; + qCCritical(generic) << "[TvShowSearch] Invalid index for SeasonOrder"; return; } m_seasonOrder = SeasonOrder(order); diff --git a/src/ui/tv_show/TvShowWidget.cpp b/src/ui/tv_show/TvShowWidget.cpp index 5d715b56f6..ab41aec632 100644 --- a/src/ui/tv_show/TvShowWidget.cpp +++ b/src/ui/tv_show/TvShowWidget.cpp @@ -54,14 +54,14 @@ void TvShowWidget::onClear() */ void TvShowWidget::onTvShowSelected(TvShow* show) { - qDebug() << "Entered, show=" << show->title(); + qCDebug(generic) << "Entered, show=" << show->title(); ui->stackedWidget->setCurrentIndex(0); ui->tvShowWidget->setTvShow(show); } void TvShowWidget::onSeasonSelected(TvShow* show, SeasonNumber season) { - qDebug() << "Entered, show=" << show->title() << "season=" << season.toString(); + qCDebug(generic) << "Entered, show=" << show->title() << "season=" << season.toString(); ui->stackedWidget->setCurrentIndex(2); ui->seasonWidget->setSeason(show, season); } @@ -72,7 +72,7 @@ void TvShowWidget::onSeasonSelected(TvShow* show, SeasonNumber season) */ void TvShowWidget::onEpisodeSelected(TvShowEpisode* episode) { - qDebug() << "Entered, episode=" << episode->title(); + qCDebug(generic) << "Entered, episode=" << episode->title(); ui->stackedWidget->setCurrentIndex(1); ui->episodeWidget->setEpisode(episode); } @@ -83,7 +83,7 @@ void TvShowWidget::onEpisodeSelected(TvShowEpisode* episode) void TvShowWidget::onTvShowSetEnabledTrue(TvShow* show, SeasonNumber season) { if ((show != nullptr) && show->downloadsInProgress()) { - qDebug() << "Downloads are in progress"; + qCDebug(generic) << "Downloads are in progress"; return; } @@ -100,7 +100,7 @@ void TvShowWidget::onTvShowSetEnabledTrue(TvShow* show, SeasonNumber season) void TvShowWidget::onEpisodeSetEnabledTrue(TvShowEpisode* episode) { if ((episode != nullptr) && (episode->tvShow() != nullptr) && episode->tvShow()->downloadsInProgress()) { - qDebug() << "Downloads are in progress"; + qCDebug(generic) << "Downloads are in progress"; return; } @@ -186,7 +186,7 @@ void TvShowWidget::onSaveInformation() */ void TvShowWidget::onSaveAll() { - qDebug() << "[TvShowWidget] Save all episodes"; + qCDebug(generic) << "[TvShowWidget] Save all episodes"; QVector shows = Manager::instance()->tvShowModel()->tvShows(); int episodesToSave = 0; int episodesSaved = 0; @@ -200,7 +200,7 @@ void TvShowWidget::onSaveAll() } } } - qDebug() << "episodesToSave=" << episodesToSave; + qCDebug(generic) << "episodesToSave=" << episodesToSave; NotificationBox::instance()->showProgressBar( tr("Saving changed TV Shows and Episodes"), Constants::TvShowWidgetSaveProgressMessageId); @@ -208,7 +208,7 @@ void TvShowWidget::onSaveAll() for (int i = 0, n = shows.count(); i < n; ++i) { if (shows[i]->hasChanged()) { - qDebug() << "SAVING TV SHOW" << shows[i]->title(); + qCDebug(generic) << "SAVING TV SHOW" << shows[i]->title(); shows[i]->saveData(Manager::instance()->mediaCenterInterfaceTvShow()); NotificationBox::instance()->progressBarProgress( ++episodesSaved, episodesToSave, Constants::TvShowWidgetSaveProgressMessageId); @@ -232,7 +232,7 @@ void TvShowWidget::onSaveAll() */ void TvShowWidget::onStartScraperSearch() { - qDebug() << "Entered, currentIndex=" << ui->stackedWidget->currentIndex(); + qCDebug(generic) << "Entered, currentIndex=" << ui->stackedWidget->currentIndex(); if (ui->stackedWidget->currentIndex() == 0) { QTimer::singleShot(0, ui->tvShowWidget, &TvShowWidgetTvShow::onStartScraperSearch); } else if (ui->stackedWidget->currentIndex() == 1) { diff --git a/src/ui/tv_show/TvShowWidgetEpisode.cpp b/src/ui/tv_show/TvShowWidgetEpisode.cpp index 9d657be95f..b52ce4d5d9 100644 --- a/src/ui/tv_show/TvShowWidgetEpisode.cpp +++ b/src/ui/tv_show/TvShowWidgetEpisode.cpp @@ -325,7 +325,7 @@ void TvShowWidgetEpisode::onSetEnabled(bool enabled) */ void TvShowWidgetEpisode::setEpisode(TvShowEpisode* episode) { - qDebug() << "Entered, episode=" << episode->title(); + qCDebug(generic) << "Entered, episode=" << episode->title(); m_episode = episode; if (!episode->streamDetailsLoaded() && Settings::instance()->autoLoadStreamDetails() && !episode->isDummy()) { // Loading stream details als marks the episode as changed... @@ -347,7 +347,7 @@ void TvShowWidgetEpisode::setEpisode(TvShowEpisode* episode) void TvShowWidgetEpisode::updateEpisodeInfo() { if (m_episode == nullptr) { - qWarning() << "My episode is invalid"; + qCWarning(generic) << "My episode is invalid"; return; } @@ -595,7 +595,7 @@ void TvShowWidgetEpisode::onReloadStreamDetails() void TvShowWidgetEpisode::onSaveInformation() { if (m_episode == nullptr) { - qCritical() << "My episode is invalid"; + qCCritical(generic) << "My episode is invalid"; return; } @@ -628,7 +628,7 @@ void TvShowWidgetEpisode::onRevertChanges() void TvShowWidgetEpisode::onStartScraperSearch() { if (m_episode == nullptr) { - qWarning() << "My episode is invalid"; + qCWarning(generic) << "My episode is invalid"; return; } @@ -673,7 +673,7 @@ void TvShowWidgetEpisode::onLoadDone() NotificationBox::instance()->hideProgressBar(Constants::TvShowScrapeProgressMessageId); if (m_episode == nullptr) { - qWarning() << "My episode is invalid"; + qCWarning(generic) << "My episode is invalid"; return; } @@ -701,7 +701,7 @@ void TvShowWidgetEpisode::onLoadDone() void TvShowWidgetEpisode::onChooseThumbnail() { if (m_episode == nullptr) { - qWarning() << "My episode is invalid"; + qCWarning(generic) << "My episode is invalid"; return; } @@ -760,7 +760,7 @@ void TvShowWidgetEpisode::onImageDropped(ImageType imageType, QUrl imageUrl) void TvShowWidgetEpisode::onPosterDownloadFinished(DownloadManagerElement elem) { if (elem.imageType == ImageType::TvShowEpisodeThumb) { - qDebug() << "Got a backdrop"; + qCDebug(generic) << "Got a backdrop"; if (m_episode == elem.episode) { ui->thumbnail->setImage(elem.data); } diff --git a/src/ui/tv_show/TvShowWidgetTvShow.cpp b/src/ui/tv_show/TvShowWidgetTvShow.cpp index 350fb5e92b..a4036b51da 100644 --- a/src/ui/tv_show/TvShowWidgetTvShow.cpp +++ b/src/ui/tv_show/TvShowWidgetTvShow.cpp @@ -290,7 +290,7 @@ void TvShowWidgetTvShow::onSetEnabled(bool enabled) */ void TvShowWidgetTvShow::setTvShow(TvShow* show) { - qDebug() << "Entered, show=" << show->title(); + qCDebug(generic) << "Entered, show=" << show->title(); show->loadData(Manager::instance()->mediaCenterInterface()); m_show = show; updateTvShowInfo(); @@ -311,7 +311,7 @@ void TvShowWidgetTvShow::setTvShow(TvShow* show) void TvShowWidgetTvShow::updateTvShowInfo() { if (m_show == nullptr) { - qDebug() << "My show is invalid"; + qCDebug(generic) << "My show is invalid"; return; } @@ -432,7 +432,7 @@ void TvShowWidgetTvShow::updateImages(QVector images) void TvShowWidgetTvShow::onSaveInformation() { if (m_show == nullptr) { - qDebug() << "My show is invalid"; + qCDebug(generic) << "My show is invalid"; return; } @@ -459,7 +459,8 @@ void TvShowWidgetTvShow::onRevertChanges() void TvShowWidgetTvShow::onStartScraperSearch() { if (m_show == nullptr) { - qCritical() << "[TvShowWidgetTvShow] Cannot start show search without valid show! This must not happen!"; + qCCritical(generic) + << "[TvShowWidgetTvShow] Cannot start show search without valid show! This must not happen!"; return; } @@ -528,14 +529,14 @@ void TvShowWidgetTvShow::onInfoLoadDone(TvShow* show, QSet deta void TvShowWidgetTvShow::onLoadDone(TvShow* show, QMap> posters) { if (m_show == nullptr) { - qDebug() << "My show is invalid"; + qCDebug(generic) << "My show is invalid"; return; } if (m_show == show) { updateTvShowInfo(); } else { - qDebug() << "Show has changed"; + qCDebug(generic) << "Show has changed"; } int downloadsSize = 0; if (!show->posters().isEmpty() && show->infosToLoad().contains(ShowScraperInfo::Poster)) { @@ -771,10 +772,10 @@ void TvShowWidgetTvShow::onPosterDownloadFinished(DownloadManagerElement elem) void TvShowWidgetTvShow::onDownloadsFinished(TvShow* show) { if (show == nullptr) { - qCritical() << "[TvShowWidgetTvShow]"; + qCCritical(generic) << "[TvShowWidgetTvShow]"; return; } - qDebug() << "Downloads finished for show:" << show->title(); + qCDebug(generic) << "Downloads finished for show:" << show->title(); emit sigDownloadsFinished(Constants::TvShowProgressMessageId + show->showId()); if (show == m_show) { onSetEnabled(true); @@ -1145,7 +1146,7 @@ void TvShowWidgetTvShow::onExtraFanartDropped(QUrl imageUrl) void TvShowWidgetTvShow::onDownloadTune() { if (m_show == nullptr) { - qCritical() << "[TvShowWidgetTvShow] Show is undefined, cannot download TV tunes!"; + qCCritical(generic) << "[TvShowWidgetTvShow] Show is undefined, cannot download TV tunes!"; return; } auto* tvTunesDialog = new TvTunesDialog(*m_show, this); diff --git a/src/ui/tv_show/TvTunesDialog.cpp b/src/ui/tv_show/TvTunesDialog.cpp index 340ba5793a..9f529e23c1 100644 --- a/src/ui/tv_show/TvTunesDialog.cpp +++ b/src/ui/tv_show/TvTunesDialog.cpp @@ -1,6 +1,7 @@ #include "TvTunesDialog.h" #include "ui_TvTunesDialog.h" +#include "log/Log.h" #include "network/NetworkRequest.h" #include "scrapers/music/TvTunes.h" @@ -218,7 +219,7 @@ void TvTunesDialog::downloadFinished() if (m_downloadReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302 || m_downloadReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) { const QUrl url = m_downloadReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); - qDebug() << "[TvTunesDialog] Got redirect" << url; + qCDebug(generic) << "[TvTunesDialog] Got redirect" << url; m_downloadReply = m_network->get(mediaelch::network::requestWithDefaults(url)); connect(m_downloadReply, &QNetworkReply::finished, this, &TvTunesDialog::downloadFinished); connect(m_downloadReply, &QNetworkReply::downloadProgress, this, &TvTunesDialog::downloadProgress);