summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-18 23:10:29 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2015-12-18 23:42:18 +0100
commit79d513dd7e0a1e5b8a9e7d821ef575b3e7f6f173 (patch)
tree6784a33a341ddcfd036d3844be70e9323e2c3690
parentd24a9ea3b2eaec28e44608bfc50d02cb14cea51b (diff)
downloadrockbox-79d513dd7e0a1e5b8a9e7d821ef575b3e7f6f173.tar.gz
rockbox-79d513dd7e0a1e5b8a9e7d821ef575b3e7f6f173.zip
Add documentation to HttpGet and remove unnecessary return value.
HttpGet::getFile() always returns the same value. Remove the return value since it isn't necessary. Add some missing function documentation comments. Change-Id: I1cee242211272a996437b10dbc8de791b3fc3d67
-rw-r--r--rbutil/rbutilqt/base/httpget.cpp37
-rw-r--r--rbutil/rbutilqt/base/httpget.h2
2 files changed, 33 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/base/httpget.cpp b/rbutil/rbutilqt/base/httpget.cpp
index 4d10301bc0..476da87bad 100644
--- a/rbutil/rbutilqt/base/httpget.cpp
+++ b/rbutil/rbutilqt/base/httpget.cpp
@@ -44,8 +44,9 @@ HttpGet::HttpGet(QObject *parent)
44} 44}
45 45
46 46
47//! @brief set cache path 47/** @brief set cache path
48// @param d new directory to use as cache path 48 * @param d new directory to use as cache path
49 */
49void HttpGet::setCache(const QDir& d) 50void HttpGet::setCache(const QDir& d)
50{ 51{
51 if(m_cache && m_cachedir == d.absolutePath()) 52 if(m_cache && m_cachedir == d.absolutePath())
@@ -95,6 +96,9 @@ QByteArray HttpGet::readAll()
95} 96}
96 97
97 98
99/** @brief Set and enable Proxy to use.
100 * @param proxy Proxy URL.
101 */
98void HttpGet::setProxy(const QUrl &proxy) 102void HttpGet::setProxy(const QUrl &proxy)
99{ 103{
100 LOG_INFO() << "Proxy set to" << proxy; 104 LOG_INFO() << "Proxy set to" << proxy;
@@ -107,6 +111,9 @@ void HttpGet::setProxy(const QUrl &proxy)
107} 111}
108 112
109 113
114/** @brief Enable or disable use of previously set proxy.
115 * @param enable Enable proxy.
116 */
110void HttpGet::setProxy(bool enable) 117void HttpGet::setProxy(bool enable)
111{ 118{
112 if(enable) m_mgr->setProxy(m_proxy); 119 if(enable) m_mgr->setProxy(m_proxy);
@@ -114,6 +121,14 @@ void HttpGet::setProxy(bool enable)
114} 121}
115 122
116 123
124/** @brief Set output file.
125 *
126 * Set filename for storing the downloaded file to. If no file is set the
127 * downloaded file will not be stored to disk but kept in memory. The result
128 * can then be retrieved using readAll().
129 *
130 * @param file Output file.
131 */
117void HttpGet::setFile(QFile *file) 132void HttpGet::setFile(QFile *file)
118{ 133{
119 m_outputFile = file; 134 m_outputFile = file;
@@ -202,22 +217,34 @@ void HttpGet::networkError(QNetworkReply::NetworkError error)
202} 217}
203 218
204 219
205bool HttpGet::getFile(const QUrl &url) 220/** @brief Retrieve the file pointed to by url.
221 *
222 * Note: This also handles file:// URLs. Be aware that QUrl requires file://
223 * URLs to be absolute, i.e. file://filename.txt doesn't work. Use
224 * QDir::absoluteFilePath() to convert to an absolute path first.
225 *
226 * @param url URL to download.
227 */
228void HttpGet::getFile(const QUrl &url)
206{ 229{
207 LOG_INFO() << "Get URI" << url.toString(); 230 LOG_INFO() << "Get URI" << url.toString();
208 m_data.clear(); 231 m_data.clear();
209 startRequest(url); 232 startRequest(url);
210
211 return false;
212} 233}
213 234
214 235
236/** @brief Retrieve string representation for most recent error.
237 * @return Error string.
238 */
215QString HttpGet::errorString(void) 239QString HttpGet::errorString(void)
216{ 240{
217 return m_lastErrorString; 241 return m_lastErrorString;
218} 242}
219 243
220 244
245/** @brief Return last HTTP response code.
246 * @return Response code.
247 */
221int HttpGet::httpResponse(void) 248int HttpGet::httpResponse(void)
222{ 249{
223 return m_lastStatusCode; 250 return m_lastStatusCode;
diff --git a/rbutil/rbutilqt/base/httpget.h b/rbutil/rbutilqt/base/httpget.h
index 8c62157e5f..0bd3d284ac 100644
--- a/rbutil/rbutilqt/base/httpget.h
+++ b/rbutil/rbutilqt/base/httpget.h
@@ -34,7 +34,7 @@ class HttpGet : public QObject
34 public: 34 public:
35 HttpGet(QObject *parent = 0); 35 HttpGet(QObject *parent = 0);
36 36
37 bool getFile(const QUrl &url); 37 void getFile(const QUrl &url);
38 void setProxy(const QUrl &url); 38 void setProxy(const QUrl &url);
39 void setProxy(bool); 39 void setProxy(bool);
40 QString errorString(void); 40 QString errorString(void);