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
basenetworkaccessmanager.h
1 /*
2  Copyright (c) 2012, BuildmLearn Contributors listed at http://buildmlearn.org/people/
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of the BuildmLearn nor the names of its
16  contributors may be used to endorse or promote products derived from
17  this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 
32 #ifndef BASENETWORKACCESSMANAGER_H
33 #define BASENETWORKACCESSMANAGER_H
34 
35 #include <QNetworkAccessManager>
36 
37 
38 /// \brief Base class for all network access managers.
39 class BaseNetworkAccessManager : public QNetworkAccessManager {
40  Q_OBJECT
41 
42  public:
43  /// \brief Constructor.
44  explicit BaseNetworkAccessManager(QObject *parent = 0);
45  virtual ~BaseNetworkAccessManager();
46 
47  public slots:
48  /// \brief Loads network settings for this instance.
49  /// \remarks This sets up proxy settings.
50  virtual void loadSettings();
51 
52  protected slots:
53  /// \brief Catches and processes SSL errors.
54  /// \param reply Network reply for which error came up.
55  /// \param error Error description.
56  void onSslErrors(QNetworkReply *reply,
57  const QList<QSslError> &error);
58 
59  protected:
60  /// \brief Creates custom request.
61  /// \param op Requested operation.
62  /// \param request The request object itself.
63  /// \param outgoingData Buffer for writting output data.
64  /// \return Returns newly created reply for given request.
65  QNetworkReply *createRequest(Operation op,
66  const QNetworkRequest &request,
67  QIODevice *outgoingData);
68 };
69 
70 #endif // BASENETWORKACCESSMANAGER_H
BaseNetworkAccessManager(QObject *parent=0)
Constructor.
virtual void loadSettings()
Loads network settings for this instance.
void onSslErrors(QNetworkReply *reply, const QList< QSslError > &error)
Catches and processes SSL errors.
QNetworkReply * createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
Creates custom request.
Base class for all network access managers.