summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/logger/include/Logger.h3
-rw-r--r--rbutil/rbutilqt/logger/src/AbstractStringAppender.cpp11
-rw-r--r--rbutil/rbutilqt/logger/src/Logger.cpp11
3 files changed, 18 insertions, 7 deletions
diff --git a/rbutil/rbutilqt/logger/include/Logger.h b/rbutil/rbutilqt/logger/include/Logger.h
index 509bc5f435..941e556eb9 100644
--- a/rbutil/rbutilqt/logger/include/Logger.h
+++ b/rbutil/rbutilqt/logger/include/Logger.h
@@ -18,6 +18,7 @@
#include <QString>
#include <QDebug>
#include <QDateTime>
+#include <QElapsedTimer>
// Local
#include "CuteLogger_global.h"
@@ -224,7 +225,7 @@ class CUTELOGGERSHARED_EXPORT LoggerTimingHelper
private:
Logger* m_logger;
- QTime m_time;
+ QElapsedTimer m_time;
Logger::LogLevel m_logLevel;
Logger::TimingMode m_timingMode;
const char* m_file;
diff --git a/rbutil/rbutilqt/logger/src/AbstractStringAppender.cpp b/rbutil/rbutilqt/logger/src/AbstractStringAppender.cpp
index ce64aaeb43..ea5883f744 100644
--- a/rbutil/rbutilqt/logger/src/AbstractStringAppender.cpp
+++ b/rbutil/rbutilqt/logger/src/AbstractStringAppender.cpp
@@ -20,7 +20,7 @@
#include <QReadLocker>
#include <QWriteLocker>
#include <QDateTime>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QCoreApplication>
#include <QThread>
@@ -155,12 +155,13 @@ QByteArray AbstractStringAppender::qCleanupFuncinfo(const char* name)
}
bool hasLambda = false;
- QRegExp lambdaRegex("::<lambda\\(.*\\)>");
- int lambdaIndex = lambdaRegex.indexIn(QString::fromLatin1(info));
+ QRegularExpression lambdaRegex("::<lambda\\(.*?\\)>");
+ QRegularExpressionMatch match = lambdaRegex.match(QString::fromLatin1(info));
+ int lambdaIndex = match.capturedStart();
if (lambdaIndex != -1)
{
hasLambda = true;
- info.remove(lambdaIndex, lambdaRegex.matchedLength());
+ info.remove(lambdaIndex, match.capturedLength());
}
// operator names with '(', ')', '<', '>' in it
@@ -405,7 +406,7 @@ QString AbstractStringAppender::formattedString(const QDateTime& timeStamp, Logg
// Filename without a path
else if (command == QLatin1String("file"))
- chunk = QString(QLatin1String(file)).section(QRegExp("[/\\\\]"), -1);
+ chunk = QString(QLatin1String(file)).section(QRegularExpression("[/\\\\]"), -1);
// Source line number
else if (command == QLatin1String("line"))
diff --git a/rbutil/rbutilqt/logger/src/Logger.cpp b/rbutil/rbutilqt/logger/src/Logger.cpp
index 16a18db728..689bc42e80 100644
--- a/rbutil/rbutilqt/logger/src/Logger.cpp
+++ b/rbutil/rbutilqt/logger/src/Logger.cpp
@@ -600,8 +600,13 @@ Logger::~Logger()
// Cleanup appenders
QMutexLocker appendersLocker(&d->loggerMutex);
+#if QT_VERSION >= 0x050e00
+ QSet<AbstractAppender*> deleteList(QSet<AbstractAppender*>(d->appenders.begin(), d->appenders.end()));
+ deleteList.unite(QSet<AbstractAppender*>(d->categoryAppenders.values().begin(), d->categoryAppenders.values().end()));
+#else
QSet<AbstractAppender*> deleteList(QSet<AbstractAppender*>::fromList(d->appenders));
deleteList.unite(QSet<AbstractAppender*>::fromList(d->categoryAppenders.values()));
+#endif
qDeleteAll(deleteList);
appendersLocker.unlock();
@@ -1032,7 +1037,11 @@ void LoggerTimingHelper::start(const char* msg, ...)
{
va_list va;
va_start(va, msg);
+#if QT_VERSION >= 0x050500
+ m_block = QString().vasprintf(msg, va);
+#else
m_block = QString().vsprintf(msg, va);
+#endif
va_end(va);
m_time.start();
@@ -1062,7 +1071,7 @@ LoggerTimingHelper::~LoggerTimingHelper()
else
message = QString(QLatin1String("\"%1\" finished in ")).arg(m_block);
- int elapsed = m_time.elapsed();
+ qint64 elapsed = m_time.elapsed();
if (elapsed >= 10000 && m_timingMode == Logger::TimingAuto)
message += QString(QLatin1String("%1 s.")).arg(elapsed / 1000);
else