summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/main.cpp4
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp4
-rw-r--r--rbutil/rbutilqt/systrace.cpp20
-rw-r--r--rbutil/rbutilqt/systrace.h4
4 files changed, 32 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp
index 75b98cf35f..7d57f42290 100644
--- a/rbutil/rbutilqt/main.cpp
+++ b/rbutil/rbutilqt/main.cpp
@@ -30,7 +30,11 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)
30 30
31 31
32int main( int argc, char ** argv ) { 32int main( int argc, char ** argv ) {
33#if QT_VERSION < 0x050000
33 qInstallMsgHandler(SysTrace::debug); 34 qInstallMsgHandler(SysTrace::debug);
35#else
36 qInstallMessageHandler(SysTrace::debug);
37#endif
34 QApplication app( argc, argv ); 38 QApplication app( argc, argv );
35#if defined(Q_OS_MAC) 39#if defined(Q_OS_MAC)
36 QDir dir(QApplication::applicationDirPath()); 40 QDir dir(QApplication::applicationDirPath());
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 5ea5002c8f..c5cdeb1cf7 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -183,7 +183,11 @@ void RbUtilQt::shutdown(void)
183 // restore default message handler to prevent trace accesses during 183 // restore default message handler to prevent trace accesses during
184 // object destruction -- the trace object could already be destroyed. 184 // object destruction -- the trace object could already be destroyed.
185 // Fixes segfaults on exit. 185 // Fixes segfaults on exit.
186#if QT_VERSION < 0x050000
186 qInstallMsgHandler(0); 187 qInstallMsgHandler(0);
188#else
189 qInstallMessageHandler(0);
190#endif
187 SysTrace::save(); 191 SysTrace::save();
188 this->close(); 192 this->close();
189} 193}
diff --git a/rbutil/rbutilqt/systrace.cpp b/rbutil/rbutilqt/systrace.cpp
index f713a45d4c..943f34f7b9 100644
--- a/rbutil/rbutilqt/systrace.cpp
+++ b/rbutil/rbutilqt/systrace.cpp
@@ -93,6 +93,7 @@ void SysTrace::savePreviousTrace(void)
93 return; 93 return;
94} 94}
95 95
96#if QT_VERSION < 0x050000
96void SysTrace::debug(QtMsgType type, const char* msg) 97void SysTrace::debug(QtMsgType type, const char* msg)
97{ 98{
98 (void)type; 99 (void)type;
@@ -109,6 +110,25 @@ void SysTrace::debug(QtMsgType type, const char* msg)
109 repeat++; 110 repeat++;
110 } 111 }
111} 112}
113#else
114void SysTrace::debug(QtMsgType type, const QMessageLogContext &context, const QString &msg)
115{
116 (void)type;
117 QByteArray localMsg = msg.toLocal8Bit();
118 if(lastmessage != msg) {
119 lastmessage = msg;
120 flush();
121 debugbuffer.append(msg + "\n");
122#if !defined(NODEBUG)
123 fprintf(stderr, "%s\n", localMsg.constData());
124#endif
125 repeat = 1;
126 }
127 else {
128 repeat++;
129 }
130}
131#endif
112 132
113void SysTrace::flush(void) 133void SysTrace::flush(void)
114{ 134{
diff --git a/rbutil/rbutilqt/systrace.h b/rbutil/rbutilqt/systrace.h
index 8658df1cba..092d115489 100644
--- a/rbutil/rbutilqt/systrace.h
+++ b/rbutil/rbutilqt/systrace.h
@@ -29,7 +29,11 @@ class SysTrace : public QDialog
29 Q_OBJECT 29 Q_OBJECT
30 public: 30 public:
31 SysTrace(QWidget *parent); 31 SysTrace(QWidget *parent);
32#if QT_VERSION < 0x050000
32 static void debug(QtMsgType type, const char* msg); 33 static void debug(QtMsgType type, const char* msg);
34#else
35 static void debug(QtMsgType type, const QMessageLogContext &context, const QString &msg);
36#endif
33 static QString getTrace() {return debugbuffer;} 37 static QString getTrace() {return debugbuffer;}
34 static void save(QString filename = ""); 38 static void save(QString filename = "");
35 private: 39 private: