From 5a2716535388d5613e34f72e4e117a7d111ce6bc Mon Sep 17 00:00:00 2001 From: drbob Date: Tue, 15 Apr 2008 16:40:38 +0000 Subject: [PATCH] Significant improvements to Forums: * displays forums * displays thread list/msg * Threaded/Flat View. * Add new Forum / Add new Message. * new classes in src/gui/forums Updated rank and forums interfaces. Improvements to Link Cloud GUI. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@506 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/RetroShare.pro | 6 + retroshare-gui/src/gui/ForumsDialog.cpp | 518 ++++++-------- retroshare-gui/src/gui/ForumsDialog.h | 9 + retroshare-gui/src/gui/ForumsDialog.ui | 132 +--- retroshare-gui/src/gui/LinksDialog.cpp | 202 +++--- retroshare-gui/src/gui/LinksDialog.h | 1 + retroshare-gui/src/gui/LinksDialog.ui | 88 ++- retroshare-gui/src/gui/forums/CreateForum.cpp | 90 +++ retroshare-gui/src/gui/forums/CreateForum.h | 52 ++ retroshare-gui/src/gui/forums/CreateForum.ui | 658 ++++++++++++++++++ .../src/gui/forums/CreateForumMsg.cpp | 76 ++ .../src/gui/forums/CreateForumMsg.h | 56 ++ .../src/gui/forums/CreateForumMsg.ui | 643 +++++++++++++++++ retroshare-gui/src/rsiface/rsforums.h | 17 +- retroshare-gui/src/rsiface/rsrank.h | 7 +- 15 files changed, 2051 insertions(+), 504 deletions(-) create mode 100644 retroshare-gui/src/gui/forums/CreateForum.cpp create mode 100644 retroshare-gui/src/gui/forums/CreateForum.h create mode 100644 retroshare-gui/src/gui/forums/CreateForum.ui create mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.cpp create mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.h create mode 100644 retroshare-gui/src/gui/forums/CreateForumMsg.ui diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 57237cd12..d8bab2aa3 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -65,6 +65,8 @@ HEADERS += rshare.h \ gui/PhotoShow.h \ gui/LinksDialog.h \ gui/ForumsDialog.h \ + gui/forums/CreateForum.h \ + gui/forums/CreateForumMsg.h \ gui/NetworkView.h \ gui/MessengerWindow.h \ gui/PeersDialog.h \ @@ -160,6 +162,8 @@ FORMS += gui/ChatDialog.ui \ gui/PhotoShow.ui \ gui/LinksDialog.ui \ gui/ForumsDialog.ui \ + gui/forums/CreateForum.ui \ + gui/forums/CreateForumMsg.ui \ gui/NetworkView.ui \ gui/MessengerWindow.ui \ gui/PeersDialog.ui \ @@ -225,6 +229,8 @@ SOURCES += main.cpp \ gui/PhotoShow.cpp \ gui/LinksDialog.cpp \ gui/ForumsDialog.cpp \ + gui/forums/CreateForum.cpp \ + gui/forums/CreateForumMsg.cpp \ gui/NetworkView.cpp \ gui/MessengerWindow.cpp \ gui/PeersDialog.cpp \ diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index c734784db..aa3a7038a 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -21,6 +21,8 @@ #include "ForumsDialog.h" +#include "gui/forums/CreateForum.h" +#include "gui/forums/CreateForumMsg.h" #include "rsiface/rsiface.h" #include "rsiface/rspeers.h" @@ -38,7 +40,7 @@ #include #include #include - +#include /* Images for context menu icons */ #define IMAGE_MESSAGE ":/images/folder-draft.png" @@ -60,6 +62,23 @@ ForumsDialog::ForumsDialog(QWidget *parent) connect(ui.newForumButton, SIGNAL(clicked()), this, SLOT(newforum())); + + connect( ui.forumTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem *) ), this, + SLOT( changedForum( QTreeWidgetItem *, QTreeWidgetItem * ) ) ); + + //connect( ui.threadTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem *) ), this, + // SLOT( changedThread( QTreeWidgetItem *, QTreeWidgetItem * ) ) ); + + connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread2() ) ); + connect( ui.viewBox, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( changedThread2() ) ); + + connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview())); + + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + timer->start(1000); + + #if 0 connect( ui.msgWidget, SIGNAL( itemClicked ( QTreeWidgetItem *, int) ), this, SLOT( updateMessages ( QTreeWidgetItem *, int) ) ); connect( ui.listWidget, SIGNAL( currentRowChanged ( int) ), this, SLOT( changeBox ( int) ) ); @@ -70,7 +89,6 @@ ForumsDialog::ForumsDialog(QWidget *parent) //connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print())); //connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview())); - connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); @@ -155,10 +173,10 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point ) QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); QAction *replyAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Reply" ), this ); - connect( replyAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) ); + connect( replyAct , SIGNAL( triggered() ), this, SLOT( createmessage() ) ); - QAction *viewAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "View Post" ), this ); - connect( viewAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) ); + QAction *viewAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "View Whole Thread" ), this ); + connect( viewAct , SIGNAL( triggered() ), this, SLOT( showthread() ) ); contextMnu.clear(); contextMnu.addAction( replyAct); @@ -192,7 +210,6 @@ void ForumsDialog::replytomessage() void ForumsDialog::togglefileview() { -#if 0 /* if msg header visible -> hide by changing splitter * three widgets... */ @@ -202,7 +219,6 @@ void ForumsDialog::togglefileview() int listSize = 0; int msgSize = 0; - int recommendSize = 0; int i = 0; for(it = sizeList.begin(); it != sizeList.end(); it++, i++) @@ -215,16 +231,12 @@ void ForumsDialog::togglefileview() { msgSize = (*it); } - else if (i == 2) - { - recommendSize = (*it); - } } - int totalSize = listSize + msgSize + recommendSize; + int totalSize = listSize + msgSize; bool toShrink = true; - if (recommendSize < (int) totalSize / 10) + if (msgSize < (int) totalSize / 10) { toShrink = false; } @@ -232,22 +244,40 @@ void ForumsDialog::togglefileview() QList newSizeList; if (toShrink) { - newSizeList.push_back(listSize + recommendSize / 3); - newSizeList.push_back(msgSize + recommendSize * 2 / 3); + newSizeList.push_back(totalSize); newSizeList.push_back(0); } else { /* no change */ - int nlistSize = (totalSize * 2 / 3) * listSize / (listSize + msgSize); - int nMsgSize = (totalSize * 2 / 3) - listSize; + int nlistSize = (totalSize / 2); + int nMsgSize = (totalSize / 2); newSizeList.push_back(nlistSize); newSizeList.push_back(nMsgSize); - newSizeList.push_back(totalSize * 1 / 3); } ui.msgSplitter->setSizes(newSizeList); -#endif +} + +void ForumsDialog::checkUpdate() +{ + std::list forumIds; + std::list::iterator it; + if (!rsForums) + return; + + if (rsForums->forumsChanged(forumIds)) + { + /* update Forums List */ + insertForums(); + + it = std::find(forumIds.begin(), forumIds.end(), mCurrForumId); + if (it != forumIds.end()) + { + /* update threads as well */ + insertThreads(); + } + } } @@ -273,6 +303,9 @@ void ForumsDialog::insertForums() rsForums->getForumList(forumList); + mCurrForumId = ""; + mCurrPostId = ""; + QList AdminList; QList SubList; QList PopList; @@ -456,157 +489,179 @@ void ForumsDialog::insertForums() return; } +void ForumsDialog::changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev ) +{ + insertThreads(); +} + +void ForumsDialog::changedThread( QTreeWidgetItem *curr, QTreeWidgetItem *prev ) +{ + /* just grab the ids of the current item */ + if ((!curr) || (!curr->isSelected())) + { + mCurrPostId = ""; + } + else + { + mCurrPostId = (curr->text(5)).toStdString(); + insertPost(); + } +} + +void ForumsDialog::changedThread2() +{ + QTreeWidgetItem *curr = ui.threadTreeWidget->currentItem(); + + /* just grab the ids of the current item */ + if ((!curr) || (!curr->isSelected())) + { + mCurrPostId = ""; + } + else + { + mCurrPostId = (curr->text(5)).toStdString(); + insertPost(); + } +} + + void ForumsDialog::insertThreads() { -#if 0 + /* get the current Forum */ + std::cerr << "ForumsDialog::insertThreads()" << std::endl; -virtual bool getForumList(std::list &forumList) = 0; -virtual bool getForumThreadList(std::string fId, std::list &msgs) = 0; -virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list &msgs) = 0; -virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0; - std::list msgList; - std::list::const_iterator it; - - rsMsgs -> getMessageSummaries(msgList); - - /* get a link to the table */ - QTreeWidget *msgWidget = ui.msgWidget; - - /* get the MsgId of the current one ... */ - - std::string cid; - std::string mid; - - bool oldSelected = getCurrentMsg(cid, mid); - QTreeWidgetItem *newSelected = NULL; - - /* remove old items ??? */ - - int listrow = ui.listWidget -> currentRow(); - - //std::cerr << "ForumsDialog::insertMessages()" << std::endl; - //std::cerr << "Current Row: " << listrow << std::endl; - - /* check the mode we are in */ - unsigned int msgbox = 0; - switch(listrow) + QTreeWidgetItem *forumItem = ui.forumTreeWidget->currentItem(); + if ((!forumItem) || (forumItem->parent() == NULL)) { - case 3: - msgbox = RS_MSG_SENTBOX; - break; - case 2: - msgbox = RS_MSG_DRAFTBOX; - break; - case 1: - msgbox = RS_MSG_OUTBOX; - break; - case 0: - default: - msgbox = RS_MSG_INBOX; - break; + /* not an actual forum - clear */ + ui.threadTreeWidget->clear(); + std::cerr << "ForumsDialog::insertThreads() Current Thread Invalid" << std::endl; + + return; } - QList items; - for(it = msgList.begin(); it != msgList.end(); it++) - { - /* check the message flags, to decide which - * group it should go in... - * - * InBox - * OutBox - * Drafts - * Sent - * - * FLAGS = OUTGOING. - * -> Outbox/Drafts/Sent - * + SENT -> Sent - * + IN_PROGRESS -> Draft. - * + nuffing -> Outbox. - * FLAGS = INCOMING = (!OUTGOING) - * -> + NEW -> Bold. - * - */ + /* store forumId */ + mCurrForumId = (forumItem->text(4)).toStdString(); + ui.forumName->setText(forumItem->text(0)); + mCurrPostId = ""; + std::string fId = mCurrForumId; - if ((it -> msgflags & RS_MSG_BOXMASK) != msgbox) + bool flatView = false; + if (ui.viewBox->currentIndex() == 1) + { + flatView = true; + } + + std::list threads; + std::list::iterator tit; + rsForums->getForumThreadList(mCurrForumId, threads); + + QList items; + for(tit = threads.begin(); tit != threads.end(); tit++) + { + std::cerr << "ForumsDialog::insertThreads() Adding TopLevel Thread: mId: "; + std::cerr << tit->msgId << std::endl; + + /* add the top threads */ + ForumMsgInfo msg; + if (!rsForums->getForumMessage(fId, tit->threadId, msg)) { - //std::cerr << "Msg from other box: " << it->msgflags; - //std::cerr << std::endl; + std::cerr << "ForumsDialog::insertThreads() Failed to Get TopLevel Msg"; + std::cerr << std::endl; continue; } - /* make a widget per friend */ - QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - /* So Text should be: - * (1) Msg / Broadcast - * (1b) Person / Channel Name - * (2) Rank - * (3) Date - * (4) Title - * (5) Msg - * (6) File Count - * (7) File Total + /* add Msg */ + /* setup + * */ - // Date First.... (for sorting) + QTreeWidgetItem *item = new QTreeWidgetItem(); + { QDateTime qtime; - qtime.setTime_t(it->ts); + qtime.setTime_t(tit->ts); QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - item -> setText(3, timestamp); + item -> setText(0, timestamp); } + item->setText(1, QString::fromStdWString(tit->title)); + item->setText(2, "author"); + item->setText(3, "signed"); + item->setText(4, QString::fromStdString(tit->parentId)); + item->setText(5, QString::fromStdString(tit->msgId)); - // From .... + std::list threadlist; + threadlist.push_back(item); + + while (threadlist.size() > 0) { - item -> setText(1, QString::fromStdString(rsPeers->getPeerName(it->srcId))); - } + /* get children */ + QTreeWidgetItem *parent = threadlist.front(); + threadlist.pop_front(); + std::string pId = (parent->text(5)).toStdString(); - // Subject - item -> setText(2, QString::fromStdWString(it->title)); - item -> setIcon(2, (QIcon(":/images/message-mail-read.png"))); + std::list msgs; + std::list::iterator mit; - // No of Files. - { - std::ostringstream out; - out << it -> count; - item -> setText(0, QString::fromStdString(out.str())); - } + std::cerr << "ForumsDialog::insertThreads() Getting Children of : " << pId; + std::cerr << std::endl; - item -> setText(4, QString::fromStdString(it->srcId)); - item -> setText(5, QString::fromStdString(it->msgId)); - if ((oldSelected) && (mid == it->msgId)) - { - newSelected = item; - } - - if (it -> msgflags & RS_MSG_NEW) - { - for(int i = 0; i < 10; i++) + if (rsForums->getForumThreadMsgList(fId, pId, msgs)) { - QFont qf = item->font(i); - qf.setBold(true); - item->setFont(i, qf); - item -> setIcon(2, (QIcon(":/images/message-mail.png"))); + std::cerr << "ForumsDialog::insertThreads() #Children " << msgs.size(); + std::cerr << std::endl; - //std::cerr << "Setting Item BOLD!" << std::endl; + /* iterate through child */ + for(mit = msgs.begin(); mit != msgs.end(); mit++) + { + std::cerr << "ForumsDialog::insertThreads() adding " << mit->msgId; + std::cerr << std::endl; + + QTreeWidgetItem *child = NULL; + if (flatView) + { + child = new QTreeWidgetItem(NULL); + } + else + { + child = new QTreeWidgetItem(parent); + } + + { + QDateTime qtime; + qtime.setTime_t(mit->ts); + QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); + child -> setText(0, timestamp); + } + child->setText(1, QString::fromStdWString(mit->title)); + child->setText(2, "author"); + child->setText(3, "signed"); + child->setText(4, QString::fromStdString(mit->parentId)); + child->setText(5, QString::fromStdString(mit->msgId)); + + /* setup child */ + threadlist.push_back(child); + + if (flatView) + { + items.append(child); + } + } } } - /* add to the list */ + /* add to list */ items.append(item); } - /* add the items in! */ - msgWidget->clear(); - msgWidget->insertTopLevelItems(0, items); + /* add all messages in! */ + ui.threadTreeWidget->clear(); + ui.threadTreeWidget->insertTopLevelItems(0, items); - if (newSelected) - { - msgWidget->setCurrentItem(newSelected); - } -#endif } + void ForumsDialog::updateMessages( QTreeWidgetItem * item, int column ) { #if 0 @@ -618,169 +673,29 @@ void ForumsDialog::updateMessages( QTreeWidgetItem * item, int column ) void ForumsDialog::insertPost() { -#if 0 - /* Locate the current Message */ - QTreeWidget *msglist = ui.msgWidget; - - std::cerr << "ForumsDialog::insertMsgTxtAndFiles()" << std::endl; - - - /* get its Ids */ - std::string cid; - std::string mid; - - QTreeWidgetItem *qtwi = msglist -> currentItem(); - if (!qtwi) + if ((mCurrForumId == "") || (mCurrPostId == "")) { - /* blank it */ - ui.dateText-> setText(""); - ui.toText->setText(""); - ui.fromText->setText(""); - ui.filesText->setText(""); + /* + */ - ui.subjectText->setText(""); - //ui.msgText->setText(""); - ui.msgList->clear(); - - return; - } - else - { - cid = qtwi -> text(4).toStdString(); - mid = qtwi -> text(5).toStdString(); - } - - std::cerr << "ForumsDialog::insertMsgTxtAndFiles() mid:" << mid << std::endl; - - /* Save the Data.... for later */ - - mCurrCertId = cid; - mCurrMsgId = mid; - - MessageInfo msgInfo; - if (!rsMsgs -> getMessage(mid, msgInfo)) - { - std::cerr << "ForumsDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl; + ui.postText->setText(""); return; } - const std::list &recList = msgInfo.files; - std::list::const_iterator it; - - /* get a link to the table */ - QTreeWidget *tree = ui.msgList; - - /* get the MessageInfo */ - - tree->clear(); - tree->setColumnCount(5); - - QList items; - for(it = recList.begin(); it != recList.end(); it++) + /* get the Post */ + ForumMsgInfo msg; + if (!rsForums->getForumMessage(mCurrForumId, mCurrPostId, msg)) { - /* make a widget per person */ - QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - /* (0) Filename */ - item -> setText(0, QString::fromStdString(it->fname)); - //std::cerr << "Msg FileItem(" << it->fname.length() << ") :" << it->fname << std::endl; - - /* (1) Size */ - { - std::ostringstream out; - out << it->size; - item -> setText(1, QString::fromStdString(out.str())); - } - /* (2) Rank */ - { - std::ostringstream out; - out << it->rank; - item -> setText(2, QString::fromStdString(out.str())); - } - - item -> setText(3, QString::fromStdString(it->hash)); - - /* add to the list */ - items.append(item); + ui.postText->setText(""); + return; } - /* add the items in! */ - tree->insertTopLevelItems(0, items); - - /* iterate through the sources */ - std::list::const_iterator pit; - - QString msgTxt; - for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++) - { - msgTxt += QString::fromStdString(*pit); - msgTxt += " <"; - msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit)); - msgTxt += ">, "; - } - - if (msgInfo.msgcc.size() > 0) - msgTxt += "\nCc: "; - for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++) - { - msgTxt += QString::fromStdString(*pit); - msgTxt += " <"; - msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit)); - msgTxt += ">, "; - } - - if (msgInfo.msgbcc.size() > 0) - msgTxt += "\nBcc: "; - for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++) - { - msgTxt += QString::fromStdString(*pit); - msgTxt += " <"; - msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit)); - msgTxt += ">, "; - } - - { - QDateTime qtime; - qtime.setTime_t(msgInfo.ts); - QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - ui.dateText-> setText(timestamp); - } - ui.toText->setText(msgTxt); - ui.fromText->setText(QString::fromStdString(rsPeers->getPeerName(msgInfo.srcId))); - - ui.subjectText->setText(QString::fromStdWString(msgInfo.title)); - ui.msgText->setText(QString::fromStdWString(msgInfo.msg)); - - { - std::ostringstream out; - out << "(" << msgInfo.count << " Files)"; - ui.filesText->setText(QString::fromStdString(out.str())); - } - - std::cerr << "ForumsDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl; - - /* finally mark message as read! */ - rsMsgs -> MessageRead(mid); -#endif + ui.postText->setHtml(QString::fromStdWString(msg.msg)); } bool ForumsDialog::getCurrentMsg(std::string &cid, std::string &mid) { -#if 0 - /* Locate the current Message */ - QTreeWidget *msglist = ui.msgWidget; - - //std::cerr << "ForumsDialog::getCurrentMsg()" << std::endl; - - /* get its Ids */ - QTreeWidgetItem *qtwi = msglist -> currentItem(); - if (qtwi) - { - cid = qtwi -> text(4).toStdString(); - mid = qtwi -> text(5).toStdString(); - return true; - } -#endif return false; } @@ -828,7 +743,36 @@ void ForumsDialog::markMsgAsRead() void ForumsDialog::newforum() { - insertForums(); + CreateForum *cf = new CreateForum(NULL); + cf->show(); + + //insertForums(); } +void ForumsDialog::createmessage() +{ + if (mCurrForumId == "") + { + return; + } + + CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, mCurrPostId); + cfm->show(); +} + + +void ForumsDialog::showthread() +{ + if (mCurrForumId == "") + { + return; + } + + CreateForumMsg *cfm = new CreateForumMsg(mCurrForumId, ""); + cfm->show(); +} + + + + diff --git a/retroshare-gui/src/gui/ForumsDialog.h b/retroshare-gui/src/gui/ForumsDialog.h index 1ffb056a8..0b2dea741 100644 --- a/retroshare-gui/src/gui/ForumsDialog.h +++ b/retroshare-gui/src/gui/ForumsDialog.h @@ -44,6 +44,12 @@ private slots: void newforum(); +void checkUpdate(); + +void changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev ); +void changedThread( QTreeWidgetItem *curr, QTreeWidgetItem *prev ); +void changedThread2(); + void changeBox( int newrow ); void updateMessages ( QTreeWidgetItem * item, int column ); @@ -59,6 +65,9 @@ void updateMessages ( QTreeWidgetItem * item, int column ); /* handle splitter */ void togglefileview(); + void showthread(); + void createmessage(); + private: bool getCurrentMsg(std::string &cid, std::string &mid); diff --git a/retroshare-gui/src/gui/ForumsDialog.ui b/retroshare-gui/src/gui/ForumsDialog.ui index 5b727ab3d..9fcf96538 100644 --- a/retroshare-gui/src/gui/ForumsDialog.ui +++ b/retroshare-gui/src/gui/ForumsDialog.ui @@ -5,8 +5,8 @@ 0 0 - 673 - 430 + 485 + 422 @@ -506,11 +506,11 @@ - + Qt::Horizontal - + @@ -538,61 +538,6 @@ Posts - - - Subscribed Forums - - - - - - - - - - RS Forums - - - - - - - - - - - - Popular Forums - - - - - - - - - - Rs Forums - - - - - - - - - - - - Other Forums - - - - - - - - @@ -604,7 +549,7 @@ - + Qt::Vertical @@ -645,7 +590,7 @@ - + 2 @@ -669,6 +614,20 @@ + + + + + Threaded View + + + + + Flat View + + + + @@ -676,14 +635,17 @@ Qt::CustomContextMenu + + true + - Title + Date - Date + Title @@ -696,48 +658,6 @@ Signed - - - Thread 1 - - - - - - - - - - - - - Thread 1 Post 2 - - - - - - - - - - - - - - Thread 1 Post 3 - - - - - - - - - - - - @@ -796,7 +716,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/retroshare-gui/src/gui/LinksDialog.cpp b/retroshare-gui/src/gui/LinksDialog.cpp index d00662387..c0d90574a 100644 --- a/retroshare-gui/src/gui/LinksDialog.cpp +++ b/retroshare-gui/src/gui/LinksDialog.cpp @@ -80,6 +80,7 @@ LinksDialog::LinksDialog(QWidget *parent) connect( ui.linkTreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int ) ), this, SLOT( openLink ( QTreeWidgetItem *, int ) ) ); + connect( ui.anonBox, SIGNAL( stateChanged ( int ) ), this, SLOT( checkAnon ( void ) ) ); @@ -237,6 +238,7 @@ void LinksDialog::changedSortFrom( int index ) updateLinks(); } +#define ENTRIES_PER_BLOCK 100 void LinksDialog::changedSortTop( int index ) { @@ -253,19 +255,19 @@ void LinksDialog::changedSortTop( int index ) case 0: mStart = 0; break; + case 1: + mStart = 1 * ENTRIES_PER_BLOCK; + break; case 2: - mStart = 100; + mStart = 2 * ENTRIES_PER_BLOCK; break; case 3: - mStart = 200; + mStart = 3 * ENTRIES_PER_BLOCK; break; case 4: - mStart = 300; + mStart = 4 * ENTRIES_PER_BLOCK; break; case 5: - mStart = 400; - break; - case 6: mStart = -1; break; } @@ -281,11 +283,13 @@ void LinksDialog::updateLinks() std::list::iterator rit; std::list::iterator cit; + std::cerr << "LinksDialog::updateLinks()" << std::endl; + /* Work out the number/entries to show */ uint32_t count = rsRanks->getRankingsCount(); uint32_t start; - uint32_t entries = 100; + uint32_t entries = ENTRIES_PER_BLOCK; if (count < entries) { entries = count; @@ -367,15 +371,44 @@ void LinksDialog::updateLinks() /* create items */ QTreeWidgetItem *child = new QTreeWidgetItem((QTreeWidget*)0); + QString commentText; + QString peerScore; + if (cit->score > 1) + { + peerScore = "[+2] "; + //peerScore = "[+2 Great Link] "; + } + else if (cit->score == 1) + { + peerScore = "[+1] "; + //peerScore = "[+1 Good] "; + } + else if (cit->score == 0) + { + peerScore = "[+0] "; + //peerScore = "[+0 Okay] "; + } + else if (cit->score == -1) + { + peerScore = "[-1] "; + //peerScore = "[-1 Not Worth It] "; + } + else //if (cit->score < -1) + { + peerScore = "[-2 BAD] "; + //peerScore = "[-2 BAD Link] "; + } + /* (0) Comment */ if (cit->comment != L"") { - child -> setText(0, QString::fromStdWString(cit->comment)); + commentText = peerScore + QString::fromStdWString(cit->comment); } else { - child -> setText(0, "No Comment"); + commentText = peerScore + "No Comment"; } + child -> setText(0, commentText); /* (2) Peer / Date */ { @@ -388,9 +421,10 @@ void LinksDialog::updateLinks() { peerLabel = "<"; peerLabel += QString::fromStdString(cit->id); - peerLabel = ">"; + peerLabel += ">"; } - peerLabel += " "; + peerLabel += " "; + peerLabel += timestamp; child -> setText(2, peerLabel); @@ -493,6 +527,27 @@ void LinksDialog::changedItem(QTreeWidgetItem *curr, QTreeWidgetItem *prev) } } +void LinksDialog::checkAnon() +{ + changedItem(ui.linkTreeWidget->currentItem(), NULL); +} + + +int IndexToScore(int index) +{ + if ((index == -1) || (index > 4)) + return 0; + int score = 2 - index; + return score; +} + +int ScoreToIndex(int score) +{ + if ((score < -2) || (score > 2)) + return 2; + int index = 2 - score; + return index; +} /* get the list of Links from the RsRanks. */ @@ -500,26 +555,43 @@ void LinksDialog::updateComments(std::string rid, std::string pid) { std::list::iterator cit; - if (rid == "") + + if (ui.anonBox->isChecked()) + { + /* empty everything */ + ui.titleLineEdit->setText(""); + ui.linkLineEdit->setText(""); + ui.linkTextEdit->setText(""); + ui.scoreBox->setCurrentIndex(ScoreToIndex(0)); + mLinkId = ""; + + /* disable comment + score */ + ui.scoreBox->setEnabled(false); + ui.linkTextEdit->setEnabled(false); + + /* done! */ + return; + } + else + { + /* enable comment + score */ + ui.scoreBox->setEnabled(true); + ui.linkTextEdit->setEnabled(true); + } + + + RsRankDetails detail; + if ((rid == "") || (!rsRanks->getRankDetails(rid, detail))) { /* clear it up */ ui.titleLineEdit->setText(""); ui.linkLineEdit->setText(""); ui.linkTextEdit->setText(""); + ui.scoreBox->setCurrentIndex(ScoreToIndex(0)); mLinkId = rid; return; } - RsRankDetails detail; - if (!rsRanks->getRankDetails(rid, detail)) - { - /* clear it up */ - ui.titleLineEdit->setText(""); - ui.linkLineEdit->setText(""); - ui.linkTextEdit->setText(""); - mLinkId = ""; - return; - } /* set Link details */ ui.titleLineEdit->setText(QString::fromStdWString(detail.title)); @@ -547,74 +619,16 @@ void LinksDialog::updateComments(std::string rid, std::string pid) { QString comment = QString::fromStdWString(cit->comment); ui.linkTextEdit->setText(comment); + ui.scoreBox->setCurrentIndex(ScoreToIndex(cit->score)); } else { ui.linkTextEdit->setText(""); + ui.scoreBox->setCurrentIndex(ScoreToIndex(0)); } return; - - -#if 0 - - for(cit = detail.comments.begin(); cit != detail.comments.end(); cit++) - { - if (cit->id == pid) - break; - } - - if (cit != detail.comments.end()) - { - /* one comment selected */ - QString comment; - - QDateTime qtime; - qtime.setTime_t(cit->timestamp); - QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - - comment += "Submitter: "; - comment += QString::fromStdString(rsPeers->getPeerName(cit->id)); - comment += " Date: "; - comment += timestamp; - comment += "\n"; - comment += QString::fromStdWString(cit->comment); - - ui.linkTextEdit->setText(comment); - return; - } - - - QString comment; - for(cit = detail.comments.begin(); cit != detail.comments.end(); cit++) - { - /* add all comments */ - QDateTime qtime; - qtime.setTime_t(cit->timestamp); - QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - - comment += "Submitter: "; - comment += QString::fromStdString(rsPeers->getPeerName(cit->id)); - comment += " Date: "; - comment += timestamp; - comment += "\n"; - comment += QString::fromStdWString(cit->comment); - comment += "\n===================================================="; - comment += "====================================================\n"; - } - - ui.linkTextEdit->setText(comment); - - /* .... - * */ - /** - mLinkId = rid; - mPeerId = pid; - mCommentFilled = true; - **/ -#endif - } void LinksDialog::addLinkComment( void ) @@ -623,6 +637,7 @@ void LinksDialog::addLinkComment( void ) QString title = ui.titleLineEdit->text(); QString link = ui.linkLineEdit->text(); QString comment = ui.linkTextEdit->toPlainText(); + int32_t score = IndexToScore(ui.scoreBox->currentIndex()); if (mLinkId == "") { @@ -635,10 +650,19 @@ void LinksDialog::addLinkComment( void ) /* can't do anything */ return; } - rsRanks->newRankMsg( - link.toStdWString(), - title.toStdWString(), - comment.toStdWString()); + + /* add it either way */ + if (ui.anonBox->isChecked()) + { + rsRanks->anonRankMsg(link.toStdWString(), title.toStdWString()); + } + else + { + rsRanks->newRankMsg( + link.toStdWString(), + title.toStdWString(), + comment.toStdWString(), score); + } updateLinks(); return; @@ -669,7 +693,8 @@ void LinksDialog::addLinkComment( void ) } rsRanks->updateComment(mLinkId, - comment.toStdWString()); + comment.toStdWString(), + score); } else { @@ -689,7 +714,8 @@ void LinksDialog::addLinkComment( void ) rsRanks->newRankMsg( link.toStdWString(), title.toStdWString(), - comment.toStdWString()); + comment.toStdWString(), + score); } } updateLinks(); diff --git a/retroshare-gui/src/gui/LinksDialog.h b/retroshare-gui/src/gui/LinksDialog.h index f12e1c819..c90191344 100644 --- a/retroshare-gui/src/gui/LinksDialog.h +++ b/retroshare-gui/src/gui/LinksDialog.h @@ -57,6 +57,7 @@ void toggleWindows( void ); void openLink ( QTreeWidgetItem * item, int column ); void changedItem(QTreeWidgetItem *curr, QTreeWidgetItem *prev); +void checkAnon(); void checkUpdate(); diff --git a/retroshare-gui/src/gui/LinksDialog.ui b/retroshare-gui/src/gui/LinksDialog.ui index a130b8256..1edf32f57 100644 --- a/retroshare-gui/src/gui/LinksDialog.ui +++ b/retroshare-gui/src/gui/LinksDialog.ui @@ -5,23 +5,14 @@ 0 0 - 633 - 530 + 650 + 529 Form - - 0 - - - 6 - - - 0 - @@ -326,12 +317,26 @@ p, li { white-space: pre-wrap; } - 441 - 20 + 311 + 32 + + + + + 12 + 50 + false + + + + Add Anonymous Link + + + @@ -347,8 +352,8 @@ p, li { white-space: pre-wrap; } - - + + @@ -362,7 +367,7 @@ p, li { white-space: pre-wrap; } - + @@ -371,7 +376,54 @@ p, li { white-space: pre-wrap; } - + + + + + 12 + 75 + true + + + + Score: + + + + + + + + +2 Great! + + + + + +1 Good + + + + + 0 Okay + + + + + -1 Sux + + + + + -2 Bad Link + + + + + + + + + @@ -385,7 +437,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/retroshare-gui/src/gui/forums/CreateForum.cpp b/retroshare-gui/src/gui/forums/CreateForum.cpp new file mode 100644 index 000000000..86a68cd70 --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForum.cpp @@ -0,0 +1,90 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + + +#include "CreateForum.h" + +#include "rsiface/rsforums.h" + +/** Constructor */ +CreateForum::CreateForum(QWidget *parent) +: QWidget(parent) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); + + // connect up the buttons. + connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) ); + connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) ); + + newForum(); + +} + + +void CreateForum::newForum() +{ + /* clear all */ + ui.forumTypePublic->setChecked(true); + ui.forumMsgAnon->setChecked(true); +} + +void CreateForum::createForum() +{ + QString name = ui.forumName->text(); + QString desc = ui.forumDesc->toHtml(); + uint32_t flags = 0; + + if (ui.forumTypePublic->isChecked()) + { + flags |= RS_FORUM_PUBLIC; + } + else if (ui.forumTypePrivate->isChecked()) + { + flags |= RS_FORUM_PRIVATE; + } + else if (ui.forumTypeEncrypted->isChecked()) + { + flags |= RS_FORUM_ENCRYPTED; + } + + if (ui.forumMsgAuth->isChecked()) + { + flags |= RS_FORUM_MSG_AUTH; + } + else if (ui.forumMsgAnon->isChecked()) + { + flags |= RS_FORUM_MSG_ANON; + } + + rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags); + + close(); + return; +} + + +void CreateForum::cancelForum() +{ + close(); + return; +} + diff --git a/retroshare-gui/src/gui/forums/CreateForum.h b/retroshare-gui/src/gui/forums/CreateForum.h new file mode 100644 index 000000000..fb4b90132 --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForum.h @@ -0,0 +1,52 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + + +#ifndef _CREATE_FORUM_DIALOG_H +#define _CREATE_FORUM_DIALOG_H + +#include + +#include "ui_CreateForum.h" + +class CreateForum : public QWidget +{ + Q_OBJECT + +public: + CreateForum(QWidget *parent = 0); + +void newForum(); /* cleanup */ + +private slots: + + /* actions to take.... */ +void createForum(); +void cancelForum(); + +private: + + /** Qt Designer generated object */ + Ui::CreateForum ui; +}; + +#endif + diff --git a/retroshare-gui/src/gui/forums/CreateForum.ui b/retroshare-gui/src/gui/forums/CreateForum.ui new file mode 100644 index 000000000..72329f53b --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForum.ui @@ -0,0 +1,658 @@ + + CreateForum + + + + 0 + 0 + 480 + 428 + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 192 + 192 + 192 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 104 + 104 + 104 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 104 + 104 + 104 + + + + + + + 255 + 255 + 255 + + + + + + + 104 + 104 + 104 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + Arial + 8 + 50 + false + false + false + false + + + + Qt::NoContextMenu + + + Create a Forum + + + ../msgs + + + + + + + + Forum Name + + + + + + + + + + + + + + Forum Description + + + + + + + + + + + + Forum Type: + + + + + + Public Forum (Shared Publish Key) + + + + + + + Private Forum (Private Publish Key) + + + + + + + Encrypted Forum (Private Publish Key required to view Messages) + + + + + + + + + + Allowed Messages + + + + + + Authemticated Messages + + + + + + + Anonymous Messages + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel Forum + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Create Forum + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + createButton + + + + + + diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp new file mode 100644 index 000000000..07854b40d --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -0,0 +1,76 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + + +#include "CreateForumMsg.h" + +#include "rsiface/rsforums.h" + +/** Constructor */ +CreateForumMsg::CreateForumMsg(std::string fId, std::string pId) +: QWidget(NULL), mForumId(fId), mParentId(pId) +{ + /* Invoke the Qt Designer generated object setup routine */ + ui.setupUi(this); + + // connect up the buttons. + connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelMsg( ) ) ); + connect( ui.postButton, SIGNAL( clicked ( bool ) ), this, SLOT( createMsg( ) ) ); + + newMsg(); + +} + + +void CreateForumMsg::newMsg() +{ + /* clear all */ +} + +void CreateForumMsg::createMsg() +{ + QString name = ui.forumSubject->text(); + QString desc = ui.forumMessage->toHtml(); + + + ForumMsgInfo msgInfo; + + msgInfo.forumId = mForumId; + msgInfo.threadId = ""; + msgInfo.parentId = mParentId; + msgInfo.msgId = ""; + + msgInfo.title = name.toStdWString(); + msgInfo.msg = desc.toStdWString(); + + rsForums->ForumMessageSend(msgInfo); + + close(); + return; +} + + +void CreateForumMsg::cancelMsg() +{ + close(); + return; +} + diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h new file mode 100644 index 000000000..877b1e9fd --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.h @@ -0,0 +1,56 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2008 Robert Fernie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + + +#ifndef _CREATE_FORUM_MSG_DIALOG_H +#define _CREATE_FORUM_MSG_DIALOG_H + +#include +#include + +#include "ui_CreateForumMsg.h" + +class CreateForumMsg : public QWidget +{ + Q_OBJECT + +public: + CreateForumMsg(std::string fId, std::string pId); + +void newMsg(); /* cleanup */ + +private slots: + + /* actions to take.... */ +void createMsg(); +void cancelMsg(); + +private: + + std::string mForumId; + std::string mParentId; + + /** Qt Designer generated object */ + Ui::CreateForumMsg ui; +}; + +#endif + diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui new file mode 100644 index 000000000..368a55921 --- /dev/null +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.ui @@ -0,0 +1,643 @@ + + CreateForumMsg + + + + 0 + 0 + 358 + 435 + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 192 + 192 + 192 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 104 + 104 + 104 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 104 + 104 + 104 + + + + + + + 255 + 255 + 255 + + + + + + + 104 + 104 + 104 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + Arial + 8 + 50 + false + false + false + false + + + + Qt::NoContextMenu + + + Post Forum Msg + + + ../msgs + + + + + + + + + + Forum + + + + + + + + + + + + + + Forum Post Subject + + + + + + + + + + + + + + Forum Post + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Sign Message + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel Msg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Post Forum Msg + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + postButton + + + + + + diff --git a/retroshare-gui/src/rsiface/rsforums.h b/retroshare-gui/src/rsiface/rsforums.h index 4fa85790c..80c40941c 100644 --- a/retroshare-gui/src/rsiface/rsforums.h +++ b/retroshare-gui/src/rsiface/rsforums.h @@ -37,6 +37,9 @@ #define RS_FORUM_PRIVATE 0x0002 /* anyone with key can publish */ #define RS_FORUM_ENCRYPTED 0x0004 /* need admin key */ +#define RS_FORUM_MSG_AUTH 0x0010 /* you must sign messages */ +#define RS_FORUM_MSG_ANON 0x0020 /* you can send anonymous messages */ + #define RS_FORUM_ADMIN 0x0100 /* anyone can publish */ #define RS_FORUM_SUBSCRIBED 0x0200 /* anyone can publish */ @@ -61,8 +64,11 @@ class ForumMsgInfo ForumMsgInfo() {} std::string forumId; std::string threadId; + std::string parentId; std::string msgId; + std::string srcId; /* if Authenticated -> signed here */ + unsigned int msgflags; std::wstring title; @@ -75,13 +81,15 @@ class ThreadInfoSummary { public: ThreadInfoSummary() {} - + std::string forumId; + std::string threadId; + std::string parentId; std::string msgId; - std::string srcId; uint32_t msgflags; std::wstring title; + std::wstring msg; int count; /* file count */ time_t ts; @@ -105,9 +113,12 @@ virtual ~RsForums() { return; } virtual bool forumsChanged(std::list &forumIds) = 0; + +virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) = 0; + virtual bool getForumList(std::list &forumList) = 0; virtual bool getForumThreadList(std::string fId, std::list &msgs) = 0; -virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list &msgs) = 0; +virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list &msgs) = 0; virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0; virtual bool ForumMessageSend(ForumMsgInfo &info) = 0; diff --git a/retroshare-gui/src/rsiface/rsrank.h b/retroshare-gui/src/rsiface/rsrank.h index f99bab4d5..4c56d513e 100644 --- a/retroshare-gui/src/rsiface/rsrank.h +++ b/retroshare-gui/src/rsiface/rsrank.h @@ -40,6 +40,7 @@ class RsRankComment std::string id; std::wstring comment; + int32_t score; time_t timestamp; }; @@ -85,8 +86,10 @@ virtual bool getRankings(uint32_t first, uint32_t count, std::list virtual bool getRankDetails(std::string rid, RsRankDetails &details) = 0; /* Add New Comment / Msg */ -virtual std::string newRankMsg(std::wstring link, std::wstring title, std::wstring comment) = 0; -virtual bool updateComment(std::string rid, std::wstring comment) = 0; +virtual std::string newRankMsg(std::wstring link, std::wstring title, std::wstring comment, int32_t score) = 0; +virtual bool updateComment(std::string rid, std::wstring comment, int32_t score) = 0; + +virtual std::string anonRankMsg(std::wstring link, std::wstring title) = 0; };