|
|
@ -45,21 +45,21 @@ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
void ub_message_output(QtMsgType type, const char *msg) { |
|
|
|
void ub_message_output(QtMsgType type, const QMessageLogContext& context, const QString& msg) { |
|
|
|
// We must temporarily remove the handler to avoid the infinite recursion of
|
|
|
|
// We must temporarily remove the handler to avoid the infinite recursion of
|
|
|
|
// ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ...
|
|
|
|
// ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ...
|
|
|
|
QtMsgHandler previousHandler = qInstallMsgHandler(0); |
|
|
|
QtMessageHandler previousHandler = qInstallMessageHandler(0); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(QT_NO_DEBUG) |
|
|
|
#if defined(QT_NO_DEBUG) |
|
|
|
// Suppress qDebug output in release builds
|
|
|
|
// Suppress qDebug output in release builds
|
|
|
|
if (type != QtDebugMsg) |
|
|
|
if (type != QtDebugMsg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qt_message_output(type, msg); |
|
|
|
qt_message_output(type, context, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
// Default output in debug builds
|
|
|
|
// Default output in debug builds
|
|
|
|
qt_message_output(type, msg); |
|
|
|
qt_message_output(type, context, msg); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (UBApplication::app() && UBApplication::app()->isVerbose()) { |
|
|
|
if (UBApplication::app() && UBApplication::app()->isVerbose()) { |
|
|
@ -77,7 +77,7 @@ void ub_message_output(QtMsgType type, const char *msg) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
qInstallMsgHandler(previousHandler); |
|
|
|
qInstallMessageHandler(previousHandler); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) |
|
|
|
int main(int argc, char *argv[]) |
|
|
@ -93,7 +93,7 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
Q_INIT_RESOURCE(OpenBoard); |
|
|
|
Q_INIT_RESOURCE(OpenBoard); |
|
|
|
|
|
|
|
|
|
|
|
qInstallMsgHandler(ub_message_output); |
|
|
|
qInstallMessageHandler(ub_message_output); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_WS_X11) |
|
|
|
#if defined(Q_WS_X11) |
|
|
|
qDebug() << "Setting GraphicsSystem to raster"; |
|
|
|
qDebug() << "Setting GraphicsSystem to raster"; |
|
|
@ -102,16 +102,6 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
UBApplication app("OpenBoard", argc, argv); |
|
|
|
UBApplication app("OpenBoard", argc, argv); |
|
|
|
|
|
|
|
|
|
|
|
//BUGFIX:
|
|
|
|
|
|
|
|
//when importing a OpenBoard file that contains a non standard character
|
|
|
|
|
|
|
|
//the codecForLocale or the codecForCString is used to convert the file path
|
|
|
|
|
|
|
|
//into a const char*. This is why in french windows setup the codec name shouldn't be
|
|
|
|
|
|
|
|
//set to UTF-8. For example, setting UTF-8, will convert "Haïti" into "HaÂ-ti.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); |
|
|
|
|
|
|
|
//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
|
|
|
|
|
|
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList args = app.arguments(); |
|
|
|
QStringList args = app.arguments(); |
|
|
|
|
|
|
|
|
|
|
|
QString dumpPath = UBSettings::userDataDirectory() + "/log"; |
|
|
|
QString dumpPath = UBSettings::userDataDirectory() + "/log"; |
|
|
@ -138,7 +128,7 @@ int main(int argc, char *argv[]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
app.initialize(false); |
|
|
|
//app.initialize(false); // should not be needed anymore
|
|
|
|
|
|
|
|
|
|
|
|
QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); |
|
|
|
QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&))); |
|
|
|
|
|
|
|
|
|
|
|