Permalink
Browse files

Renaming, Code Formatting & small Changes

  • Loading branch information...
1 parent 3377274 commit 64e4ca7780a22b10f87d0a38d2acac1c0295f93c @Horrendus Horrendus committed Dec 24, 2010
View
@@ -13,8 +13,8 @@ find_package(QJSON REQUIRED)
include( ${QT_USE_FILE} )
set( MYGPO_LIB_MAJOR_VERSION "0" )
-set( MYGPO_LIB_MINOR_VERSION "2" )
-set( MYGPO_LIB_PATCH_VERSION "5" )
+set( MYGPO_LIB_MINOR_VERSION "9" )
+set( MYGPO_LIB_PATCH_VERSION "0" )
set( MYGPO_LIB_VERSION "${MYGPO_LIB_MAJOR_VERSION}.${MYGPO_LIB_MINOR_VERSION}.${MYGPO_LIB_PATCH_VERSION}" )
set( MYGPO_LIB_VERSION_SONAME "${MYGPO_LIB_MAJOR_VERSION}.${MYGPO_LIB_MINOR_VERSION}")
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -24,8 +24,7 @@
#include "AddRemoveResult.h"
-#include <QDebug>
-#include <QSharedPointer>
+#include <QUrl>
namespace mygpo {
@@ -62,7 +61,7 @@ AddRemoveResultPrivate::AddRemoveResultPrivate ( AddRemoveResult* qq, QNetworkRe
AddRemoveResultPrivate::~AddRemoveResultPrivate()
{
- delete m_reply;
+ delete m_reply;
}
@@ -119,16 +118,16 @@ bool AddRemoveResultPrivate::parse ( const QByteArray& data )
void AddRemoveResultPrivate::parseData()
{
- if (m_reply->error() == QNetworkReply::NoError) {
-
- if ( parse ( m_reply->readAll( ) ) )
- {
- emit q->finished();
- }
- else
- {
- emit q->parseError();
- }
+ if (m_reply->error() == QNetworkReply::NoError) {
+
+ if ( parse ( m_reply->readAll( ) ) )
+ {
+ emit q->finished();
+ }
+ else
+ {
+ emit q->parseError();
+ }
}
}
@@ -145,22 +144,22 @@ AddRemoveResult::AddRemoveResult( QNetworkReply* reply ,QObject* parent ) : QObj
AddRemoveResult::~AddRemoveResult ()
{
- delete d;
+ delete d;
}
QVariant AddRemoveResult::updateUrls() const
{
- return d->updateUrls();
+ return d->updateUrls();
}
qulonglong AddRemoveResult::timestamp() const
{
- return d->timestamp();
+ return d->timestamp();
}
QList<QPair<QUrl, QUrl> > AddRemoveResult::updateUrlsList() const
{
- return d->updateUrlsList();
+ return d->updateUrlsList();
}
}
View
@@ -23,13 +23,13 @@
#ifndef ADDREMOVERESULT_H
#define ADDREMOVERESULT_H
-#include <QObject>
#include <QList>
-#include <QUrl>
#include <QVariant>
#include <QNetworkReply>
#include <QSharedPointer>
+class QUrl;
+
#include "mygpo_export.h"
namespace mygpo
View
@@ -22,9 +22,9 @@
#include "ApiRequest.h"
+
#include "UrlBuilder.h"
-#include "JsonParser.h"
-//#include "RequestExceptions.h"
+#include "JsonCreator.h"
#include "RequestHandler.h"
@@ -73,7 +73,6 @@ class ApiRequestPrivate
EpisodeActionListPtr episodeActionsByDeviceAndTimestamp(const QString& username, const QString& deviceId, const qulonglong since);
EpisodeActionListPtr episodeActionsByPodcastAndAggregate(const QString& username, const QString& podcastUrl, const bool aggregated);
AddRemoveResultPtr uploadEpisodeActions(const QString& username, const QList<EpisodeActionPtr>& episodeActions);
- QNetworkReply* renameDevice( const QString& username, const QString& deviceId, const QString& caption, const QString& type);
private:
RequestHandler m_requestHandler;
};
@@ -191,7 +190,7 @@ PodcastListPtr ApiRequestPrivate::suggestions ( uint count )
AddRemoveResultPtr ApiRequestPrivate::addRemoveSubscriptions ( const QString& username, const QString& device,const QList< QUrl >& add, const QList< QUrl >& remove )
{
QUrl requesturl = UrlBuilder::getAddRemoveSubUrl ( username,device );
- QByteArray data = JsonParser::addRemoveSubsToJSON ( add,remove );
+ QByteArray data = JsonCreator::addRemoveSubsToJSON ( add,remove );
//TODO: Check if no URL is contained in both Lists
QNetworkReply *reply;
reply = m_requestHandler.postRequest ( data, requesturl );
@@ -240,7 +239,7 @@ SettingsPtr ApiRequestPrivate::setAccountSettings(const QString& username, QMap<
{
QUrl requesturl = UrlBuilder::getAccountSettingsUrl( username );
QNetworkReply *reply;
- QByteArray postData = JsonParser::saveSettingsToJSON(set,remove);
+ QByteArray postData = JsonCreator::saveSettingsToJSON(set,remove);
reply = m_requestHandler.postRequest(postData,requesturl);
SettingsPtr settings(new Settings ( reply ));
return settings;
@@ -250,7 +249,7 @@ SettingsPtr ApiRequestPrivate::setDeviceSettings(const QString& username, const
{
QUrl requesturl = UrlBuilder::getDeviceSettingsUrl( username, device );
QNetworkReply *reply;
- QByteArray postData = JsonParser::saveSettingsToJSON(set,remove);
+ QByteArray postData = JsonCreator::saveSettingsToJSON(set,remove);
reply = m_requestHandler.postRequest(postData,requesturl);
SettingsPtr settings(new Settings ( reply ));
return settings;
@@ -260,7 +259,7 @@ SettingsPtr ApiRequestPrivate::setPodcastSettings(const QString& username, const
{
QUrl requesturl = UrlBuilder::getPodcastSettingsUrl( username, podcastUrl );
QNetworkReply *reply;
- QByteArray postData = JsonParser::saveSettingsToJSON(set,remove);
+ QByteArray postData = JsonCreator::saveSettingsToJSON(set,remove);
reply = m_requestHandler.postRequest(postData,requesturl);
SettingsPtr settings(new Settings ( reply ));
return settings;
@@ -270,7 +269,7 @@ SettingsPtr ApiRequestPrivate::setEpisodeSettings(const QString& username, const
{
QUrl requesturl = UrlBuilder::getEpisodeSettingsUrl( username, podcastUrl, episodeUrl );
QNetworkReply *reply;
- QByteArray postData = JsonParser::saveSettingsToJSON(set,remove);
+ QByteArray postData = JsonCreator::saveSettingsToJSON(set,remove);
reply = m_requestHandler.postRequest(postData,requesturl);
SettingsPtr settings(new Settings ( reply ));
return settings;
@@ -351,7 +350,7 @@ EpisodeActionListPtr ApiRequestPrivate::episodeActionsByPodcastAndAggregate(cons
AddRemoveResultPtr ApiRequestPrivate::uploadEpisodeActions(const QString& username, const QList<EpisodeActionPtr>& episodeActions) {
QUrl requesturl = UrlBuilder::getEpisodeActionsUrl(username);
QNetworkReply *reply;
- QByteArray postData = JsonParser::episodeActionListToJSON(episodeActions);
+ QByteArray postData = JsonCreator::episodeActionListToJSON(episodeActions);
reply = m_requestHandler.postRequest(postData,requesturl);
AddRemoveResultPtr addRemoveResult(new AddRemoveResult ( reply ));
return addRemoveResult;
@@ -364,19 +363,19 @@ QNetworkReply* ApiRequestPrivate::renameDevice(const QString& username , const Q
QByteArray data;
switch (type) {
case ApiRequest::DESKTOP:
- data = JsonParser::renameDeviceStringToJSON(caption,QLatin1String("desktop"));
+ data = JsonCreator::renameDeviceStringToJSON(caption,QLatin1String("desktop"));
break;
case ApiRequest::LAPTOP:
- data = JsonParser::renameDeviceStringToJSON(caption,QLatin1String("laptop"));
+ data = JsonCreator::renameDeviceStringToJSON(caption,QLatin1String("laptop"));
break;
case ApiRequest::MOBILE:
- data = JsonParser::renameDeviceStringToJSON(caption,QLatin1String("mobile"));
+ data = JsonCreator::renameDeviceStringToJSON(caption,QLatin1String("mobile"));
break;
case ApiRequest::SERVER:
- data = JsonParser::renameDeviceStringToJSON(caption,QLatin1String("server"));
+ data = JsonCreator::renameDeviceStringToJSON(caption,QLatin1String("server"));
break;
case ApiRequest::OTHER:
- data = JsonParser::renameDeviceStringToJSON(caption,QLatin1String("other"));
+ data = JsonCreator::renameDeviceStringToJSON(caption,QLatin1String("other"));
break;
}
reply = m_requestHandler.postRequest(data, requestUrl);
View
@@ -24,17 +24,12 @@
#define APIREQUEST_H
#define MYGPO_MAJOR_VERSION 0
-#define MYGPO_MINOR_VERSION 2
-#define MYGPO_PATCH_VERSION 5
+#define MYGPO_MINOR_VERSION 9
+#define MYGPO_PATCH_VERSION 0
-//#include "RequestHandler.h"
#include "mygpo_export.h"
-#include "Podcast.h"
-#include "Episode.h"
-#include "Tag.h"
#include "AddRemoveResult.h"
#include "EpisodeList.h"
-#include "EpisodeAction.h"
#include "EpisodeActionList.h"
#include "PodcastList.h"
#include "TagList.h"
@@ -213,7 +208,7 @@ class MYGPO_EXPORT ApiRequest
AddRemoveResultPtr uploadEpisodeActions(const QString& username, const QList<EpisodeActionPtr>& episodeActions);
- QNetworkReply* renameDevice( const QString& username, const QString& deviceId, const QString& caption, const QString& type);
+
private:
ApiRequestPrivate* const d;
View
@@ -5,15 +5,14 @@ set ( LIBMYGPO_QT_SRC
Settings.cpp
AddRemoveResult.cpp
Tag.cpp
- JsonParser.cpp
+ JsonCreator.cpp
Podcast.cpp
Episode.cpp
EpisodeAction.cpp
EpisodeActionList.cpp
ApiRequest.cpp
RequestHandler.cpp
UrlBuilder.cpp
- RequestExceptions.cpp
TagList.cpp
EpisodeList.cpp
PodcastList.cpp
@@ -24,8 +23,7 @@ set ( LIBMYGPO_QT_SRC
set ( LIBMYGPO_QT_H
Settings.h
AddRemoveResult.h
- JsonParser.h
- mygpo.h
+ JsonCreator.h
mygpo_export.h
Podcast.h
Episode.h
@@ -35,7 +33,6 @@ set ( LIBMYGPO_QT_H
ApiRequest.h
RequestHandler.h
UrlBuilder.h
- RequestExceptions.h
TagList.h
EpisodeList.h
PodcastList.h
View
@@ -3,7 +3,7 @@
namespace mygpo
{
-
+
class DeviceListPrivate : public QObject
{
Q_OBJECT
@@ -12,16 +12,16 @@ class DeviceListPrivate : public QObject
virtual ~DeviceListPrivate();
QVariant devices() const;
QList< QMap<QString,QString> > devicesList() const;
-
+
private:
DeviceList* q;
QNetworkReply* m_reply;
QVariant m_devices;
QNetworkReply::NetworkError m_error;
-
+
bool parse ( const QVariant& data );
bool parse ( const QByteArray& data );
-
+
private slots:
void parseData();
void error ( QNetworkReply::NetworkError error );
@@ -54,19 +54,19 @@ QList< QMap< QString, QString > > DeviceListPrivate::devicesList() const
QList< QMap< QString, QString > > ret;
foreach( const QVariant& var, varList)
{
- if(var.canConvert(QVariant::Map))
+ if (var.canConvert(QVariant::Map))
{
QMap<QString,QVariant> varMap;
QMap<QString,QString> tmp;
-
+
varMap = var.toMap();
- if(varMap.value(QLatin1String("id")).canConvert(QVariant::String))
+ if (varMap.value(QLatin1String("id")).canConvert(QVariant::String))
tmp.insert(QLatin1String("id"),varMap.value(QLatin1String("id")).toString());
- if(varMap.value(QLatin1String("caption")).canConvert(QVariant::String))
+ if (varMap.value(QLatin1String("caption")).canConvert(QVariant::String))
tmp.insert(QLatin1String("caption"),varMap.value(QLatin1String("caption")).toString());
- if(varMap.value(QLatin1String("type")).canConvert(QVariant::String))
+ if (varMap.value(QLatin1String("type")).canConvert(QVariant::String))
tmp.insert(QLatin1String("type"),varMap.value(QLatin1String("type")).toString());
- if(varMap.value(QLatin1String("subscription")).canConvert(QVariant::Int))
+ if (varMap.value(QLatin1String("subscription")).canConvert(QVariant::Int))
tmp.insert(QLatin1String("subscription"),QString::number(varMap.value(QLatin1String("subscription")).toInt()));
ret.append(tmp);
}
@@ -93,8 +93,8 @@ bool DeviceListPrivate::parse(const QByteArray& data)
QJson::Parser parser;
bool ok;
QVariant variant = parser.parse( data, &ok );
- if( ok ) {
- ok = (parse( variant ));
+ if ( ok ) {
+ ok = (parse( variant ));
}
return ok;
}
View
@@ -23,7 +23,6 @@
#ifndef DEVICELIST_H
#define DEVICELIST_H
-#include <QObject>
#include <QNetworkReply>
#include <QSharedPointer>
@@ -34,17 +33,17 @@ namespace mygpo
class DeviceListPrivate;
-class MYGPO_EXPORT DeviceList : public QObject
+class MYGPO_EXPORT DeviceList : public QObject
{
Q_OBJECT
Q_PROPERTY ( QVariant devices READ devices CONSTANT )
-
+
public:
DeviceList(QNetworkReply* reply, QObject* parent = 0);
virtual ~DeviceList();
QVariant devices() const;
QList< QMap<QString,QString> > devicesList() const;
-
+
private:
Q_DISABLE_COPY(DeviceList)
DeviceListPrivate* const d;
@@ -56,11 +55,11 @@ class MYGPO_EXPORT DeviceList : public QObject
void parseError();
/**Gets emitted when an request error ocurred*/
void requestError ( QNetworkReply::NetworkError error );
-
+
};
typedef QSharedPointer<DeviceList> DeviceListPtr;
}
-#endif //DEVICELIST_H
+#endif //DEVICELIST_H
Oops, something went wrong.

0 comments on commit 64e4ca7

Please sign in to comment.