updated to make sure it compiled

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@732 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2008-09-21 20:58:48 +00:00
parent d14a1ffb39
commit d7bcd50ad7
5 changed files with 63 additions and 117 deletions

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <QtGui> #include <QtGui>
@ -38,29 +38,29 @@ BlogDialog::BlogDialog(QWidget *parent)
setupUi(this); setupUi(this);
connect(postButton, SIGNAL(clicked()), this, SLOT(postBlog())); connect(postButton, SIGNAL(clicked()), this, SLOT(postBlog()));
/* mLayout -> to add widgets to */ /* mLayout -> to add widgets to */
mLayout = new QVBoxLayout; mLayout = new QVBoxLayout;
//mLayout->setSpacing(0); //mLayout->setSpacing(0);
//mLayout->setMargin(0); //mLayout->setMargin(0);
QWidget *middleWidget = new QWidget(); QWidget *middleWidget = new QWidget();
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget->setLayout(mLayout); middleWidget->setLayout(mLayout);
QScrollArea *scrollArea = new QScrollArea; QScrollArea *scrollArea = new QScrollArea;
//scrollArea->setBackgroundRole(QPalette::Dark); //scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(middleWidget); scrollArea->setWidget(middleWidget);
scrollArea->setWidgetResizable(true); scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
QVBoxLayout *layout2 = new QVBoxLayout; QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(scrollArea); layout2->addWidget(scrollArea);
layout2->setSpacing(0); layout2->setSpacing(0);
layout2->setMargin(0); layout2->setMargin(0);
frame->setLayout(layout2); frame->setLayout(layout2);
addDummyData(); addDummyData();
updateBlogsStatic(); updateBlogsStatic();
@ -83,79 +83,79 @@ void BlogDialog::updateBlogsStatic(void)
#if 0 #if 0
rsQblog->getFilterSwitch(); rsQblog->getFilterSwitch();
std::map<std::string, std::string> UsrStatus; std::map<std::string, std::string> UsrStatus;
if(!rsQblog->getStatus(UsrStatus)) if(!rsQblog->getStatus(UsrStatus))
std::cerr << "failed to get usr status" << std::endl; std::cerr << "failed to get usr status" << std::endl;
clear(); //create a clear screen clear(); //create a clear screen
/* retrieve usr names and populate usr list bar */ /* retrieve usr names and populate usr list bar */
std::list<std::string> usrList; std::list<std::string> usrList;
QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary
if (!rsPeers) if (!rsPeers)
{ {
/* not ready yet! */ /* not ready yet! */
return; return;
} }
if(!rsPeers->getFriendList(usrList)) if(!rsPeers->getFriendList(usrList))
std::cerr << "failed to get friend list"; std::cerr << "failed to get friend list";
usrList.push_back(rsPeers->getOwnId()); // add your id usrList.push_back(rsPeers->getOwnId()); // add your id
/* populate the blog msgs screen */ /* populate the blog msgs screen */
std::map< std::string, std::multimap<long int, std::string> > blogs; // to store blogs std::map< std::string, std::multimap<long int, std::string> > blogs; // to store blogs
if(!rsQblog->getBlogs(blogs)) if(!rsQblog->getBlogs(blogs))
std::cerr << "failed to get blogs" << std::endl; std::cerr << "failed to get blogs" << std::endl;
/* print usr name and their blogs to screen */ /* print usr name and their blogs to screen */
for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++) for(std::list<std::string>::iterator it = usrList.begin(); it !=usrList.end(); it++)
{ {
TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary
blogText->setTextColor(QColor(255, 0, 0, 255)); blogText->setTextColor(QColor(255, 0, 0, 255));
blogText->setCurrentFont(mUsrFont); // make bold for username blogText->setCurrentFont(mUsrFont); // make bold for username
blogText->append("\n" + TempVar); // write usr name to screen blogText->append("\n" + TempVar); // write usr name to screen
std::cerr << "creating usr tree" << std::endl; std::cerr << "creating usr tree" << std::endl;
/*print blog time-posted/msgs to screen*/ /*print blog time-posted/msgs to screen*/
std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin(); std::multimap<long int, std::string>::reverse_iterator blogIt = blogs[*it].rbegin();
if(blogs[*it].empty()) if(blogs[*it].empty())
{ {
std::cerr << "usr blog empty!" << std::endl; std::cerr << "usr blog empty!" << std::endl;
continue; continue;
} }
for( ; blogIt != blogs[*it].rend(); blogIt++) for( ; blogIt != blogs[*it].rend(); blogIt++)
{ {
std::cerr << "now printing blogs" << std::endl; std::cerr << "now printing blogs" << std::endl;
time_t postedTime = blogIt->first; time_t postedTime = blogIt->first;
time(&postedTime); //convert to human readable time time(&postedTime); //convert to human readable time
blogText->setTextColor(QColor(255, 0, 0, 255)); // blogText->setTextColor(QColor(255, 0, 0, 255)); //
blogText->setCurrentFont(mUsrFont); // make bold for posted date blogText->setCurrentFont(mUsrFont); // make bold for posted date
blogText->append("\nPosted: " + QString (ctime(&postedTime))); // print time of blog to screen blogText->append("\nPosted: " + QString (ctime(&postedTime))); // print time of blog to screen
blogText->setCurrentFont(mCurrentFont); // reset the font for blog messages blogText->setCurrentFont(mCurrentFont); // reset the font for blog messages
blogText->setTextColor(QColor(0, 0, 0, 255)); // set back color to black blogText->setTextColor(QColor(0, 0, 0, 255)); // set back color to black
blogText->append(blogIt->second.c_str()); // print blog msg to screen blogText->append(blogIt->second.c_str()); // print blog msg to screen
} }
} }
#endif #endif
} }
void BlogDialog::addDummyData() void BlogDialog::addDummyData()
{ {
BlogMsgItem *bm1 = new BlogMsgItem(this, 0, "peerId", "msgId", true); BlogMsgItem *bm1 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
@ -189,6 +189,7 @@ void BlogDialog::openChat(std::string peerId)
void BlogDialog::postBlog() void BlogDialog::postBlog()
{ {
openMsg(FEEDHOLDER_MSG_BLOG, "", ""); openMsg(FEEDHOLDER_MSG_BLOG, "", "");
} }

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -25,7 +25,7 @@
#include "mainpage.h" #include "mainpage.h"
#include "ui_BlogDialog.h" #include "ui_BlogDialog.h"
#include "gui/feeds/FeedHolder.h" #include "../gui/feeds/FeedHolder.h"
class BlogMsgItem; class BlogMsgItem;
@ -42,12 +42,12 @@ public:
virtual void openChat(std::string peerId); virtual void openChat(std::string peerId);
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo); virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
void updateBlogsStatic(); void updateBlogsStatic();
private slots: private slots:
void updateBlogs(); void updateBlogs();
void postBlog(); void postBlog();
private: private:
void addDummyData(); void addDummyData();

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -44,10 +44,10 @@ ProfileEdit::ProfileEdit(QWidget *parent)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) ); connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) );
// connect up the buttons. // connect up the buttons.
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(profileEntryAdd())); connect(ui.addButton, SIGNAL(clicked()), this, SLOT(profileEntryAdd()));
connect(ui.moveDownButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveDown())); connect(ui.moveDownButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveDown()));
connect(ui.moveUpButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveUp())); connect(ui.moveUpButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveUp()));
@ -99,8 +99,6 @@ void ProfileEdit::update()
std::list< std::pair<std::wstring, std::wstring> > profile; std::list< std::pair<std::wstring, std::wstring> > profile;
std::list< std::pair<std::wstring, std::wstring> >::iterator pit; std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
rsQblog -> getPeerProfile(pId, profile);
QList<QTreeWidgetItem *> itemList; QList<QTreeWidgetItem *> itemList;
for(pit = profile.begin(); pit != profile.end(); pit++) for(pit = profile.begin(); pit != profile.end(); pit++)
{ {

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -45,13 +45,13 @@ ProfileView::ProfileView(QWidget *parent)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
connect( ui.photoLabel, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( imageCustomPopupMenu( QPoint ) ) ); connect( ui.photoLabel, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( imageCustomPopupMenu( QPoint ) ) );
connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) ); connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) );
connect( ui.fileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( fileCustomPopupMenu( QPoint ) ) ); connect( ui.fileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( fileCustomPopupMenu( QPoint ) ) );
// //
// connect up the buttons. // connect up the buttons.
connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView())); connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView()));
/* Hide platform specific features */ /* Hide platform specific features */
@ -176,7 +176,7 @@ void ProfileView::update()
//{ //{
// isOwnId = true; // isOwnId = true;
//} //}
mIsOwnId = true; /* switche on context menues */ mIsOwnId = true; /* switche on context menues */
if (!rsQblog) if (!rsQblog)
@ -185,7 +185,7 @@ void ProfileView::update()
return; return;
} }
uint32_t PostTs; uint32_t PostTs;
std::wstring BlogPost; std::wstring BlogPost;
std::list< std::pair<std::wstring, std::wstring> > profile; std::list< std::pair<std::wstring, std::wstring> > profile;
std::list< std::pair<std::wstring, std::wstring> >::iterator pit; std::list< std::pair<std::wstring, std::wstring> >::iterator pit;
@ -193,8 +193,6 @@ void ProfileView::update()
std::list<FileInfo>::iterator fit; std::list<FileInfo>::iterator fit;
rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost); rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost);
rsQblog -> getPeerProfile(pId, profile);
rsQblog -> getPeerFavourites(pId, files);
ui.idLineEdit->setText(QString::fromStdString(pId)); ui.idLineEdit->setText(QString::fromStdString(pId));
ui.nameLineEdit->setText(QString::fromStdString("username")); ui.nameLineEdit->setText(QString::fromStdString("username"));

View file

@ -25,15 +25,15 @@
* Please report all bugs and problems to "retroshare@lunamutt.com". * Please report all bugs and problems to "retroshare@lunamutt.com".
* *
*/ */
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <list> #include <list>
#include <map> #include <map>
#include "rsiface/rstypes.h" #include "../rsiface/rstypes.h"
/* delcare interafce for everyone o use */ /* delcare interafce for everyone o use */
class RsQblog; class RsQblog;
extern RsQblog *rsQblog; extern RsQblog *rsQblog;
@ -42,60 +42,23 @@ extern RsQblog *rsQblog;
class RsQblog class RsQblog
{ {
public: public:
RsQblog() { return; } RsQblog() { return; }
virtual ~RsQblog() { return; } virtual ~RsQblog() { return; }
/**
* choose whether to filter or not
* @param filterSwitch
*/
virtual bool setFilterSwitch(bool &filterSwitch) = 0;
/**
* retrieve usrs filterSwitch status
*/
virtual bool getFilterSwitch(void) = 0;
/**
* add user id to filter list
* @param usr id to add to filter list
*/
virtual bool addToFilter(std::string &usrId) = 0;
/**
* remove friend from filter list
* @param id The user's frined's id
*/
virtual bool removeFiltFriend(std::string &usrId) = 0;
/** /**
* send blog info, will send to a data structure for transmission * send blog info, will send to a data structure for transmission
* @param msg The msg the usr wants to send * @param msg The msg the usr wants to send
*/ */
virtual bool sendBlog(const std::wstring &msg) = 0; virtual bool sendBlog(const std::wstring &msg) = 0;
/** /**
* retrieve blog of a usr * retrieve blog of a usr
* @param blogs contains the blog msgs of usr along with time posted for sorting * @param blogs contains the blog msgs of usr along with time posted for sorting
*/ */
virtual bool getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs) = 0; virtual bool getBlogs(std::map< std::string, std::multimap<long int, std::wstring> > &blogs) = 0;
/**
* set usr profile, send an empty second pair to delete entry
* @param entry profile entry
*/
virtual bool setProfile(std::pair<std::wstring, std::wstring> entry) = 0;
/**
* add fav file, send file info with only name to delete that entry
* @param entry file info entry
*/
virtual bool setFavorites(FileInfo favFile) = 0;
/** /**
* Stuff DrBob Added for Profile View! * Stuff DrBob Added for Profile View!
@ -107,22 +70,8 @@ extern RsQblog *rsQblog;
* @param ts Timestamp of the Blog Post. * @param ts Timestamp of the Blog Post.
* @param post the actual Blog Post. * @param post the actual Blog Post.
*/ */
virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post) = 0; virtual bool getPeerLatestBlog(std::string id, uint32_t &ts, std::wstring &post) = 0;
/**
* get users Profile.
* @param id the user id
* @param entries set of profile information.
*/
virtual bool getPeerProfile(std::string id, std::list< std::pair<std::wstring, std::wstring> > &entries) = 0;
/**
* get users fav files
* @param id the user whose info you want.
* @param favs list of Files
*/
virtual bool getPeerFavourites(std::string id, std::list<FileInfo> &favs) = 0;
}; };
#endif /*RSQBLOG_H_*/ #endif /*RSQBLOG_H_*/