-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathqspwebchannel.cpp
More file actions
41 lines (35 loc) · 1.12 KB
/
qspwebchannel.cpp
File metadata and controls
41 lines (35 loc) · 1.12 KB
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
#include "qspwebchannel.h"
#include <QMessageBox>
#include <qsp_default.h>
#include "callbacks_gui.h"
#include "comtools.h"
QspWebChannel::QspWebChannel(QObject *parent) : QObject(parent)
{
}
void QspWebChannel::ExecString(const QString &string)
{
if (!QSPExecString(qspStringFromQString(string), QSP_TRUE))
ShowError();
}
void QspWebChannel::ShowError()
{
QString errorMessage;
QSP_CHAR *loc;
int code, actIndex, line;
QSPGetLastErrorData(&code, &loc, &actIndex, &line);
QString desc = QSPTools::qspStrToQt(QSPGetErrorDesc(code));
if (loc)
errorMessage = QString("Location: %1\nArea: %2\nLine: %3\nCode: %4\nDesc: %5")
.arg(QSPTools::qspStrToQt(loc))
.arg(actIndex < 0 ? QString("on visit") : QString("on action"))
.arg(line)
.arg(code)
.arg(desc);
else
errorMessage = QString("Code: %1\nDesc: %2")
.arg(code)
.arg(desc);
QMessageBox dialog(QMessageBox::Critical, tr("Error"), errorMessage, QMessageBox::Ok);
dialog.exec();
QSPCallBacks::RefreshInt(QSP_FALSE);
}