Fixing log upload error handling.

This commit is contained in:
lotodore
2012-12-23 00:33:04 +01:00
parent d9f6bd88c2
commit 89144b2832
2 changed files with 11 additions and 7 deletions
+2
View File
@@ -104,6 +104,8 @@ enum PlayerActionLog {
};
#define LOG_UPLOAD_ID_SIZE 40
#define LOG_UPLOAD_OK_STR "OK"
#define LOG_UPLOAD_ERROR_STR "ERROR"
enum LogUploadErrorCode {
LOG_UPLOAD_ERROR_NO_FILE = 1,
+9 -7
View File
@@ -259,19 +259,21 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
{
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) != '<') {
qDebug() << id << endl;
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id));
if (retStr == LOG_UPLOAD_OK_STR) {
QString hash(returnMessage.mid(retStr.size()).trimmed());
qDebug() << hash << endl;
QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID=" + hash));
} else {
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."));
// 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: ");
switch (returnMessage.toInt())
switch (errorId.toInt())
{
case LOG_UPLOAD_ERROR_NO_FILE :
serverMsg += tr("No file received.");