From d7bcd50ad71cfc8da2ffe34ca44899839506cf7f Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sun, 21 Sep 2008 20:58:48 +0000 Subject: [PATCH] updated to make sure it compiled git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@732 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/BlogDialog.cpp | 77 ++++++++++--------- retroshare-gui/src/gui/BlogDialog.h | 10 +-- .../src/gui/profile/ProfileEdit.cpp | 10 +-- .../src/gui/profile/ProfileView.cpp | 14 ++-- retroshare-gui/src/rsiface/rsQblog.h | 69 +++-------------- 5 files changed, 63 insertions(+), 117 deletions(-) diff --git a/retroshare-gui/src/gui/BlogDialog.cpp b/retroshare-gui/src/gui/BlogDialog.cpp index 5c2286faa..41a66ebac 100644 --- a/retroshare-gui/src/gui/BlogDialog.cpp +++ b/retroshare-gui/src/gui/BlogDialog.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ #include @@ -38,29 +38,29 @@ BlogDialog::BlogDialog(QWidget *parent) setupUi(this); connect(postButton, SIGNAL(clicked()), this, SLOT(postBlog())); - + /* mLayout -> to add widgets to */ mLayout = new QVBoxLayout; //mLayout->setSpacing(0); //mLayout->setMargin(0); - + QWidget *middleWidget = new QWidget(); middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); middleWidget->setLayout(mLayout); - + QScrollArea *scrollArea = new QScrollArea; //scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(middleWidget); scrollArea->setWidgetResizable(true); scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); - + QVBoxLayout *layout2 = new QVBoxLayout; layout2->addWidget(scrollArea); layout2->setSpacing(0); layout2->setMargin(0); - + frame->setLayout(layout2); - + addDummyData(); updateBlogsStatic(); @@ -83,79 +83,79 @@ void BlogDialog::updateBlogsStatic(void) #if 0 rsQblog->getFilterSwitch(); - + std::map UsrStatus; - + if(!rsQblog->getStatus(UsrStatus)) std::cerr << "failed to get usr status" << std::endl; - + clear(); //create a clear screen - + /* retrieve usr names and populate usr list bar */ - - std::list usrList; + + std::list usrList; QString TempVar; // to convert numerics to string note: tbd find way to avoid temporary - + if (!rsPeers) { /* not ready yet! */ return; } - + if(!rsPeers->getFriendList(usrList)) std::cerr << "failed to get friend list"; - - + + usrList.push_back(rsPeers->getOwnId()); // add your id - + /* populate the blog msgs screen */ - + std::map< std::string, std::multimap > blogs; // to store blogs - + if(!rsQblog->getBlogs(blogs)) std::cerr << "failed to get blogs" << std::endl; - + /* print usr name and their blogs to screen */ for(std::list::iterator it = usrList.begin(); it !=usrList.end(); it++) - { + { TempVar = rsPeers->getPeerName(*it).c_str(); // store usr name in temporary 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 std::cerr << "creating usr tree" << std::endl; - + /*print blog time-posted/msgs to screen*/ - - std::multimap::reverse_iterator blogIt = blogs[*it].rbegin(); - + + std::multimap::reverse_iterator blogIt = blogs[*it].rbegin(); + if(blogs[*it].empty()) { std::cerr << "usr blog empty!" << std::endl; - continue; + continue; } - + for( ; blogIt != blogs[*it].rend(); blogIt++) - { + { std::cerr << "now printing blogs" << std::endl; time_t postedTime = blogIt->first; 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->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->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 } - - + + void BlogDialog::addDummyData() { BlogMsgItem *bm1 = new BlogMsgItem(this, 0, "peerId", "msgId", true); @@ -189,6 +189,7 @@ void BlogDialog::openChat(std::string peerId) void BlogDialog::postBlog() { + openMsg(FEEDHOLDER_MSG_BLOG, "", ""); } diff --git a/retroshare-gui/src/gui/BlogDialog.h b/retroshare-gui/src/gui/BlogDialog.h index 59e390c37..61a5b2bae 100644 --- a/retroshare-gui/src/gui/BlogDialog.h +++ b/retroshare-gui/src/gui/BlogDialog.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ @@ -25,7 +25,7 @@ #include "mainpage.h" #include "ui_BlogDialog.h" -#include "gui/feeds/FeedHolder.h" +#include "../gui/feeds/FeedHolder.h" class BlogMsgItem; @@ -42,12 +42,12 @@ public: virtual void openChat(std::string peerId); virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo); - void updateBlogsStatic(); + void updateBlogsStatic(); private slots: - void updateBlogs(); - void postBlog(); + void updateBlogs(); + void postBlog(); private: void addDummyData(); diff --git a/retroshare-gui/src/gui/profile/ProfileEdit.cpp b/retroshare-gui/src/gui/profile/ProfileEdit.cpp index 2eb8b8559..959bd7fb2 100644 --- a/retroshare-gui/src/gui/profile/ProfileEdit.cpp +++ b/retroshare-gui/src/gui/profile/ProfileEdit.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ @@ -44,10 +44,10 @@ ProfileEdit::ProfileEdit(QWidget *parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - + 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.moveDownButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveDown())); connect(ui.moveUpButton, SIGNAL(clicked()), this, SLOT(profileEntryMoveUp())); @@ -99,8 +99,6 @@ void ProfileEdit::update() std::list< std::pair > profile; std::list< std::pair >::iterator pit; - rsQblog -> getPeerProfile(pId, profile); - QList itemList; for(pit = profile.begin(); pit != profile.end(); pit++) { diff --git a/retroshare-gui/src/gui/profile/ProfileView.cpp b/retroshare-gui/src/gui/profile/ProfileView.cpp index 9345e9d39..eca6a76fb 100644 --- a/retroshare-gui/src/gui/profile/ProfileView.cpp +++ b/retroshare-gui/src/gui/profile/ProfileView.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * 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. ****************************************************************/ @@ -45,13 +45,13 @@ ProfileView::ProfileView(QWidget *parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - + connect( ui.photoLabel, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( imageCustomPopupMenu( QPoint ) ) ); connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( 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())); /* Hide platform specific features */ @@ -176,7 +176,7 @@ void ProfileView::update() //{ // isOwnId = true; //} - + mIsOwnId = true; /* switche on context menues */ if (!rsQblog) @@ -185,7 +185,7 @@ void ProfileView::update() return; } - uint32_t PostTs; + uint32_t PostTs; std::wstring BlogPost; std::list< std::pair > profile; std::list< std::pair >::iterator pit; @@ -193,8 +193,6 @@ void ProfileView::update() std::list::iterator fit; rsQblog -> getPeerLatestBlog(pId, PostTs, BlogPost); - rsQblog -> getPeerProfile(pId, profile); - rsQblog -> getPeerFavourites(pId, files); ui.idLineEdit->setText(QString::fromStdString(pId)); ui.nameLineEdit->setText(QString::fromStdString("username")); diff --git a/retroshare-gui/src/rsiface/rsQblog.h b/retroshare-gui/src/rsiface/rsQblog.h index fe0aa9af7..5cddc3f39 100644 --- a/retroshare-gui/src/rsiface/rsQblog.h +++ b/retroshare-gui/src/rsiface/rsQblog.h @@ -25,15 +25,15 @@ * Please report all bugs and problems to "retroshare@lunamutt.com". * */ - + #include #include #include #include -#include "rsiface/rstypes.h" - - + #include "../rsiface/rstypes.h" + + /* delcare interafce for everyone o use */ class RsQblog; extern RsQblog *rsQblog; @@ -42,60 +42,23 @@ extern RsQblog *rsQblog; class RsQblog { public: - - + + 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 * @param msg The msg the usr wants to send */ virtual bool sendBlog(const std::wstring &msg) = 0; - + /** * retrieve blog of a usr * @param blogs contains the blog msgs of usr along with time posted for sorting */ virtual bool getBlogs(std::map< std::string, std::multimap > &blogs) = 0; - - /** - * set usr profile, send an empty second pair to delete entry - * @param entry profile entry - */ - virtual bool setProfile(std::pair 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! @@ -107,22 +70,8 @@ extern RsQblog *rsQblog; * @param ts Timestamp of the Blog Post. * @param post the actual Blog Post. */ - 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 > &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 &favs) = 0; - }; #endif /*RSQBLOG_H_*/