Fixing log upload error handling.
This commit is contained in:
@@ -104,6 +104,8 @@ enum PlayerActionLog {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define LOG_UPLOAD_ID_SIZE 40
|
#define LOG_UPLOAD_ID_SIZE 40
|
||||||
|
#define LOG_UPLOAD_OK_STR "OK"
|
||||||
|
#define LOG_UPLOAD_ERROR_STR "ERROR"
|
||||||
|
|
||||||
enum LogUploadErrorCode {
|
enum LogUploadErrorCode {
|
||||||
LOG_UPLOAD_ERROR_NO_FILE = 1,
|
LOG_UPLOAD_ERROR_NO_FILE = 1,
|
||||||
|
|||||||
@@ -259,19 +259,21 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
|
|||||||
{
|
{
|
||||||
uploadInProgressAnimationStop();
|
uploadInProgressAnimationStop();
|
||||||
|
|
||||||
QString id = returnMessage.trimmed();
|
returnMessage = returnMessage.trimmed();
|
||||||
|
QString retStr(returnMessage.mid(0, returnMessage.indexOf(' ')));
|
||||||
|
|
||||||
if(id.length() == LOG_UPLOAD_ID_SIZE && id.at(0) != '<') {
|
if (retStr == LOG_UPLOAD_OK_STR) {
|
||||||
|
QString hash(returnMessage.mid(retStr.size()).trimmed());
|
||||||
qDebug() << id << endl;
|
qDebug() << hash << endl;
|
||||||
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id));
|
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID=" + hash));
|
||||||
} else {
|
} else {
|
||||||
qDebug() << returnMessage << endl;
|
qDebug() << returnMessage << endl;
|
||||||
QString serverMsg(tr("Processing of the log file on the web server failed.\nPlease verify that you are uploading a valid PokerTH log file."));
|
QString serverMsg(tr("Processing of the log file on the web server failed.\nPlease verify that you are uploading a valid PokerTH log file."));
|
||||||
// if there is an error code, display a corresponding message.
|
// if there is an error code, display a corresponding message.
|
||||||
if (returnMessage.at(0).isDigit()) {
|
if (retStr == LOG_UPLOAD_ERROR_STR) {
|
||||||
|
QString errorId(returnMessage.mid(retStr.size()).trimmed());
|
||||||
serverMsg += "\n" + tr("Failure reason: ");
|
serverMsg += "\n" + tr("Failure reason: ");
|
||||||
switch (returnMessage.toInt())
|
switch (errorId.toInt())
|
||||||
{
|
{
|
||||||
case LOG_UPLOAD_ERROR_NO_FILE :
|
case LOG_UPLOAD_ERROR_NO_FILE :
|
||||||
serverMsg += tr("No file received.");
|
serverMsg += tr("No file received.");
|
||||||
|
|||||||
Reference in New Issue
Block a user