From 3a0f1380232561147385dca5ac2de3de8ab731bf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 6 Dec 2013 17:09:08 -0800 Subject: Whitespace cleanup That one slipped by me... Signed-off-by: Dirk Hohndel --- qt-ui/subsurfacewebservices.cpp | 152 ++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 8dd6b5921..8699a23da 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -296,10 +296,10 @@ void SubsurfaceWebServices::setStatusText(int status) { QString text; switch (status) { - case DD_STATUS_ERROR_CONNECT: text = tr("Connection Error: "); break; - case DD_STATUS_ERROR_ID: text = tr("Invalid user identifier!"); break; - case DD_STATUS_ERROR_PARSE: text = tr("Cannot parse response!"); break; - case DD_STATUS_OK: text = tr("Download Success!"); break; + case DD_STATUS_ERROR_CONNECT: text = tr("Connection Error: "); break; + case DD_STATUS_ERROR_ID: text = tr("Invalid user identifier!"); break; + case DD_STATUS_ERROR_PARSE: text = tr("Cannot parse response!"); break; + case DD_STATUS_OK: text = tr("Download Success!"); break; } ui.status->setText(text); } @@ -356,80 +356,80 @@ struct DiveListResult static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) { - /* XML format seems to be: - * - * - * DD.MM.YYYY hh:mm - * [repeat ] - * - * - */ - QXmlStreamReader reader(xmlData); - const QString invalidXmlError = DivelogsDeWebServices::tr("Invalid response from server"); - bool seenDiveDates = false; - DiveListResult result; - result.idCount = 0; - - if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { - result.errorCondition = invalidXmlError; - result.errorDetails = - DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") - .arg(reader.name().toString()); - goto out; - } - - while (reader.readNextStartElement()) { - if (reader.name() != "DiveDates") { - if (reader.name() == "Login") { - QString status = reader.readElementText(); - // qDebug() << "Login status:" << status; - - // Note: there has to be a better way to determine a successful login... - if (status == "failed") { - result.errorCondition = "Login failed"; - goto out; - } - } else { - // qDebug() << "Skipping" << reader.name(); - } - continue; - } - - // process - seenDiveDates = true; - while (reader.readNextStartElement()) { - if (reader.name() != "date") { - // qDebug() << "Skipping" << reader.name(); - continue; - } - QStringRef id = reader.attributes().value("divelogsId"); - // qDebug() << "Found" << reader.name() << "with id =" << id; - if (!id.isEmpty()) { - result.idList += id.toLatin1(); - result.idList += ','; - ++result.idCount; - } - - reader.skipCurrentElement(); - } - } - - // chop the ending comma, if any - result.idList.chop(1); - - if (!seenDiveDates) { - result.errorCondition = invalidXmlError; - result.errorDetails = DivelogsDeWebServices::tr("Expected XML tag 'DiveDates' not found"); - } + /* XML format seems to be: + * + * + * DD.MM.YYYY hh:mm + * [repeat ] + * + * + */ + QXmlStreamReader reader(xmlData); + const QString invalidXmlError = DivelogsDeWebServices::tr("Invalid response from server"); + bool seenDiveDates = false; + DiveListResult result; + result.idCount = 0; + + if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { + result.errorCondition = invalidXmlError; + result.errorDetails = + DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") + .arg(reader.name().toString()); + goto out; + } + + while (reader.readNextStartElement()) { + if (reader.name() != "DiveDates") { + if (reader.name() == "Login") { + QString status = reader.readElementText(); + // qDebug() << "Login status:" << status; + + // Note: there has to be a better way to determine a successful login... + if (status == "failed") { + result.errorCondition = "Login failed"; + goto out; + } + } else { + // qDebug() << "Skipping" << reader.name(); + } + continue; + } + + // process + seenDiveDates = true; + while (reader.readNextStartElement()) { + if (reader.name() != "date") { + // qDebug() << "Skipping" << reader.name(); + continue; + } + QStringRef id = reader.attributes().value("divelogsId"); + // qDebug() << "Found" << reader.name() << "with id =" << id; + if (!id.isEmpty()) { + result.idList += id.toLatin1(); + result.idList += ','; + ++result.idCount; + } + + reader.skipCurrentElement(); + } + } + + // chop the ending comma, if any + result.idList.chop(1); + + if (!seenDiveDates) { + result.errorCondition = invalidXmlError; + result.errorDetails = DivelogsDeWebServices::tr("Expected XML tag 'DiveDates' not found"); + } out: - if (reader.hasError()) { - // if there was an XML error, overwrite the result or other error conditions - result.errorCondition = invalidXmlError; - result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2") - .arg(reader.lineNumber()).arg(reader.errorString()); - } - return result; + if (reader.hasError()) { + // if there was an XML error, overwrite the result or other error conditions + result.errorCondition = invalidXmlError; + result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2") + .arg(reader.lineNumber()).arg(reader.errorString()); + } + return result; } DivelogsDeWebServices* DivelogsDeWebServices::instance() -- cgit v1.2.3-70-g09d2