Hmmmm
This commit is contained in:
parent
3d320bbaf1
commit
ad3677f7ca
@ -46,6 +46,9 @@ FormUpdater::FormUpdater(QWidget *parent)
|
|||||||
setWindowIcon(QIcon(APP_ICON_PATH));
|
setWindowIcon(QIcon(APP_ICON_PATH));
|
||||||
|
|
||||||
moveToCenterAndResize();
|
moveToCenterAndResize();
|
||||||
|
|
||||||
|
connect(this, SIGNAL(debugMessageProduced(QtMsgType,QString)),
|
||||||
|
this, SLOT(consumeDebugMessage(QtMsgType,QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FormUpdater::~FormUpdater() {
|
FormUpdater::~FormUpdater() {
|
||||||
@ -108,14 +111,11 @@ void FormUpdater::executeMainApplication() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormUpdater::triggerDebugMessageConsumption(QtMsgType type, const QString &message) {
|
||||||
|
emit debugMessageProduced(type, message);
|
||||||
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
void FormUpdater::consumeDebugMessage(QtMsgType type, const QString &message) {
|
||||||
void FormUpdater::debugHandler(QtMsgType type,
|
|
||||||
const QMessageLogContext &placement,
|
|
||||||
const QString &message) {
|
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
|
||||||
Q_UNUSED(placement)
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
s_instance->printText(QString("DEBUG: %1").arg(message));
|
s_instance->printText(QString("DEBUG: %1").arg(message));
|
||||||
@ -136,6 +136,16 @@ void FormUpdater::debugHandler(QtMsgType type,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
void FormUpdater::debugHandler(QtMsgType type,
|
||||||
|
const QMessageLogContext &placement,
|
||||||
|
const QString &message) {
|
||||||
|
#ifndef QT_NO_DEBUG_OUTPUT
|
||||||
|
Q_UNUSED(placement)
|
||||||
|
|
||||||
|
s_instance->triggerDebugMessageConsumption(type, message);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(type)
|
Q_UNUSED(type)
|
||||||
Q_UNUSED(placement)
|
Q_UNUSED(placement)
|
||||||
@ -145,26 +155,7 @@ void FormUpdater::debugHandler(QtMsgType type,
|
|||||||
#else
|
#else
|
||||||
void FormUpdater::debugHandler(QtMsgType type, const char *message) {
|
void FormUpdater::debugHandler(QtMsgType type, const char *message) {
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
#ifndef QT_NO_DEBUG_OUTPUT
|
||||||
switch (type) {
|
s_instance->triggerDebugMessageConsumption(type, QString(message));
|
||||||
case QtDebugMsg:
|
|
||||||
s_instance->printText(QString("DEBUG: %1").arg(message));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QtWarningMsg:
|
|
||||||
s_instance->printText(QString("WARNING: %1").arg(message));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QtCriticalMsg:
|
|
||||||
s_instance->printText(QString("CRITICAL: %1").arg(message));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QtFatalMsg:
|
|
||||||
s_instance->printText(QString("FATAL: %1").arg(message));
|
|
||||||
qApp->exit(EXIT_FAILURE);
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(type)
|
Q_UNUSED(type)
|
||||||
Q_UNUSED(message)
|
Q_UNUSED(message)
|
||||||
|
@ -42,6 +42,9 @@ class FormUpdater : public QMainWindow {
|
|||||||
bool doFinalCleanup();
|
bool doFinalCleanup();
|
||||||
void executeMainApplication();
|
void executeMainApplication();
|
||||||
|
|
||||||
|
// Used to trigger signal informaing about new debug message.
|
||||||
|
void triggerDebugMessageConsumption(QtMsgType type, const QString &message);
|
||||||
|
|
||||||
// Debug handlers for messages.
|
// Debug handlers for messages.
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
static void debugHandler(QtMsgType type,
|
static void debugHandler(QtMsgType type,
|
||||||
@ -52,6 +55,14 @@ class FormUpdater : public QMainWindow {
|
|||||||
const char *message);
|
const char *message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
// Should be always called on GUI thread which is enforced
|
||||||
|
// by signal/slot auto connection.
|
||||||
|
void consumeDebugMessage(QtMsgType type, const QString &message);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void debugMessageProduced(QtMsgType type, QString message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Catch the "press any key event" to exit the updater.
|
// Catch the "press any key event" to exit the updater.
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user