/* * MathPlanner 3.1.0 - Mathematical design tool. * Copyright(C) 2002 Jarmo Nikkanen * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation. * * You should have received a copy of the GNU General Public License with this program. * */ #include "Error.h" #include #include extern int bug_report; QString head("\ Bug Tracking.html"); QString end(""); char *tr(char *txt) { return((char *)QObject::trUtf8(txt).latin1()); } void NBugReset() { FILE *fil; if (bug_report==1) { fil=fopen("NBugReport.html","wb"); fputs(head.latin1(),fil); fputs("BugReport:\n\n",fil); fclose(fil); } } void NBugEnd() { FILE *fil; if (bug_report==1) { fil=fopen("NBugReport.html","ab"); fputs(end.latin1(),fil); fclose(fil); } } void NBug(int lev,QString c) { FILE *fil; if (bug_report==1) { fil=fopen("NBugReport.html","ab"); if (lev==0) c.append("
\n"); if (lev==1) c.prepend(""),c.append("
\n"); if (lev==2) c.prepend(""),c.append("
\n"); if (lev==3) c.prepend(""),c.append("
\n"); fputs(c.latin1(),fil); fclose(fil); } } void NBug(int lev,QString c,int no) { if (bug_report) NBug(lev,c+QString(" %1").arg(no)); } void NBug(int lev,QString c,double no) { if (bug_report) NBug(lev,c+QString(" %1").arg(no,0,'f',15)); } void NBug(int lev,char *c) { NBug(lev,QString(c)); } void NBug(int lev,char *c,int no) { if (bug_report) NBug(lev,QString(c)+QString(" %1").arg(no)); } void NBug(int lev,char *c,double no) { if (bug_report) NBug(lev,QString(c)+QString(" %1").arg(no,0,'f',16)); } //******** OLD ******* void Bug(char *c) { FILE *fil; if (bug_report==1) { fil=fopen("BUGI.txt","ab"); fputs(c,fil); fputs("\n",fil); fclose(fil); } } void Bug(char *c,int no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%d",no); fil=fopen("BUGI.txt","ab"); fputs(c,fil); fputs(" ",fil); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void Bug(char *c,double no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%f",(double)no); fil=fopen("BUGI.txt","ab"); fputs(c,fil); fputs(" ",fil); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void Bug2(char *c,double no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%f",(double)no); fil=fopen("BUGI.txt","ab"); fputs(c,fil); fputs(" ",fil); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void Bug(long no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%d",(int)no); fil=fopen("BUGI.txt","ab"); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void Bug(double no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%f",(double)no); fil=fopen("BUGI.txt","ab"); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void BugHex(long no) { char st[200]; FILE *fil; if (bug_report==1) { sprintf(st,"%X",(unsigned int)no); fil=fopen("BUGI.txt","ab"); fputs(st,fil); fputs("\n",fil); fclose(fil); } } void ErrorReport(char *from,char *errorDetails,bool exit) { if (exit) { QMessageBox::critical( 0, from, QString("An internal error occured. Error details : \n\n") + errorDetails + "\n\nApplication will now exit." ); } else { QMessageBox::critical( 0, from, QString("Malfunction occured. Error details : \n\n") + errorDetails + "\n\nApplication will now continue." ); } } void ErrorReport(char *from,char *errorDetails) { QMessageBox::critical( 0, from, QString("Malfunction occured. Error details : \n\n") + errorDetails + "\n\nApplication will now continue." ); } void ErrorReport(char *from,QString x) { ErrorReport(from,(char *)x.latin1()); }