Skip to content

Commit

Permalink
Dont use QDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
neochapay committed Jul 10, 2024
1 parent 730e432 commit ed6a76e
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/controls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(SRC
nemofocussingleton.cpp
nemowindow.cpp
inversemousearea.cpp
)
logging.cpp)

set(HEADERS
editfilter.h
Expand All @@ -18,7 +18,8 @@ set(HEADERS
nemofocussingleton.h
nemowindow.h
nemopage.h
inversemousearea.h )
inversemousearea.h
logging.h)

set(QML
qml/ActionButton.qml
Expand Down Expand Up @@ -80,7 +81,6 @@ target_link_libraries(nemocontrolsplugin PUBLIC
Qt6::Quick
PkgConfig::MLITE)


install(TARGETS nemocontrolsplugin
RUNTIME DESTINATION "${QT_INSTALL_QML}/Nemo/Controls"
BUNDLE DESTINATION "${QT_INSTALL_QML}/Nemo/Controls"
Expand Down
3 changes: 2 additions & 1 deletion src/controls/filteringmousearea.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "filteringmousearea.h"
#include "logging.h"
#include <QQuickWindow>

FilteringMouseArea::FilteringMouseArea(QQuickItem* parent)
Expand Down Expand Up @@ -180,7 +181,7 @@ void FilteringMouseArea::mouseUngrabEvent()

void FilteringMouseArea::grabMouseEvents()
{
qDebug() << "Glacier Header: Grabbing mouse!";
qCDebug(lcNemoControlsControlsLog) << "Glacier Header: Grabbing mouse!";
grabMouse();
}

Expand Down
34 changes: 34 additions & 0 deletions src/controls/logging.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/****************************************************************************************
**
** Copyright (C) 2024 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

#include "logging.h"

Q_LOGGING_CATEGORY(lcNemoControlsControlsLog, "org.nemocontrols.controls", QtWarningMsg)
39 changes: 39 additions & 0 deletions src/controls/logging.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/****************************************************************************************
**
** Copyright (C) 2024 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

#ifndef LOGGING_H
#define LOGGING_H

#include <QLoggingCategory>

Q_DECLARE_LOGGING_CATEGORY(lcNemoControlsControlsLog)

#endif // LOGGING_H
4 changes: 2 additions & 2 deletions src/controls/nemopage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include "nemopage.h"
#include <QDebug>
#include "logging.h"

NemoPage::NemoPage(QQuickItem* parent)
: QQuickItem(parent)
Expand All @@ -43,7 +43,7 @@ void NemoPage::setAllowedOrientations(Qt::ScreenOrientations allowed)
m_allowedOrientations = allowed;
emit allowedOrientationsChanged();
} else {
qDebug() << "NemoPage: invalid allowedOrientation!";
qCDebug(lcNemoControlsControlsLog) << "NemoPage: invalid allowedOrientation!";
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ set(SRC
plugin.cpp
themedaemon/mlocalthemedaemonclient.cpp
themedaemon/mabstractthemedaemonclient.cpp
theme.cpp)
theme.cpp
logging.cpp)

set(HEADERS
nemoimageprovider.h
plugin.h
sizing.h
theme.h
logging.h
themedaemon/mlocalthemedaemonclient.h
themedaemon/mabstractthemedaemonclient.h)

Expand Down
34 changes: 34 additions & 0 deletions src/core/logging.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/****************************************************************************************
**
** Copyright (C) 2024 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

#include "logging.h"

Q_LOGGING_CATEGORY(lcNemoControlsCoreLog, "org.nemocontrols.core", QtWarningMsg)
39 changes: 39 additions & 0 deletions src/core/logging.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/****************************************************************************************
**
** Copyright (C) 2024 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

#ifndef LOGGING_H
#define LOGGING_H

#include <QLoggingCategory>

Q_DECLARE_LOGGING_CATEGORY(lcNemoControlsCoreLog)

#endif // LOGGING_H
1 change: 0 additions & 1 deletion src/core/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "plugin.h"
#include "nemoimageprovider.h"
#include "sizing.h"
#include "theme.h"
#include <QtQml>

Expand Down
4 changes: 2 additions & 2 deletions src/core/sizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

#include "sizing.h"
#include "logging.h"

#include <MGConfItem>
#include <QDebug>
#include <QGuiApplication>
#include <QScreen>
#include <math.h>
Expand Down Expand Up @@ -80,7 +80,7 @@ void Sizing::recalcConstants()
return;
}

qDebug() << "Screen DPI is: " << dpi;
qCDebug(lcNemoControlsCoreLog) << "Screen DPI is: " << dpi;

float dpScaleFactor;

Expand Down
8 changes: 4 additions & 4 deletions src/core/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

#include "theme.h"
#include <QDebug>
#include "logging.h"
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
Expand Down Expand Up @@ -47,12 +47,12 @@ bool Theme::loadTheme(QString fileName)
QFile themeFile(fileName);

if (!themeFile.exists()) {
qDebug() << "Theme file " << fileName << " not found";
qCDebug(lcNemoControlsCoreLog) << "Theme file " << fileName << " not found";
return false;
}

if (themeFile.size() == 0) {
qDebug() << "Theme file " << fileName << " is empty";
qCDebug(lcNemoControlsCoreLog) << "Theme file " << fileName << " is empty";
return false;
}

Expand Down Expand Up @@ -208,7 +208,7 @@ void Theme::setThemeValues()
QFile fontFile;
fontFile.setFileName(theme.value("fontPath").toString());
if (!themeFile.exists()) {
qDebug() << "Font file " << fontFile.fileName() << " not found";
qCDebug(lcNemoControlsCoreLog) << "Font file " << fontFile.fileName() << " not found";
} else {
m_fontPath = theme.value("fontPath").toString();
emit fontPathChanged();
Expand Down
14 changes: 7 additions & 7 deletions src/core/themedaemon/mlocalthemedaemonclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

#include "mlocalthemedaemonclient.h"

#include "../logging.h"
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QSettings>
Expand Down Expand Up @@ -82,7 +82,7 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString& testPath, QObjec
#define THEME_NAME "glacier"
#endif
#ifdef HAVE_MLITE
qDebug() << Q_FUNC_INFO << "Theme: " << themeItem.value(THEME_NAME).toString();
qCDebug(lcNemoControlsCoreLog) << "Theme: " << themeItem.value(THEME_NAME).toString();
themeName = themeItem.value(THEME_NAME).toString();
#else
themeName = QLatin1String(THEME_NAME);
Expand All @@ -95,20 +95,20 @@ MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString& testPath, QObjec
const QSettings themeIndexFile(themeIndexFileName, QSettings::IniFormat);

if (themeIndexFile.status() != QSettings::NoError) {
qWarning() << Q_FUNC_INFO << "Theme" << themeName << "does not exist! Falling back to " << THEME_NAME;
qCWarning(lcNemoControlsCoreLog) << "Theme" << themeName << "does not exist! Falling back to " << THEME_NAME;
}

// we need to have X-MeeGoTouch-Metatheme group in index.theme
if (!themeIndexFile.childGroups().contains(QString("X-MeeGoTouch-Metatheme"))) {
qWarning() << Q_FUNC_INFO << "Theme" << themeName << " is invalid";
qCWarning(lcNemoControlsCoreLog) << "Theme" << themeName << " is invalid";
}

// the paths should be stored in reverse order than in the inheritance chain
themeRoots.prepend(themeRoot + QDir::separator() + themeName + QDir::separator() + QLatin1String("meegotouch"));
themeRoots.prepend(themeRoot + QDir::separator() + themeName + QDir::separator() + QLatin1String("fontawesome"));

} else {
qDebug() << Q_FUNC_INFO << "Theme: test mode: " << themeRoot;
qCDebug(lcNemoControlsCoreLog) << "Theme: test mode: " << themeRoot;
themeRoots += themeRoot;
}

Expand Down Expand Up @@ -190,10 +190,10 @@ QImage MLocalThemeDaemonClient::readImage(const QString& id) const
}
}
}
qDebug() << "Unknown theme image:" << id;
qCDebug(lcNemoControlsCoreLog) << "Unknown theme image:" << id;
QDir hicolorIconsDir("/usr/share/icons/hicolor/scalable/");
if (hicolorIconsDir.exists()) {
qDebug() << "trying load into hicolor scalable dir";
qCDebug(lcNemoControlsCoreLog) << "trying load into hicolor scalable dir";
QDirIterator it("/usr/share/icons/hicolor/scalable/", QStringList() << "*.svg", QDir::Files, QDirIterator::Subdirectories);

while (it.hasNext()) {
Expand Down

0 comments on commit ed6a76e

Please sign in to comment.