Show messages to user If not graphical user interface is running this class send messages to and get information from the user through the console. In graphical user interface, a GuiMessage class is also available (in library qtbguitools), which transparently (for the developer) send the message to dialog boxes. Those two classes have eaxctly the same API. So always use this class for send messages and automatically the messages will be displayed in the appropriate way. More...
#include <Message.h>
Classes | |
class | Context |
Public Types | |
enum | Answer { Answer0, Answer1, Answer2 } |
enum | Severity { Question, Information, Warning, Critical, Fatal } |
Public Member Functions | |
void | beginContext (bool quiet=false) |
void | endContext () |
Message () | |
virtual | ~Message () |
Static Public Member Functions | |
static QString | abort () |
static QString | cancel () |
static QString | close () |
static Answer | critical (uint msgId, const QString &caption, const QString &text, bool againOption=false) |
static Answer | critical (uint msgId, const QString &caption, const QString &text, QString answer0, bool againOption=false) |
static Answer | critical (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, bool againOption=false) |
static Answer | critical (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, QString answer2, bool againOption=false) |
static QString | getExistingDirectory (const QString &caption, const QString &dir=QString::null) |
static QString | getOpenFileName (const QString &caption, const QString &filter=QString::null, const QString &directory=QString::null) |
static QStringList | getOpenFileNames (const QString &caption, const QString &filter=QString::null, const QString &directory=QString::null) |
static QString | getSaveFileName (const QString &caption, const QString &filter=QString::null, const QString &selection=QString::null) |
static QString | ignore () |
static Answer | information (uint msgId, const QString &caption, const QString &text, bool againOption=false) |
static Answer | information (uint msgId, const QString &caption, const QString &text, QString answer0, bool againOption=false) |
static Answer | information (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, bool againOption=false) |
static Answer | information (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, QString answer2, bool againOption=false) |
static uint | messageId (const char *fileName, int lineNumber) |
static QString | no () |
static QString | noAll () |
static QString | ok () |
static Answer | question (uint msgId, const QString &caption, const QString &text, bool againOption=false) |
static Answer | question (uint msgId, const QString &caption, const QString &text, QString answer0, bool againOption=false) |
static Answer | question (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, bool againOption=false) |
static Answer | question (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, QString answer2, bool againOption=false) |
static QString | retry () |
static QString | severityString (Severity sev) |
static Answer | warning (uint msgId, const QString &caption, const QString &text, bool againOption=false) |
static Answer | warning (uint msgId, const QString &caption, const QString &text, QString answer0, bool againOption=false) |
static Answer | warning (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, bool againOption=false) |
static Answer | warning (uint msgId, const QString &caption, const QString &text, QString answer0, QString answer1, QString answer2, bool againOption=false) |
static void | wrongTextFormat (FILE *fErr, const QString &caption, const QString &fileName) |
static void | wrongTextFormat (QTextStream &sErr, const QString &caption) |
static QString | yes () |
static QString | yesAll () |
Protected Member Functions | |
Answer | autoAnswer (uint msgId, Severity sev, QString caption, const QString &text, QString answer0, QString answer1, QString answer2) |
virtual QString | getExistingDirectoryInternal (const QString &caption, const QString &dir=QString::null) |
virtual QString | getOpenFileNameInternal (const QString &caption, const QString &filter=QString::null, const QString &directory=QString::null) |
virtual QStringList | getOpenFileNamesInternal (const QString &caption, const QString &filter=QString::null, const QString &directory=QString::null) |
virtual QString | getSaveFileNameInternal (const QString &caption, const QString &filter=QString::null, const QString &selection=QString::null) |
bool | hasAutoAnswer (uint msgId) const |
virtual Answer | message (uint msgId, Severity sev, QString caption, const QString &text, QString answer0, QString answer1, QString answer2, bool againOption) |
bool | quiet () const |
void | setAutoAnswer (uint msgId, Answer a) |
Show messages to user If not graphical user interface is running this class send messages to and get information from the user through the console. In graphical user interface, a GuiMessage class is also available (in library qtbguitools), which transparently (for the developer) send the message to dialog boxes. Those two classes have eaxctly the same API. So always use this class for send messages and automatically the messages will be displayed in the appropriate way.
The console is considered is its largest sense here. In fact this is a log stream which can be redirected anywhere: true unix terminal, inside a general log view, to a specific log (attached to a thread), or simply to trash.
{Question, Information, Warning, Critical, Fatal};
Init base context for answers to messages
References beginContext(), and TRACE.
{ TRACE; beginContext(false); }
virtual QGpCoreTools::Message::~Message | ( | ) | [inline, virtual] |
{}
static QString QGpCoreTools::Message::abort | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("Abort");}
Message::Answer QGpCoreTools::Message::autoAnswer | ( | uint | msgId, |
Severity | sev, | ||
QString | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2 | ||
) | [protected] |
Print auto answer to log console and return the automatic answer for message with id msgId
References Answer0, Answer1, Answer2, QGpCoreTools::endl(), severityString(), and QGpCoreTools::App::stream().
Referenced by message().
{ App::stream() << severityString(sev) << QTime::currentTime().toString("hh:mm:ss") << " -- " << caption << "----" << endl; App::stream() << text << "\n ==> "; _contextMutex.lock(); Answer a=_contexts.top().answers[msgId]; _contextMutex.unlock(); switch (a) { case Answer0: App::stream() << answer0 << endl; break; case Answer1: App::stream() << answer1 << endl; break; case Answer2: App::stream() << answer2 << endl; break; } return a; }
void QGpCoreTools::Message::beginContext | ( | bool | quiet = false | ) |
Define a new context for automatic answers, stack this context
References TRACE.
Referenced by Message(), and QGpCoreTools::MessageContext::MessageContext().
static QString QGpCoreTools::Message::cancel | ( | ) | [inline, static] |
References QGpCoreTools::tr().
Referenced by QGpCoreTools::GoogleEarthKML::save(), and wrongTextFormat().
{return tr("Cancel");}
static QString QGpCoreTools::Message::close | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("Close");}
Message::Answer QGpCoreTools::Message::critical | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
bool | againOption = false |
||
) | [inline, static] |
Referenced by critical(), QGpCoreTools::XMLErrorReport::exec(), and wrongTextFormat().
{ return critical(msgId, caption, text, QString::null, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::critical | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
bool | againOption = false |
||
) | [inline, static] |
References critical().
{ return critical(msgId, caption, text, answer0, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::critical | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
bool | againOption = false |
||
) | [inline, static] |
References critical().
{ return critical(msgId, caption, text, answer0, answer1, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::critical | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2, | ||
bool | againOption = false |
||
) | [static] |
Show a critical message. msgId has to be the macro MSG_ID.
References Critical, QGpCoreTools::CoreApplication::instance(), message(), and QGpCoreTools::CoreApplicationPrivate::messageHandler().
{ return CoreApplication::instance()->messageHandler() ->message(msgId, Critical, caption, text, answer0, answer1, answer2, againOption); }
void QGpCoreTools::Message::endContext | ( | ) |
Delete current context for automatic answers, and restore old one
References TRACE.
Referenced by QGpCoreTools::MessageContext::~MessageContext().
{ TRACE; QMutexLocker ml(&_contextMutex); _contexts.pop(); }
QString QGpCoreTools::Message::getExistingDirectory | ( | const QString & | caption, |
const QString & | dir = QString::null |
||
) | [static] |
get an existing directory
References getExistingDirectoryInternal(), QGpCoreTools::CoreApplication::instance(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and TRACE.
{ TRACE; return CoreApplication::instance()->messageHandler() ->getExistingDirectoryInternal(caption, dir); }
QString QGpCoreTools::Message::getExistingDirectoryInternal | ( | const QString & | caption, |
const QString & | dir = QString::null |
||
) | [protected, virtual] |
get an existing directory
References QGpCoreTools::endl(), QGpCoreTools::flush(), QGpCoreTools::File::readLine(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and TRACE.
Referenced by getExistingDirectory().
{ TRACE; App::stream() << "---- " << caption << " ----" << endl; App::stream() << tr(" Dir: ") << dir << endl; App::stream() << tr("Directory to choose: ") << flush; return File::readLine(true); }
QString QGpCoreTools::Message::getOpenFileName | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | directory = QString::null |
||
) | [static] |
get an existing file name
References getOpenFileNameInternal(), QGpCoreTools::CoreApplication::instance(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and TRACE.
{ TRACE; return CoreApplication::instance()->messageHandler() ->getOpenFileNameInternal(caption, filter, directory); }
QString QGpCoreTools::Message::getOpenFileNameInternal | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | directory = QString::null |
||
) | [protected, virtual] |
get an existing file name
References QGpCoreTools::endl(), QGpCoreTools::flush(), QGpCoreTools::File::readLine(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and TRACE.
Referenced by getOpenFileName().
{ TRACE; App::stream() << "---- " << caption << " ----" << endl; App::stream() << tr(" Filter: ") << filter << endl; App::stream() << tr(" Current directory: ") << directory << endl; App::stream() << tr("File to open: ") << flush; return File::readLine(true); }
QStringList QGpCoreTools::Message::getOpenFileNames | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | directory = QString::null |
||
) | [static] |
get existing file names
References getOpenFileNamesInternal(), QGpCoreTools::CoreApplication::instance(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and TRACE.
{ TRACE; return CoreApplication::instance()->messageHandler() ->getOpenFileNamesInternal(caption, filter, directory); }
QStringList QGpCoreTools::Message::getOpenFileNamesInternal | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | directory = QString::null |
||
) | [protected, virtual] |
get existing file names
References QGpCoreTools::endl(), QGpCoreTools::flush(), QGpCoreTools::File::readLine(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and TRACE.
Referenced by getOpenFileNames().
{ TRACE; App::stream() << "---- " << caption << " ----" << endl; App::stream() << tr(" Filter: ") << filter << endl; App::stream() << tr(" Current directory: ") << directory << endl; QStringList fileNames; while(true) { App::stream() << tr("File %1 to open: ").arg(fileNames.count()+1) << flush; QString fn=File::readLine(true); if(fn.isEmpty()) break; fileNames.append(fn); } return fileNames; }
QString QGpCoreTools::Message::getSaveFileName | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | selection = QString::null |
||
) | [static] |
get a new file name
References getSaveFileNameInternal(), QGpCoreTools::CoreApplication::instance(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and TRACE.
{ TRACE; return CoreApplication::instance()->messageHandler() ->getSaveFileNameInternal(caption, filter, selection); }
QString QGpCoreTools::Message::getSaveFileNameInternal | ( | const QString & | caption, |
const QString & | filter = QString::null , |
||
const QString & | selection = QString::null |
||
) | [protected, virtual] |
get a new file name
References QGpCoreTools::endl(), QGpCoreTools::flush(), QGpCoreTools::File::readLine(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and TRACE.
Referenced by getSaveFileName().
{ TRACE; App::stream() << "---- " << caption << " ----" << endl; App::stream() << tr(" Filter: ") << filter << endl; App::stream() << tr(" Selection: ") << selection << endl; App::stream() << tr("File to save: ") << flush; return File::readLine(true); }
bool QGpCoreTools::Message::hasAutoAnswer | ( | uint | msgId | ) | const [inline, protected] |
Referenced by message().
{
QMutexLocker ml(&_contextMutex);
return _contexts.top().answers.contains(msgId);
}
static QString QGpCoreTools::Message::ignore | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("Ignore");}
Message::Answer QGpCoreTools::Message::information | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
bool | againOption = false |
||
) | [inline, static] |
Referenced by information().
{ return information(msgId, caption, text, QString::null, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::information | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
bool | againOption = false |
||
) | [inline, static] |
References information().
{ return information(msgId, caption, text, answer0, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::information | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
bool | againOption = false |
||
) | [inline, static] |
References information().
{ return information(msgId, caption, text, answer0, answer1, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::information | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2, | ||
bool | againOption = false |
||
) | [static] |
Show an information message. msgId has to be the macro MSG_ID.
References Information, QGpCoreTools::CoreApplication::instance(), message(), and QGpCoreTools::CoreApplicationPrivate::messageHandler().
{ return CoreApplication::instance()->messageHandler() ->message(msgId, Information, caption, text, answer0, answer1, answer2, againOption); }
Message::Answer QGpCoreTools::Message::message | ( | uint | msgId, |
Severity | sev, | ||
QString | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2, | ||
bool | againOption | ||
) | [protected, virtual] |
General message function with interactions with console
References Answer0, Answer1, Answer2, autoAnswer(), QGpCoreTools::endl(), QGpCoreTools::flush(), hasAutoAnswer(), QGpCoreTools::File::readLine(), setAutoAnswer(), severityString(), QGpCoreTools::App::stream(), and QGpCoreTools::tr().
Referenced by critical(), information(), question(), and warning().
{ if(againOption && hasAutoAnswer(msgId)) { return autoAnswer(msgId, sev, caption, text, answer0, answer1, answer2); } App::stream() << severityString(sev) << caption << "----" << endl; App::stream() << text << endl; if(answer1.isEmpty() && answer2.isEmpty()) return Answer0; App::stream() << " 1. " << answer0 << tr( " <-- default" ) << endl; App::stream() << " 2. " << answer1 << endl; if( !answer2.isEmpty()) App::stream() << " 3. " << answer2 << endl; App::stream() << tr( "? " ) << flush; QString rep=File::readLine(true); rep=rep.toLower(); Answer a; if(rep=="1" ) a=Answer0; else if(rep=="2" ) a=Answer1; else if(rep=="3" ) a=Answer2; else if(answer0.toLower().startsWith(rep)) a=Answer0; else if(answer1.toLower().startsWith(rep)) a=Answer1; else if(answer2.toLower().startsWith(rep)) a=Answer2; else a=Answer0; if(againOption) { App::stream() << tr("Show this message again? [y]/n ") << flush; QString rep=File::readLine(true); if(rep.toLower().startsWith("n")) setAutoAnswer(msgId, a); } return a; }
uint QGpCoreTools::Message::messageId | ( | const char * | fileName, |
int | lineNumber | ||
) | [static] |
Generate a unique message id from position in source file.
Use C macros __FILE__ and __LINE__ as argument of this function.
References QGpCoreTools::qHash(), and TRACE.
static QString QGpCoreTools::Message::no | ( | ) | [inline, static] |
References QGpCoreTools::tr().
Referenced by QGpCoreTools::CoreApplicationPrivate::askForUserInterrupt().
{return tr("No");}
static QString QGpCoreTools::Message::noAll | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("No to all");}
static QString QGpCoreTools::Message::ok | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("OK");}
Message::Answer QGpCoreTools::Message::question | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
bool | againOption = false |
||
) | [inline, static] |
Referenced by QGpCoreTools::CoreApplicationPrivate::askForUserInterrupt(), and question().
{ return question(msgId, caption, text, QString::null, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::question | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
bool | againOption = false |
||
) | [inline, static] |
References question().
{ return question(msgId, caption, text, answer0, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::question | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
bool | againOption = false |
||
) | [inline, static] |
References question().
{ return question(msgId, caption, text, answer0, answer1, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::question | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2, | ||
bool | againOption = false |
||
) | [static] |
Ask a question. msgId has to be the macro MSG_ID.
References QGpCoreTools::CoreApplication::instance(), message(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and Question.
{ return CoreApplication::instance()->messageHandler() ->message(msgId, Question, caption, text, answer0, answer1, answer2, againOption); }
bool QGpCoreTools::Message::quiet | ( | ) | const [inline, protected] |
{
QMutexLocker ml(&_contextMutex);
return _contexts.top().quiet;
}
static QString QGpCoreTools::Message::retry | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("Retry");}
void QGpCoreTools::Message::setAutoAnswer | ( | uint | msgId, |
Answer | a | ||
) | [protected] |
QString QGpCoreTools::Message::severityString | ( | Severity | sev | ) | [static] |
Translate severity sev into a localized string.
References Critical, Fatal, Information, Question, QGpCoreTools::tr(), TRACE, and Warning.
Referenced by autoAnswer(), QGpCoreTools::CoreApplicationPrivate::bugInfo(), message(), and QGpCoreTools::CoreApplicationPrivate::reportBug().
Message::Answer QGpCoreTools::Message::warning | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
bool | againOption = false |
||
) | [inline, static] |
Referenced by QGpCoreTools::GoogleEarthKML::save(), and warning().
{ return warning(msgId, caption, text, QString::null, QString::null, QString::null, againOption); }
Message::Answer QGpCoreTools::Message::warning | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
bool | againOption = false |
||
) | [inline, static] |
Message::Answer QGpCoreTools::Message::warning | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
bool | againOption = false |
||
) | [inline, static] |
Message::Answer QGpCoreTools::Message::warning | ( | uint | msgId, |
const QString & | caption, | ||
const QString & | text, | ||
QString | answer0, | ||
QString | answer1, | ||
QString | answer2, | ||
bool | againOption = false |
||
) | [static] |
Show a warning message. msgId has to be the macro MSG_ID.
References QGpCoreTools::CoreApplication::instance(), message(), QGpCoreTools::CoreApplicationPrivate::messageHandler(), and Warning.
{ return CoreApplication::instance()->messageHandler() ->message(msgId, Warning, caption, text, answer0, answer1, answer2, againOption); }
void QGpCoreTools::Message::wrongTextFormat | ( | FILE * | fErr, |
const QString & | caption, | ||
const QString & | fileName | ||
) | [static] |
Call this function to print a user friendly message in case of error while reading a text file. If graphical user interface is available, it will be printed in a dialog box, if not to the terminal
References cancel(), critical(), MSG_ID, QGpCoreTools::File::readLine(), sOut(), str, QGpCoreTools::tr(), and TRACE.
{ TRACE; QTextStream sOut(stdout); QString str; if(fileName.isEmpty()) { str=tr("Error parsing text file\n"); } else { str=tr("Error parsing text file %1\n").arg(fileName); } uint errorLocation=ftell(fErr); uint errorShowStart; if(errorLocation<200) errorShowStart=0; else errorShowStart=errorLocation-200; // TODO check if possible to know if it can seek correctly fseek(fErr,errorShowStart,SEEK_SET); int strLineLen=256; char * strLine=new char[strLineLen]; File::readLine(strLine, strLineLen, fErr); uint lastLinePos=errorShowStart; uint currentPos=ftell(fErr); while(currentPos<errorLocation) { str+=tr(" " )+strLine+"\n"; File::readLine(strLine, strLineLen, fErr); lastLinePos=currentPos; currentPos=ftell(fErr); } uint errorCharPos=errorLocation-lastLinePos; char c=strLine[errorCharPos]; strLine[errorCharPos]='\0'; str+=tr("==> %1\n").arg(strLine); strLine[errorCharPos]=c; QString blankStr; blankStr.fill(' ',errorCharPos+4); if(strlen(strLine)>=errorCharPos) str+=blankStr+(strLine+errorCharPos)+"\n"; str+=blankStr+"^\n"; while(!feof(fErr) && currentPos<errorLocation+200) { File::readLine(strLine, strLineLen, fErr); str+=tr(" " )+strLine+"\n"; currentPos=ftell(fErr); } fseek(fErr,errorLocation,SEEK_SET); critical(MSG_ID, caption, str, cancel()); }
void QGpCoreTools::Message::wrongTextFormat | ( | QTextStream & | sErr, |
const QString & | caption | ||
) | [static] |
Call this function to print a user friendly message in case of error while parsing a formated text from a QTextStream. If graphical user interface is available, it will be printed in a dialog box, if not to the terminal
References cancel(), critical(), MSG_ID, str, QGpCoreTools::tr(), and TRACE.
{ TRACE; QFile * fErr=static_cast<QFile *>(sErr.device()); QString str; if(fErr) { str=tr("Error parsing text file %1\n").arg(fErr->fileName()); } else { str=tr("Error parsing text\n"); } qint64 errorLocation=sErr.pos (); qint64 errorShowStart; if(errorLocation<200) errorShowStart=0; else errorShowStart=errorLocation-200; if(sErr.seek(errorShowStart)) { str+=tr("Offset from beginning of file: %1 bytes.\n").arg(errorShowStart); QString strLine=sErr.readLine(); qint64 lastLinePos=errorShowStart; qint64 currentPos=sErr.pos(); while(currentPos<errorLocation) { str+=tr(" " )+strLine+"\n"; strLine=sErr.readLine(); lastLinePos=currentPos; currentPos=sErr.pos(); } int errorCharPos=errorLocation-lastLinePos; str+=tr("==> %1\n").arg(strLine.left(errorCharPos)); QString blankStr; blankStr.fill(' ',errorCharPos+4); if(strLine.length()>=errorCharPos) str+=blankStr+strLine.right(strLine.length()-errorCharPos)+"\n"; str+=blankStr+"^\n"; while(!sErr.atEnd() && currentPos<errorLocation+200) { str+=tr(" " )+sErr.readLine()+"\n"; currentPos=sErr.pos(); } sErr.seek(errorLocation); } else { str+=tr("Impossible to print the context of the parsing error\n"); } critical(MSG_ID, caption, str, cancel()); }
static QString QGpCoreTools::Message::yes | ( | ) | [inline, static] |
References QGpCoreTools::tr().
Referenced by QGpCoreTools::CoreApplicationPrivate::askForUserInterrupt().
{return tr("Yes");}
static QString QGpCoreTools::Message::yesAll | ( | ) | [inline, static] |
References QGpCoreTools::tr().
{return tr("Yes to all");}