laid groundwork for newcache posted

re-enabled postedVEG
added convenience base class for gxs services
fixed posted and gxs gui
removed tokenservicev2, now just tokenservice 

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5641 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-10-05 18:12:52 +00:00
parent a57d627074
commit 8f2d85ed52
32 changed files with 1202 additions and 761 deletions

View File

@ -395,7 +395,7 @@ bool RsGenExchange::getMsgData(const uint32_t &token,
}
RsTokenServiceV2* RsGenExchange::getTokenService()
RsTokenService* RsGenExchange::getTokenService()
{
return mDataAccess;
}
@ -511,10 +511,10 @@ void RsGenExchange::processMsgMetaChanges()
if(ok)
{
mDataAccess->updatePublicRequestStatus(token, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE);
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
}else
{
mDataAccess->updatePublicRequestStatus(token, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FAILED);
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
}
mMsgNotify.insert(std::make_pair(token, m.msgId));
}
@ -537,10 +537,10 @@ void RsGenExchange::processGrpMetaChanges()
if(ok)
{
mDataAccess->updatePublicRequestStatus(token, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE);
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
}else
{
mDataAccess->updatePublicRequestStatus(token, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FAILED);
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
}
mGrpNotify.insert(std::make_pair(token, g.grpId));
}
@ -605,7 +605,7 @@ void RsGenExchange::publishMsgs()
// add to published to allow acknowledgement
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE);
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
}
// if addition failed then delete nxs message
@ -663,7 +663,7 @@ void RsGenExchange::publishGrps()
// add to published to allow acknowledgement
mGrpNotify.insert(std::make_pair(mit->first, grpId));
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE);
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
}
if(!ok)
@ -676,7 +676,7 @@ void RsGenExchange::publishGrps()
// add to published to allow acknowledgement, grpid is empty as grp creation failed
mGrpNotify.insert(std::make_pair(mit->first, RsGxsGroupId("")));
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FAILED);
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
continue;
}

View File

@ -103,7 +103,7 @@ public:
* @return handle to token service handle for making
* request to this gxs service
*/
RsTokenServiceV2* getTokenService();
RsTokenService* getTokenService();
protected:

View File

@ -39,6 +39,7 @@
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq;
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
typedef std::map<RsGxsGroupId, std::vector<RsGxsMsgMetaData*> > GxsMsgMetaResult;
typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > MsgMetaResult;
class RsGxsService
{

View File

@ -49,12 +49,12 @@
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FAILED = 0;
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_PENDING = 1;
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_PARTIAL = 2;
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FINISHED_INCOMPLETE = 3;
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE = 4;
const uint8_t RsTokenServiceV2::GXS_REQUEST_V2_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED.
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FAILED = 0;
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PENDING = 1;
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_PARTIAL = 2;
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_FINISHED_INCOMPLETE = 3;
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE = 4;
const uint8_t RsTokenService::GXS_REQUEST_V2_STATUS_DONE = 5; // ONCE ALL DATA RETRIEVED.
RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds)
: mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0)
@ -1331,7 +1331,7 @@ uint32_t RsGxsDataAccess::generatePublicToken()
{
RsStackMutex stack(mDataMutex);
mPublicToken[token] = RsTokenServiceV2::GXS_REQUEST_V2_STATUS_PENDING;
mPublicToken[token] = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
}
return token;

View File

@ -33,7 +33,7 @@
typedef std::map< RsGxsGroupId, std::map<RsGxsMessageId, RsGxsMsgMetaData*> > MsgMetaFilter;
class RsGxsDataAccess : public RsTokenServiceV2
class RsGxsDataAccess : public RsTokenService
{
public:
RsGxsDataAccess(RsGeneralDataService* ds);

View File

@ -0,0 +1,61 @@
#include "rsgxsifaceimpl.h"
#include "gxs/rsgxs.h"
RsGxsIfaceImpl::RsGxsIfaceImpl(RsGenExchange *gxs)
: mGxs(gxs)
{
}
void RsGxsIfaceImpl::groupsChanged(std::list<RsGxsGroupId>& grpIds)
{
}
void RsGxsIfaceImpl::msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs)
{
}
RsTokenService* RsGxsIfaceImpl::getTokenService()
{
return mGxs->getTokenService();
}
bool RsGxsIfaceImpl::getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds)
{
}
bool RsGxsIfaceImpl::getMsgList(const uint32_t &token,
GxsMsgIdResult& msgIds)
{
}
/* Generic Summary */
bool RsGxsIfaceImpl::getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo)
{
}
bool RsGxsIfaceImpl::getMsgSummary(const uint32_t &token,
GxsMsgMetaMap &msgInfo)
{
}
bool RsGxsIfaceImpl::acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
}
bool RsGxsIfaceImpl::acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId)
{
}

View File

@ -0,0 +1,71 @@
#ifndef RSGXSIFACEIMPL_H
#define RSGXSIFACEIMPL_H
#include "gxs/rsgenexchange.h"
/*!
* The simple idea of this class is to implement the simple interface functions
* of gen exchange
*/
class RsGxsIfaceImpl
{
public:
RsGxsIfaceImpl(RsGenExchange* gxs);
/*!
* @return true if a change has occured
*/
bool updated();
public:
/** Requests **/
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
void msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs);
RsTokenService* getTokenService();
bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds);
bool getMsgList(const uint32_t &token,
GxsMsgIdResult& msgIds);
/* Generic Summary */
bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo);
bool getMsgSummary(const uint32_t &token,
GxsMsgMetaMap &msgInfo);
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
private:
RsGenExchange* mGxs;
};
#endif // RSGXSIFACEIMPL_H

View File

@ -102,7 +102,7 @@ time_t mAfter;
* A proxy class for requesting generic service data for GXS
* This seperates the request mechanism from the actual retrieval of data
*/
class RsTokenServiceV2
class RsTokenService
{
public:
@ -116,8 +116,8 @@ public:
public:
RsTokenServiceV2() { return; }
virtual ~RsTokenServiceV2() { return; }
RsTokenService() { return; }
virtual ~RsTokenService() { return; }
/* Data Requests */

File diff suppressed because it is too large Load Diff

View File

@ -169,7 +169,6 @@ std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
typedef std::map<RsGxsGroupId, std::vector<RsPhotoComment> > PhotoCommentResult;
typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > MsgMetaResult;
class RsPhotoV2
{
@ -209,7 +208,7 @@ public:
* needed to make requests to the service
* @return handle to token service for this gxs service
*/
virtual RsTokenServiceV2* getTokenService() = 0;
virtual RsTokenService* getTokenService() = 0;
/* Generic Lists */

View File

@ -0,0 +1,155 @@
#ifndef RSPOSTED_H
#define RSPOSTED_H
/*
* libretroshare/src/retroshare: rsposted.h
*
* RetroShare C++ Interface.
*
* Copyright 2008-2012 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <inttypes.h>
#include <string>
#include <list>
#include "gxs/rstokenservice.h"
#include "gxs/rsgxsifaceimpl.h"
/* The Main Interface Class - for information about your Peers */
class RsPostedVEG;
extern RsPostedVEG *rsPostedVEG;
class RsPostedGroup
{
public:
RsGroupMetaData mMeta;
RsPostedGroup() { return; }
};
class RsPostedMsg
{
public:
RsPostedMsg(uint32_t t)
:postedType(t) { return; }
RsMsgMetaData mMeta;
uint32_t postedType;
};
#define RSPOSTED_MSGTYPE_POST 0x0001
#define RSPOSTED_MSGTYPE_VOTE 0x0002
#define RSPOSTED_MSGTYPE_COMMENT 0x0004
#define RSPOSTED_PERIOD_YEAR 1
#define RSPOSTED_PERIOD_MONTH 2
#define RSPOSTED_PERIOD_WEEK 3
#define RSPOSTED_PERIOD_DAY 4
#define RSPOSTED_PERIOD_HOUR 5
#define RSPOSTED_VIEWMODE_LATEST 1
#define RSPOSTED_VIEWMODE_TOP 2
#define RSPOSTED_VIEWMODE_HOT 3
#define RSPOSTED_VIEWMODE_COMMENTS 4
class RsPostedPost: public RsPostedMsg
{
public:
RsPostedPost(): RsPostedMsg(RSPOSTED_MSGTYPE_POST)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_POST;
return;
}
std::string mLink;
std::string mNotes;
};
class RsPostedVote: public RsPostedMsg
{
public:
RsPostedVote(): RsPostedMsg(RSPOSTED_MSGTYPE_VOTE)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_VOTE;
return;
}
};
class RsPostedComment: public RsPostedMsg
{
public:
RsPostedComment(): RsPostedMsg(RSPOSTED_MSGTYPE_COMMENT)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_COMMENT;
return;
}
std::string mComment;
};
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
std::ostream &operator<<(std::ostream &out, const RsPostedVote &vote);
std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment);
class RsPosted : public RsGxsIfaceImpl
{
public:
RsPosted(RsGenExchange* gxs) : RsGxsIfaceImpl(gxs) { return; }
virtual ~RsPosted() { return; }
/* Specific Service Data */
virtual RsTokenService* getToken() = 0;
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;
virtual bool getPost(const uint32_t &token, RsPostedPost &post) = 0;
virtual bool getComment(const uint32_t &token, RsPostedComment &comment) = 0;
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;
virtual bool submitVote(uint32_t &token, RsPostedVote &vote) = 0;
virtual bool submitComment(uint32_t &token, RsPostedComment &comment) = 0;
// Special Ranking Request.
virtual bool requestRanking(uint32_t &token, RsGxsGroupId groupId) = 0;
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post) = 0;
virtual bool extractPostedCache() = 0;
// Control Ranking Calculations.
virtual bool setViewMode(uint32_t mode) = 0;
virtual bool setViewPeriod(uint32_t period) = 0;
virtual bool setViewRange(uint32_t first, uint32_t count) = 0;
// exposed for testing...
virtual float calcPostScore(uint32_t& token, const RsGxsMessageId) = 0;
};
#endif // RSPOSTED_H

View File

@ -140,7 +140,7 @@ void p3PhotoServiceV2::msgsChanged(
}
RsTokenServiceV2* p3PhotoServiceV2::getTokenService() {
RsTokenService* p3PhotoServiceV2::getTokenService() {
return RsGenExchange::getTokenService();
}

View File

@ -56,7 +56,7 @@ public:
void msgsChanged(std::map<RsGxsGroupId,
std::vector<RsGxsMessageId> >& msgs);
RsTokenServiceV2* getTokenService();
RsTokenService* getTokenService();
bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds);

View File

@ -0,0 +1,86 @@
#include "p3posted.h"
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
: RsGenExchange(gds, nes, NULL, RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this)
{
}
void p3Posted::notifyChanges(std::vector<RsGxsNotify *> &changes)
{
}
bool p3Posted::getGroup(const uint32_t &token, RsPostedGroup &group)
{
}
bool p3Posted::getPost(const uint32_t &token, RsPostedPost &post)
{
}
bool p3Posted::getComment(const uint32_t &token, RsPostedComment &comment)
{
}
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
{
}
bool p3Posted::submitPost(uint32_t &token, RsPostedPost &post)
{
}
bool p3Posted::submitVote(uint32_t &token, RsPostedVote &vote)
{
}
bool p3Posted::submitComment(uint32_t &token, RsPostedComment &comment)
{
}
// Special Ranking Request.
bool p3Posted::requestRanking(uint32_t &token, RsGxsGroupId groupId)
{
}
bool p3Posted::getRankedPost(const uint32_t &token, RsPostedPost &post)
{
}
bool p3Posted::extractPostedCache()
{
}
// Control Ranking Calculations.
bool p3Posted::setViewMode(uint32_t mode)
{
}
bool p3Posted::setViewPeriod(uint32_t period)
{
}
bool p3Posted::setViewRange(uint32_t first, uint32_t count)
{
}
// exposed for testing...
float p3Posted::calcPostScore(uint32_t& token, const RsGxsMessageId)
{
}

View File

@ -0,0 +1,52 @@
#ifndef P3POSTED_H
#define P3POSTED_H
#include "retroshare/rsposted.h"
#include "gxs/rsgenexchange.h"
class p3Posted : public RsGenExchange, public RsPosted
{
public:
p3Posted(RsGeneralDataService* gds, RsNetworkExchangeService* nes);
protected:
/*!
* This confirms this class as an abstract one that \n
* should not be instantiated \n
* The deriving class should implement this function \n
* as it is called by the backend GXS system to \n
* update client of changes which should \n
* instigate client to retrieve new content from the system
* @param changes the changes that have occured to data held by this service
*/
void notifyChanges(std::vector<RsGxsNotify*>& changes) ;
public:
bool getGroup(const uint32_t &token, RsPostedGroup &group);
bool getPost(const uint32_t &token, RsPostedPost &post) ;
bool getComment(const uint32_t &token, RsPostedComment &comment) ;
bool submitGroup(uint32_t &token, RsPostedGroup &group);
bool submitPost(uint32_t &token, RsPostedPost &post);
bool submitVote(uint32_t &token, RsPostedVote &vote);
bool submitComment(uint32_t &token, RsPostedComment &comment) ;
// Special Ranking Request.
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
bool getRankedPost(const uint32_t &token, RsPostedPost &post) ;
bool extractPostedCache() ;
// Control Ranking Calculations.
bool setViewMode(uint32_t mode);
bool setViewPeriod(uint32_t period);
bool setViewRange(uint32_t first, uint32_t count);
// exposed for testing...
float calcPostScore(uint32_t& token, const RsGxsMessageId);
};
#endif // P3POSTED_H

View File

@ -6,9 +6,9 @@ CONFIG += photoshare
#CONFIG += thewire
#CONFIG += identities
#CONFIG += forumsv2
#CONFIG += posted
CONFIG += posted
CONFIG += unfinished
#CONFIG += gxsgui
CONFIG += gxsgui
#CONFIG += pluginmgr
@ -940,14 +940,14 @@ thewire {
identities {
HEADERS += util/TokenQueueVEG.h \
HEADERS += \
gui/Identity/IdDialog.h \
gui/Identity/IdEditDialog.h \
FORMS += gui/Identity/IdDialog.ui \
gui/Identity/IdEditDialog.ui \
SOURCES += util/TokenQueueVEG.cpp \
SOURCES += \
gui/Identity/IdDialog.cpp \
gui/Identity/IdEditDialog.cpp \
@ -983,6 +983,7 @@ posted {
gui/Posted/PostedListDialog.h \
gui/Posted/PostedItem.h \
gui/Posted/PostedComments.h \
util/TokenQueueVEG.h
FORMS += gui/Posted/PostedDialog.ui \
gui/Posted/PostedListDialog.ui \
@ -993,27 +994,31 @@ posted {
gui/Posted/PostedListDialog.cpp \
gui/Posted/PostedItem.cpp \
gui/Posted/PostedComments.cpp \
util/TokenQueueVEG.cpp
}
gxsgui {
HEADERS += gui/gxs/GxsGroupDialog.h \
gui/gxs/ForumV2GroupDialog.h \
gui/gxs/WikiGroupDialog.h \
gui/gxs/PostedGroupDialog.h \
gui/gxs/GxsCommentTreeWidget.h \
gui/gxs/GxsCommentTreeWidget.h
# gui/gxs/ForumV2GroupDialog.h \
# gui/gxs/WikiGroupDialog.h \
# gui/gxs/GxsMsgDialog.h \
FORMS += gui/gxs/GxsGroupDialog.ui \
# gui/gxs/GxsMsgDialog.ui \
# gui/gxs/GxsCommentTreeWidget.ui \
SOURCES += gui/gxs/GxsGroupDialog.cpp \
gui/gxs/ForumV2GroupDialog.cpp \
gui/gxs/WikiGroupDialog.cpp \
SOURCES += gui/gxs/GxsGroupDialog.cpp \
gui/gxs/PostedGroupDialog.cpp \
gui/gxs/GxsCommentTreeWidget.cpp \
gui/gxs/GxsCommentTreeWidget.cpp
#gui/gxs/ForumV2GroupDialog.cpp \
# gui/gxs/WikiGroupDialog.cpp \
#
# gui/gxs/GxsMsgDialog.cpp \

View File

@ -24,7 +24,7 @@
#include "PostedComments.h"
//#include <retroshare/rspeers.h>
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <iostream>
#include <sstream>
@ -83,7 +83,7 @@ PostedComments::PostedComments(QWidget *parent)
/* setup TokenQueue */
//mPhotoQueue = new TokenQueue(rsPhoto, this);
ui.treeWidget->setup(rsPosted);
ui.treeWidget->setup(rsPostedVEG);
}
@ -573,7 +573,7 @@ void PhotoDialog::loadPhotoData(const uint32_t &token)
/********************************/
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequestVEG &req)
{
std::cerr << "PhotoDialog::loadRequest()";
std::cerr << std::endl;

View File

@ -27,16 +27,16 @@
//#include "gui/mainpage.h"
#include "ui_PostedComments.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <map>
//#include "gui/Posted/PostedItem.h"
//#include "gui/PhotoShare/PhotoAddDialog.h"
//#include "gui/PhotoShare/PhotoSlideShow.h"
#include "util/TokenQueue.h"
#include "util/TokenQueueVEG.h"
class PostedComments: public QWidget, public TokenResponse
class PostedComments: public QWidget, public TokenResponseVEG
{
Q_OBJECT
@ -47,7 +47,7 @@ public slots:
void loadComments( std::string );
private:
void loadRequest(const TokenQueue *queue, const TokenRequest &req) { return; }
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req) { return; }
#if 0
virtual void deletePhotoItem(PhotoItem *, uint32_t type);
@ -112,7 +112,7 @@ private:
#endif
TokenQueue *mPhotoQueue;
TokenQueueVEG *mPhotoQueue;
/* UI - from Designer */
Ui::PostedComments ui;

View File

@ -26,7 +26,7 @@
#include "PostedListDialog.h"
#include "PostedComments.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <iostream>
#include <sstream>

View File

@ -27,7 +27,7 @@
#include "retroshare-gui/mainpage.h"
#include "ui_PostedDialog.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <map>

View File

@ -30,7 +30,7 @@
#include "PostedItem.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <algorithm>
#include <iostream>
@ -53,7 +53,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
//scoreLabel->setText(QString("1140"));
// exposed for testing...
float score = rsPosted->calcPostScore(post.mMeta);
float score = rsPostedVEG->calcPostScore(post.mMeta);
time_t now = time(NULL);
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
@ -62,7 +62,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
uint32_t votes = 0;
uint32_t comments = 0;
rsPosted->extractPostedCache(post.mMeta.mServiceString, votes, comments);
rsPostedVEG->extractPostedCache(post.mMeta.mServiceString, votes, comments);
scoreLabel->setText(QString::number(votes));
QString commentLabel = QString("Comments: ") + QString::number(comments);
commentLabel += QString(" Votes: ") + QString::number(votes);

View File

@ -26,7 +26,7 @@
#include "ui_PostedItem.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
class RsPostedPost;
class PostedItem;

View File

@ -26,7 +26,7 @@
#include "gui/gxs/PostedGroupDialog.h"
//#include <retroshare/rspeers.h>
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <iostream>
#include <sstream>
@ -69,7 +69,7 @@ PostedListDialog::PostedListDialog(QWidget *parent)
ui.setupUi(this);
/* Setup Queue */
mPostedQueue = new TokenQueue(rsPosted, this);
mPostedQueue = new TokenQueueVEG(rsPostedVEG, this);
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
@ -157,12 +157,12 @@ void PostedListDialog::updateDisplay()
{
std::list<std::string> groupIds;
std::list<std::string>::iterator it;
if (!rsPosted)
if (!rsPostedVEG)
return;
// TODO groupsChanged... HACK XXX.
#if 0
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
if ((rsPostedVEG->groupsChanged(groupIds)) || (rsPostedVEG->updated()))
{
/* update Forums List */
insertGroups();
@ -176,7 +176,7 @@ void PostedListDialog::updateDisplay()
}
#endif
if (rsPosted->updated())
if (rsPostedVEG->updated())
{
/* update Forums List */
insertGroups();
@ -235,47 +235,47 @@ void PostedListDialog::sortButtonClicked( QAbstractButton *button )
std::cerr << "PostedListDialog::sortButtonClicked( From Button Group! )";
std::cerr << std::endl;
uint32_t sortMode = RSPOSTED_VIEWMODE_HOT;
uint32_t sortMode = RSPOSTED_VIEWMODE_HOT;
if (button == ui.hotSortButton) {
sortMode = RSPOSTED_VIEWMODE_HOT;
sortMode = RSPOSTED_VIEWMODE_HOT;
} else if (button == ui.newSortButton) {
sortMode = RSPOSTED_VIEWMODE_LATEST;
sortMode = RSPOSTED_VIEWMODE_LATEST;
} else if (button == ui.topSortButton) {
sortMode = RSPOSTED_VIEWMODE_TOP;
sortMode = RSPOSTED_VIEWMODE_TOP;
}
rsPosted->setViewMode(sortMode);
rsPostedVEG->setViewMode(sortMode);
}
void PostedListDialog::periodChanged( int index )
{
uint32_t periodMode = RSPOSTED_PERIOD_HOUR;
uint32_t periodMode = RSPOSTED_PERIOD_HOUR;
switch (index)
{
case 0:
periodMode = RSPOSTED_PERIOD_HOUR;
periodMode = RSPOSTED_PERIOD_HOUR;
break;
case 1:
periodMode = RSPOSTED_PERIOD_DAY;
periodMode = RSPOSTED_PERIOD_DAY;
break;
default:
case 2:
periodMode = RSPOSTED_PERIOD_WEEK;
periodMode = RSPOSTED_PERIOD_WEEK;
break;
case 3:
periodMode = RSPOSTED_PERIOD_MONTH;
periodMode = RSPOSTED_PERIOD_MONTH;
break;
case 4:
periodMode = RSPOSTED_PERIOD_YEAR;
periodMode = RSPOSTED_PERIOD_YEAR;
break;
}
rsPosted->setViewPeriod(periodMode);
rsPostedVEG->setViewPeriod(periodMode);
}
@ -342,7 +342,7 @@ void PostedListDialog::requestGroupSummary()
std::cerr << std::endl;
std::list<std::string> ids;
RsTokReqOptions opts;
RsTokReqOptionsVEG opts;
uint32_t token;
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, POSTEDDIALOG_LISTING);
}
@ -353,7 +353,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsPosted->getGroupSummary(token, groupInfo);
rsPostedVEG->getGroupSummary(token, groupInfo);
if (groupInfo.size() > 0)
{
@ -373,7 +373,7 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
{
RsTokReqOptions opts;
RsTokReqOptionsVEG opts;
std::list<std::string> grpIds;
grpIds.push_back(forumId);
@ -391,7 +391,7 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsPosted->getGroupSummary(token, groupInfo);
rsPostedVEG->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
@ -452,7 +452,7 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
{
RsTokReqOptions opts;
RsTokReqOptionsVEG opts;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
@ -466,7 +466,7 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
//mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
// Do specific Posted Request....
if (rsPosted->requestRanking(token, groupId))
if (rsPostedVEG->requestRanking(token, groupId))
{
// get the Queue to handle response.
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
@ -482,11 +482,11 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
bool moreData = true;
while(moreData)
{
RsPostedPost post;
RsPostedPost post;
// Old Format.
//if (rsPosted->getPost(token, post))
//if (rsPostedVEG->getPost(token, post))
if (rsPosted->getRankedPost(token, post))
if (rsPostedVEG->getRankedPost(token, post))
{
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
std::cerr << std::endl;
@ -559,7 +559,7 @@ void PostedListDialog::clearPosts()
/*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/
void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
void PostedListDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
{
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;

View File

@ -27,18 +27,18 @@
#include "retroshare-gui/mainpage.h"
#include "ui_PostedListDialog.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <map>
#include "gui/Posted/PostedItem.h"
#include "gui/common/GroupTreeWidget.h"
#include "util/TokenQueue.h"
#include "util/TokenQueueVEG.h"
#include "retroshare-gui/RsAutoUpdatePage.h"
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponseVEG
{
Q_OBJECT
@ -90,7 +90,7 @@ void loadGroupThreadData_InsertThreads(const uint32_t &token);
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
QTreeWidgetItem *yourTopics;
@ -103,7 +103,7 @@ void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &
bool mThreadLoading;
std::string mCurrTopicId;
TokenQueue *mPostedQueue;
TokenQueueVEG *mPostedQueue;
/* UI - from Designer */
Ui::PostedListDialog ui;

View File

@ -36,7 +36,7 @@
#define GXSCOMMENTS_LOADTHREAD 1
// Temporarily make this specific.
#include "retroshare/rsposted.h"
#include "retroshare/rspostedVEG.h"
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
@ -46,10 +46,10 @@ GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
return;
}
void GxsCommentTreeWidget::setup(RsTokenService *service)
void GxsCommentTreeWidget::setup(RsTokenServiceVEG *service)
{
mRsService = service;
mTokenQueue = new TokenQueue(service, this);
mTokenQueue = new TokenQueueVEG(service, this);
return;
}
@ -72,7 +72,7 @@ void GxsCommentTreeWidget::service_requestComments(std::string threadId)
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId << ")";
std::cerr << std::endl;
RsTokReqOptions opts;
RsTokReqOptionsVEG opts;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
opts.mFlagsFilter = RSPOSTED_MSGTYPE_COMMENT;
@ -212,7 +212,7 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
std::cerr << std::endl;
RsPostedComment comment;
while(rsPosted->getComment(token, comment))
while(rsPostedVEG->getComment(token, comment))
{
/* convert to a QTreeWidgetItem */
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment;
@ -286,7 +286,7 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(std::string par
}
void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
void GxsCommentTreeWidget::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
{
std::cerr << "GxsCommentTreeWidget::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;

View File

@ -24,7 +24,7 @@
#include <QTreeWidget>
#include "util/TokenQueue.h"
#include "util/TokenQueueVEG.h"
/* indicies for search results item columns SR_ = Search Result */
#define SR_NAME_COL 0
@ -39,17 +39,17 @@
#define SR_ROLE_LOCAL Qt::UserRole
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponseVEG
{
Q_OBJECT
public:
GxsCommentTreeWidget(QWidget *parent = 0);
void setup(RsTokenService *service);
void setup(RsTokenServiceVEG *service);
void requestComments(std::string threadId);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
protected:
@ -73,8 +73,8 @@ protected:
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
TokenQueue *mTokenQueue;
RsTokenService *mRsService;
TokenQueueVEG *mTokenQueue;
RsTokenServiceVEG *mRsService;
protected:
//virtual QMimeData * mimeData ( const QList<QTreeWidgetItem *> items ) const;

View File

@ -35,13 +35,13 @@
#define GXSGROUP_LOADGROUP 2
/** Constructor */
GxsGroupDialog::GxsGroupDialog(RsTokenService *service, QWidget *parent)
GxsGroupDialog::GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent)
: QDialog(parent), mRsService(service)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
mTokenQueue = new TokenQueue(service, this);
mTokenQueue = new TokenQueueVEG(service, this);
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelDialog( ) ) );
@ -289,7 +289,7 @@ void GxsGroupDialog::existingGroup(std::string groupId, uint32_t mode)
/* request data */
{
RsTokReqOptions opts;
RsTokReqOptionsVEG opts;
std::list<std::string> grpIds;
grpIds.push_back(groupId);
@ -605,7 +605,7 @@ void GxsGroupDialog::service_loadExistingGroup(const uint32_t &token)
}
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
void GxsGroupDialog::loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req)
{
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;

View File

@ -25,7 +25,7 @@
#include "ui_GxsGroupDialog.h"
#include "util/TokenQueue.h"
#include "util/TokenQueueVEG.h"
/********
@ -90,12 +90,12 @@ public:
#define GXS_GROUP_DIALOG_SHOW_MODE 2
#define GXS_GROUP_DIALOG_EDIT_MODE 3
class GxsGroupDialog : public QDialog, public TokenResponse
class GxsGroupDialog : public QDialog, public TokenResponseVEG
{
Q_OBJECT
public:
GxsGroupDialog(RsTokenService *service, QWidget *parent = 0);
GxsGroupDialog(RsTokenServiceVEG *service, QWidget *parent = 0);
void setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultFlags);
void setMode(uint32_t mode);
@ -105,7 +105,7 @@ public:
void existingGroup(std::string groupId, uint32_t mode);
// Callback for all Loads.
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
virtual void loadRequest(const TokenQueueVEG *queue, const TokenRequestVEG &req);
// Functions that can be overloaded for specific stuff.
@ -159,8 +159,8 @@ private:
QPixmap picture;
RsTokenService *mRsService;
TokenQueue *mTokenQueue;
RsTokenServiceVEG *mRsService;
TokenQueueVEG *mTokenQueue;
uint32_t mMode;

View File

@ -21,11 +21,11 @@
#include "PostedGroupDialog.h"
#include <retroshare/rsposted.h>
#include <retroshare/rspostedVEG.h>
#include <iostream>
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
:GxsGroupDialog(rsPosted, parent)
:GxsGroupDialog(rsPostedVEG, parent)
{
// To start with we only have open forums - with distribution controls.
@ -66,11 +66,11 @@ PostedGroupDialog::PostedGroupDialog(QWidget *parent)
bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
// Specific Function.
RsPostedGroup grp;
RsPostedGroup grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
rsPosted->submitGroup(token, grp, true);
rsPostedVEG->submitGroup(token, grp, true);
return true;
}
@ -80,7 +80,7 @@ void PostedGroupDialog::service_loadExistingGroup(const uint32_t &token)
std::cerr << std::endl;
RsPostedGroup group;
if (!rsPosted->getGroup(token, group))
if (!rsPostedVEG->getGroup(token, group))
{
std::cerr << "PostedGroupDialog::service_loadExistingGroup() ERROR Getting Group";
std::cerr << std::endl;

View File

@ -33,6 +33,7 @@
#include <retroshare/rsiface.h>
#include "gui/PhotoShare/PhotoShare.h"
#include "gui/Posted/PostedDialog.h"
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
#if USE_VEG_SERVICE
@ -40,7 +41,7 @@
#include "gui/TheWire/WireDialog.h"
#include "gui/Identity/IdDialog.h"
#include "gui/ForumsV2Dialog.h"
#include "gui/Posted/PostedDialog.h"
#endif
//#include "GamesDialog.h"
@ -108,6 +109,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(photoShare = new PhotoShare(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo Share"), grp));
PostedDialog *postedDialog = NULL;
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LIBRARY), tr("Posted Links"), grp));
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
#if USE_VEG_SERVICE
WikiDialog *wikiDialog = NULL;
@ -122,9 +126,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(forumsV2Dialog = new ForumsV2Dialog(ui.stackPages),
createPageAction(QIcon(IMAGE_FORUMSV2), tr("ForumsV2"), grp));
PostedDialog *postedDialog = NULL;
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LIBRARY), tr("Posted Links"), grp));
#endif

View File

@ -32,7 +32,7 @@
*****/
/** Constructor */
TokenQueueV2::TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp)
TokenQueueV2::TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp)
:QWidget(NULL), mService(service), mResponder(resp)
{
return;
@ -152,8 +152,8 @@ bool TokenQueueV2::checkForRequest(uint32_t token)
{
/* check token */
uint32_t status = mService->requestStatus(token);
return ( (RsTokenServiceV2::GXS_REQUEST_V2_STATUS_FAILED == status) ||
(RsTokenServiceV2::GXS_REQUEST_V2_STATUS_COMPLETE == status) );
return ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) ||
(RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) );
}

View File

@ -72,7 +72,7 @@ class TokenQueueV2: public QWidget
Q_OBJECT
public:
TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp);
TokenQueueV2(RsTokenService *service, TokenResponseV2 *resp);
/* generic handling of token / response update behaviour */
@ -111,7 +111,7 @@ private:
/* Info for Data Requests */
std::list<TokenRequestV2> mRequests;
RsTokenServiceV2 *mService;
RsTokenService *mService;
TokenResponseV2 *mResponder;
QTimer *mTrigger;