aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-08-26 15:53:13 +0200
committerhjk <hjk121@nokiamail.com>2014-08-27 15:01:57 +0200
commit61276ab636a29e6b1f8e13afbf498f9d43e15535 (patch)
treeade6b5e307aecf40a694dcb4ae9d41aef1bd9bdb
parent251a1d25880858345ef64a5f4ac88bf08d6b736d (diff)
Remove logging wrapper code for Qt 4 compatibility
Change-Id: I95ed943638895b718862f05e3f706dcbef4c6a7d Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
-rw-r--r--src/app/main.cpp2
-rw-r--r--src/libs/qmljs/qmljscodeformatter.cpp9
-rw-r--r--src/libs/qmljs/qmljsconstants.h3
-rw-r--r--src/libs/qmljs/qmljsicons.cpp9
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.cpp6
-rw-r--r--src/libs/qmljs/qmljssimplereader.cpp7
-rw-r--r--src/libs/utils/logging.h133
-rw-r--r--src/libs/utils/utils-lib.pri1
-rw-r--r--src/libs/utils/utils.qbs1
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp3
-rw-r--r--src/plugins/ios/iosconstants.h2
-rw-r--r--src/plugins/ios/iosprobe.cpp12
-rw-r--r--src/plugins/ios/iostoolhandler.cpp16
13 files changed, 28 insertions, 176 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 6e9738e847..a087584555 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -36,12 +36,12 @@
#include <extensionsystem/pluginspec.h>
#include <qtsingleapplication.h>
#include <utils/hostosinfo.h>
-#include <utils/logging.h>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QLibraryInfo>
+#include <QLoggingCategory>
#include <QSettings>
#include <QTextStream>
#include <QThreadPool>
diff --git a/src/libs/qmljs/qmljscodeformatter.cpp b/src/libs/qmljs/qmljscodeformatter.cpp
index 89e7544e1e..7e74fce7bd 100644
--- a/src/libs/qmljs/qmljscodeformatter.cpp
+++ b/src/libs/qmljs/qmljscodeformatter.cpp
@@ -29,15 +29,12 @@
#include "qmljscodeformatter.h"
-#include <utils/logging.h>
-
+#include <QLoggingCategory>
#include <QMetaEnum>
-#include <QTextDocument>
#include <QTextBlock>
+#include <QTextDocument>
-namespace {
-Q_LOGGING_CATEGORY(formatterLog, "qtc.qmljs.formatter")
-}
+static Q_LOGGING_CATEGORY(formatterLog, "qtc.qmljs.formatter")
namespace QmlJS {
diff --git a/src/libs/qmljs/qmljsconstants.h b/src/libs/qmljs/qmljsconstants.h
index cd9a43bc35..af7364e66a 100644
--- a/src/libs/qmljs/qmljsconstants.h
+++ b/src/libs/qmljs/qmljsconstants.h
@@ -29,9 +29,10 @@
#ifndef QMLJSCONSTANTS_H
#define QMLJSCONSTANTS_H
+
#include "qmljs_global.h"
-#include <utils/logging.h>
+#include <QLoggingCategory>
namespace QmlJS {
diff --git a/src/libs/qmljs/qmljsicons.cpp b/src/libs/qmljs/qmljsicons.cpp
index 3131583aa6..a8c3e6ce86 100644
--- a/src/libs/qmljs/qmljsicons.cpp
+++ b/src/libs/qmljs/qmljsicons.cpp
@@ -29,11 +29,10 @@
#include "qmljsicons.h"
-#include <utils/logging.h>
-
-#include <QIcon>
#include <QDir>
#include <QHash>
+#include <QIcon>
+#include <QLoggingCategory>
#include <QPair>
using namespace QmlJS;
@@ -43,9 +42,7 @@ enum {
debug = false
};
-namespace {
-Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons")
-}
+static Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons")
namespace QmlJS {
diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp
index 390b188724..7437ff9e70 100644
--- a/src/libs/qmljs/qmljsimportdependencies.cpp
+++ b/src/libs/qmljs/qmljsimportdependencies.cpp
@@ -32,15 +32,13 @@
#include "qmljsqrcparser.h"
#include <utils/qtcassert.h>
-#include <utils/logging.h>
#include <QCryptographicHash>
+#include <QLoggingCategory>
#include <algorithm>
-namespace {
-Q_LOGGING_CATEGORY(importsLog, "qtc.qmljs.imports")
-}
+static Q_LOGGING_CATEGORY(importsLog, "qtc.qmljs.imports")
namespace QmlJS {
diff --git a/src/libs/qmljs/qmljssimplereader.cpp b/src/libs/qmljs/qmljssimplereader.cpp
index 46505eb3c1..b7e01430e2 100644
--- a/src/libs/qmljs/qmljssimplereader.cpp
+++ b/src/libs/qmljs/qmljssimplereader.cpp
@@ -33,15 +33,12 @@
#include "parser/qmljslexer_p.h"
#include "parser/qmljsengine_p.h"
-#include <utils/logging.h>
-
#include "qmljsutils.h"
#include <QFile>
+#include <QLoggingCategory>
-namespace {
-Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader")
-}
+static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader")
namespace QmlJS{
diff --git a/src/libs/utils/logging.h b/src/libs/utils/logging.h
deleted file mode 100644
index f5f8a61b62..0000000000
--- a/src/libs/utils/logging.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#ifndef LOGGING_H
-#define LOGGING_H
-
-#include <qglobal.h>
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
-
-#include <QDebug>
-
-//
-// Qt < 5.2 didn't feature categorized logging:
-// Just enable qCWarning, qCCritical, but disable qCDebug
-//
-class QLoggingCategory
-{
- Q_DISABLE_COPY(QLoggingCategory)
-public:
- explicit QLoggingCategory(const char *category) : name(category) {}
- ~QLoggingCategory() {}
- static void setFilterRules(const QString &) {}
-
- bool isDebugEnabled() const { return false; }
- bool isWarningEnabled() const { return true; }
- bool isCriticalEnabled() const { return true; }
-
- const char *categoryName() const { return name; }
-
- QLoggingCategory &operator()() { return *this; }
-
-private:
- const char *name;
-};
-
-#define Q_DECLARE_LOGGING_CATEGORY(name) \
- extern QLoggingCategory &name();
-
-// relies on QLoggingCategory(QString) being thread safe!
-#define Q_LOGGING_CATEGORY(name, string) \
- QLoggingCategory &name() \
- { \
- static QLoggingCategory category(string); \
- return category; \
- }
-
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-
-//
-// Qt 5.0, 5.1 do have already support for categories in QMessageLogger
-//
-
-#define qCDebug(category, ...) \
- for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
-#define qCWarning(category, ...) \
- for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
-#define qCCritical(category, ...) \
- for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_QT_VERSION < 0x053000INFO, category().categoryName()).critical(__VA_ARGS__)
-
-# else
-
-//
-// Qt 4: just map to qDebug etc
-//
-
-#define qCDebug(category, ...) \
- for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
- qDebug(__VA_ARGS__)
-#define qCWarning(category, ...) \
- for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
- qWarning(__VA_ARGS__)
-#define qCCritical(category, ...) \
- for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
- qCritical(__VA_ARGS__)
-
-
-# endif // QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-
-#else // QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
-
-#include <QLoggingCategory>
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
-
-// printf style for qCDebug was only added in Qt 5.3
-
-#undef qCDebug
-#undef qCWarning
-#undef qCCritical
-
-#define qCDebug(category, ...) \
- for (bool q_category_enabled = category().isDebugEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
-#define qCWarning(category, ...) \
- for (bool q_category_enabled = category().isWarningEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
-#define qCCritical(category, ...) \
- for (bool q_category_enabled = category().isCriticalEnabled(); q_category_enabled; q_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
-
-#endif // QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
-#endif // QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
-#endif // LOGGING_H
diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri
index 0532576a59..d89f9b142d 100644
--- a/src/libs/utils/utils-lib.pri
+++ b/src/libs/utils/utils-lib.pri
@@ -180,7 +180,6 @@ HEADERS += \
$$PWD/ansiescapecodehandler.h \
$$PWD/execmenu.h \
$$PWD/completinglineedit.h \
- $$PWD/logging.h \
$$PWD/winutils.h \
$$PWD/itemviews.h \
$$PWD/treeviewcombobox.h \
diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs
index 3f240c93ee..764478fcf6 100644
--- a/src/libs/utils/utils.qbs
+++ b/src/libs/utils/utils.qbs
@@ -107,7 +107,6 @@ QtcLibrary {
"linecolumnlabel.cpp",
"linecolumnlabel.h",
"listutils.h",
- "logging.h",
"multitask.h",
"navigationtreeview.cpp",
"navigationtreeview.h",
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index a3310fb583..9f278f471c 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -36,11 +36,12 @@
#include <debugger/watchhandler.h>
#include <qmldebug/qmldebugconstants.h>
-#include <utils/logging.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
+
#include <QElapsedTimer>
#include <QFileInfo>
+#include <QLoggingCategory>
using namespace QmlDebug;
using namespace QmlDebug::Constants;
diff --git a/src/plugins/ios/iosconstants.h b/src/plugins/ios/iosconstants.h
index 00ecdcd7cb..ccf4e30695 100644
--- a/src/plugins/ios/iosconstants.h
+++ b/src/plugins/ios/iosconstants.h
@@ -30,7 +30,7 @@
#define IOSCONSTANTS_H
#include <QtGlobal>
-#include <utils/logging.h>
+#include <QLoggingCategory>
namespace Ios {
namespace Internal {
diff --git a/src/plugins/ios/iosprobe.cpp b/src/plugins/ios/iosprobe.cpp
index 8cea854e15..39433669a1 100644
--- a/src/plugins/ios/iosprobe.cpp
+++ b/src/plugins/ios/iosprobe.cpp
@@ -29,16 +29,14 @@
#include "iosprobe.h"
-#include <utils/logging.h>
-
-#include <QFileInfo>
-#include <QProcess>
#include <QDir>
+#include <QFileInfo>
#include <QFileInfoList>
+#include <QLoggingCategory>
+#include <QProcess>
+
+static Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe")
-namespace {
-Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe")
-}
namespace Ios {
static QString qsystem(const QString &exe, const QStringList &args = QStringList())
diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp
index c17679fb23..5398afc9e3 100644
--- a/src/plugins/ios/iostoolhandler.cpp
+++ b/src/plugins/ios/iostoolhandler.cpp
@@ -34,24 +34,22 @@
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
-#include <utils/logging.h>
-#include <QProcess>
-#include <QXmlStreamReader>
-#include <QSocketNotifier>
#include <QCoreApplication>
+#include <QFileInfo>
#include <QList>
-#include <QScopedArrayPointer>
+#include <QLoggingCategory>
+#include <QProcess>
#include <QProcessEnvironment>
-#include <QFileInfo>
+#include <QScopedArrayPointer>
+#include <QSocketNotifier>
#include <QTimer>
+#include <QXmlStreamReader>
#include <string.h>
#include <errno.h>
-namespace {
-Q_LOGGING_CATEGORY(toolHandlerLog, "qtc.ios.toolhandler")
-}
+static Q_LOGGING_CATEGORY(toolHandlerLog, "qtc.ios.toolhandler")
namespace Ios {