diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index d6ed24db4..a060122dc 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -67,12 +67,16 @@ ecm_add_test(${coronatest_srcs} TEST_NAME coronatest LINK_LIBRARIES Qt5::Gui Qt5 add_test(plasma-storagetest storagetest) ecm_mark_as_test(storagetest) -add_executable(sortfiltermodeltest +set(sortfiltermodeltest_SRCS sortfiltermodeltest.cpp ../src/declarativeimports/core/datamodel.cpp ../src/declarativeimports/core/datasource.cpp ) +ecm_qt_declare_logging_category(sortfiltermodeltest_SRCS HEADER plasmacoredebug_p.h IDENTIFIER LOG_PLASMACORE CATEGORY_NAME org.kde.plasma.imports.core) + +add_executable(sortfiltermodeltest ${sortfiltermodeltest_SRCS}) + target_link_libraries(sortfiltermodeltest KF5::Plasma Qt5::Gui diff --git a/autotests/sortfiltermodeltest.cpp b/autotests/sortfiltermodeltest.cpp index da0e393cc..c10a7cf12 100644 --- a/autotests/sortfiltermodeltest.cpp +++ b/autotests/sortfiltermodeltest.cpp @@ -19,6 +19,7 @@ #include #include +#include "plasmacoredebug_p.h" // KDE diff --git a/src/declarativeimports/calendar/CMakeLists.txt b/src/declarativeimports/calendar/CMakeLists.txt index 93d9c1407..9f18b9d91 100644 --- a/src/declarativeimports/calendar/CMakeLists.txt +++ b/src/declarativeimports/calendar/CMakeLists.txt @@ -11,6 +11,8 @@ set(calendar_SRCS eventpluginsmanager.cpp ) +ecm_qt_declare_logging_category(calendar_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMACALENDAR CATEGORY_NAME org.kde.plasma.imports.calendar) + add_library(calendarplugin SHARED ${calendar_SRCS}) target_link_libraries(calendarplugin diff --git a/src/declarativeimports/calendar/calendar.cpp b/src/declarativeimports/calendar/calendar.cpp index 790833b8d..a94f960de 100644 --- a/src/declarativeimports/calendar/calendar.cpp +++ b/src/declarativeimports/calendar/calendar.cpp @@ -299,16 +299,16 @@ void Calendar::updateData() emit weeksModelChanged(); m_daysModel->update(); -// qDebug() << "---------------------------------------------------------------"; -// qDebug() << "Date obj: " << m_displayedDate; -// qDebug() << "Month: " << m_displayedDate.month(); -// qDebug() << "m_days: " << m_days; -// qDebug() << "m_weeks: " << m_weeks; -// qDebug() << "Days before this month: " << daysBeforeCurrentMonth; -// qDebug() << "Days after this month: " << daysAfterCurrentMonth; -// qDebug() << "Days in current month: " << m_displayedDate.daysInMonth(); -// qDebug() << "m_dayList size: " << m_dayList.count(); -// qDebug() << "---------------------------------------------------------------"; +// qCDebug(LOG_PLASMACALENDAR) << "---------------------------------------------------------------"; +// qCDebug(LOG_PLASMACALENDAR) << "Date obj: " << m_displayedDate; +// qCDebug(LOG_PLASMACALENDAR) << "Month: " << m_displayedDate.month(); +// qCDebug(LOG_PLASMACALENDAR) << "m_days: " << m_days; +// qCDebug(LOG_PLASMACALENDAR) << "m_weeks: " << m_weeks; +// qCDebug(LOG_PLASMACALENDAR) << "Days before this month: " << daysBeforeCurrentMonth; +// qCDebug(LOG_PLASMACALENDAR) << "Days after this month: " << daysAfterCurrentMonth; +// qCDebug(LOG_PLASMACALENDAR) << "Days in current month: " << m_displayedDate.daysInMonth(); +// qCDebug(LOG_PLASMACALENDAR) << "m_dayList size: " << m_dayList.count(); +// qCDebug(LOG_PLASMACALENDAR) << "---------------------------------------------------------------"; } void Calendar::nextDecade() diff --git a/src/declarativeimports/calendar/eventpluginsmanager.cpp b/src/declarativeimports/calendar/eventpluginsmanager.cpp index bcc6177a0..ac48e5337 100644 --- a/src/declarativeimports/calendar/eventpluginsmanager.cpp +++ b/src/declarativeimports/calendar/eventpluginsmanager.cpp @@ -18,6 +18,7 @@ */ #include "eventpluginsmanager.h" +#include "debug_p.h" #include @@ -205,8 +206,8 @@ void EventPluginsManager::loadPlugin(const QString &absolutePath) QPluginLoader loader(absolutePath); if (!loader.load()) { - qWarning() << "Could not create Plasma Calendar Plugin: " << absolutePath; - qWarning() << loader.errorString(); + qCWarning(LOG_PLASMACALENDAR) << "Could not create Plasma Calendar Plugin: " << absolutePath; + qCWarning(LOG_PLASMACALENDAR) << loader.errorString(); return; } @@ -214,7 +215,7 @@ void EventPluginsManager::loadPlugin(const QString &absolutePath) if (obj) { CalendarEvents::CalendarEventsPlugin *eventsPlugin = qobject_cast(obj); if (eventsPlugin) { - qDebug() << "Loading Calendar plugin" << eventsPlugin; + qCDebug(LOG_PLASMACALENDAR) << "Loading Calendar plugin" << eventsPlugin; eventsPlugin->setProperty("pluginPath", absolutePath); m_plugins << eventsPlugin; diff --git a/src/declarativeimports/core/CMakeLists.txt b/src/declarativeimports/core/CMakeLists.txt index 689a4b6c5..12a4e1497 100644 --- a/src/declarativeimports/core/CMakeLists.txt +++ b/src/declarativeimports/core/CMakeLists.txt @@ -24,6 +24,8 @@ set(corebindings_SRCS windowthumbnail.cpp ) +ecm_qt_declare_logging_category(corebindings_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMACORE CATEGORY_NAME org.kde.plasma.imports.core) + add_library(corebindingsplugin SHARED ${corebindings_SRCS}) target_link_libraries(corebindingsplugin Qt5::Quick diff --git a/src/declarativeimports/core/datamodel.cpp b/src/declarativeimports/core/datamodel.cpp index 06b64e4af..a7abc0c91 100644 --- a/src/declarativeimports/core/datamodel.cpp +++ b/src/declarativeimports/core/datamodel.cpp @@ -19,6 +19,7 @@ #include "datamodel.h" #include "datasource.h" +#include "debug_p.h" #include #include @@ -210,7 +211,7 @@ int SortFilterModel::mapRowToSource(int row) const int SortFilterModel::mapRowFromSource(int row) const { if (!sourceModel()) { - qWarning() << "No source model defined!"; + qCWarning(LOG_PLASMACORE) << "No source model defined!"; return -1; } QModelIndex idx = sourceModel()->index(row, 0); @@ -287,7 +288,7 @@ void DataModel::setDataSource(QObject *object) { DataSource *source = qobject_cast(object); if (!source) { - qWarning() << "Error: DataSource type expected"; + qCWarning(LOG_PLASMACORE) << "Error: DataSource type expected"; return; } if (m_dataSource == source) { diff --git a/src/declarativeimports/core/datasource.cpp b/src/declarativeimports/core/datasource.cpp index f60e2cc5b..8608cb050 100644 --- a/src/declarativeimports/core/datasource.cpp +++ b/src/declarativeimports/core/datasource.cpp @@ -21,6 +21,7 @@ */ #include "datasource.h" +#include "debug_p.h" namespace Plasma { @@ -95,7 +96,7 @@ void DataSource::setEngine(const QString &e) m_dataEngineConsumer = new Plasma::DataEngineConsumer(); Plasma::DataEngine *engine = dataEngine(m_engine); if (!engine) { - qWarning() << "DataEngine" << m_engine << "not found"; + qCWarning(LOG_PLASMACORE) << "DataEngine" << m_engine << "not found"; emit engineChanged(); return; } @@ -159,7 +160,7 @@ void DataSource::setupData() return; } -// qDebug() << " loading engine " << m_engine; +// qCDebug(LOG_PLASMACORE) << " loading engine " << m_engine; //FIXME: should all services be deleted just because we're changing the interval, etc? qDeleteAll(m_services); m_services.clear(); diff --git a/src/declarativeimports/core/framesvgitem.cpp b/src/declarativeimports/core/framesvgitem.cpp index bc8d45a62..ec9c5b367 100644 --- a/src/declarativeimports/core/framesvgitem.cpp +++ b/src/declarativeimports/core/framesvgitem.cpp @@ -183,7 +183,7 @@ FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *pa m_frameSvg(frameSvg), m_fixed(false) { - //qDebug() << "margins at: " << left() << top() << right() << bottom(); + //qCDebug(LOG_PLASMACORE) << "margins at: " << left() << top() << right() << bottom(); connect(m_frameSvg, SIGNAL(repaintNeeded()), this, SLOT(update())); } diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp index 8f29ee2d1..126b799bf 100644 --- a/src/declarativeimports/core/iconitem.cpp +++ b/src/declarativeimports/core/iconitem.cpp @@ -19,6 +19,7 @@ */ #include "iconitem.h" +#include "debug_p.h" #include #include #include @@ -139,7 +140,7 @@ void IconItem::setSource(const QVariant &source) iconPath = iconTheme->iconPath(sourceString + QLatin1String(".svgz"), qMin(width(), height()), KIconLoader::MatchBest); } } else { - qWarning() << "KIconLoader has no theme set"; + qCWarning(LOG_PLASMACORE) << "KIconLoader has no theme set"; } if (!iconPath.isEmpty()) { @@ -450,7 +451,7 @@ void IconItem::loadPixmap() iconPath = iconTheme->iconPath(m_svgIconName + QLatin1String(".svgz"), qMin(width(), height()), KIconLoader::MatchBest); } } else { - qWarning() << "KIconLoader has no theme set"; + qCWarning(LOG_PLASMACORE) << "KIconLoader has no theme set"; } if (!iconPath.isEmpty()) { diff --git a/src/declarativeimports/core/windowthumbnail.cpp b/src/declarativeimports/core/windowthumbnail.cpp index a67453883..5a9ccd1a6 100644 --- a/src/declarativeimports/core/windowthumbnail.cpp +++ b/src/declarativeimports/core/windowthumbnail.cpp @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "windowthumbnail.h" +#include "debug_p.h" // KF5 #include // Qt @@ -437,7 +438,7 @@ bool WindowThumbnail::xcbWindowToTextureEGL(WindowTextureNode *textureNode) (EGLClientBuffer)m_pixmap, attribs); if (m_image == EGL_NO_IMAGE_KHR) { - qDebug() << "failed to create egl image"; + qCDebug(LOG_PLASMACORE) << "failed to create egl image"; return false; } @@ -469,7 +470,7 @@ void WindowThumbnail::resolveEGLFunctions() (extensions.contains(QByteArrayLiteral("EGL_KHR_image_base")) && extensions.contains(QByteArrayLiteral("EGL_KHR_image_pixmap")))) { if (context->hasExtension(QByteArrayLiteral("GL_OES_EGL_image"))) { - qDebug() << "Have EGL texture from pixmap"; + qCDebug(LOG_PLASMACORE) << "Have EGL texture from pixmap"; m_eglCreateImageKHR = context->getProcAddress(QByteArrayLiteral("eglCreateImageKHR")); m_eglDestroyImageKHR = context->getProcAddress(QByteArrayLiteral("eglDestroyImageKHR")); m_glEGLImageTargetTexture2DOES = context->getProcAddress(QByteArrayLiteral("glEGLImageTargetTexture2DOES")); @@ -554,7 +555,7 @@ void WindowThumbnail::resolveGLXFunctions() m_bindTexImage = context->getProcAddress(QByteArrayLiteral("glXBindTexImageEXT")); m_releaseTexImage = context->getProcAddress(QByteArrayLiteral("glXReleaseTexImageEXT")); } else - qWarning() << "couldn't resolve GLX_EXT_texture_from_pixmap functions"; + qCWarning(LOG_PLASMACORE) << "couldn't resolve GLX_EXT_texture_from_pixmap functions"; m_openGLFunctionsResolved = true; } diff --git a/src/declarativeimports/plasmacomponents/CMakeLists.txt b/src/declarativeimports/plasmacomponents/CMakeLists.txt index 8e5ca90d5..0f434397e 100644 --- a/src/declarativeimports/plasmacomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmacomponents/CMakeLists.txt @@ -10,6 +10,8 @@ set(plasmacomponents_SRCS qmenuitem.cpp ) +ecm_qt_declare_logging_category(plasmacomponents_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMACOMPONENTS CATEGORY_NAME org.kde.plasma.imports.components) + add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) target_link_libraries(plasmacomponentsplugin Qt5::Core diff --git a/src/declarativeimports/plasmacomponents/fullscreenwindow.cpp b/src/declarativeimports/plasmacomponents/fullscreenwindow.cpp index 05da708b9..60c065f36 100644 --- a/src/declarativeimports/plasmacomponents/fullscreenwindow.cpp +++ b/src/declarativeimports/plasmacomponents/fullscreenwindow.cpp @@ -20,6 +20,7 @@ #include "fullscreenwindow.h" #include "../core/declarativeitemcontainer_p.h" #include "plasmacomponentsplugin.h" +#include "debug_p.h" #include #include @@ -136,13 +137,13 @@ void FullScreenWindow::init(const QString &componentName) } if (filePath.isEmpty()) { - qWarning() << "Component not found:" << componentName; + qCWarning(LOG_PLASMACOMPONENTS) << "Component not found:" << componentName; return; } QDeclarativeEngine *engine = EngineBookKeeping::self()->engine(); if (!engine) { - qWarning() << "Warning, no QDeclarativeEngines available anymore, should never happen"; + qCWarning(LOG_PLASMACOMPONENTS) << "Warning, no QDeclarativeEngines available anymore, should never happen"; Q_ASSERT(0); } QDeclarativeComponent *component = new QDeclarativeComponent(engine, filePath, this); @@ -150,7 +151,7 @@ void FullScreenWindow::init(const QString &componentName) QDeclarativeContext *creationContext = component->creationContext(); m_rootObject = component->create(creationContext); if (component->status() == QDeclarativeComponent::Error) { - qWarning() << component->errors(); + qCWarning(LOG_PLASMACOMPONENTS) << component->errors(); } if (m_rootObject) { diff --git a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp index 83016c222..1831132c3 100644 --- a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp @@ -33,6 +33,7 @@ #include "enums.h" #include "qmenu.h" #include "qmenuitem.h" +#include "debug_p.h" class BKSingleton { @@ -54,7 +55,7 @@ QQmlEngine *EngineBookKeeping::engine() const { //for components creation, any engine will do, as long is valid if (m_engines.isEmpty()) { - qWarning() << "No engines found, this should never happen"; + qCWarning(LOG_PLASMACOMPONENTS) << "No engines found, this should never happen"; return 0; } else { return m_engines.values().at(0); diff --git a/src/declarativeimports/plasmacomponents/qmenu.cpp b/src/declarativeimports/plasmacomponents/qmenu.cpp index c6b59a87e..81cb3cad6 100644 --- a/src/declarativeimports/plasmacomponents/qmenu.cpp +++ b/src/declarativeimports/plasmacomponents/qmenu.cpp @@ -18,6 +18,7 @@ ***************************************************************************/ #include "qmenu.h" +#include "debug_p.h" #include #include @@ -269,7 +270,7 @@ void QMenuProxy::rebuildMenu() void QMenuProxy::open(int x, int y) { - qDebug() << "Opening menu at" << x << y; + qCDebug(LOG_PLASMACOMPONENTS) << "Opening menu at" << x << y; QQuickItem *parentItem = nullptr; diff --git a/src/declarativeimports/platformcomponents/CMakeLists.txt b/src/declarativeimports/platformcomponents/CMakeLists.txt index 4cce385f2..911e8ab76 100644 --- a/src/declarativeimports/platformcomponents/CMakeLists.txt +++ b/src/declarativeimports/platformcomponents/CMakeLists.txt @@ -7,6 +7,8 @@ set(platformcomponents_SRCS icondialog.cpp ) +ecm_qt_declare_logging_category(platformcomponents_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMAPLATFORMCOMPONENTS CATEGORY_NAME org.kde.plasma.imports.platformcomponents) + add_library(platformcomponentsplugin SHARED ${platformcomponents_SRCS}) target_link_libraries( diff --git a/src/declarativeimports/platformcomponents/application.cpp b/src/declarativeimports/platformcomponents/application.cpp index 1326a7b46..39cc3786d 100644 --- a/src/declarativeimports/platformcomponents/application.cpp +++ b/src/declarativeimports/platformcomponents/application.cpp @@ -19,6 +19,7 @@ #include "application.h" #include "application_p.h" +#include "debug_p.h" #include "utils/d_ptr_implementation.h" @@ -50,7 +51,7 @@ void Application::Private::stateChanged(QProcess::ProcessState newState) void Application::Private::errorFound(QProcess::ProcessError err) { Q_UNUSED(err) - qWarning() << "Error" << process.error() << "while starting" << application; + qCWarning(LOG_PLASMAPLATFORMCOMPONENTS) << "Error" << process.error() << "while starting" << application; } Application::Application(QObject *parent) @@ -109,7 +110,7 @@ void Application::start() } if (d->application.isEmpty()) { - qWarning() << "Cannot run an empty application"; + qCWarning(LOG_PLASMAPLATFORMCOMPONENTS) << "Cannot run an empty application"; return; } diff --git a/src/plasmapkg/CMakeLists.txt b/src/plasmapkg/CMakeLists.txt index 7d3df5d22..c788fc98a 100644 --- a/src/plasmapkg/CMakeLists.txt +++ b/src/plasmapkg/CMakeLists.txt @@ -1,6 +1,13 @@ + +set (plasmapkg_SRCS + main.cpp + plasmapkg.cpp +) + +ecm_qt_declare_logging_category(plasmapkg_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMAPKG CATEGORY_NAME org.kde.plasmapkg) + add_executable(plasmapkg2 - main.cpp - plasmapkg.cpp + ${plasmapkg_SRCS} ) target_link_libraries(plasmapkg2 KF5::Plasma KF5::I18n KF5::Service KF5::CoreAddons Qt5::DBus) diff --git a/src/plasmapkg/plasmapkg.cpp b/src/plasmapkg/plasmapkg.cpp index 3724ae85e..fd4ea1ffb 100644 --- a/src/plasmapkg/plasmapkg.cpp +++ b/src/plasmapkg/plasmapkg.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ #include "plasmapkg.h" +#include "debug_p.h" #include #include @@ -181,7 +182,7 @@ void PlasmaPkg::runMain() type = QStringLiteral("layout-template"); } else { type = serviceType; - //qDebug() << "fallthrough type is" << serviceType; + //qCDebug(LOG_PLASMAPKG) << "fallthrough type is" << serviceType; } } else { if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0) { @@ -356,7 +357,7 @@ void PlasmaPkg::runMain() return; } if (d->package.isEmpty()) { - qWarning() << i18nc("No option was given, this is the error message telling the user he needs at least one, do not translate install, remove, upgrade nor list", "One of install, remove, upgrade or list is required."); + qCWarning(LOG_PLASMAPKG) << i18nc("No option was given, this is the error message telling the user he needs at least one, do not translate install, remove, upgrade nor list", "One of install, remove, upgrade or list is required."); exit(6); } else { d->runKbuildsycoca(); @@ -483,11 +484,11 @@ QString PlasmaPkg::findPackageRoot(const QString &pluginName, const QString &pre Q_UNUSED(prefix) QString packageRoot; if (d->parser->isSet(QStringLiteral("packageroot")) && d->parser->isSet(QStringLiteral("global"))) { - qWarning() << i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one."); + qCWarning(LOG_PLASMAPKG) << i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one."); ::exit(7); } else if (d->parser->isSet(QStringLiteral("packageroot"))) { packageRoot = d->parser->value(QStringLiteral("packageroot")); - //qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot; + //qCDebug(LOG_PLASMAPKG) << "(set via arg) d->packageRoot is: " << d->packageRoot; } else if (d->parser->isSet(QStringLiteral("global"))) { packageRoot = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, d->packageRoot, QStandardPaths::LocateDirectory).last(); } else { @@ -594,7 +595,7 @@ void PlasmaPkgPrivate::listTypes() //QString path = structure->defaultPackageRoot(); //QString path = defaultPackageRoot; plugins.insert(name, QStringList() << name << plugin << comment); - //qDebug() << "KService stuff:" << name << plugin << comment; + //qCDebug(LOG_PLASMAPKG) << "KService stuff:" << name << plugin << comment; } renderTypeTable(plugins); diff --git a/src/plasmaquick/CMakeLists.txt b/src/plasmaquick/CMakeLists.txt index 8aaa77aca..a1fe2af93 100644 --- a/src/plasmaquick/CMakeLists.txt +++ b/src/plasmaquick/CMakeLists.txt @@ -20,6 +20,8 @@ set(plasmaquick_LIB_SRC ../declarativeimports/core/units.cpp ) +ecm_qt_declare_logging_category(plasmaquick_LIB_SRC HEADER debug_p.h IDENTIFIER LOG_PLASMAQUICK CATEGORY_NAME org.kde.plasmaquick) + add_library(KF5PlasmaQuick SHARED ${plasmaquick_LIB_SRC}) add_library(KF5::PlasmaQuick ALIAS KF5PlasmaQuick) target_include_directories(KF5PlasmaQuick PUBLIC "$") diff --git a/src/plasmaquick/configmodel.cpp b/src/plasmaquick/configmodel.cpp index 03beac7b8..9945c770f 100644 --- a/src/plasmaquick/configmodel.cpp +++ b/src/plasmaquick/configmodel.cpp @@ -25,6 +25,7 @@ #include "Plasma/Containment" //#include "plasmoid/wallpaperinterface.h" #include "kdeclarative/configpropertymap.h" +#include "debug_p.h" #include #include @@ -200,7 +201,7 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const // Quick check if source is an absolute path or not if (d->appletInterface && !source.isEmpty() && !(source.startsWith('/') && source.endsWith(QLatin1String("qml")))) { if(!d->appletInterface.data()->kPackage().isValid()) - qWarning() << "wrong applet" << d->appletInterface.data()->pluginMetaData().name(); + qCWarning(LOG_PLASMAQUICK) << "wrong applet" << d->appletInterface.data()->pluginMetaData().name(); return QUrl::fromLocalFile(d->appletInterface.data()->kPackage().filePath("ui", source)); } else { return source; @@ -225,11 +226,11 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const KPluginLoader loader(pluginPath); KPluginFactory* factory = loader.factory(); if (!factory) { - qWarning() << "Error loading KCM:" << loader.errorString(); + qCWarning(LOG_PLASMAQUICK) << "Error loading KCM:" << loader.errorString(); } else { KQuickAddons::ConfigModule *cm = factory->create(const_cast(this)); if (!cm) { - qWarning() << "Error creating KCM object from plugin" << loader.fileName(); + qCWarning(LOG_PLASMAQUICK) << "Error creating KCM object from plugin" << loader.fileName(); } d->kcms[pluginName] = cm; return QVariant::fromValue(cm); diff --git a/src/plasmaquick/configview.cpp b/src/plasmaquick/configview.cpp index e8627c93d..8ebc05655 100644 --- a/src/plasmaquick/configview.cpp +++ b/src/plasmaquick/configview.cpp @@ -24,6 +24,7 @@ #include "Plasma/Containment" //#include "plasmoid/wallpaperinterface.h" #include "kdeclarative/configpropertymap.h" +#include "debug_p.h" #include #include @@ -82,11 +83,11 @@ ConfigViewPrivate::ConfigViewPrivate(Plasma::Applet *appl, ConfigView *view) void ConfigViewPrivate::init() { if (!applet) { - qWarning() << "Null applet passed to constructor"; + qCWarning(LOG_PLASMAQUICK) << "Null applet passed to constructor"; return; } if (!applet.data()->pluginMetaData().isValid()) { - qWarning() << "Invalid applet passed to constructor"; + qCWarning(LOG_PLASMAQUICK) << "Invalid applet passed to constructor"; return; } @@ -115,12 +116,12 @@ void ConfigViewPrivate::init() corona = a->containment()->corona(); } } else if (!applet.data()->containment()->corona()->kPackage().isValid()) { - qWarning() << "Invalid home screen package"; + qCWarning(LOG_PLASMAQUICK) << "Invalid home screen package"; } else { corona = applet.data()->containment()->corona(); } if (!corona) { - qWarning() << "Cannot find a Corona, this should never happen!"; + qCWarning(LOG_PLASMAQUICK) << "Cannot find a Corona, this should never happen!"; return; } @@ -154,7 +155,7 @@ void ConfigViewPrivate::init() KPluginMetaData md(loader.fileName()); if (!md.isValid()) { - qWarning() << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; + qCWarning(LOG_PLASMAQUICK) << "Could not find" << kcm << "specified in X-Plasma-ConfigPlugins"; continue; } diff --git a/src/plasmaquick/containmentview.cpp b/src/plasmaquick/containmentview.cpp index 309a2cb15..11f978c1c 100644 --- a/src/plasmaquick/containmentview.cpp +++ b/src/plasmaquick/containmentview.cpp @@ -18,6 +18,7 @@ #include "containmentview.h" #include "configview.h" +#include "debug_p.h" #include #include @@ -76,7 +77,7 @@ void ContainmentViewPrivate::setContainment(Plasma::Containment *cont) QObject::disconnect(containment, 0, q, 0); QObject *oldGraphicObject = containment->property("_plasma_graphicObject").value(); if (oldGraphicObject) { -// qDebug() << "Old graphics Object:" << oldGraphicObject << "Old containment" << containment.data(); +// qCDebug(LOG_PLASMAQUICK) << "Old graphics Object:" << oldGraphicObject << "Old containment" << containment.data(); //make sure the graphic object won't die with us //FIXME:we need a way to reparent to *NO* graphics item, but this makes Qt crash oldGraphicObject->setParent(containment); @@ -133,7 +134,7 @@ void ContainmentViewPrivate::setContainment(Plasma::Containment *cont) QQuickItem *graphicObject = qobject_cast(containment->property("_plasma_graphicObject").value()); if (graphicObject) { -// qDebug() << "using as graphic containment" << graphicObject << containment.data(); +// qCDebug(LOG_PLASMAQUICK) << "using as graphic containment" << graphicObject << containment.data(); //by resizing before adding, it will avoid some resizes in most cases graphicObject->setProperty("width", q->width()); @@ -146,10 +147,10 @@ void ContainmentViewPrivate::setContainment(Plasma::Containment *cont) q->rootObject()->setProperty("wallpaper", QVariant::fromValue(wpGraphicObject)); } } else { - qWarning() << "Could not set containment property on rootObject"; + qCWarning(LOG_PLASMAQUICK) << "Could not set containment property on rootObject"; } } else { - qWarning() << "Containment graphic object not valid"; + qCWarning(LOG_PLASMAQUICK) << "Containment graphic object not valid"; } } @@ -210,10 +211,10 @@ ContainmentView::ContainmentView(Plasma::Corona *corona, QWindow *parent) if (info.isValid()) { setTranslationDomain("plasma_shell_" + info.pluginName()); } else { - qWarning() << "Invalid corona package metadata"; + qCWarning(LOG_PLASMAQUICK) << "Invalid corona package metadata"; } } else { - qWarning() << "Invalid home screen package"; + qCWarning(LOG_PLASMAQUICK) << "Invalid home screen package"; } //Force QtQuickControls to use the "Plasma" style for this engine. diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index 9afdf6032..fefce963c 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -25,6 +25,7 @@ #include "../declarativeimports/core/framesvgitem.h" #include "dialogshadows_p.h" #include "view.h" +#include "debug_p.h" #include #include @@ -580,7 +581,7 @@ void DialogPrivate::syncToMainItemSize() return; } if (mainItem->width() <= 0 || mainItem->height() <= 0) { - qWarning() << "trying to show an empty dialog"; + qCWarning(LOG_PLASMAQUICK) << "trying to show an empty dialog"; } updateTheme(); diff --git a/src/plasmaquick/dialogshadows.cpp b/src/plasmaquick/dialogshadows.cpp index 10b5ed905..e81b7452c 100644 --- a/src/plasmaquick/dialogshadows.cpp +++ b/src/plasmaquick/dialogshadows.cpp @@ -17,6 +17,7 @@ */ #include "dialogshadows_p.h" +#include "debug_p.h" #include #include @@ -544,7 +545,7 @@ void DialogShadows::Private::updateShadowX11(const QWindow *window, Plasma::Fram Display *dpy = QX11Info::display(); Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False); - //qDebug() << "going to set the shadow of" << window->winId() << "to" << data; + //qCDebug(LOG_PLASMAQUICK) << "going to set the shadow of" << window->winId() << "to" << data; XChangeProperty(dpy, window->winId(), atom, XA_CARDINAL, 32, PropModeReplace, reinterpret_cast(data[enabledBorders].constData()), data[enabledBorders].size()); #endif @@ -657,7 +658,7 @@ void DialogShadows::Private::updateShadowWayland(const QWindow *window, Plasma:: void DialogShadows::Private::clearShadow(const QWindow *window) { if (!static_cast(window)->surfaceHandle()) { - qWarning() << "Cannot clear shadow from window without native surface!"; + qCWarning(LOG_PLASMAQUICK) << "Cannot clear shadow from window without native surface!"; return; } #if HAVE_X11 diff --git a/src/plasmaquick/packageurlinterceptor.cpp b/src/plasmaquick/packageurlinterceptor.cpp index 4aa5c3ad2..7b5bb35c0 100644 --- a/src/plasmaquick/packageurlinterceptor.cpp +++ b/src/plasmaquick/packageurlinterceptor.cpp @@ -81,7 +81,7 @@ QStringList PackageUrlInterceptor::allowedPaths() const QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlInterceptor::DataType type) { - //qDebug() << "Intercepted URL:" << path << type; + //qCDebug(LOG_PLASMA) << "Intercepted URL:" << path << type; QString pkgRoot; Plasma::Package package; if (d->package.isValid()) { @@ -127,7 +127,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept //asked a file inside a package: let's rewrite the url! if (path.path().startsWith(package.path())) { - //qDebug() << "Found URL in package" << path; + //qCDebug(LOG_PLASMA) << "Found URL in package" << path; //tries to isolate the relative path asked relative to the contentsPrefixPath: like ui/foo.qml QString relativePath; @@ -153,7 +153,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept QUrl ret = QUrl::fromLocalFile(package.filePath(prefixForType(type, filename), filename)); - //qDebug() << "Returning" << ret; + //qCDebug(LOG_PLASMA) << "Returning" << ret; if (ret.path().isEmpty()) { return path; diff --git a/src/plasmaquick/view.cpp b/src/plasmaquick/view.cpp index ca6ae6f2b..394d4cbf2 100644 --- a/src/plasmaquick/view.cpp +++ b/src/plasmaquick/view.cpp @@ -18,6 +18,7 @@ #include "view.h" #include "configview.h" +#include "debug_p.h" #include #include @@ -76,7 +77,7 @@ void ViewPrivate::setContainment(Plasma::Containment *cont) QObject::disconnect(containment, 0, q, 0); QObject *oldGraphicObject = containment->property("_plasma_graphicObject").value(); if (oldGraphicObject) { -// qDebug() << "Old graphics Object:" << oldGraphicObject << "Old containment" << containment.data(); +// qCDebug(LOG_PLASMA) << "Old graphics Object:" << oldGraphicObject << "Old containment" << containment.data(); //make sure the graphic object won't die with us //FIXME:we need a way to reparent to *NO* graphics item, but this makes Qt crash oldGraphicObject->setParent(containment); @@ -116,7 +117,7 @@ void ViewPrivate::setContainment(Plasma::Containment *cont) QQuickItem *graphicObject = qobject_cast(containment->property("_plasma_graphicObject").value()); if (graphicObject) { -// qDebug() << "using as graphic containment" << graphicObject << containment.data(); +// qCDebug(LOG_PLASMA) << "using as graphic containment" << graphicObject << containment.data(); //by resizing before adding, it will avoid some resizes in most cases graphicObject->setProperty("width", q->width()); @@ -129,10 +130,10 @@ void ViewPrivate::setContainment(Plasma::Containment *cont) q->rootObject()->setProperty("wallpaper", QVariant::fromValue(wpGraphicObject)); } } else { - qWarning() << "Could not set containment property on rootObject"; + qCWarning(LOG_PLASMAQUICK) << "Could not set containment property on rootObject"; } } else { - qWarning() << "Containment graphic object not valid"; + qCWarning(LOG_PLASMAQUICK) << "Containment graphic object not valid"; } } @@ -198,7 +199,7 @@ View::View(Plasma::Corona *corona, QWindow *parent) kdeclarative.setTranslationDomain("plasma_shell_" + corona->kPackage().metadata().pluginId()); kdeclarative.setupBindings(); } else { - qWarning() << "Invalid home screen package"; + qCWarning(LOG_PLASMAQUICK) << "Invalid home screen package"; } //Force QtQuickControls to use the "Plasma" style for this engine. diff --git a/src/scriptengines/qml/CMakeLists.txt b/src/scriptengines/qml/CMakeLists.txt index fd953d63b..b80775bd1 100644 --- a/src/scriptengines/qml/CMakeLists.txt +++ b/src/scriptengines/qml/CMakeLists.txt @@ -16,6 +16,8 @@ set(declarative_appletscript_SRCS plasmoid/wallpaperinterface.cpp ) +ecm_qt_declare_logging_category(declarative_appletscript_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMAQMLSCRIPTENGINE CATEGORY_NAME org.kde.plasma.scriptengine.qml) + add_library(plasma_appletscript_declarative MODULE ${declarative_appletscript_SRCS} ) set_target_properties(plasma_appletscript_declarative PROPERTIES PREFIX "") diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index d0dbda967..5320e2302 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -20,6 +20,7 @@ */ #include "containmentinterface.h" +#include "debug_p.h" #include "wallpaperinterface.h" #include @@ -123,10 +124,10 @@ void ContainmentInterface::init() containmentGraphicObject->setProperty("toolBox", QVariant::fromValue(toolBoxObject)); } } else { - qWarning() << "Could not load toolbox package." << pkg.path(); + qCWarning(LOG_PLASMAQMLSCRIPTENGINE) << "Could not load toolbox package." << pkg.path(); } } else { - qWarning() << "Toolbox not loading, toolbox package is either invalid or disabled."; + qCWarning(LOG_PLASMAQMLSCRIPTENGINE) << "Toolbox not loading, toolbox package is either invalid or disabled."; } } @@ -426,13 +427,13 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y) //const QMimeData *mimeData = data; - qDebug() << "Arrived mimeData" << mimeData->urls() << mimeData->formats() << "at" << x << ", " << y; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Arrived mimeData" << mimeData->urls() << mimeData->formats() << "at" << x << ", " << y; if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) { QString data = mimeData->data(QStringLiteral("text/x-plasmoidservicename")); const QStringList appletNames = data.split('\n', QString::SkipEmptyParts); foreach (const QString &appletName, appletNames) { - qDebug() << "adding" << appletName; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "adding" << appletName; metaObject()->invokeMethod(this, "createApplet", Qt::QueuedConnection, Q_ARG(QString, appletName), Q_ARG(QVariantList, QVariantList()), Q_ARG(QRectF, QRectF(x, y, -1, -1))); } @@ -448,7 +449,7 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y) QString mimeName = mime.name(); QVariantList args; args << url.url(); - qDebug() << "can decode" << mimeName << args; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "can decode" << mimeName << args; // It may be a directory or a file, let's stat KIO::JobFlags flags = KIO::HideProgressInfo; @@ -484,7 +485,7 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y) pluginFormats.insert(plugin.pluginName(), format); } } - //qDebug() << "Mimetype ..." << formats << seenPlugins.keys() << pluginFormats.values(); + //qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Mimetype ..." << formats << seenPlugins.keys() << pluginFormats.values(); QString selectedPlugin; @@ -536,7 +537,7 @@ void ContainmentInterface::dropJobResult(KJob *job) { #ifndef PLASMA_NO_KIO if (job->error()) { - qDebug() << "ERROR" << job->error() << ' ' << job->errorString(); + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "ERROR" << job->error() << ' ' << job->errorString(); } // We call mimetypeRetrieved since there might be other mechanisms // for finding suitable applets. Cleanup happens there as well. @@ -547,38 +548,38 @@ void ContainmentInterface::dropJobResult(KJob *job) void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimetype) { #ifndef PLASMA_NO_KIO - qDebug() << "Mimetype Job returns." << mimetype; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Mimetype Job returns." << mimetype; KIO::TransferJob *tjob = dynamic_cast(job); if (!tjob) { - qDebug() << "job should be a TransferJob, but isn't"; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "job should be a TransferJob, but isn't"; clearDataForMimeJob(job); return; } KPluginInfo::List appletList = Plasma::PluginLoader::self()->listAppletInfoForUrl(tjob->url()); if (mimetype.isEmpty() && appletList.isEmpty()) { clearDataForMimeJob(job); - qDebug() << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")"; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "No applets found matching the url (" << tjob->url() << ") or the mimetype (" << mimetype << ")"; return; } else { QPoint posi; // will be overwritten with the event's position if (m_dropPoints.keys().contains(tjob)) { posi = m_dropPoints[tjob]; - qDebug() << "Received a suitable dropEvent at" << posi; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Received a suitable dropEvent at" << posi; } else { - qDebug() << "Bailing out. Cannot find associated dropEvent related to the TransferJob"; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Bailing out. Cannot find associated dropEvent related to the TransferJob"; clearDataForMimeJob(job); return; } QMenu *choices = m_dropMenus.value(tjob); if (!choices) { - qDebug() << "Bailing out. No QMenu found for this job."; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Bailing out. No QMenu found for this job."; clearDataForMimeJob(job); return; } - qDebug() << "Creating menu for:" << mimetype << posi; + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Creating menu for:" << mimetype << posi; appletList << Plasma::PluginLoader::self()->listAppletInfoForMimeType(mimetype); @@ -606,7 +607,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet QHash actionsToApplets; choices->addSection(i18n("Widgets")); foreach (const KPluginInfo &info, appletList) { - qDebug() << info.name(); + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << info.name(); QAction *action; if (!info.icon().isEmpty()) { action = choices->addAction(QIcon::fromTheme(info.icon()), info.name()); @@ -615,7 +616,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet } actionsToApplets.insert(action, info.pluginName()); - qDebug() << info.pluginName(); + qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << info.pluginName(); } actionsToApplets.insert(choices->addAction(i18n("Icon")), QStringLiteral("org.kde.plasma.icon")); @@ -726,7 +727,7 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet) AppletInterface *appletGraphicObject = applet->property("_plasma_graphicObject").value(); AppletInterface *contGraphicObject = m_containment->property("_plasma_graphicObject").value(); -// qDebug() << "Applet added on containment:" << m_containment->title() << contGraphicObject +// qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Applet added on containment:" << m_containment->title() << contGraphicObject // << "Applet: " << applet << applet->title() << appletGraphicObject; //Every applet should have a graphics object, otherwise don't disaplay anything @@ -900,7 +901,7 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event) } } } - //qDebug() << "Invoking menu for applet" << applet; + //qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "Invoking menu for applet" << applet; QMenu *desktopMenu = new QMenu; desktopMenu->setAttribute(Qt::WA_DeleteOnClose); @@ -1025,13 +1026,13 @@ void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet * if (m_containment->immutability() == Plasma::Types::Mutable && (m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) { QAction *closeApplet = applet->actions()->action(QStringLiteral("remove")); - //qDebug() << "checking for removal" << closeApplet; + //qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "checking for removal" << closeApplet; if (closeApplet) { if (!desktopMenu->isEmpty()) { desktopMenu->addSeparator(); } - //qDebug() << "adding close action" << closeApplet->isEnabled() << closeApplet->isVisible(); + //qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "adding close action" << closeApplet->isEnabled() << closeApplet->isVisible(); desktopMenu->addAction(closeApplet); } } @@ -1041,7 +1042,7 @@ void ContainmentInterface::addContainmentActions(QMenu *desktopMenu, QEvent *eve { if (m_containment->corona()->immutability() != Plasma::Types::Mutable && !KAuthorized::authorizeKAction(QStringLiteral("plasma/containment_actions"))) { - //qDebug() << "immutability"; + //qCDebug(LOG_PLASMAQMLSCRIPTENGINE) << "immutability"; return; } diff --git a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp index 9ef2d03a6..623b45b74 100644 --- a/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp +++ b/src/scriptengines/qml/plasmoid/wallpaperinterface.cpp @@ -18,6 +18,7 @@ */ #include "wallpaperinterface.h" +#include "debug_p.h" #include "containmentinterface.h" #include @@ -136,7 +137,7 @@ void WallpaperInterface::syncWallpaperPackage() m_pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/Wallpaper")); m_pkg.setPath(m_wallpaperPlugin); if (!m_pkg.isValid()) { - qWarning() << "Error loading the wallpaper, no valid package loaded"; + qCWarning(LOG_PLASMAQMLSCRIPTENGINE) << "Error loading the wallpaper, no valid package loaded"; return; } @@ -179,13 +180,13 @@ void WallpaperInterface::loadFinished() prop.write(expr.evaluate()); } else if (m_qmlObject->mainComponent()) { - qWarning() << "Error loading the wallpaper" << m_qmlObject->mainComponent()->errors(); + qCWarning(LOG_PLASMAQMLSCRIPTENGINE) << "Error loading the wallpaper" << m_qmlObject->mainComponent()->errors(); s_rootObjects.remove(m_qmlObject->engine()); m_qmlObject->deleteLater(); m_qmlObject = 0; } else { - qWarning() << "Error loading the wallpaper, package not found"; + qCWarning(LOG_PLASMAQMLSCRIPTENGINE) << "Error loading the wallpaper, package not found"; } emit packageChanged();