diff --git a/kcm/src/CMakeLists.txt b/kcm/src/CMakeLists.txt --- a/kcm/src/CMakeLists.txt +++ b/kcm/src/CMakeLists.txt @@ -9,6 +9,7 @@ collapsablebutton.cpp controlpanel.cpp + debug.cpp outputconfig.cpp primaryoutputcombo.cpp unifiedoutputconfig.cpp diff --git a/kcm/src/controlpanel.cpp b/kcm/src/controlpanel.cpp --- a/kcm/src/controlpanel.cpp +++ b/kcm/src/controlpanel.cpp @@ -22,6 +22,7 @@ #include "controlpanel.h" #include "outputconfig.h" #include "unifiedoutputconfig.h" +#include "debug.h" #include @@ -91,7 +92,7 @@ return; } - qDebug() << "Activate output" << output->id(); + qCDebug(KSCREEN_KCM) << "Activate output" << output->id(); Q_FOREACH (OutputConfig *cfg, mOutputConfigs) { cfg->setVisible(cfg->output()->id() == output->id()); diff --git a/kcm/src/debug.h b/kcm/src/debug.h new file mode 100644 --- /dev/null +++ b/kcm/src/debug.h @@ -0,0 +1,27 @@ +/* + * Copyright 2016 Sebastian Kügler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef KSCREEN_KCM_DEBUG_H +#define KSCREEN_KCM_DEBUG_H + +#include + +Q_DECLARE_LOGGING_CATEGORY(KSCREEN_KCM) + +#endif diff --git a/kcm/src/debug.cpp b/kcm/src/debug.cpp new file mode 100644 --- /dev/null +++ b/kcm/src/debug.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2016 Sebastian Kügler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "debug.h" + +Q_LOGGING_CATEGORY(KSCREEN_KCM, "kscreen.kcm") diff --git a/kcm/src/kcm_kscreen.cpp b/kcm/src/kcm_kscreen.cpp --- a/kcm/src/kcm_kscreen.cpp +++ b/kcm/src/kcm_kscreen.cpp @@ -18,6 +18,7 @@ #include "kcm_kscreen.h" +#include "debug.h" #include "widget.h" #include @@ -100,7 +101,7 @@ void KCMKScreen::save() { - qDebug() << "Saving"; + qCDebug(KSCREEN_KCM) << "Saving."; if (!mKScreenWidget) { return; @@ -116,7 +117,7 @@ atLeastOneEnabledOutput = true; } - qDebug() << output->name() << output->id() << output.data() << "\n" + qCDebug(KSCREEN_KCM) << output->name() << output->id() << output.data() << "\n" << " Connected:" << output->isConnected() << "\n" << " Enabled:" << output->isEnabled() << "\n" << " Primary:" << output->isPrimary() << "\n" @@ -162,13 +163,13 @@ void KCMKScreen::defaults() { - qDebug() << "LOAD"; + qCDebug(KSCREEN_KCM) << "LOAD"; load(); } void KCMKScreen::load() { - qDebug() << "LOAD"; + qCDebug(KSCREEN_KCM) << "LOAD"; connect(new GetConfigOperation(), &GetConfigOperation::finished, this, &KCMKScreen::configReady); } diff --git a/kcm/src/outputconfig.cpp b/kcm/src/outputconfig.cpp --- a/kcm/src/outputconfig.cpp +++ b/kcm/src/outputconfig.cpp @@ -23,6 +23,7 @@ #include "resolutionslider.h" #include "collapsablebutton.h" #include "utils.h" +#include "debug.h" #include #include @@ -102,7 +103,7 @@ connect(mEnabled, &QCheckBox::clicked, this, [=](bool checked) { mOutput->setEnabled(checked); - qDebug() << mOutput.data() << mOutput->name() << mOutput->isEnabled(); + qCDebug(KSCREEN_KCM) << mOutput.data() << mOutput->name() << mOutput->isEnabled(); Q_EMIT changed(); }); formLayout->addRow(i18n("Display:"), mEnabled); diff --git a/kcm/src/unifiedoutputconfig.cpp b/kcm/src/unifiedoutputconfig.cpp --- a/kcm/src/unifiedoutputconfig.cpp +++ b/kcm/src/unifiedoutputconfig.cpp @@ -23,6 +23,7 @@ #include "collapsablebutton.h" #include "resolutionslider.h" #include "utils.h" +#include "debug.h" #include #include @@ -138,7 +139,7 @@ if (commonResults.isEmpty()) { QSize smallestMode; Q_FOREACH (const KScreen::OutputPtr &clone, mClones) { - qDebug() << smallestMode << clone->preferredMode()->size(); + qCDebug(KSCREEN_KCM) << smallestMode << clone->preferredMode()->size(); if (!smallestMode.isValid() || clone->preferredMode()->size() < smallestMode) { smallestMode = clone->preferredMode()->size(); }