BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
StoreFactory Class Reference

Main BuildmLearn Store functionality. More...

#include <storefactory.h>

Collaboration diagram for StoreFactory:
Collaboration graph

Public Types

enum  UploadStatus {
  Success, NetworkError, MissingParameters, InvalidKey,
  FileTooBig, OtherError
}
 Possible states of application upload process.
 

Static Public Member Functions

static QString uploadStatusToString (UploadStatus status)
 Converts UploadStatus enumeration to textual representation. More...
 
static UploadStatus parseResponseXml (QNetworkReply::NetworkError error_status, const QByteArray &response)
 Parses received XML from BuildmLearn Store server. More...
 

Detailed Description

Main BuildmLearn Store functionality.

Definition at line 40 of file storefactory.h.

Member Function Documentation

StoreFactory::UploadStatus StoreFactory::parseResponseXml ( QNetworkReply::NetworkError  error_status,
const QByteArray &  response 
)
static

Parses received XML from BuildmLearn Store server.

Parameters
error_statusNetwork status of connection to BuildmLearn Store server.
responseXML received from BuildmLearn Store server.
Returns
Returns appropriate UploadStatus for given service response XML.

Definition at line 64 of file storefactory.cpp.

65  {
66  // TODO: finalize this.
67  switch (error_status) {
68  case QNetworkReply::NoError: {
69  QDomDocument xml_response;
70  xml_response.setContent(QString(response));
71 
72  QString status = xml_response.documentElement().namedItem("status").toElement().text();
73 
74  if (status == STORE_ANSWER_SUCCESS) {
75  return Success;
76  }
77  else if (status == STORE_ANSWER_INVALID_KEY) {
78  return InvalidKey;
79  }
80  else if (status == STORE_ANSWER_NO_PARAMETERS) {
81  return MissingParameters;
82  }
83  else {
84  return OtherError;
85  }
86  }
87 
88  default:
89  return NetworkError;
90  }
91 }
QString StoreFactory::uploadStatusToString ( StoreFactory::UploadStatus  status)
static

Converts UploadStatus enumeration to textual representation.

Parameters
statusUpload result.
Returns
Returns textual representation of application upload process status.

Definition at line 45 of file storefactory.cpp.

45  {
46  switch (status) {
47  case Success:
48  return tr("Application uploaded successfully.");
49 
50  case NetworkError:
51  return tr("Network error occurred.");
52 
53  case MissingParameters:
54  return tr("Error - some parameters are missing.");
55 
56  case FileTooBig:
57  return tr("Application file is too big.");
58 
59  default:
60  return tr("Unknown status.");
61  }
62 }

The documentation for this class was generated from the following files: