diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cb336c98..a27b3ac4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ include(ECMPackageConfigHelpers) include(ECMSetupVersion) include(KDEFrameworkCompilerSettings) include(KDETemplateMacro) +include(ECMQtDeclareLoggingCategory) set(KF5_VERSION "5.18.0") # handled by release scripts set(KF5_DEP_VERSION "5.17.0") # handled by release scripts diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index a8481822b..258adb840 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -46,7 +46,7 @@ PLASMA_UNIT_TESTS( # plasmoidpackagetest ) -add_executable(storagetest storagetest.cpp ../src/plasma/private/storage.cpp ../src/plasma/private/storagethread.cpp) +add_executable(storagetest storagetest.cpp ../src/plasma/private/storage.cpp ../src/plasma/private/storagethread.cpp ../src/plasma/debug_p.cpp) target_link_libraries(storagetest Qt5::Gui Qt5::Test Qt5::Sql KF5::KIOCore KF5::Plasma KF5::CoreAddons) if(HAVE_X11) diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index e2e253b1c..e9215c14b 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -94,6 +94,7 @@ kconfig_add_kcfg_files(Plasma_LIB_SRCS data/kconfigxt/libplasma-theme-global.kcf # TEST_INCLUDES #) +ecm_qt_declare_logging_category(Plasma_LIB_SRCS HEADER debug_p.h IDENTIFIER LOG_PLASMA CATEGORY_NAME org.kde.plasma) add_library(KF5Plasma ${Plasma_LIB_SRCS}) add_library(KF5::Plasma ALIAS KF5Plasma) diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index a703185a0..0b7ef5632 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -55,6 +55,7 @@ #include "private/associatedapplicationmanager_p.h" #include "private/containment_p.h" #include "private/package_p.h" +#include "debug_p.h" namespace Plasma { @@ -63,7 +64,7 @@ Applet::Applet(const KPluginInfo &info, QObject *parent, uint appletId) : QObject(parent), d(new AppletPrivate(KService::Ptr(), &info, appletId, this)) { - qDebug() << " From KPluginInfo, valid? " << info.isValid(); + qCDebug(LOG_PLASMA) << " From KPluginInfo, valid? " << info.isValid(); // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point d->init(); @@ -141,7 +142,7 @@ void Applet::save(KConfigGroup &g) const group = *d->mainConfigGroup(); } - //qDebug() << "saving" << pluginName() << "to" << group.name(); + //qCDebug(LOG_PLASMA) << "saving" << pluginName() << "to" << group.name(); // we call the dptr member directly for locked since isImmutable() // also checks kiosk and parent containers group.writeEntry("immutability", (int)d->immutability); @@ -174,10 +175,10 @@ void Applet::restore(KConfigGroup &group) setGlobalShortcut(QKeySequence(shortcutText)); /* #ifndef NDEBUG - // qDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); + // qCDebug(LOG_PLASMA) << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); #endif #ifndef NDEBUG - // qDebug() << "set to" << d->activationAction->objectName() + // qCDebug(LOG_PLASMA) << "set to" << d->activationAction->objectName() #endif << d->activationAction->globalShortcut().primary(); */ @@ -314,7 +315,7 @@ void Applet::constraintsEvent(Plasma::Types::Constraints constraints) // without calling the Applet:: version as well, which it shouldn't need to. // INSTEAD put such code into flushPendingConstraintsEvents Q_UNUSED(constraints) - //qDebug() << constraints << "constraints are FormFactor: " << formFactor() + //qCDebug(LOG_PLASMA) << constraints << "constraints are FormFactor: " << formFactor() // << ", Location: " << location(); if (d->script) { d->script->constraintsEvent(constraints); @@ -466,7 +467,7 @@ void Applet::flushPendingConstraintsEvents() d->constraintsTimer.stop(); } - //qDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!"; + //qCDebug(LOG_PLASMA) << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!"; Plasma::Types::Constraints c = d->pendingConstraints; d->pendingConstraints = Types::NoConstraint; @@ -562,7 +563,7 @@ void Applet::flushPendingConstraintsEvents() QList Applet::contextualActions() { - //qDebug() << "empty context actions"; + //qCDebug(LOG_PLASMA) << "empty context actions"; return d->script ? d->script->contextualActions() : QList(); } diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 51e02155e..512cdc4bc 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -49,6 +49,7 @@ #include "containmentactions.h" #include "corona.h" #include "pluginloader.h" +#include "debug_p.h" #include "private/applet_p.h" @@ -166,11 +167,11 @@ void Containment::restore(KConfigGroup &group) { /* #ifndef NDEBUG - // qDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type; - // qDebug() << " location:" << group.readEntry("location", (int)d->location); - // qDebug() << " geom:" << group.readEntry("geometry", geometry()); - // qDebug() << " formfactor:" << group.readEntry("formfactor", (int)d->formFactor); - // qDebug() << " screen:" << group.readEntry("screen", d->screen); + // qCDebug(LOG_PLASMA) << "!!!!!!!!!!!!initConstraints" << group.name() << d->type; + // qCDebug(LOG_PLASMA) << " location:" << group.readEntry("location", (int)d->location); + // qCDebug(LOG_PLASMA) << " geom:" << group.readEntry("geometry", geometry()); + // qCDebug(LOG_PLASMA) << " formfactor:" << group.readEntry("formfactor", (int)d->formFactor); + // qCDebug(LOG_PLASMA) << " screen:" << group.readEntry("screen", d->screen); #endif */ setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location)); @@ -189,10 +190,10 @@ void Containment::restore(KConfigGroup &group) KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins"); cfg = KConfigGroup(&cfg, QString::number(containmentType())); - //qDebug() << cfg.keyList(); + //qCDebug(LOG_PLASMA) << cfg.keyList(); if (cfg.exists()) { foreach (const QString &key, cfg.keyList()) { - //qDebug() << "loading" << key; + //qCDebug(LOG_PLASMA) << "loading" << key; setContainmentActions(key, cfg.readEntry(key, QString())); } } else { //shell defaults @@ -213,7 +214,7 @@ void Containment::restore(KConfigGroup &group) /* #ifndef NDEBUG - // qDebug() << "Containment" << id() << + // qCDebug(LOG_PLASMA) << "Containment" << id() << #endif "screen" << screen() << "geometry is" << geometry() << @@ -267,7 +268,7 @@ void Containment::restoreContents(KConfigGroup &group) // are added from left to right or top to bottom for a panel containment QList appletConfigs; foreach (const QString &appletGroup, groups) { - //qDebug() << "reading from applet group" << appletGroup; + //qCDebug(LOG_PLASMA) << "reading from applet group" << appletGroup; KConfigGroup appletConfig(&applets, appletGroup); appletConfigs.append(appletConfig); } @@ -329,7 +330,7 @@ void Containment::setFormFactor(Types::FormFactor formFactor) return; } - //qDebug() << "switching FF to " << formFactor; + //qCDebug(LOG_PLASMA) << "switching FF to " << formFactor; d->formFactor = formFactor; updateConstraints(Plasma::Types::FormFactorConstraint); @@ -375,14 +376,14 @@ void Containment::addApplet(Applet *applet) if (!applet) { #ifndef NDEBUG - // qDebug() << "adding null applet!?!"; + // qCDebug(LOG_PLASMA) << "adding null applet!?!"; #endif return; } if (d->applets.contains(applet)) { #ifndef NDEBUG - // qDebug() << "already have this applet!"; + // qCDebug(LOG_PLASMA) << "already have this applet!"; #endif } diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index 123a5d0a4..316b225ec 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -43,6 +43,7 @@ #include "private/containment_p.h" #include "private/package_p.h" #include "private/timetracker.h" +#include "debug_p.h" using namespace Plasma; @@ -54,7 +55,7 @@ Corona::Corona(QObject *parent) d(new CoronaPrivate(this)) { #ifndef NDEBUG - // qDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start"; + // qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start"; #endif d->init(); @@ -291,7 +292,7 @@ void Corona::setImmutability(const Types::ImmutabilityType immutable) } #ifndef NDEBUG - // qDebug() << "setting immutability to" << immutable; + // qCDebug(LOG_PLASMA) << "setting immutability to" << immutable; #endif d->immutability = immutable; d->updateContainmentImmutability(); @@ -445,7 +446,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi Containment *containment = 0; Applet *applet = 0; - // qDebug() << "Loading" << name << args << id; + // qCDebug(LOG_PLASMA) << "Loading" << name << args << id; if (pluginName.isEmpty() || pluginName == "default") { // default to the desktop containment @@ -464,7 +465,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi if (!containment) { if (!loadingNull) { #ifndef NDEBUG - // qDebug() << "loading of containment" << name << "failed."; + // qCDebug(LOG_PLASMA) << "loading of containment" << name << "failed."; #endif } @@ -562,9 +563,9 @@ QList CoronaPrivate::importLayout(const KConfigGroup &con containmentConfig.copyTo(&realConf); } - //qDebug() << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group; + //qCDebug(LOG_PLASMA) << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group; #ifndef NDEBUG - // qDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin", QString()); + // qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin", QString()); #endif Containment *c = addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(), cid); if (!c) { @@ -575,7 +576,7 @@ QList CoronaPrivate::importLayout(const KConfigGroup &con containmentsIds.insert(c->id()); #ifndef NDEBUG -// qDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Restored Containment" << c->pluginName(); +// qCDebug(LOG_PLASMA) << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Restored Containment" << c->pluginName(); #endif } diff --git a/src/plasma/datacontainer.cpp b/src/plasma/datacontainer.cpp index 4c3d977c4..396bc6dac 100644 --- a/src/plasma/datacontainer.cpp +++ b/src/plasma/datacontainer.cpp @@ -24,6 +24,8 @@ #include #include "plasma.h" +#include "debug_p.h" + namespace Plasma { @@ -106,7 +108,7 @@ bool DataContainer::visualizationIsConnected(QObject *visualization) const void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval, Plasma::Types::IntervalAlignment alignment) { - //qDebug() << "connecting visualization" <::iterator objIt = d->relayObjects.find(visualization); bool connected = objIt != d->relayObjects.end(); @@ -116,15 +118,15 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt SignalRelay *relay = objIt.value(); if (relay) { // connected to a relay - //qDebug() << " already connected, but to a relay"; + //qCDebug(LOG_PLASMA) << " already connected, but to a relay"; if (relay->m_interval == pollingInterval && relay->m_align == alignment) { - //qDebug() << " already connected to a relay of the same interval of" + //qCDebug(LOG_PLASMA) << " already connected to a relay of the same interval of" // << pollingInterval << ", nothing to do"; return; } if (relay->receiverCount() == 1) { - //qDebug() << " removing relay, as it is now unused"; + //qCDebug(LOG_PLASMA) << " removing relay, as it is now unused"; d->relays.remove(relay->m_interval); delete relay; } else { @@ -141,7 +143,7 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt // the visualization was connected already, but not to a relay // and it still doesn't want to connect to a relay, so we have // nothing to do! - //qDebug() << " already connected, nothing to do"; + //qCDebug(LOG_PLASMA) << " already connected, nothing to do"; return; } else { disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)), @@ -157,7 +159,7 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt } if (pollingInterval < 1) { - //qDebug() << " connecting directly"; + //qCDebug(LOG_PLASMA) << " connecting directly"; d->relayObjects[visualization] = 0; if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) { connect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)), @@ -168,7 +170,7 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt visualization, SLOT(modelChanged(QString,QAbstractItemModel*))); } } else { - //qDebug() << " connecting to a relay"; + //qCDebug(LOG_PLASMA) << " connecting to a relay"; // we only want to do an imediate update if this is not the first object to connect to us // if it is the first visualization, then the source will already have been populated // engine's sourceRequested method @@ -338,7 +340,7 @@ void DataContainer::disconnectVisualization(QObject *visualization) void DataContainer::checkForUpdate() { - //qDebug() << objectName() << d->dirty; + //qCDebug(LOG_PLASMA) << objectName() << d->dirty; if (d->dirty) { emit dataUpdated(objectName(), d->data); @@ -390,7 +392,7 @@ void DataContainer::timerEvent(QTimerEvent *event) if (event->timerId() == d->checkUsageTimer.timerId()) { if (!isUsed()) { // DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED! - //qDebug() << objectName() << "is unused"; + //qCDebug(LOG_PLASMA) << objectName() << "is unused"; //NOTE: Notifying visualization of the model destruction before actual deletion avoids crashes in some edge cases if (d->model) { diff --git a/src/plasma/dataengine.cpp b/src/plasma/dataengine.cpp index e3a9d4bbd..dd56807f5 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -74,7 +74,7 @@ DataEngine::DataEngine(QObject *parent, const QVariantList &args) DataEngine::~DataEngine() { - //qDebug() << objectName() << ": bye bye birdy! "; + //qCDebug(LOG_PLASMA) << objectName() << ": bye bye birdy! "; delete d; } @@ -108,7 +108,7 @@ void DataEngine::connectSource(const QString &source, QObject *visualization, uint pollingInterval, Plasma::Types::IntervalAlignment intervalAlignment) const { - //qDebug() << "connectSource" << source; + //qCDebug(LOG_PLASMA) << "connectSource" << source; bool newSource; DataContainer *s = d->requestSource(source, &newSource); @@ -122,7 +122,7 @@ void DataEngine::connectSource(const QString &source, QObject *visualization, } d->connectSource(s, visualization, pollingInterval, intervalAlignment, !newSource || pollingInterval > 0); - //qDebug() << " ==> source connected"; + //qCDebug(LOG_PLASMA) << " ==> source connected"; } } @@ -162,7 +162,7 @@ bool DataEngine::updateSourceEvent(const QString &source) if (d->script) { return d->script->updateSourceEvent(source); } else { - //qDebug() << source; + //qCDebug(LOG_PLASMA) << source; return false; //TODO: should this be true to trigger, even needless, updates on every tick? } } @@ -260,7 +260,7 @@ void DataEngine::addSource(DataContainer *source) { if (d->sources.contains(source->objectName())) { #ifndef NDEBUG - // qDebug() << "source named \"" << source->objectName() << "\" already exists."; + // qCDebug(LOG_PLASMA) << "source named \"" << source->objectName() << "\" already exists."; #endif return; } @@ -342,17 +342,17 @@ QHash DataEngine::containerDict() const void DataEngine::timerEvent(QTimerEvent *event) { - //qDebug(); + //qCDebug(LOG_PLASMA); if (event->timerId() == d->updateTimerId) { // if the freq update is less than 0, don't bother if (d->minPollingInterval < 0) { - //qDebug() << "uh oh.. no polling allowed!"; + //qCDebug(LOG_PLASMA) << "uh oh.. no polling allowed!"; return; } // minPollingInterval if (d->updateTimer.elapsed() < d->minPollingInterval) { - //qDebug() << "hey now.. slow down!"; + //qCDebug(LOG_PLASMA) << "hey now.. slow down!"; return; } @@ -377,7 +377,7 @@ void DataEngine::updateAllSources() QHashIterator it(d->sources); while (it.hasNext()) { it.next(); - //qDebug() << "updating" << it.key(); + //qCDebug(LOG_PLASMA) << "updating" << it.key(); if (it.value()->isUsed()) { updateSourceEvent(it.key()); } @@ -445,7 +445,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con if (!script) { #ifndef NDEBUG - // qDebug() << "Could not create a" << api << "ScriptEngine for the" + // qCDebug(LOG_PLASMA) << "Could not create a" << api << "ScriptEngine for the" // << dataEngineDescription.name() << "DataEngine."; #endif delete package; @@ -468,7 +468,7 @@ void DataEnginePrivate::internalUpdateSource(DataContainer *source) if (minPollingInterval > 0 && source->timeSinceLastUpdate() < (uint)minPollingInterval) { // skip updating this source; it's been too soon - //qDebug() << "internal update source is delaying" << source->timeSinceLastUpdate() << minPollingInterval; + //qCDebug(LOG_PLASMA) << "internal update source is delaying" << source->timeSinceLastUpdate() << minPollingInterval; //but fake an update so that the signalrelay that triggered this gets the data from the //recent update. this way we don't have to worry about queuing - the relay will send a //signal immediately and everyone else is undisturbed. @@ -477,11 +477,11 @@ void DataEnginePrivate::internalUpdateSource(DataContainer *source) } if (q->updateSourceEvent(source->objectName())) { - //qDebug() << "queuing an update"; + //qCDebug(LOG_PLASMA) << "queuing an update"; scheduleSourcesUpdated(); }/* else { #ifndef NDEBUG - // qDebug() << "no update"; + // qCDebug(LOG_PLASMA) << "no update"; #endif }*/ } @@ -513,7 +513,7 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW return 0; } - //qDebug() << "DataEngine " << q->objectName() << ": could not find DataContainer " << sourceName << ", creating"; + //qCDebug(LOG_PLASMA) << "DataEngine " << q->objectName() << ": could not find DataContainer " << sourceName << ", creating"; DataContainer *s = new DataContainer(q); s->setObjectName(sourceName); sources.insert(sourceName, s); @@ -529,7 +529,7 @@ void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization, Plasma::Types::IntervalAlignment align, bool immediateCall) { - //qDebug() << "connect source called" << s->objectName() << "with interval" << pollingInterval; + //qCDebug(LOG_PLASMA) << "connect source called" << s->objectName() << "with interval" << pollingInterval; if (pollingInterval > 0) { // never more frequently than allowed, never more than 20 times per second @@ -543,7 +543,7 @@ void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization, if (immediateCall) { // we don't want to do an immediate call if we are simply // reconnecting - //qDebug() << "immediate call requested, we have:" << s->visualizationIsConnected(visualization); + //qCDebug(LOG_PLASMA) << "immediate call requested, we have:" << s->visualizationIsConnected(visualization); immediateCall = !s->data().isEmpty() && !s->visualizationIsConnected(visualization); } @@ -582,12 +582,12 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool *newSource = false; } - //qDebug() << "requesting source " << sourceName; + //qCDebug(LOG_PLASMA) << "requesting source " << sourceName; DataContainer *s = source(sourceName, false); if (!s) { // we didn't find a data source, so give the engine an opportunity to make one - /*// qDebug() << "DataEngine " << q->objectName() + /*// qCDebug(LOG_PLASMA) << "DataEngine " << q->objectName() << ": could not find DataContainer " << sourceName << " will create on request" << endl;*/ waitingSourceRequest = sourceName; @@ -619,7 +619,7 @@ void DataEnginePrivate::setupScriptSupport() /* #ifndef NDEBUG - // qDebug() << "sletting up script support, package is in" << package->path() + // qCDebug(LOG_PLASMA) << "sletting up script support, package is in" << package->path() #endif << "which is a" << package->structure()->type() << "package" << ", main script is" << package->filePath("mainscript"); diff --git a/src/plasma/dataengineconsumer.cpp b/src/plasma/dataengineconsumer.cpp index c1e886bb7..7c9b5f93a 100644 --- a/src/plasma/dataengineconsumer.cpp +++ b/src/plasma/dataengineconsumer.cpp @@ -29,6 +29,7 @@ #include "private/dataenginemanager_p.h" #include "servicejob.h" +#include "debug_p.h" namespace Plasma { @@ -36,36 +37,36 @@ namespace Plasma void DataEngineConsumerPrivate::slotJobFinished(Plasma::ServiceJob *job) { #ifndef NDEBUG - // qDebug() << "engine ready!"; + // qCDebug(LOG_PLASMA) << "engine ready!"; #endif QString engineName = job->parameters()["EngineName"].toString(); QString location = job->destination(); QPair pair(location, engineName); #ifndef NDEBUG - // qDebug() << "pair = " << pair; + // qCDebug(LOG_PLASMA) << "pair = " << pair; #endif } void DataEngineConsumerPrivate::slotServiceReady(Plasma::Service *plasmoidService) { #ifndef NDEBUG - // qDebug() << "service ready!"; + // qCDebug(LOG_PLASMA) << "service ready!"; #endif if (!engineNameForService.contains(plasmoidService)) { #ifndef NDEBUG - // qDebug() << "no engine name for service!"; + // qCDebug(LOG_PLASMA) << "no engine name for service!"; #endif #ifndef NDEBUG - // qDebug() << "amount of services in map: " << engineNameForService.count(); + // qCDebug(LOG_PLASMA) << "amount of services in map: " << engineNameForService.count(); #endif } else { #ifndef NDEBUG - // qDebug() << "value = " << engineNameForService.value(plasmoidService); + // qCDebug(LOG_PLASMA) << "value = " << engineNameForService.value(plasmoidService); #endif } #ifndef NDEBUG - // qDebug() << "requesting dataengine!"; + // qCDebug(LOG_PLASMA) << "requesting dataengine!"; #endif QVariantMap op = plasmoidService->operationDescription("DataEngine"); op["EngineName"] = engineNameForService.value(plasmoidService); diff --git a/src/plasma/framesvg.cpp b/src/plasma/framesvg.cpp index af3a18975..107e0e6d1 100644 --- a/src/plasma/framesvg.cpp +++ b/src/plasma/framesvg.cpp @@ -35,6 +35,7 @@ #include "theme.h" #include "private/svg_p.h" #include "private/framesvg_helpers.h" +#include "debug_p.h" namespace Plasma { @@ -137,10 +138,10 @@ void FrameSvg::setEnabledBorders(const EnabledBorders borders) const QString newKey = d->cacheId(fd, d->prefix); fd->enabledBorders = oldBorders; - //qDebug() << "looking for" << newKey; + //qCDebug(LOG_PLASMA) << "looking for" << newKey; FrameData *newFd = FrameSvgPrivate::s_sharedFrames[theme()->d].value(newKey); if (newFd) { - //qDebug() << "FOUND IT!" << newFd->refcount; + //qCDebug(LOG_PLASMA) << "FOUND IT!" << newFd->refcount; // we've found a math, so insert that new one and ref it .. newFd->ref(this); d->frames.insert(d->prefix, newFd); @@ -148,7 +149,7 @@ void FrameSvg::setEnabledBorders(const EnabledBorders borders) //.. then deref the old one and if it's no longer used, get rid of it if (fd->deref(this)) { //const QString oldKey = d->cacheId(fd, d->prefix); - //qDebug() << "1. Removing it" << oldKey << fd->refcount; + //qCDebug(LOG_PLASMA) << "1. Removing it" << oldKey << fd->refcount; FrameSvgPrivate::s_sharedFrames[theme()->d].remove(oldKey); delete fd; } @@ -256,7 +257,7 @@ void FrameSvg::setElementPrefix(const QString &prefix) // we have to cache after inserting the frame since the cacheId requires the // frame to be in the frames collection already const QString key = d->cacheId(oldFrameData, d->prefix); - //qDebug() << this << " 1. inserting as" << key; + //qCDebug(LOG_PLASMA) << this << " 1. inserting as" << key; FrameSvgPrivate::s_sharedFrames[theme()->d].insert(key, newFd); } @@ -329,7 +330,7 @@ void FrameSvg::resizeFrame(const QSizeF &size) if (size.isEmpty()) { #ifndef NDEBUG - // qDebug() << "Invalid size" << size; + // qCDebug(LOG_PLASMA) << "Invalid size" << size; #endif return; } @@ -345,10 +346,10 @@ void FrameSvg::resizeFrame(const QSizeF &size) const QString newKey = d->cacheId(fd, d->prefix); fd->frameSize = currentSize; - //qDebug() << "looking for" << newKey; + //qCDebug(LOG_PLASMA) << "looking for" << newKey; FrameData *newFd = FrameSvgPrivate::s_sharedFrames[theme()->d].value(newKey); if (newFd) { - //qDebug() << "FOUND IT!" << newFd->refcount; + //qCDebug(LOG_PLASMA) << "FOUND IT!" << newFd->refcount; // we've found a math, so insert that new one and ref it .. newFd->ref(this); d->frames.insert(d->prefix, newFd); @@ -356,7 +357,7 @@ void FrameSvg::resizeFrame(const QSizeF &size) //.. then deref the old one and if it's no longer used, get rid of it if (fd->deref(this)) { //const QString oldKey = d->cacheId(fd, d->prefix); - //qDebug() << "1. Removing it" << oldKey << fd->refcount; + //qCDebug(LOG_PLASMA) << "1. Removing it" << oldKey << fd->refcount; FrameSvgPrivate::s_sharedFrames[theme()->d].remove(oldKey); delete fd; } @@ -583,7 +584,7 @@ FrameSvgPrivate::~FrameSvgPrivate() { #ifdef DEBUG_FRAMESVG_CACHE #ifndef NDEBUG - // qDebug() << "*************" << q << q->imagePath() << "****************"; + // qCDebug(LOG_PLASMA) << "*************" << q << q->imagePath() << "****************"; #endif #endif @@ -597,7 +598,7 @@ FrameSvgPrivate::~FrameSvgPrivate() const QString key = cacheId(it.value(), it.key()); #ifdef DEBUG_FRAMESVG_CACHE #ifndef NDEBUG - // qDebug() << "2. Removing it" << key << it.value() << it.value()->refcount() << s_sharedFrames[theme()->d].contains(key); + // qCDebug(LOG_PLASMA) << "2. Removing it" << key << it.value() << it.value()->refcount() << s_sharedFrames[theme()->d].contains(key); #endif #endif s_sharedFrames[q->theme()->d].remove(key); @@ -606,12 +607,12 @@ FrameSvgPrivate::~FrameSvgPrivate() #ifdef DEBUG_FRAMESVG_CACHE else { #ifndef NDEBUG - // qDebug() << "still shared:" << cacheId(it.value(), it.key()) << it.value() << it.value()->refcount() << it.value()->isUsed(); + // qCDebug(LOG_PLASMA) << "still shared:" << cacheId(it.value(), it.key()) << it.value() << it.value()->refcount() << it.value()->isUsed(); #endif } } else { #ifndef NDEBUG - // qDebug() << "lost our value for" << it.key(); + // qCDebug(LOG_PLASMA) << "lost our value for" << it.key(); #endif #endif } @@ -625,22 +626,22 @@ FrameSvgPrivate::~FrameSvgPrivate() const int rc = it2.value()->refcount(); if (rc == 0) { #ifndef NDEBUG - // qDebug() << " LOST!" << it2.key() << rc << it2.value();// << it2.value()->references; + // qCDebug(LOG_PLASMA) << " LOST!" << it2.key() << rc << it2.value();// << it2.value()->references; #endif } else { #ifndef NDEBUG - // qDebug() << " " << it2.key() << rc << it2.value(); + // qCDebug(LOG_PLASMA) << " " << it2.key() << rc << it2.value(); #endif foreach (FrameSvg *data, it2.value()->references.keys()) { #ifndef NDEBUG - qDebug() << " " << (void *)data << it2.value()->references[data]; + qCDebug(LOG_PLASMA) << " " << (void *)data << it2.value()->references[data]; #endif } shares += rc - 1; } } #ifndef NDEBUG - // qDebug() << "#####################################" << s_sharedFrames[theme()->d].count() << ", pixmaps saved:" << shares; + // qCDebug(LOG_PLASMA) << "#####################################" << s_sharedFrames[theme()->d].count() << ", pixmaps saved:" << shares; #endif #endif @@ -793,17 +794,17 @@ void FrameSvgPrivate::generateBackground(FrameData *frame) void FrameSvgPrivate::generateFrameBackground(FrameData *frame) { - //qDebug() << "generating background"; + //qCDebug(LOG_PLASMA) << "generating background"; const QSize size = frameSize(frame).toSize() * q->devicePixelRatio(); if (!size.isValid()) { #ifndef NDEBUG - // qDebug() << "Invalid frame size" << size; + // qCDebug(LOG_PLASMA) << "Invalid frame size" << size; #endif return; } if (size.width() >= MAX_FRAME_SIZE || size.height() >= MAX_FRAME_SIZE) { - qWarning() << "Not generating frame background for a size whose width or height is more than" << MAX_FRAME_SIZE << size; + qCWarning(LOG_PLASMA) << "Not generating frame background for a size whose width or height is more than" << MAX_FRAME_SIZE << size; return; } @@ -934,7 +935,7 @@ void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &bac const QString id = cacheId(frame, prefixToSave); - //qDebug()<<"Saving to cache frame"<theme()->insertIntoCache(id, background, QString::number((qint64)q, 16) % prefixToSave); @@ -946,7 +947,7 @@ void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &bac void FrameSvgPrivate::updateSizes() const { - //qDebug() << "!!!!!!!!!!!!!!!!!!!!!! updating sizes" << prefix; + //qCDebug(LOG_PLASMA) << "!!!!!!!!!!!!!!!!!!!!!! updating sizes" << prefix; FrameData *frame = frames[prefix]; Q_ASSERT(frame); @@ -1073,13 +1074,13 @@ QSizeF FrameSvgPrivate::frameSize(FrameData *frame) const void FrameData::ref(FrameSvg *svg) { references[svg] = references[svg] + 1; - //qDebug() << this << svg << references[svg]; + //qCDebug(LOG_PLASMA) << this << svg << references[svg]; } bool FrameData::deref(FrameSvg *svg) { references[svg] = references[svg] - 1; - //qDebug() << this << svg << references[svg]; + //qCDebug(LOG_PLASMA) << this << svg << references[svg]; if (references[svg] < 1) { references.remove(svg); } diff --git a/src/plasma/package.cpp b/src/plasma/package.cpp index e5a83cbbc..09f36f30d 100644 --- a/src/plasma/package.cpp +++ b/src/plasma/package.cpp @@ -290,8 +290,8 @@ KJob *Package::install(const QString &sourcePackage, const QString &packageRoot) { const QString src = sourcePackage; const QString dest = packageRoot.isEmpty() ? defaultPackageRoot() : packageRoot; - //qDebug() << "Source: " << src; - //qDebug() << "PackageRoot: " << dest; + //qCDebug(LOG_PLASMA) << "Source: " << src; + //qCDebug(LOG_PLASMA) << "PackageRoot: " << dest; KJob *j = d->structure->install(this, src, dest); return j; } diff --git a/src/plasma/packagestructure.cpp b/src/plasma/packagestructure.cpp index aaea44cf9..09ea6982b 100644 --- a/src/plasma/packagestructure.cpp +++ b/src/plasma/packagestructure.cpp @@ -21,6 +21,7 @@ #include #include "private/package_p.h" #include "private/packagestructure_p.h" +#include "debug_p.h" #include #include @@ -108,7 +109,7 @@ void PackageStructurePrivate::installPathChanged(const QString &path) bool ok = QFile::remove(service); if (!ok) { - qWarning() << "Unable to remove " << service; + qCWarning(LOG_PLASMA) << "Unable to remove " << service; } //install @@ -135,16 +136,16 @@ void PackageStructurePrivate::installPathChanged(const QString &path) QString localServiceDirectory = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/"); if (!QDir().mkpath(localServiceDirectory)) { - qDebug() << "Failed to create ... " << localServiceDirectory; - qWarning() << "Could not create local service directory:" << localServiceDirectory; + qCDebug(LOG_PLASMA) << "Failed to create ... " << localServiceDirectory; + qCWarning(LOG_PLASMA) << "Could not create local service directory:" << localServiceDirectory; return; } QString service = localServiceDirectory + serviceName; - qDebug() << "-- Copying " << metaPath << service; + qCDebug(LOG_PLASMA) << "-- Copying " << metaPath << service; const bool ok = QFile::copy(metaPath, service); if (ok) { - qDebug() << "Copying metadata went ok."; + qCDebug(LOG_PLASMA) << "Copying metadata went ok."; // the icon in the installed file needs to point to the icon in the // installation dir! QString iconPath = path + '/' + cg.readEntry("Icon"); @@ -155,7 +156,7 @@ void PackageStructurePrivate::installPathChanged(const QString &path) cg.writeEntry("Icon", iconPath); } } else { - qWarning() << "Could not register package as service (this is not necessarily fatal):" << serviceName; + qCWarning(LOG_PLASMA) << "Could not register package as service (this is not necessarily fatal):" << serviceName; } } } diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp index a27f924d0..d7c49f2a4 100644 --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -45,6 +45,7 @@ #include "private/storage_p.h" #include "private/package_p.h" #include "private/packagestructure_p.h" +#include "debug_p.h" namespace Plasma { @@ -151,7 +152,7 @@ void PluginLoader::setPluginLoader(PluginLoader *loader) s_pluginLoader = loader; } else { #ifndef NDEBUG - // qDebug() << "Cannot set pluginLoader, already set!" << s_pluginLoader; + // qCDebug(LOG_PLASMA) << "Cannot set pluginLoader, already set!" << s_pluginLoader; #endif } } @@ -223,7 +224,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari p.setFallbackPackage(fp); if (!fp.isValid()) { - qWarning() << "invalid fallback path in " << p.path(); + qCWarning(LOG_PLASMA) << "invalid fallback path in " << p.path(); return 0; } } @@ -233,12 +234,12 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari { KPluginInfo info = KPluginInfo::fromMetaData(p.metadata()); if (!info.isValid()) { - qWarning() << "invalid plugin in" << p.path(); + qCWarning(LOG_PLASMA) << "invalid plugin in" << p.path(); return 0; } KPluginLoader loader(info.libraryPath()); if (!Plasma::isPluginVersionCompatible(loader.pluginVersion())) { - qWarning() << "incompatiable plugin version in" << p.path(); + qCWarning(LOG_PLASMA) << "incompatiable plugin version in" << p.path(); return 0; } KPluginFactory *factory = loader.factory(); @@ -254,7 +255,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari if (!applet) { - //qDebug() << name << "not a C++ applet: Falling back to an empty one"; + //qCDebug(LOG_PLASMA) << name << "not a C++ applet: Falling back to an empty one"; QVariantList allArgs; allArgs << p.metadata().fileName() << appletId << args; @@ -462,7 +463,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co if (offers.isEmpty()) { #ifndef NDEBUG - qDebug() << "offers is empty for " << name; + qCDebug(LOG_PLASMA) << "offers is empty for " << name; #endif return 0; } @@ -481,7 +482,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co if (!actions) { #ifndef NDEBUG - // qDebug() << "Couldn't load containmentActions \"" << name << "\"! reason given: " << error; + // qCDebug(LOG_PLASMA) << "Couldn't load containmentActions \"" << name << "\"! reason given: " << error; #endif } @@ -551,7 +552,7 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s } #ifndef NDEBUG - // qDebug() << "Couldn't load Package for" << packageFormat << "! reason given: " << error; + // qCDebug(LOG_PLASMA) << "Couldn't load Package for" << packageFormat << "! reason given: " << error; #endif return Package(); @@ -581,7 +582,7 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS for (auto md : KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter)) { auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName())); if (!pi.isValid()) { - qWarning() << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; + qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; continue; } list << pi; @@ -607,7 +608,7 @@ KPluginInfo::List PluginLoader::listAppletInfo(const QString &category, const QS for (auto md : KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter)) { auto pi = KPluginInfo(KService::serviceByStorageId(md.metaDataFileName())); if (!pi.isValid()) { - qWarning() << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; + qCWarning(LOG_PLASMA) << "Could not load plugin info for plugin :" << md.pluginId() << "skipping plugin"; continue; } list << pi; @@ -648,7 +649,7 @@ KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url) rx.setPatternSyntax(QRegExp::Wildcard); if (rx.exactMatch(url.toString())) { #ifndef NDEBUG - // qDebug() << info.name() << "matches" << glob << url; + // qCDebug(LOG_PLASMA) << info.name() << "matches" << glob << url; #endif filtered << info; } diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index f37a42e25..511b45119 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -46,6 +46,7 @@ #include "private/containment_p.h" #include "private/package_p.h" #include "timetracker.h" +#include "debug_p.h" namespace Plasma { @@ -90,7 +91,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int AppletPrivate::~AppletPrivate() { if (activationAction && globalShortcutEnabled) { - //qDebug() << "resetting global action for" << q->title() << activationAction->objectName(); + //qCDebug(LOG_PLASMA) << "resetting global action for" << q->title() << activationAction->objectName(); KGlobalAccel::self()->removeAllShortcuts(activationAction); } @@ -127,7 +128,7 @@ void AppletPrivate::init(const QString &packagePath, const QVariantList &args) if (!appletDescription.isValid()) { #ifndef NDEBUG - // qDebug() << "Check your constructor! " + // qCDebug(LOG_PLASMA) << "Check your constructor! " // << "You probably want to be passing in a Service::Ptr " // << "or a QVariantList with a valid storageid as arg[0]."; #endif @@ -348,7 +349,7 @@ void AppletPrivate::globalShortcutChanged() shortcutConfig.writeEntry("global", newShortCut); scheduleModificationNotification(); } - //qDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary(); + //qCDebug(LOG_PLASMA) << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary(); } KActionCollection *AppletPrivate::defaultActions(QObject *parent) @@ -445,7 +446,7 @@ void AppletPrivate::setupPackage() } #ifndef NDEBUG - // qDebug() << "setting up script support, package is in" << package->path() + // qCDebug(LOG_PLASMA) << "setting up script support, package is in" << package->path() // << ", main script is" << package->filePath("mainscript"); #endif @@ -511,7 +512,7 @@ KConfigGroup *AppletPrivate::mainConfigGroup() if (q->isContainment()) { Corona *corona = static_cast(q)->corona(); KConfigGroup containmentConfig; - //qDebug() << "got a corona, baby?" << (QObject*)corona << (QObject*)q; + //qCDebug(LOG_PLASMA) << "got a corona, baby?" << (QObject*)corona << (QObject*)q; if (parentApplet) { containmentConfig = parentApplet->config(); @@ -531,7 +532,7 @@ KConfigGroup *AppletPrivate::mainConfigGroup() appletConfig = c->config(); appletConfig = KConfigGroup(&appletConfig, "Applets"); } else { - qWarning() << "requesting config for" << q->title() << "without a containment!"; + qCWarning(LOG_PLASMA) << "requesting config for" << q->title() << "without a containment!"; appletConfig = KConfigGroup(KSharedConfig::openConfig(), "Applets"); } diff --git a/src/plasma/private/associatedapplicationmanager.cpp b/src/plasma/private/associatedapplicationmanager.cpp index 182f657d5..e1620e99b 100644 --- a/src/plasma/private/associatedapplicationmanager.cpp +++ b/src/plasma/private/associatedapplicationmanager.cpp @@ -20,6 +20,7 @@ #include "associatedapplicationmanager_p.h" #include "config-plasma.h" +#include "debug_p.h" #include #include @@ -167,7 +168,7 @@ void AssociatedApplicationManager::run(Plasma::Applet *applet) #if !PLASMA_NO_KIO bool success = KRun::run(d->applicationNames.value(applet), d->urlLists.value(applet), 0); if (!success) { - qWarning() << "couldn't run" << d->applicationNames.value(applet) << d->urlLists.value(applet); + qCWarning(LOG_PLASMA) << "couldn't run" << d->applicationNames.value(applet) << d->urlLists.value(applet); } #else QString execCommand = d->applicationNames.value(applet); diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index 5e417d5a0..86d27c43f 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -35,6 +35,7 @@ #include "private/applet_p.h" #include "timetracker.h" +#include "debug_p.h" namespace Plasma { @@ -115,7 +116,7 @@ void ContainmentPrivate::configChanged() void ContainmentPrivate::checkStatus(Plasma::Types::ItemStatus appletStatus) { - //qDebug() << "================== "<< appletStatus << q->status(); + //qCDebug(LOG_PLASMA) << "================== "<< appletStatus << q->status(); if (appletStatus == q->status()) { emit q->statusChanged(appletStatus); return; @@ -145,7 +146,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints return; } - //qDebug() << "got containmentConstraintsEvent" << constraints; + //qCDebug(LOG_PLASMA) << "got containmentConstraintsEvent" << constraints; if (constraints & Plasma::Types::ImmutableConstraint) { //update actions const bool unlocked = q->immutability() == Types::Mutable; @@ -200,7 +201,7 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList if (q->immutability() != Types::Mutable) { #ifndef NDEBUG - // qDebug() << "addApplet for" << name << "requested, but we're currently immutable!"; + // qCDebug(LOG_PLASMA) << "addApplet for" << name << "requested, but we're currently immutable!"; #endif return 0; } @@ -208,7 +209,7 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList Applet *applet = PluginLoader::self()->loadApplet(name, id, args); if (!applet) { - qWarning() << "Applet" << name << "could not be loaded."; + qCWarning(LOG_PLASMA) << "Applet" << name << "could not be loaded."; applet = new Applet(0, QString(), id); applet->setLaunchErrorMessage(i18n("Could not find requested component: %1", name)); } diff --git a/src/plasma/private/datacontainer_p.cpp b/src/plasma/private/datacontainer_p.cpp index d9d33d77f..919311150 100644 --- a/src/plasma/private/datacontainer_p.cpp +++ b/src/plasma/private/datacontainer_p.cpp @@ -65,7 +65,7 @@ SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint m_resetTimer(true), m_queued(true) { - //qDebug() << "signal relay with time of" << m_timerId << "being set up"; + //qCDebug(LOG_PLASMA) << "signal relay with time of" << m_timerId << "being set up"; m_timerId = startTimer(immediateUpdate ? 0 : m_interval); if (m_align != Plasma::Types::NoAlignment) { checkAlignment(); @@ -110,7 +110,7 @@ void SignalRelay::checkAlignment() void SignalRelay::checkQueueing() { - //qDebug() << m_queued; + //qCDebug(LOG_PLASMA) << m_queued; if (m_queued) { emit dataUpdated(dc->objectName(), d->data); m_queued = false; @@ -153,13 +153,13 @@ void SignalRelay::timerEvent(QTimerEvent *event) emit dc->updateRequested(dc); if (d->hasUpdates()) { - //qDebug() << "emitting data updated directly" << d->data; + //qCDebug(LOG_PLASMA) << "emitting data updated directly" << d->data; emit dataUpdated(dc->objectName(), d->data); m_queued = false; } else { // the source wasn't actually updated; so let's put ourselves in the queue // so we get a dataUpdated() call when the data does arrive - //qDebug() << "queued"; + //qCDebug(LOG_PLASMA) << "queued"; m_queued = true; } } diff --git a/src/plasma/private/dataenginemanager.cpp b/src/plasma/private/dataenginemanager.cpp index 48bd0a906..7862171b7 100644 --- a/src/plasma/private/dataenginemanager.cpp +++ b/src/plasma/private/dataenginemanager.cpp @@ -32,6 +32,7 @@ #include "private/dataengine_p.h" #include "private/datacontainer_p.h" #include "scripting/scriptengine.h" +#include "debug_p.h" namespace Plasma { @@ -121,7 +122,7 @@ Plasma::DataEngine *DataEngineManager::engine(const QString &name) const Plasma::DataEngine *DataEngineManager::loadEngine(const QString &name) { if (name.isEmpty()) { - qDebug() << "Asked an engine with empty name"; + qCDebug(LOG_PLASMA) << "Asked an engine with empty name"; return d->nullEngine(); } Plasma::DataEngine::Dict::const_iterator it = d->engines.constFind(name); @@ -134,7 +135,7 @@ Plasma::DataEngine *DataEngineManager::loadEngine(const QString &name) DataEngine *engine = PluginLoader::self()->loadDataEngine(name); if (!engine) { - qDebug() << "Can't find a dataengine named" << name; + qCDebug(LOG_PLASMA) << "Can't find a dataengine named" << name; // Try installing the engine. However, it's too late for this request. ComponentInstaller::self()->installMissingComponent("dataengine", name); @@ -166,7 +167,7 @@ void DataEngineManager::timerEvent(QTimerEvent *) QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "plasma_dataenginemanager_log"; QFile f(path); if (!f.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) { - // qDebug() << "faild to open" << path; + // qCDebug(LOG_PLASMA) << "faild to open" << path; return; } diff --git a/src/plasma/private/storagethread.cpp b/src/plasma/private/storagethread.cpp index d3a621971..91b490bac 100644 --- a/src/plasma/private/storagethread.cpp +++ b/src/plasma/private/storagethread.cpp @@ -30,6 +30,7 @@ #include #include +#include "debug_p.h" namespace Plasma { @@ -84,12 +85,12 @@ void StorageThread::initializeDb(StorageJob *caller) } if (!m_db.open()) { - qWarning() << "Unable to open the plasma storage cache database: " << m_db.lastError(); + qCWarning(LOG_PLASMA) << "Unable to open the plasma storage cache database: " << m_db.lastError(); } else if (!m_db.tables().contains(caller->clientName())) { QSqlQuery query(m_db); query.prepare(QString("create table ") + caller->clientName() + " (valueGroup varchar(256), id varchar(256), txt TEXT, int INTEGER, float REAL, binary BLOB, creationTime datetime, accessTime datetime, primary key (valueGroup, id))"); if (!query.exec()) { - qWarning() << "Unable to create table for" << caller->clientName(); + qCWarning(LOG_PLASMA) << "Unable to create table for" << caller->clientName(); m_db.close(); } } @@ -150,7 +151,7 @@ void StorageThread::save(QWeakPointer wcaller, const QVariantMap &pa it.toFront(); while (it.hasNext()) { it.next(); - //qDebug() << "going to insert" << valueGroup << it.key(); + //qCDebug(LOG_PLASMA) << "going to insert" << valueGroup << it.key(); query.bindValue(":id", it.key()); QString field; @@ -185,7 +186,7 @@ void StorageThread::save(QWeakPointer wcaller, const QVariantMap &pa } if (!query.exec()) { - //qDebug() << "query failed:" << query.lastQuery() << query.lastError().text(); + //qCDebug(LOG_PLASMA) << "query failed:" << query.lastQuery() << query.lastError().text(); m_db.commit(); emit newResult(caller, false); return; diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index b2ba156fb..18419bb1b 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -21,6 +21,7 @@ #include "theme_p.h" #include "framesvg.h" #include "framesvg_p.h" +#include "debug_p.h" #include #include @@ -143,7 +144,7 @@ KConfigGroup &ThemePrivate::config() if (!app.isEmpty()) { #ifndef NDEBUG - // qDebug() << "using theme for app" << app; + // qCDebug(LOG_PLASMA) << "using theme for app" << app; #endif groupName.append('-').append(app); } @@ -306,7 +307,7 @@ void ThemePrivate::compositingChanged(bool active) #if HAVE_X11 if (compositingActive != active) { compositingActive = active; - //qDebug() << QTime::currentTime(); + //qCDebug(LOG_PLASMA) << QTime::currentTime(); scheduleThemeChangeNotification(PixmapCache | SvgElementsCache); } #endif @@ -374,7 +375,7 @@ void ThemePrivate::scheduleThemeChangeNotification(CacheTypes caches) void ThemePrivate::notifyOfChanged() { - //qDebug() << cachesToDiscard; + //qCDebug(LOG_PLASMA) << cachesToDiscard; discardCache(cachesToDiscard); cachesToDiscard = NoCache; emit themeChanged(); @@ -501,7 +502,7 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group) void ThemePrivate::settingsFileChanged(const QString &file) { - qDebug() << "settingsFile: " << file; + qCDebug(LOG_PLASMA) << "settingsFile: " << file; if (file == themeMetadataPath) { const KPluginInfo pluginInfo(themeMetadataPath); if (themeVersion != pluginInfo.version()) { @@ -518,7 +519,7 @@ void ThemePrivate::settingsChanged(bool emitChanges) if (fixedName) { return; } - //qDebug() << "Settings Changed!"; + //qCDebug(LOG_PLASMA) << "Settings Changed!"; KConfigGroup cg = config(); setThemeName(cg.readEntry("name", ThemePrivate::defaultTheme), false, emitChanges); } @@ -761,7 +762,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/colors")) : QString(); - //qDebug() << "we're going for..." << colorsFile << "*******************"; + //qCDebug(LOG_PLASMA) << "we're going for..." << colorsFile << "*******************"; if (colorsFile.isEmpty()) { colors = 0; diff --git a/src/plasma/scripting/scriptengine.cpp b/src/plasma/scripting/scriptengine.cpp index 8571949db..b9f43fede 100644 --- a/src/plasma/scripting/scriptengine.cpp +++ b/src/plasma/scripting/scriptengine.cpp @@ -28,6 +28,7 @@ #include "private/componentinstaller_p.h" #include "scripting/appletscript.h" #include "scripting/dataenginescript.h" +#include "debug_p.h" namespace Plasma { @@ -90,7 +91,7 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb if (((type & Types::AppletComponent) && !componentTypes.contains(QLatin1String("Applet"))) || ((type & Types::DataEngineComponent) && !componentTypes.contains(QLatin1String("DataEngine")))) { - qWarning() << "ScriptEngine" << plugins.first().name() << "does not provide Applet or DataEngine components, returning empty."; + qCWarning(LOG_PLASMA) << "ScriptEngine" << plugins.first().name() << "does not provide Applet or DataEngine components, returning empty."; return 0; } KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); @@ -99,7 +100,7 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb if (factory) { engine = factory->create(0, args); } else { - qWarning() << "Unable to load" << plugins.first().name() << "ScriptEngine"; + qCWarning(LOG_PLASMA) << "Unable to load" << plugins.first().name() << "ScriptEngine"; } } diff --git a/src/plasma/service.cpp b/src/plasma/service.cpp index 9815c71f0..d603cf2e9 100644 --- a/src/plasma/service.cpp +++ b/src/plasma/service.cpp @@ -35,6 +35,7 @@ #include "version.h" #include "pluginloader.h" +#include "debug_p.h" namespace Plasma { @@ -71,7 +72,7 @@ QStringList Service::operationNames() const { if (d->operationsMap.keys().isEmpty()) { #ifndef NDEBUG - // qDebug() << "No valid operations scheme has been registered"; + // qCDebug(LOG_PLASMA) << "No valid operations scheme has been registered"; #endif return QStringList(); } @@ -83,12 +84,12 @@ QVariantMap Service::operationDescription(const QString &operationName) { if (d->operationsMap.keys().isEmpty()) { #ifndef NDEBUG - // qDebug() << "No valid operations scheme has been registered"; + // qCDebug(LOG_PLASMA) << "No valid operations scheme has been registered"; #endif return QVariantMap(); } - //qDebug() << "operation" << operationName + //qCDebug(LOG_PLASMA) << "operation" << operationName // << "requested, has keys" << d->operationsMap.keys(); return d->operationsMap.value(operationName); } @@ -101,12 +102,12 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject if (d->operationsMap.keys().isEmpty()) { #ifndef NDEBUG - // qDebug() << "No valid operations scheme has been registered"; + // qCDebug(LOG_PLASMA) << "No valid operations scheme has been registered"; #endif } else if (!op.isEmpty() && d->operationsMap.contains(op)) { if (d->disabledOperations.contains(op)) { #ifndef NDEBUG - // qDebug() << "Operation" << op << "is disabled"; + // qCDebug(LOG_PLASMA) << "Operation" << op << "is disabled"; #endif } else { QVariantMap map = description; @@ -114,7 +115,7 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject } } else { #ifndef NDEBUG - // qDebug() << op << "is not a valid group; valid groups are:" << d->operationsMap.keys(); + // qCDebug(LOG_PLASMA) << op << "is not a valid group; valid groups are:" << d->operationsMap.keys(); #endif } @@ -192,7 +193,7 @@ void Service::registerOperationsScheme() if (d->name.isEmpty()) { #ifndef NDEBUG - // qDebug() << "No name found"; + // qCDebug(LOG_PLASMA) << "No name found"; #endif return; } @@ -201,7 +202,7 @@ void Service::registerOperationsScheme() if (path.isEmpty()) { #ifndef NDEBUG - // qDebug() << "Cannot find operations description:" << d->name << ".operations"; + // qCDebug(LOG_PLASMA) << "Cannot find operations description:" << d->name << ".operations"; #endif return; } diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index a840cb4aa..28abd0051 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -40,6 +40,7 @@ #include "applet.h" #include "package.h" #include "theme.h" +#include "debug_p.h" namespace Plasma { @@ -225,7 +226,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath) path = actualPath; } else { #ifndef NDEBUG - // qDebug() << "file '" << path << "' does not exist!"; + // qCDebug(LOG_PLASMA) << "file '" << path << "' does not exist!"; #endif } @@ -242,9 +243,9 @@ bool SvgPrivate::setImagePath(const QString &imagePath) } else { createRenderer(); naturalSize = renderer->defaultSize() * scaleFactor; - //qDebug() << "natural size for" << path << "from renderer is" << naturalSize; + //qCDebug(LOG_PLASMA) << "natural size for" << path << "from renderer is" << naturalSize; cacheAndColorsTheme()->insertIntoRectsCache(path, QStringLiteral("_Natural_%1").arg(scaleFactor), QRectF(QPointF(0, 0), naturalSize)); - //qDebug() << "natural size for" << path << "from cache is" << naturalSize; + //qCDebug(LOG_PLASMA) << "natural size for" << path << "from cache is" << naturalSize; } } @@ -356,18 +357,18 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, qreal ratio, const QSi id.append(actualElementId); } - //qDebug() << "id is " << id; + //qCDebug(LOG_PLASMA) << "id is " << id; QPixmap p; if (cacheRendering && cacheAndColorsTheme()->findInCache(id, p, lastModified)) { p.setDevicePixelRatio(ratio); - //qDebug() << "found cached version of " << id << p.size(); + //qCDebug(LOG_PLASMA) << "found cached version of " << id << p.size(); return p; } - //qDebug() << "didn't find cached version of " << id << ", so re-rendering"; + //qCDebug(LOG_PLASMA) << "didn't find cached version of " << id << ", so re-rendering"; - //qDebug() << "size for " << actualElementId << " is " << s; + //qCDebug(LOG_PLASMA) << "size for " << actualElementId << " is " << s; // we have to re-render this puppy createRenderer(); @@ -410,7 +411,7 @@ void SvgPrivate::createRenderer() return; } - //qDebug() << kBacktrace(); + //qCDebug(LOG_PLASMA) << kBacktrace(); if (themed && path.isEmpty() && !themeFailed) { Applet *applet = qobject_cast(q->parent()); //FIXME: this maybe could be more efficient if we knew if the package was empty, e.g. for @@ -429,14 +430,14 @@ void SvgPrivate::createRenderer() path = actualTheme()->imagePath(themePath); themeFailed = path.isEmpty(); if (themeFailed) { - qWarning() << "No image path found for" << themePath; + qCWarning(LOG_PLASMA) << "No image path found for" << themePath; } } } - //qDebug() << "********************************"; - //qDebug() << "FAIL! **************************"; - //qDebug() << path << "**"; + //qCDebug(LOG_PLASMA) << "********************************"; + //qCDebug(LOG_PLASMA) << "FAIL! **************************"; + //qCDebug(LOG_PLASMA) << path << "**"; QString styleSheet = cacheAndColorsTheme()->d->svgStyleSheet(colorGroup); styleCrc = qChecksum(styleSheet.toUtf8(), styleSheet.size()); @@ -444,7 +445,7 @@ void SvgPrivate::createRenderer() QHash::const_iterator it = s_renderers.constFind(styleCrc + path); if (it != s_renderers.constEnd()) { - //qDebug() << "gots us an existing one!"; + //qCDebug(LOG_PLASMA) << "gots us an existing one!"; renderer = it.value(); } else { if (path.isEmpty()) { @@ -639,7 +640,7 @@ QRectF SvgPrivate::makeUniform(const QRectF &orig, const QRectF &dst) res.setHeight(res.height() + offset); } - //qDebug()<<"Aligning Rects, origin:"<resize(); - //qDebug() << themePath << ">>>>>>>>>>>>>>>>>> theme changed"; + //qCDebug(LOG_PLASMA) << themePath << ">>>>>>>>>>>>>>>>>> theme changed"; emit q->repaintNeeded(); } @@ -671,7 +672,7 @@ void SvgPrivate::colorsChanged() } eraseRenderer(); - //qDebug() << "repaint needed from colorsChanged"; + //qCDebug(LOG_PLASMA) << "repaint needed from colorsChanged"; // in the case the theme follows the desktop settings, refetch the colorschemes // and discard the svg pixmap cache @@ -913,7 +914,7 @@ bool Svg::containsMultipleImages() const void Svg::setImagePath(const QString &svgFilePath) { if (d->setImagePath(svgFilePath)) { - //qDebug() << "repaintNeeded"; + //qCDebug(LOG_PLASMA) << "repaintNeeded"; emit repaintNeeded(); } } diff --git a/src/plasma/theme.cpp b/src/plasma/theme.cpp index 263ed2349..e9420e69f 100644 --- a/src/plasma/theme.cpp +++ b/src/plasma/theme.cpp @@ -43,6 +43,7 @@ #include #include "private/packages_p.h" +#include "debug_p.h" namespace Plasma { @@ -149,7 +150,7 @@ QString Theme::imagePath(const QString &name) const // look for a compressed svg file in the theme if (name.contains(QLatin1String("../")) || name.isEmpty()) { // we don't support relative paths - //qDebug() << "Theme says: bad image path " << name; + //qCDebug(LOG_PLASMA) << "Theme says: bad image path " << name; return QString(); } @@ -180,7 +181,7 @@ QString Theme::imagePath(const QString &name) const /* if (path.isEmpty()) { #ifndef NDEBUG - // qDebug() << "Theme says: bad image path " << name; + // qCDebug(LOG_PLASMA) << "Theme says: bad image path " << name; #endif } */ @@ -230,19 +231,19 @@ QString Theme::wallpaperPath(const QSize &size) const if (fullPath.isEmpty()) { // we failed to find it in the theme, so look in the standard directories - //qDebug() << "looking for" << image; + //qCDebug(LOG_PLASMA) << "looking for" << image; fullPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("wallpapers/") + image); } if (fullPath.isEmpty()) { // we still failed to find it in the theme, so look for the default in // the standard directories - //qDebug() << "looking for" << defaultImage; + //qCDebug(LOG_PLASMA) << "looking for" << defaultImage; fullPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("wallpapers/") + defaultImage); if (fullPath.isEmpty()) { #ifndef NDEBUG - // qDebug() << "exhausted every effort to find a wallpaper."; + // qCDebug(LOG_PLASMA) << "exhausted every effort to find a wallpaper."; #endif } } diff --git a/src/plasma/version.cpp b/src/plasma/version.cpp index 88aae6cc3..a11a2443d 100644 --- a/src/plasma/version.cpp +++ b/src/plasma/version.cpp @@ -19,6 +19,7 @@ #include #include +#include "debug_p.h" namespace Plasma { @@ -52,7 +53,7 @@ bool isPluginVersionCompatible(unsigned int version) { if (version == quint32(-1)) { // unversioned, just let it through - qWarning() << "unversioned plugin detected, may result in instability"; + qCWarning(LOG_PLASMA) << "unversioned plugin detected, may result in instability"; return true; } @@ -62,7 +63,7 @@ bool isPluginVersionCompatible(unsigned int version) if (version < minVersion || version > maxVersion) { #ifndef NDEBUG - // qDebug() << "plugin is compiled against incompatible Plasma version " << version + // qCDebug(LOG_PLASMA) << "plugin is compiled against incompatible Plasma version " << version // << "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion // << ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")"; #endif