summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/unix/slog2/slog2.cpp48
-rw-r--r--config.tests/unix/slog2/slog2.pro4
-rwxr-xr-xconfigure32
-rw-r--r--src/corelib/global/global.pri5
-rw-r--r--src/corelib/global/qglobal.cpp57
-rw-r--r--tools/configure/configureapp.cpp24
6 files changed, 169 insertions, 1 deletions
diff --git a/config.tests/unix/slog2/slog2.cpp b/config.tests/unix/slog2/slog2.cpp
new file mode 100644
index 0000000..900d14a
--- /dev/null
+++ b/config.tests/unix/slog2/slog2.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <slog2.h>
+
+int main(int, char **)
+{
+ slog2_set_default_buffer((slog2_buffer_t)-1);
+ return 0;
+}
diff --git a/config.tests/unix/slog2/slog2.pro b/config.tests/unix/slog2/slog2.pro
new file mode 100644
index 0000000..9f5b34d
--- /dev/null
+++ b/config.tests/unix/slog2/slog2.pro
@@ -0,0 +1,4 @@
+SOURCES = slog2.cpp
+CONFIG -= qt
+mac:CONFIG -= app_bundle
+LIBS += -lslog2
diff --git a/configure b/configure
index 08d9270..e3d464b 100755
--- a/configure
+++ b/configure
@@ -917,6 +917,7 @@ CFG_ICD=auto
CFG_NOPROCESS=no
CFG_ICU=auto
CFG_SYSTEM_PROXIES=no
+CFG_SLOG2=auto
# initalize variables used for installation
QT_INSTALL_PREFIX=
@@ -2100,6 +2101,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ slog2)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_SLOG2="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
gstreamer)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_GSTREAMER="$VAL"
@@ -4349,6 +4357,16 @@ Qt/X11 only:
EOF
fi
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ cat << EOF
+
+ -no-slog2 .......... Do not compile with slog2 support.
+ -slog2 ............. Compile with slog2 support.
+
+EOF
+
+fi
+
if [ "$PLATFORM_MAC" = "yes" ]; then
cat << EOF
@@ -5314,6 +5332,17 @@ if [ "$CFG_ZLIB" = "auto" ]; then
fi
fi
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ if [ "$CFG_SLOG2" != "no" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/slog2 "slog2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+ CFG_SLOG2=yes
+ QMAKE_CONFIG="$QMAKE_CONFIG slog2"
+ else
+ CFG_SLOG2=no
+ fi
+ fi
+fi
+
if [ "$CFG_LARGEFILE" = "auto" ]; then
#Large files should be enabled for all Linux systems
CFG_LARGEFILE=yes
@@ -8930,6 +8959,9 @@ if [ "$CFG_MNG" = "no" ]; then
else
echo "MNG support ............ $CFG_MNG ($CFG_LIBMNG)"
fi
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ echo "SLOG2 support .......... $CFG_SLOG2"
+fi
echo "zlib support ........... $CFG_ZLIB"
echo "Session management ..... $CFG_SM"
if [ "$PLATFORM_QWS" = "yes" ]; then
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 68582bf..dbd042b 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -31,4 +31,9 @@ symbian {
S60_VERSION_$$upper($$replace(S60_VERSION,\\.,_))
}
+slog2 {
+ LIBS_PRIVATE += -lslog2
+ DEFINES += QT_USE_SLOG2
+}
+
include(../../../tools/shared/symbian/epocroot.pri)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 79aafb4..b929776 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -78,6 +78,11 @@
#include <CoreServices/CoreServices.h>
#endif
+#ifdef QT_USE_SLOG2
+#include <slog2.h>
+#endif
+
+
#if defined(Q_OS_SYMBIAN)
#include <e32def.h>
#include <e32debug.h>
@@ -2076,6 +2081,56 @@ static void mac_default_handler(const char *msg)
}
#endif // Q_CC_MWERKS && Q_OS_MACX
+#if defined(QT_USE_SLOG2)
+#ifndef QT_LOG_CODE
+#define QT_LOG_CODE 9000
+#endif
+
+extern char *__progname;
+
+static void slog2_default_handler(QtMsgType msgType, const char *message)
+{
+ if (slog2_set_default_buffer((slog2_buffer_t)-1) == 0) {
+ slog2_buffer_set_config_t buffer_config;
+ slog2_buffer_t buffer_handle;
+
+ buffer_config.buffer_set_name = __progname;
+ buffer_config.num_buffers = 1;
+ buffer_config.verbosity_level = SLOG2_INFO;
+ buffer_config.buffer_config[0].buffer_name = "default";
+ buffer_config.buffer_config[0].num_pages = 8;
+
+ if (slog2_register(&buffer_config, &buffer_handle, 0) == -1) {
+ fprintf(stderr, "Error registering slogger2 buffer!\n");
+ fprintf(stderr, "%s", message);
+ fflush(stderr);
+ return;
+ }
+
+ // Set as the default buffer
+ slog2_set_default_buffer(buffer_handle);
+ }
+ int severity;
+ //Determines the severity level
+ switch (msgType) {
+ case QtDebugMsg:
+ severity = SLOG2_INFO;
+ break;
+ case QtWarningMsg:
+ severity = SLOG2_NOTICE;
+ break;
+ case QtCriticalMsg:
+ severity = SLOG2_WARNING;
+ break;
+ case QtFatalMsg:
+ severity = SLOG2_ERROR;
+ break;
+ }
+ //writes to the slog2 buffer
+ slog2c(NULL, QT_LOG_CODE, severity, message);
+}
+#endif // QT_USE_SLOG2
+
#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
namespace {
@@ -2215,6 +2270,8 @@ void qt_message_output(QtMsgType msgType, const char *buf)
} else {
#if defined(Q_CC_MWERKS) && defined(Q_OS_MACX)
mac_default_handler(buf);
+#elif defined(QT_USE_SLOG2)
+ slog2_default_handler(msgType, buf);
#elif defined(Q_OS_WINCE)
QString fstr = QString::fromLatin1(buf);
fstr += QLatin1Char('\n');
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 77174d5..9410793 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -401,6 +401,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "NATIVE_GESTURES" ] = "yes";
dictionary[ "MSVC_MP" ] = "no";
dictionary[ "SYSTEM_PROXIES" ] = "no";
+ dictionary[ "SLOG2" ] = "no";
}
Configure::~Configure()
@@ -1018,6 +1019,10 @@ void Configure::parseCmdLine()
dictionary[ "PLUGIN_MANIFESTS" ] = "no";
} else if (configCmdLine.at(i) == "-plugin-manifests") {
dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-slog2") {
+ dictionary[ "SLOG2" ] = "no";
+ } else if (configCmdLine.at(i) == "-slog2") {
+ dictionary[ "SLOG2" ] = "yes";
}
// Work around compiler nesting limitation
@@ -1715,7 +1720,7 @@ void Configure::applySpecSpecifics()
dictionary[ "QT_ICONV" ] = "no";
dictionary["DECORATIONS"] = "default windows styled";
- } else if (dictionary[ "XQMAKESPEC" ].contains("blackberry")) { //TODO actually wrong.
+ } else if (platform() == QNX || platform() == BLACKBERRY) {
dictionary[ "STYLE_WINDOWSXP" ] = "no";
dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
dictionary[ "STYLE_WINDOWSCE" ] = "no";
@@ -1742,6 +1747,7 @@ void Configure::applySpecSpecifics()
dictionary[ "FONT_CONFIG" ] = "yes";
dictionary[ "FREETYPE" ] = "system";
dictionary[ "STACK_PROTECTOR_STRONG" ] = "auto";
+ dictionary[ "SLOG2" ] = "auto";
}
}
@@ -1983,6 +1989,11 @@ bool Configure::displayHelp()
desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
+ if (platform() == QNX || platform() == BLACKBERRY) {
+ desc("SLOG2", "yes", "-slog2", "Compile with slog2 support.");
+ desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
+ }
+
#endif
// Qt\Windows only options go below here --------------------------------------------------------------------------------
desc("Qt for Windows only:\n\n");
@@ -2427,6 +2438,8 @@ bool Configure::checkAvailability(const QString &part)
compilerAndArgs += "qcc";
compilerAndArgs += "-fstack-protector-strong";
available = dictionary[ "XQMAKESPEC" ].contains("blackberry") && compilerSupportsFlag(compilerAndArgs);
+ } else if (part == "SLOG2") {
+ available = findFile("slog2.h");
}
return available;
@@ -2534,6 +2547,10 @@ void Configure::autoDetection()
if (dictionary["STACK_PROTECTOR_STRONG"] == "auto")
dictionary["STACK_PROTECTOR_STRONG"] = checkAvailability("STACK_PROTECTOR_STRONG") ? "yes" : "no";
+ if ((platform() == QNX || platform == BLACKBERRY) && dictionary["SLOG2"] == "auto") {
+ dictionary[ "SLOG2" ] = checkAvailability("SLOG2") ? "yes" : "no";
+ }
+
// Mark all unknown "auto" to the default value..
for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
if (i.value() == "auto")
@@ -3268,6 +3285,9 @@ void Configure::generateCachefile()
if (dictionary["FONT_CONFIG"] == "yes")
configStream << " fontconfig";
+ if (dictionary[ "SLOG2" ] == "yes")
+ configStream << " slog2";
+
if (dictionary.contains("SYMBIAN_DEFFILES")) {
if (dictionary["SYMBIAN_DEFFILES"] == "yes") {
configStream << " def_files";
@@ -3785,6 +3805,8 @@ void Configure::displayConfig()
cout << " PNG support............." << dictionary[ "PNG" ] << endl;
cout << " MNG support............." << dictionary[ "MNG" ] << endl;
cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
+ if (platform() == QNX || platform() == BLACKBERRY)
+ cout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl;
cout << "Styles:" << endl;
cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;