Commit e972cf78 authored by victor's avatar victor

git-svn-id: http://lpm.org.ru/svn/kumir2@540 382dccb8-6cdf-11e0-9640-eb60159f4418
parent 3e7e562a
......@@ -14,6 +14,46 @@
#endif
void GuiMessageOutput(QtMsgType type, const char *msg)
{
switch (type) {
case QtDebugMsg:
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", msg);
abort();
default:
break;
}
}
void ConsoleMessageOutput(QtMsgType type, const char *msg)
{
switch (type) {
case QtDebugMsg:
// fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
// fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", msg);
abort();
default:
break;
}
}
void showErrorMessage(const QString & text)
{
bool gui = true;
......@@ -69,8 +109,11 @@ int main(int argc, char **argv)
const QString sharePath = QDir(app->applicationDirPath()+SHARE_PATH).canonicalPath();
bool allowDebugMessages = false;
#ifdef SPLASHSCREEN
if (gui) {
allowDebugMessages = true;
QString imgPath = sharePath+QString("/")+SPLASHSCREEN;
splashScreen = new QSplashScreen();
QImage img(imgPath);
......@@ -97,6 +140,13 @@ int main(int argc, char **argv)
}
#endif
if (allowDebugMessages) {
qInstallMsgHandler(GuiMessageOutput);
}
else {
qInstallMsgHandler(ConsoleMessageOutput);
}
QDir translationsDir(sharePath+"/translations");
QStringList ts_files = translationsDir.entryList(QStringList() << "*_"+getLanguage()+".qm");
foreach (QString tsname, ts_files) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment