1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/****************************************************************************
**
** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick
** All rights reserved.
** Contact: chuebsch@moliso.de
**
** This file is part of the ShelXle
**
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file COPYING included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
**
****************************************************************************/
#include "window.h"
#include <QApplication>
//öß
void mh(QtMsgType type, const char *msg){
QString pth=QDir::homePath()+"/ShelXle_message.txt";
FILE *er=fopen(pth.toStdString().c_str(),"wt");
fprintf(er,"======\n%s\n======\n",msg);
fclose(er);
if (strstr(msg,"QGLShader::link:")!=NULL) {
printf("%s\n",msg);fflush(stdout);
return; // ignore useless error messages with shitty intel graphic cards reporting \"No error."
}
if (strstr(msg,"QAccessibleWidget")!=NULL) {
printf("%s\n",msg);fflush(stdout);
return; // ignore useless error messages on win with touch screens
}
if (strstr(msg,"QGLShader::link:")!=NULL) {
printf("%s\n",msg);fflush(stdout);
return; // ignore useless error messages
}
switch (type){
case QtDebugMsg:
printf("%s\n",msg);fflush(stdout);
#if defined Q_WS_WIN || defined Q_WS_MAC
QMessageBox::information(0,"information",msg);
#endif
break;
case QtWarningMsg:
printf("%s\n",msg);fflush(stdout);
#if defined Q_WS_WIN || defined Q_WS_MAC
QMessageBox::warning(0,"warning",msg);
#endif
break;
case QtCriticalMsg:
printf("%s\n",msg);fflush(stdout);
#if defined Q_WS_WIN || defined Q_WS_MAC
QMessageBox::critical(0,"critical",msg);
#endif
break;
case QtFatalMsg:
printf("%s\n",msg);fflush(stdout);
#if defined Q_WS_WIN || defined Q_WS_MAC
QMessageBox::critical(0,"fatal",msg);
#endif
abort();
}
}
int main(int argv, char *args[]){
QApplication app(argv, args);
app.setOrganizationName("shelxle");
// app.setOrganizationDomain("shelxle");
qInstallMsgHandler(mh);
app.setWindowIcon(QIcon(":/icons/SHELxLE.png"));
Window *window = new Window();
window->show();
int istat = app.exec();
delete window;
return istat;
}
|