mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Significant changes to the GUI to introduce new display style.
* Completed much of General Msg Dialog. * Completed much of ChannelFeed. * Added Channel Messages to News Feed. * Connected Blog/Channels to GeneralMsgDialog. * Improved SubFileItem display. * Completed ChanGroup/Menu/MsgItems. * Added SubDestItem for use in GeneralMsgDialog. * Generalise CreateForum to cover Channels as well. * Restricted CreateForum to public forums/private channels. * Demo of Drag-N-Drop Files for Linux (filesystem->GenMsgDialog) * Updates to rsiface stuff (blog/channels/types) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@621 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b9ccbd54e8
commit
c6a595c7db
@ -164,6 +164,7 @@ HEADERS += rshare.h \
|
||||
gui/feeds/ChanMsgItem.h \
|
||||
gui/feeds/BlogMsgItem.h \
|
||||
gui/feeds/SubFileItem.h \
|
||||
gui/feeds/SubDestItem.h \
|
||||
|
||||
|
||||
FORMS += gui/ChatDialog.ui \
|
||||
@ -238,6 +239,7 @@ FORMS += gui/ChatDialog.ui \
|
||||
gui/feeds/ChanMsgItem.ui \
|
||||
gui/feeds/BlogMsgItem.ui \
|
||||
gui/feeds/SubFileItem.ui \
|
||||
gui/feeds/SubDestItem.ui \
|
||||
|
||||
SOURCES += main.cpp \
|
||||
rshare.cpp \
|
||||
@ -350,6 +352,7 @@ SOURCES += main.cpp \
|
||||
gui/feeds/ChanMsgItem.cpp \
|
||||
gui/feeds/BlogMsgItem.cpp \
|
||||
gui/feeds/SubFileItem.cpp \
|
||||
gui/feeds/SubDestItem.cpp \
|
||||
|
||||
RESOURCES += gui/images.qrc lang/lang.qrc games/qcheckers/qcheckers.qrc apps/smplayer/icons.qrc
|
||||
TRANSLATIONS += \
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "BlogDialog.h"
|
||||
|
||||
#include "GeneralMsgDialog.h"
|
||||
|
||||
#include "rsiface/rsQblog.h"
|
||||
#include "rsiface/rspeers.h" //to retrieve peer/usrId info
|
||||
|
||||
@ -188,8 +190,15 @@ void BlogDialog::postBlog()
|
||||
|
||||
void BlogDialog::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
std::cerr << "BlogDialog::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "BlogDialog::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,55 +20,49 @@
|
||||
****************************************************************/
|
||||
#include <QtGui>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "rsiface/rschannels.h"
|
||||
|
||||
#include "ChannelFeed.h"
|
||||
#include "gui/feeds/ChanGroupItem.h"
|
||||
#include "gui/feeds/ChanMenuItem.h"
|
||||
#include "gui/feeds/ChanMsgItem.h"
|
||||
|
||||
#include "gui/forums/CreateForum.h"
|
||||
|
||||
#include "GeneralMsgDialog.h"
|
||||
|
||||
|
||||
/** Constructor */
|
||||
ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
: MainPage (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
/* add dynamic widgets in */
|
||||
connect(chanButton, SIGNAL(clicked()), this, SLOT(createChannel()));
|
||||
connect(postButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||
|
||||
/* add layout */
|
||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||
|
||||
/* add form */
|
||||
mGroupLayout = new QVBoxLayout;
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
mGroupOwn = new ChanGroupItem("Own Channels");
|
||||
mGroupSub = new ChanGroupItem("Subscribed Channels");
|
||||
mGroupPop = new ChanGroupItem("Popular Channels");
|
||||
mGroupOther = new ChanGroupItem("Other Channels");
|
||||
|
||||
ChanGroupItem *cg1 = new ChanGroupItem("Own Channels");
|
||||
ChanGroupItem *cg2 = new ChanGroupItem("Subscribed Channels");
|
||||
ChanGroupItem *cg3 = new ChanGroupItem("Popular Channels");
|
||||
ChanGroupItem *cg4 = new ChanGroupItem("Other Channels");
|
||||
mGroupLayout->addWidget(mGroupOwn);
|
||||
mGroupLayout->addWidget(mGroupSub);
|
||||
mGroupLayout->addWidget(mGroupPop);
|
||||
mGroupLayout->addWidget(mGroupOther);
|
||||
|
||||
ChanMenuItem *cm1 = new ChanMenuItem("Channel with long name");
|
||||
ChanMenuItem *cm2 = new ChanMenuItem("Channel with very very very very long name");
|
||||
ChanMenuItem *cm3 = new ChanMenuItem("Channel with long name");
|
||||
ChanMenuItem *cm4 = new ChanMenuItem("Retroshare Releases");
|
||||
ChanMenuItem *cm5 = new ChanMenuItem("Popular Channel");
|
||||
|
||||
layout->addWidget(cg1);
|
||||
layout->addWidget(cm1);
|
||||
|
||||
layout->addWidget(cg2);
|
||||
layout->addWidget(cm2);
|
||||
layout->addWidget(cm3);
|
||||
layout->addWidget(cm4);
|
||||
|
||||
layout->addWidget(cg3);
|
||||
layout->addWidget(cm5);
|
||||
|
||||
layout->addWidget(cg4);
|
||||
|
||||
QWidget *middleWidget = new QWidget();
|
||||
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
|
||||
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget->setLayout(layout);
|
||||
|
||||
middleWidget->setLayout(mGroupLayout);
|
||||
|
||||
QScrollArea *scrollArea = new QScrollArea;
|
||||
scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
@ -81,32 +75,13 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
|
||||
chanFrame->setLayout(layout2);
|
||||
|
||||
/***** SECOND HALF *****/
|
||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||
|
||||
QVBoxLayout *msgLayout = new QVBoxLayout;
|
||||
|
||||
ChanMsgItem *ni1 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni2 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni3 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni4 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni5 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni6 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni7 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
ChanMsgItem *ni8 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
|
||||
|
||||
msgLayout->addWidget(ni1);
|
||||
msgLayout->addWidget(ni2);
|
||||
msgLayout->addWidget(ni3);
|
||||
msgLayout->addWidget(ni4);
|
||||
msgLayout->addWidget(ni5);
|
||||
msgLayout->addWidget(ni6);
|
||||
msgLayout->addWidget(ni7);
|
||||
msgLayout->addWidget(ni8);
|
||||
mMsgLayout = new QVBoxLayout;
|
||||
|
||||
QWidget *middleWidget2 = new QWidget();
|
||||
middleWidget2->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
middleWidget2->setLayout(msgLayout);
|
||||
|
||||
middleWidget2->setLayout(mMsgLayout);
|
||||
|
||||
QScrollArea *scrollArea2 = new QScrollArea;
|
||||
scrollArea2->setBackgroundRole(QPalette::Dark);
|
||||
@ -118,9 +93,55 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
||||
layout3->addWidget(scrollArea2);
|
||||
|
||||
msgFrame->setLayout(layout3);
|
||||
|
||||
mChannelId = "OWNID";
|
||||
|
||||
updateChannelList();
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::createChannel()
|
||||
{
|
||||
CreateForum *cf = new CreateForum(NULL, false);
|
||||
cf->show();
|
||||
}
|
||||
|
||||
void ChannelFeed::channelSelection()
|
||||
{
|
||||
/* which item was selected? */
|
||||
|
||||
|
||||
/* update mChannelId */
|
||||
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
||||
void ChannelFeed::sendMsg()
|
||||
{
|
||||
std::cerr << "ChannelFeed::sendMsg()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mChannelId != "")
|
||||
{
|
||||
openMsg(FEEDHOLDER_MSG_CHANNEL, mChannelId, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "ChannelFeed::sendMsg() no Channel Selected!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
void ChannelFeed::deleteFeedItem(QWidget *item, uint32_t type)
|
||||
{
|
||||
@ -132,9 +153,304 @@ void ChannelFeed::openChat(std::string peerId)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
{
|
||||
std::cerr << "ChannelFeed::openMsg()";
|
||||
std::cerr << std::endl;
|
||||
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
|
||||
|
||||
|
||||
msgDialog->addDestination(type, grpId, inReplyTo);
|
||||
|
||||
msgDialog->show();
|
||||
return;
|
||||
}
|
||||
|
||||
void ChannelFeed::selectChannel( std::string cId)
|
||||
{
|
||||
mChannelId = cId;
|
||||
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
||||
void ChannelFeed::checkUpdate()
|
||||
{
|
||||
std::list<std::string> chanIds;
|
||||
std::list<std::string>::iterator it;
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
if (rsChannels->channelsChanged(chanIds))
|
||||
{
|
||||
/* update Forums List */
|
||||
updateChannelList();
|
||||
|
||||
it = std::find(chanIds.begin(), chanIds.end(), mChannelId);
|
||||
if (it != chanIds.end())
|
||||
{
|
||||
updateChannelMsgs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ChannelFeed::updateChannelList()
|
||||
{
|
||||
|
||||
std::list<ChannelInfo> channelList;
|
||||
std::list<ChannelInfo>::iterator it;
|
||||
if (!rsChannels)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rsChannels->getChannelList(channelList);
|
||||
|
||||
/* get the ids for our lists */
|
||||
std::list<std::string> adminIds;
|
||||
std::list<std::string> subIds;
|
||||
std::list<std::string> popIds;
|
||||
std::list<std::string> otherIds;
|
||||
std::multimap<uint32_t, std::string> popMap;
|
||||
|
||||
for(it = channelList.begin(); it != channelList.end(); it++)
|
||||
{
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->channelFlags;
|
||||
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
adminIds.push_back(it->channelId);
|
||||
}
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
subIds.push_back(it->channelId);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->pop, it->channelId));
|
||||
}
|
||||
}
|
||||
|
||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||
uint32_t popCount = 5;
|
||||
if (popCount < popMap.size() / 10)
|
||||
{
|
||||
popCount = popMap.size() / 10;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
uint32_t popLimit = 0;
|
||||
std::multimap<uint32_t, std::string>::reverse_iterator rit;
|
||||
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++)
|
||||
{
|
||||
popIds.push_back(rit->second);
|
||||
}
|
||||
|
||||
if (rit != popMap.rend())
|
||||
{
|
||||
popLimit = rit->first;
|
||||
}
|
||||
|
||||
for(it = channelList.begin(); it != channelList.end(); it++)
|
||||
{
|
||||
/* ignore the ones we've done already */
|
||||
uint32_t flags = it->channelFlags;
|
||||
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (it->pop < popLimit)
|
||||
{
|
||||
otherIds.push_back(it->channelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* now we have our lists ---> update entries */
|
||||
|
||||
updateChannelListOwn(adminIds);
|
||||
updateChannelListSub(subIds);
|
||||
updateChannelListPop(popIds);
|
||||
updateChannelListOther(otherIds);
|
||||
}
|
||||
|
||||
void ChannelFeed::updateChannelListOwn(std::list<std::string> &ids)
|
||||
{
|
||||
std::list<ChanMenuItem *>::iterator it;
|
||||
std::list<std::string>::iterator iit;
|
||||
|
||||
/* TEMP just replace all of them */
|
||||
for(it = mChannelListOwn.begin(); it != mChannelListOwn.end(); it++)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
mChannelListOwn.clear();
|
||||
|
||||
int topIndex = mGroupLayout->indexOf(mGroupOwn);
|
||||
int index = topIndex + 1;
|
||||
for (iit = ids.begin(); iit != ids.end(); iit++, index++)
|
||||
{
|
||||
std::cerr << "ChannelFeed::updateChannelListOwn(): " << *iit << " at: " << index;
|
||||
std::cerr << std::endl;
|
||||
|
||||
ChanMenuItem *cmi = new ChanMenuItem(*iit);
|
||||
mChannelListOwn.push_back(cmi);
|
||||
mGroupLayout->insertWidget(index, cmi);
|
||||
|
||||
connect(cmi, SIGNAL( selectMe( std::string )), this, SLOT( selectChannel( std::string )));
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelFeed::updateChannelListSub(std::list<std::string> &ids)
|
||||
{
|
||||
std::list<ChanMenuItem *>::iterator it;
|
||||
std::list<std::string>::iterator iit;
|
||||
|
||||
/* TEMP just replace all of them */
|
||||
for(it = mChannelListSub.begin(); it != mChannelListSub.end(); it++)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
mChannelListSub.clear();
|
||||
|
||||
int topIndex = mGroupLayout->indexOf(mGroupSub);
|
||||
int index = topIndex + 1;
|
||||
for (iit = ids.begin(); iit != ids.end(); iit++, index++)
|
||||
{
|
||||
std::cerr << "ChannelFeed::updateChannelListSub(): " << *iit << " at: " << index;
|
||||
std::cerr << std::endl;
|
||||
|
||||
ChanMenuItem *cmi = new ChanMenuItem(*iit);
|
||||
mChannelListSub.push_back(cmi);
|
||||
mGroupLayout->insertWidget(index, cmi);
|
||||
connect(cmi, SIGNAL( selectMe( std::string )), this, SLOT( selectChannel( std::string )));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChannelFeed::updateChannelListPop(std::list<std::string> &ids)
|
||||
{
|
||||
std::list<ChanMenuItem *>::iterator it;
|
||||
std::list<std::string>::iterator iit;
|
||||
|
||||
/* TEMP just replace all of them */
|
||||
for(it = mChannelListPop.begin(); it != mChannelListPop.end(); it++)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
mChannelListPop.clear();
|
||||
|
||||
int topIndex = mGroupLayout->indexOf(mGroupPop);
|
||||
int index = topIndex + 1;
|
||||
for (iit = ids.begin(); iit != ids.end(); iit++, index++)
|
||||
{
|
||||
std::cerr << "ChannelFeed::updateChannelListPop(): " << *iit << " at: " << index;
|
||||
std::cerr << std::endl;
|
||||
|
||||
ChanMenuItem *cmi = new ChanMenuItem(*iit);
|
||||
mChannelListPop.push_back(cmi);
|
||||
mGroupLayout->insertWidget(index, cmi);
|
||||
connect(cmi, SIGNAL( selectMe( std::string )), this, SLOT( selectChannel( std::string )));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ChannelFeed::updateChannelListOther(std::list<std::string> &ids)
|
||||
{
|
||||
std::list<ChanMenuItem *>::iterator it;
|
||||
std::list<std::string>::iterator iit;
|
||||
|
||||
/* TEMP just replace all of them */
|
||||
for(it = mChannelListOther.begin(); it != mChannelListOther.end(); it++)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
mChannelListOther.clear();
|
||||
|
||||
int topIndex = mGroupLayout->indexOf(mGroupOther);
|
||||
int index = topIndex + 1;
|
||||
for (iit = ids.begin(); iit != ids.end(); iit++, index++)
|
||||
{
|
||||
std::cerr << "ChannelFeed::updateChannelListOther(): " << *iit << " at: " << index;
|
||||
std::cerr << std::endl;
|
||||
|
||||
ChanMenuItem *cmi = new ChanMenuItem(*iit);
|
||||
mChannelListOther.push_back(cmi);
|
||||
mGroupLayout->insertWidget(index, cmi);
|
||||
connect(cmi, SIGNAL( selectMe( std::string )), this, SLOT( selectChannel( std::string )));
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelFeed::updateChannelMsgs()
|
||||
{
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
ChannelInfo ci;
|
||||
if (!rsChannels->getChannelInfo(mChannelId, ci))
|
||||
{
|
||||
postButton->setEnabled(false);
|
||||
subscribeButton->setEnabled(false);
|
||||
unsubscribeButton->setEnabled(false);
|
||||
nameLabel->setText("No Channel Selected");
|
||||
return;
|
||||
}
|
||||
/* set channel name */
|
||||
nameLabel->setText(QString::fromStdWString(ci.channelName));
|
||||
|
||||
/* do buttons */
|
||||
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
subscribeButton->setEnabled(false);
|
||||
unsubscribeButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subscribeButton->setEnabled(true);
|
||||
unsubscribeButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (ci.channelFlags & RS_DISTRIB_PUBLISH)
|
||||
{
|
||||
postButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
postButton->setEnabled(false);
|
||||
}
|
||||
|
||||
/* replace all the messages with new ones */
|
||||
std::list<ChanMsgItem *>::iterator mit;
|
||||
for(mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++)
|
||||
{
|
||||
delete (*mit);
|
||||
}
|
||||
mChanMsgItems.clear();
|
||||
|
||||
std::list<ChannelMsgSummary> msgs;
|
||||
std::list<ChannelMsgSummary>::iterator it;
|
||||
|
||||
rsChannels->getChannelMsgList(mChannelId, msgs);
|
||||
|
||||
for(it = msgs.begin(); it != msgs.end(); it++)
|
||||
{
|
||||
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
|
||||
|
||||
mChanMsgItems.push_back(cmi);
|
||||
mMsgLayout->addWidget(cmi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@
|
||||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
class ChanGroupItem;
|
||||
class ChanMenuItem;
|
||||
class ChanMsgItem;
|
||||
|
||||
class ChannelFeed : public MainPage, public FeedHolder, private Ui::ChannelFeed
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,10 +45,49 @@ virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
public slots:
|
||||
|
||||
void selectChannel( std::string );
|
||||
|
||||
private slots:
|
||||
|
||||
void checkUpdate();
|
||||
|
||||
void createChannel();
|
||||
void sendMsg();
|
||||
|
||||
void channelSelection();
|
||||
|
||||
private:
|
||||
|
||||
/* lists of feedItems */
|
||||
//std::list<ChanMsgItem *> mChanMsgItems;
|
||||
void updateChannelList();
|
||||
void updateChannelListOwn(std::list<std::string> &ids);
|
||||
void updateChannelListSub(std::list<std::string> &ids);
|
||||
void updateChannelListPop(std::list<std::string> &ids);
|
||||
void updateChannelListOther(std::list<std::string> &ids);
|
||||
|
||||
void updateChannelMsgs();
|
||||
|
||||
std::string mChannelId; /* current Channel */
|
||||
|
||||
/* Layout Pointers */
|
||||
QBoxLayout *mGroupLayout;
|
||||
QBoxLayout *mMsgLayout;
|
||||
|
||||
/* Group Headers */
|
||||
ChanGroupItem *mGroupOwn;
|
||||
ChanGroupItem *mGroupSub;
|
||||
ChanGroupItem *mGroupPop;
|
||||
ChanGroupItem *mGroupOther;
|
||||
|
||||
/* lists of feedItems */
|
||||
std::list<ChanMenuItem *> mChannelListOwn;
|
||||
std::list<ChanMenuItem *> mChannelListSub;
|
||||
std::list<ChanMenuItem *> mChannelListPop;
|
||||
std::list<ChanMenuItem *> mChannelListOther;
|
||||
|
||||
std::list<ChanMsgItem *> mChanMsgItems;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -743,10 +743,8 @@ void ForumsDialog::markMsgAsRead()
|
||||
|
||||
void ForumsDialog::newforum()
|
||||
{
|
||||
CreateForum *cf = new CreateForum(NULL);
|
||||
CreateForum *cf = new CreateForum(NULL, true);
|
||||
cf->show();
|
||||
|
||||
//insertForums();
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,25 +23,150 @@
|
||||
#include "GeneralMsgDialog.h"
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "gui/feeds/SubDestItem.h"
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsforums.h"
|
||||
#include "rsiface/rschannels.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
GeneralMsgDialog::GeneralMsgDialog(QWidget *parent)
|
||||
GeneralMsgDialog::GeneralMsgDialog(QWidget *parent, uint32_t type)
|
||||
: QDialog (parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect(addButton, SIGNAL(clicked()), this, SLOT(newDestination()));
|
||||
connect(typeComboBox, SIGNAL(currentIndexChanged( int )), this, SLOT(updateGroupId()));
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));
|
||||
|
||||
/* set the type to ...
|
||||
* const uint32_t GMD_TYPE_MESSAGE_IDX = 0;
|
||||
* const uint32_t GMD_TYPE_FORUM_IDX = 1;
|
||||
* const uint32_t GMD_TYPE_CHANNEL_IDX = 2;
|
||||
* const uint32_t GMD_TYPE_BLOG_IDX = 3;
|
||||
* */
|
||||
|
||||
typeComboBox->clear();
|
||||
typeComboBox->addItem("Message");
|
||||
typeComboBox->addItem("Forum");
|
||||
typeComboBox->addItem("Channel");
|
||||
typeComboBox->addItem("Blog");
|
||||
|
||||
typeComboBox->setCurrentIndex(type);
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
/* Dropping */
|
||||
|
||||
void GeneralMsgDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
/* print out mimeType */
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() Formats";
|
||||
std::cerr << std::endl;
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
QStringList::iterator it;
|
||||
for(it = formats.begin(); it != formats.end(); it++)
|
||||
{
|
||||
std::cerr << "Format: " << (*it).toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasFormat("text/plain"))
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() Accepting PlainText";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() Accepting Urls";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() No PlainText/Urls";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::dropEvent(QDropEvent *event)
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dropEvent() Formats";
|
||||
std::cerr << std::endl;
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
QStringList::iterator it;
|
||||
for(it = formats.begin(); it != formats.end(); it++)
|
||||
{
|
||||
std::cerr << "Format: " << (*it).toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasText())
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dropEvent() Plain Text:";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << event->mimeData()->text().toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dropEvent() Urls:";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
QList<QUrl>::iterator uit;
|
||||
for(uit = urls.begin(); uit != urls.end(); uit++)
|
||||
{
|
||||
std::string localpath = uit->toLocalFile().toStdString();
|
||||
std::cerr << "Whole URL: " << uit->toString().toStdString();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "or As Local File: " << localpath;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (localpath.size() > 0)
|
||||
{
|
||||
addAttachment(localpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::addAttachment(std::string path)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
std::cerr << "GeneralMsgDialog::addAttachment()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* add widget in for new destination */
|
||||
SubFileItem *file = new SubFileItem("unknownHash", path, 12000);
|
||||
|
||||
mAttachments.push_back(file);
|
||||
QLayout *layout = fileFrame->layout();
|
||||
layout->addWidget(file);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GeneralMsgDialog::cancelMsg()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::sendMsg()
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::cancelMsg()";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -50,8 +175,250 @@ void GeneralMsgDialog::addDestination(uint32_t type, std::string grpId, std::str
|
||||
std::cerr << "GeneralMsgDialog::addDestination()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* add widget in for new destination */
|
||||
SubDestItem *dest = new SubDestItem(type, grpId, inReplyTo);
|
||||
|
||||
mDestinations.push_back(dest);
|
||||
QLayout *layout = destFrame->layout();
|
||||
layout->addWidget(dest);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::updateGroupId()
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::updateGroupId()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
int idx = typeComboBox->currentIndex();
|
||||
|
||||
destIdComboBox->clear();
|
||||
switch(idx)
|
||||
{
|
||||
case GMD_TYPE_MESSAGE_IDX:
|
||||
{
|
||||
/* add a list of friends */
|
||||
if (rsPeers)
|
||||
{
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsPeers->getFriendList(friends);
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
{
|
||||
QString id = QString::fromStdString(*it);
|
||||
QString name = QString::fromStdString(rsPeers->getPeerName(*it));
|
||||
|
||||
destIdComboBox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GMD_TYPE_FORUM_IDX:
|
||||
{
|
||||
/* add a list of publishable forums */
|
||||
if (rsForums)
|
||||
{
|
||||
std::list<ForumInfo> forumList;
|
||||
std::list<ForumInfo>::iterator it;
|
||||
|
||||
rsForums->getForumList(forumList);
|
||||
for(it = forumList.begin(); it != forumList.end(); it++)
|
||||
{
|
||||
if (it->forumFlags & RS_DISTRIB_PUBLISH)
|
||||
{
|
||||
QString id = QString::fromStdString(it->forumId);
|
||||
QString name = QString::fromStdWString(it->forumName);
|
||||
|
||||
destIdComboBox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GMD_TYPE_CHANNEL_IDX:
|
||||
{
|
||||
/* add a list of publishable channels */
|
||||
if (rsChannels)
|
||||
{
|
||||
std::list<ChannelInfo> channelList;
|
||||
std::list<ChannelInfo>::iterator it;
|
||||
|
||||
rsChannels->getChannelList(channelList);
|
||||
for(it = channelList.begin(); it != channelList.end(); it++)
|
||||
{
|
||||
if (it->channelFlags & RS_DISTRIB_PUBLISH)
|
||||
{
|
||||
QString id = QString::fromStdString(it->channelId);
|
||||
QString name = QString::fromStdWString(it->channelName);
|
||||
|
||||
destIdComboBox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case GMD_TYPE_BLOG_IDX:
|
||||
{
|
||||
/* empty list */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::newDestination()
|
||||
{
|
||||
/* get details from uint32_t type, std::string grpId, std::string inReplyTo)
|
||||
*/
|
||||
|
||||
std::cerr << "GeneralMsgDialog::newDestination()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
int idx = typeComboBox->currentIndex();
|
||||
std::string grpId;
|
||||
|
||||
if (destIdComboBox->currentIndex() >= 0)
|
||||
{
|
||||
QVariant qv = destIdComboBox->itemData(destIdComboBox->currentIndex());
|
||||
grpId = qv.toString().toStdString();
|
||||
}
|
||||
|
||||
switch(idx)
|
||||
{
|
||||
case GMD_TYPE_MESSAGE_IDX:
|
||||
addDestination(FEEDHOLDER_MSG_MESSAGE, grpId, "");
|
||||
break;
|
||||
case GMD_TYPE_FORUM_IDX:
|
||||
addDestination(FEEDHOLDER_MSG_FORUM, grpId, "");
|
||||
break;
|
||||
case GMD_TYPE_CHANNEL_IDX:
|
||||
addDestination(FEEDHOLDER_MSG_CHANNEL, grpId, "");
|
||||
break;
|
||||
case GMD_TYPE_BLOG_IDX:
|
||||
addDestination(FEEDHOLDER_MSG_BLOG, "", "");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GeneralMsgDialog::sendMsg()
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::sendMsg()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* construct message bits */
|
||||
std::wstring subject = subjectEdit->text().toStdWString();
|
||||
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
||||
|
||||
std::list<FileInfo> files;
|
||||
|
||||
std::list<SubDestItem *>::iterator it;
|
||||
std::list<SubFileItem *>::iterator fit;
|
||||
|
||||
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
|
||||
{
|
||||
if (!(*fit)->isHidden())
|
||||
{
|
||||
FileInfo fi;
|
||||
fi.hash = (*fit)->FileHash();
|
||||
fi.fname = (*fit)->FileName();
|
||||
fi.size = (*fit)->FileSize();
|
||||
|
||||
files.push_back(fi);
|
||||
}
|
||||
}
|
||||
|
||||
/* iterate through each mDestinations that is visible, and send */
|
||||
for(it = mDestinations.begin(); it != mDestinations.end(); it++)
|
||||
{
|
||||
if (!(*it)->isHidden())
|
||||
{
|
||||
sendMessage((*it)->DestType(), (*it)->DestGroupId(),
|
||||
(*it)->DestInReplyTo(), subject, msg, files);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::sendMessage(uint32_t type, std::string grpId, std::string inReplyTo,
|
||||
std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::sendMessage() Type: " << type << " GroupId: " << grpId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* construct specific messages */
|
||||
switch(type)
|
||||
{
|
||||
case FEEDHOLDER_MSG_MESSAGE:
|
||||
{
|
||||
if (rsMsgs)
|
||||
{
|
||||
/* construct a message */
|
||||
MessageInfo mi;
|
||||
|
||||
mi.title = subject;
|
||||
mi.msg = msg;
|
||||
mi.files = files;
|
||||
mi.msgto.push_back(grpId);
|
||||
|
||||
rsMsgs->MessageSend(mi);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FEEDHOLDER_MSG_FORUM:
|
||||
{
|
||||
/* rsForum */
|
||||
if (rsForums)
|
||||
{
|
||||
ForumMsgInfo msgInfo;
|
||||
|
||||
msgInfo.forumId = grpId;
|
||||
msgInfo.threadId = "";
|
||||
msgInfo.parentId = inReplyTo;
|
||||
msgInfo.msgId = "";
|
||||
|
||||
msgInfo.title = subject;
|
||||
msgInfo.msg = msg;
|
||||
|
||||
rsForums->ForumMessageSend(msgInfo);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FEEDHOLDER_MSG_CHANNEL:
|
||||
{
|
||||
/* rsChannels */
|
||||
if (rsChannels)
|
||||
{
|
||||
ChannelMsgInfo msgInfo;
|
||||
|
||||
msgInfo.channelId = grpId;
|
||||
msgInfo.msgId = "";
|
||||
|
||||
msgInfo.subject = subject;
|
||||
msgInfo.msg = msg;
|
||||
msgInfo.files = files;
|
||||
|
||||
rsChannels->ChannelMessageSend(msgInfo);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case FEEDHOLDER_MSG_BLOG:
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -24,22 +24,46 @@
|
||||
|
||||
#include "ui_GeneralMsgDialog.h"
|
||||
|
||||
class SubDestItem;
|
||||
class SubFileItem;
|
||||
class FileInfo;
|
||||
|
||||
const uint32_t GMD_TYPE_MESSAGE_IDX = 0;
|
||||
const uint32_t GMD_TYPE_FORUM_IDX = 1;
|
||||
const uint32_t GMD_TYPE_CHANNEL_IDX = 2;
|
||||
const uint32_t GMD_TYPE_BLOG_IDX = 3;
|
||||
|
||||
class GeneralMsgDialog : public QDialog, private Ui::GeneralMsgDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
GeneralMsgDialog(QWidget *parent = 0);
|
||||
GeneralMsgDialog(QWidget *parent = 0, uint32_t type = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
virtual void addDestination(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
void addAttachment(std::string path);
|
||||
void addDestination(uint32_t type, std::string grpId, std::string inReplyTo);
|
||||
|
||||
virtual void cancelMsg();
|
||||
virtual void sendMsg();
|
||||
protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private slots:
|
||||
void updateGroupId();
|
||||
void newDestination();
|
||||
void cancelMsg();
|
||||
void sendMsg();
|
||||
|
||||
private:
|
||||
|
||||
void sendMessage(uint32_t type, std::string grpId, std::string inReplyTo,
|
||||
std::wstring subject, std::wstring msg, std::list<FileInfo> &files);
|
||||
|
||||
|
||||
/* maps of files and destinations */
|
||||
std::list<SubDestItem *> mDestinations;
|
||||
std::list<SubFileItem *> mAttachments;
|
||||
};
|
||||
|
||||
|
||||
|
@ -9,6 +9,9 @@
|
||||
<height>516</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="acceptDrops" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
@ -168,9 +171,6 @@
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="acceptDrops" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Drag and Drop Files from Search Results</string>
|
||||
</property>
|
||||
|
@ -220,6 +220,14 @@ void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi)
|
||||
|
||||
void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi)
|
||||
{
|
||||
/* make new widget */
|
||||
ChanMsgItem *cm = new ChanMsgItem(this, NEWSFEED_CHANMSGLIST, fi.mId1, fi.mId2, false);
|
||||
|
||||
/* store in forum list */
|
||||
|
||||
/* add to layout */
|
||||
mLayout->addWidget(cm);
|
||||
|
||||
std::cerr << "NewsFeed::addFeedItemChanMsg()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void BlogMsgItem::updateItemStatic()
|
||||
for(i = 0; i < total; i++)
|
||||
{
|
||||
/* add file */
|
||||
SubFileItem *fi = new SubFileItem("dummyHash");
|
||||
SubFileItem *fi = new SubFileItem("dummyHash", "dummyFileName", 1283918);
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
QLayout *layout = expandFrame->layout();
|
||||
|
@ -20,6 +20,7 @@
|
||||
****************************************************************/
|
||||
#include <QtGui>
|
||||
|
||||
#include "rsiface/rschannels.h"
|
||||
#include "ChanMenuItem.h"
|
||||
|
||||
#include <iostream>
|
||||
@ -50,8 +51,18 @@ void ChanMenuItem::updateItemStatic()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
titleLabel->setText(QString::fromStdString(mChanId));
|
||||
descLabel->setText("Brand new exciting Ever asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; ");
|
||||
/* extract details from channels */
|
||||
ChannelInfo ci;
|
||||
if ((rsChannels) && (rsChannels->getChannelInfo(mChanId, ci)))
|
||||
{
|
||||
titleLabel->setText(QString::fromStdWString(ci.channelName));
|
||||
descLabel->setText(QString::fromStdWString(ci.channelDesc));
|
||||
}
|
||||
else
|
||||
{
|
||||
titleLabel->setText("Unknown Channel");
|
||||
descLabel->setText("No Description");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -84,4 +95,9 @@ void ChanMenuItem::toggle()
|
||||
|
||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
||||
|
||||
void ChanMenuItem::mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
selectMe( mChanId );
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,12 +41,18 @@ public:
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
signals:
|
||||
void selectMe( std::string );
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void toggle();
|
||||
|
||||
void updateItem();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent * event );
|
||||
|
||||
private:
|
||||
std::string mChanId;
|
||||
};
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "FeedHolder.h"
|
||||
#include "SubFileItem.h"
|
||||
|
||||
#include "rsiface/rschannels.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define DEBUG_ITEM 1
|
||||
@ -60,18 +62,39 @@ void ChanMsgItem::updateItemStatic()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
msgLabel->setText("FFFFFFFFFFF AAAAAAAAAAAAAAA \n HHHHHHHHHHH HHHHHHHHHHHHHHHHH");
|
||||
titleLabel->setText("Channel Feed: Best Channel Ever");
|
||||
subjectLabel->setText("Brand new exciting Ever");
|
||||
ChannelMsgInfo cmi;
|
||||
|
||||
/* add Files */
|
||||
int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
|
||||
int i;
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
for(i = 0; i < total; i++)
|
||||
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
|
||||
return;
|
||||
|
||||
QString title;
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
ChannelInfo ci;
|
||||
rsChannels->getChannelInfo(mChanId, ci);
|
||||
title = "Channel Feed: ";
|
||||
title += QString::fromStdWString(ci.channelName);
|
||||
titleLabel->setText(title);
|
||||
subjectLabel->setText(QString::fromStdWString(cmi.subject));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* subject */
|
||||
titleLabel->setText(QString::fromStdWString(cmi.subject));
|
||||
subjectLabel->setText(QString::fromStdWString(cmi.subject));
|
||||
}
|
||||
|
||||
msgLabel->setText(QString::fromStdWString(cmi.msg));
|
||||
|
||||
std::list<FileInfo>::iterator it;
|
||||
for(it = cmi.files.begin(); it != cmi.files.end(); it++)
|
||||
{
|
||||
/* add file */
|
||||
SubFileItem *fi = new SubFileItem("dummyHash");
|
||||
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->size);
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
QLayout *layout = expandFrame->layout();
|
||||
@ -85,6 +108,7 @@ void ChanMsgItem::updateItemStatic()
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
gotoButton->setEnabled(false);
|
||||
unsubscribeButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
108
retroshare-gui/src/gui/feeds/SubDestItem.cpp
Normal file
108
retroshare-gui/src/gui/feeds/SubDestItem.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
/****************************************************************
|
||||
* 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 <QtGui>
|
||||
|
||||
#include "SubDestItem.h"
|
||||
#include "FeedHolder.h"
|
||||
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsforums.h"
|
||||
#include "rsiface/rschannels.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define DEBUG_ITEM 1
|
||||
|
||||
/** Constructor */
|
||||
SubDestItem::SubDestItem(uint32_t type, std::string groupId, std::string inReplyTo)
|
||||
:QWidget(NULL), mType(type), mGroupId(groupId), mInReplyTo(inReplyTo)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
|
||||
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
void SubDestItem::updateItemStatic()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "SubDestItem::updateItemStatic()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
QString name = "Unknown";
|
||||
switch(mType)
|
||||
{
|
||||
case FEEDHOLDER_MSG_MESSAGE:
|
||||
{
|
||||
typeLabel->setText("Message To: ");
|
||||
if (rsPeers)
|
||||
{
|
||||
name = QString::fromStdString(rsPeers->getPeerName(mGroupId));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FEEDHOLDER_MSG_FORUM:
|
||||
{
|
||||
typeLabel->setText("Forum Post To: ");
|
||||
ForumInfo fi;
|
||||
if ((rsForums) && (rsForums->getForumInfo(mGroupId, fi)))
|
||||
{
|
||||
name = QString::fromStdWString(fi.forumName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FEEDHOLDER_MSG_CHANNEL:
|
||||
{
|
||||
typeLabel->setText("Channel Post To: ");
|
||||
ChannelInfo ci;
|
||||
if ((rsChannels) && (rsChannels->getChannelInfo(mGroupId, ci)))
|
||||
{
|
||||
name = QString::fromStdWString(ci.channelName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FEEDHOLDER_MSG_BLOG:
|
||||
{
|
||||
typeLabel->setText("Blog Post");
|
||||
name = "";
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
nameLabel->setText(name);
|
||||
}
|
||||
|
||||
void SubDestItem::cancel()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "SubDestItem::cancel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
hide();
|
||||
}
|
||||
|
58
retroshare-gui/src/gui/feeds/SubDestItem.h
Normal file
58
retroshare-gui/src/gui/feeds/SubDestItem.h
Normal file
@ -0,0 +1,58 @@
|
||||
/****************************************************************
|
||||
* 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 _SUB_DEST_ITEM_DIALOG_H
|
||||
#define _SUB_DEST_ITEM_DIALOG_H
|
||||
|
||||
#include "ui_SubDestItem.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class SubDestItem : public QWidget, private Ui::SubDestItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
SubDestItem(uint32_t type, std::string groupId, std::string inReplyTo);
|
||||
|
||||
/** Default Destructor */
|
||||
|
||||
uint32_t DestType() { return mType; }
|
||||
std::string DestGroupId() { return mGroupId; }
|
||||
std::string DestInReplyTo() { return mInReplyTo; }
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
uint32_t mType;
|
||||
std::string mGroupId;
|
||||
std::string mInReplyTo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
177
retroshare-gui/src/gui/feeds/SubDestItem.ui
Normal file
177
retroshare-gui/src/gui/feeds/SubDestItem.ui
Normal file
@ -0,0 +1,177 @@
|
||||
<ui version="4.0" >
|
||||
<class>SubDestItem</class>
|
||||
<widget class="QWidget" name="SubDestItem" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>615</width>
|
||||
<height>64</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="typeLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Person/Channel Name</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>71</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Delete FeedItem</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../images.qrc" >:/images/close-down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -27,8 +27,8 @@
|
||||
#define DEBUG_ITEM 1
|
||||
|
||||
/** Constructor */
|
||||
SubFileItem::SubFileItem(std::string hash)
|
||||
:QWidget(NULL), mFileHash(hash)
|
||||
SubFileItem::SubFileItem(std::string hash, std::string name, uint64_t size)
|
||||
:QWidget(NULL), mFileHash(hash), mFileName(name), mFileSize(size)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
@ -37,7 +37,7 @@ SubFileItem::SubFileItem(std::string hash)
|
||||
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||
|
||||
amountDone = 1;
|
||||
amountDone = 1000;
|
||||
|
||||
small();
|
||||
updateItemStatic();
|
||||
@ -57,11 +57,27 @@ void SubFileItem::updateItemStatic()
|
||||
fileLabel->setToolTip(filename);
|
||||
|
||||
playButton->setEnabled(false);
|
||||
|
||||
if (mFileSize > 10000000) /* 10 Mb */
|
||||
{
|
||||
progressBar->setRange(0, mFileSize / 1000000);
|
||||
progressBar->setFormat("%v MB");
|
||||
}
|
||||
else if (mFileSize > 10000) /* 10 Kb */
|
||||
{
|
||||
progressBar->setRange(0, mFileSize / 1000);
|
||||
progressBar->setFormat("%v kB");
|
||||
}
|
||||
else
|
||||
{
|
||||
progressBar->setRange(0, mFileSize);
|
||||
progressBar->setFormat("%v B");
|
||||
}
|
||||
}
|
||||
|
||||
bool SubFileItem::done()
|
||||
{
|
||||
return (amountDone >= 100);
|
||||
return (amountDone >= mFileSize);
|
||||
}
|
||||
|
||||
|
||||
@ -74,17 +90,28 @@ void SubFileItem::updateItem()
|
||||
#endif
|
||||
int msec_rate = 1000;
|
||||
|
||||
if (amountDone < 100)
|
||||
uint64_t divisor = 1;
|
||||
if (mFileSize > 10000000) /* 10 Mb */
|
||||
{
|
||||
divisor = 1000000;
|
||||
}
|
||||
else if (mFileSize > 10000) /* 10 Kb */
|
||||
{
|
||||
divisor = 1000;
|
||||
}
|
||||
|
||||
if (amountDone < mFileSize)
|
||||
{
|
||||
amountDone *= 1.1;
|
||||
|
||||
progressBar->setValue(amountDone);
|
||||
progressBar->setValue(amountDone / divisor);
|
||||
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* complete! */
|
||||
progressBar->setValue(100);
|
||||
amountDone = mFileSize + 1;
|
||||
progressBar->setValue(mFileSize / divisor);
|
||||
playButton->setEnabled(true);
|
||||
}
|
||||
|
||||
|
@ -31,13 +31,17 @@ class SubFileItem : public QWidget, private Ui::SubFileItem
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
SubFileItem(std::string hash);
|
||||
/** Default Constructor */
|
||||
SubFileItem(std::string hash, std::string name, uint64_t size);
|
||||
|
||||
/** Default Destructor */
|
||||
/** Default Destructor */
|
||||
|
||||
void small();
|
||||
bool done();
|
||||
void small();
|
||||
bool done();
|
||||
|
||||
std::string FileHash() { return mFileHash; }
|
||||
std::string FileName() { return mFileName; }
|
||||
uint64_t FileSize() { return mFileSize; }
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
@ -51,6 +55,8 @@ private slots:
|
||||
|
||||
private:
|
||||
std::string mFileHash;
|
||||
std::string mFileName;
|
||||
uint64_t mFileSize;
|
||||
|
||||
/* for display purposes */
|
||||
float amountDone;
|
||||
|
@ -23,10 +23,11 @@
|
||||
#include "CreateForum.h"
|
||||
|
||||
#include "rsiface/rsforums.h"
|
||||
#include "rsiface/rschannels.h"
|
||||
|
||||
/** Constructor */
|
||||
CreateForum::CreateForum(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
CreateForum::CreateForum(QWidget *parent, bool isForum)
|
||||
: QWidget(parent), mIsForum(isForum)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -42,40 +43,74 @@ CreateForum::CreateForum(QWidget *parent)
|
||||
|
||||
void CreateForum::newForum()
|
||||
{
|
||||
/* clear all */
|
||||
ui.forumTypePublic->setChecked(true);
|
||||
ui.forumMsgAnon->setChecked(true);
|
||||
|
||||
if (mIsForum)
|
||||
{
|
||||
/* enforce Public for the moment */
|
||||
ui.typePublic->setChecked(true);
|
||||
|
||||
ui.typePrivate->setEnabled(false);
|
||||
ui.typeEncrypted->setEnabled(false);
|
||||
|
||||
ui.msgAnon->setChecked(true);
|
||||
ui.msgAuth->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enforce Private for the moment */
|
||||
ui.typePrivate->setChecked(true);
|
||||
|
||||
ui.typePublic->setEnabled(false);
|
||||
ui.typeEncrypted->setEnabled(false);
|
||||
|
||||
ui.msgAnon->setChecked(true);
|
||||
ui.msgAuth->setEnabled(false);
|
||||
ui.msgGroupBox->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void CreateForum::createForum()
|
||||
{
|
||||
QString name = ui.forumName->text();
|
||||
QString desc = ui.forumDesc->toHtml();
|
||||
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (ui.forumTypePublic->isChecked())
|
||||
if (ui.typePublic->isChecked())
|
||||
{
|
||||
flags |= RS_DISTRIB_PUBLIC;
|
||||
}
|
||||
else if (ui.forumTypePrivate->isChecked())
|
||||
else if (ui.typePrivate->isChecked())
|
||||
{
|
||||
flags |= RS_DISTRIB_PRIVATE;
|
||||
}
|
||||
else if (ui.forumTypeEncrypted->isChecked())
|
||||
else if (ui.typeEncrypted->isChecked())
|
||||
{
|
||||
flags |= RS_DISTRIB_ENCRYPTED;
|
||||
}
|
||||
|
||||
if (ui.forumMsgAuth->isChecked())
|
||||
if (ui.msgAuth->isChecked())
|
||||
{
|
||||
flags |= RS_DISTRIB_AUTHEN_REQ;
|
||||
}
|
||||
else if (ui.forumMsgAnon->isChecked())
|
||||
else if (ui.msgAnon->isChecked())
|
||||
{
|
||||
flags |= RS_DISTRIB_AUTHEN_ANON;
|
||||
}
|
||||
|
||||
rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags);
|
||||
if (mIsForum)
|
||||
{
|
||||
if (rsForums)
|
||||
{
|
||||
rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rsChannels)
|
||||
{
|
||||
rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags);
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ class CreateForum : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateForum(QWidget *parent = 0);
|
||||
CreateForum(QWidget *parent = 0, bool isForum = true);
|
||||
|
||||
void newForum(); /* cleanup */
|
||||
|
||||
@ -46,6 +46,8 @@ private:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateForum ui;
|
||||
|
||||
bool mIsForum;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -510,7 +510,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Forum Name</string>
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -524,7 +524,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Forum Description</string>
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -534,29 +534,29 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<widget class="QGroupBox" name="tyoeGroupBox" >
|
||||
<property name="title" >
|
||||
<string>Forum Type:</string>
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QRadioButton" name="forumTypePublic" >
|
||||
<widget class="QRadioButton" name="typePublic" >
|
||||
<property name="text" >
|
||||
<string>Public Forum (Shared Publish Key)</string>
|
||||
<string>Public - Anyone can read and publish (Shared Publish Key)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="forumTypePrivate" >
|
||||
<widget class="QRadioButton" name="typePrivate" >
|
||||
<property name="text" >
|
||||
<string>Private Forum (Private Publish Key)</string>
|
||||
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="forumTypeEncrypted" >
|
||||
<widget class="QRadioButton" name="typeEncrypted" >
|
||||
<property name="text" >
|
||||
<string>Encrypted Forum (Private Publish Key required to view Messages)</string>
|
||||
<string>Private - (Private Publish Key required to view Messages)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -564,20 +564,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<widget class="QGroupBox" name="msgGroupBox" >
|
||||
<property name="title" >
|
||||
<string>Allowed Messages</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QRadioButton" name="forumMsgAuth" >
|
||||
<widget class="QRadioButton" name="msgAuth" >
|
||||
<property name="text" >
|
||||
<string>Authemticated Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="forumMsgAnon" >
|
||||
<widget class="QRadioButton" name="msgAnon" >
|
||||
<property name="text" >
|
||||
<string>Anonymous Messages</string>
|
||||
</property>
|
||||
@ -604,7 +604,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="text" >
|
||||
<string>Cancel Forum</string>
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -624,7 +624,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="createButton" >
|
||||
<property name="text" >
|
||||
<string>Create Forum</string>
|
||||
<string>Create</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
|
@ -342,6 +342,7 @@ void ChanMsgDialog::insertSendList()
|
||||
|
||||
void ChanMsgDialog::insertChannelSendList()
|
||||
{
|
||||
#if 0
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsChanId,ChannelInfo>::const_iterator it;
|
||||
@ -399,9 +400,11 @@ void ChanMsgDialog::insertChannelSendList()
|
||||
/* add the items in! */
|
||||
sendWidget->insertTopLevelItems(0, items);
|
||||
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
sendWidget->update(); /* update display */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,17 +47,6 @@ extern RsQblog *rsQblog;
|
||||
RsQblog() { return; }
|
||||
virtual ~RsQblog() { return; }
|
||||
|
||||
/**
|
||||
* allows user to set his status
|
||||
* @param status The status of the user
|
||||
*/
|
||||
virtual bool setStatus(const std::string &status) = 0;
|
||||
|
||||
/**
|
||||
* returns reference to map of usrs and their status
|
||||
* @param usrStatus returns map to usr and their status
|
||||
*/
|
||||
virtual bool getStatus(std::map<std::string, std::string> &usrStatus) = 0;
|
||||
|
||||
/**
|
||||
* choose whether to filter or not
|
||||
@ -82,31 +71,30 @@ extern RsQblog *rsQblog;
|
||||
* @param id The user's frined's id
|
||||
*/
|
||||
virtual bool removeFiltFriend(std::string &usrId) = 0;
|
||||
|
||||
/**
|
||||
* get users fav song
|
||||
* @param usrId the usr whose fav song you want
|
||||
* @param favSong puts ref for fav song here
|
||||
*/
|
||||
virtual bool getProfile(std::map<std::string, std::string> &profile) = 0;
|
||||
|
||||
/**
|
||||
* for now just fav song, TODO: must find way to link to rs profile
|
||||
*/
|
||||
virtual bool setProfile(const std::string &favSong) = 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::string &msg) = 0;
|
||||
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<long int, std:: string> > &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;
|
||||
|
||||
|
||||
/**
|
||||
@ -134,8 +122,7 @@ extern RsQblog *rsQblog;
|
||||
* @param favs list of Files
|
||||
*/
|
||||
virtual bool getPeerFavourites(std::string id, std::list<FileInfo> &favs) = 0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*RSQBLOG_H_*/
|
||||
|
120
retroshare-gui/src/rsiface/rschannels.h
Normal file
120
retroshare-gui/src/rsiface/rschannels.h
Normal file
@ -0,0 +1,120 @@
|
||||
#ifndef RS_CHANNEL_GUI_INTERFACE_H
|
||||
#define RS_CHANNEL_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rschannels.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2008 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 <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "rsiface/rsdistrib.h" /* For FLAGS */
|
||||
|
||||
class ChannelInfo
|
||||
{
|
||||
public:
|
||||
ChannelInfo() {}
|
||||
std::string channelId;
|
||||
std::wstring channelName;
|
||||
std::wstring channelDesc;
|
||||
|
||||
uint32_t channelFlags;
|
||||
uint32_t pop;
|
||||
|
||||
time_t lastPost;
|
||||
};
|
||||
|
||||
class ChannelMsgInfo
|
||||
{
|
||||
public:
|
||||
ChannelMsgInfo() {}
|
||||
std::string channelId;
|
||||
std::string msgId;
|
||||
|
||||
unsigned int msgflags;
|
||||
|
||||
std::wstring subject;
|
||||
std::wstring msg;
|
||||
time_t ts;
|
||||
|
||||
std::list<FileInfo> files;
|
||||
uint32_t count;
|
||||
uint64_t size;
|
||||
};
|
||||
|
||||
|
||||
class ChannelMsgSummary
|
||||
{
|
||||
public:
|
||||
ChannelMsgSummary() {}
|
||||
std::string channelId;
|
||||
std::string msgId;
|
||||
|
||||
uint32_t msgflags;
|
||||
|
||||
std::wstring subject;
|
||||
std::wstring msg;
|
||||
uint32_t count; /* file count */
|
||||
time_t ts;
|
||||
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelMsgSummary &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelMsgInfo &info);
|
||||
|
||||
class RsChannels;
|
||||
extern RsChannels *rsChannels;
|
||||
|
||||
class RsChannels
|
||||
{
|
||||
public:
|
||||
|
||||
RsChannels() { return; }
|
||||
virtual ~RsChannels() { return; }
|
||||
|
||||
/****************************************/
|
||||
|
||||
virtual bool channelsChanged(std::list<std::string> &chanIds) = 0;
|
||||
|
||||
|
||||
virtual std::string createChannel(std::wstring chanName, std::wstring chanDesc, uint32_t chanFlags) = 0;
|
||||
|
||||
virtual bool getChannelInfo(std::string cId, ChannelInfo &ci) = 0;
|
||||
virtual bool getChannelList(std::list<ChannelInfo> &chanList) = 0;
|
||||
virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &msgs) = 0;
|
||||
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0;
|
||||
|
||||
virtual bool ChannelMessageSend(ChannelMsgInfo &info) = 0;
|
||||
|
||||
virtual bool channelSubscribe(std::string cId, bool subscribe) = 0;
|
||||
/****************************************/
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -100,21 +100,6 @@ virtual void unlockData() = 0;
|
||||
const PersonInfo *getPerson(std::string id);
|
||||
const DirInfo *getDirectory(std::string id, std::string path);
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getChannels()
|
||||
{ return mChannelMap; }
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getOurChannels()
|
||||
{ return mChannelOwnMap; }
|
||||
|
||||
//const MessageInfo *getChannelMsg(std::string chId, std::string mId);
|
||||
|
||||
//std::list<ChatInfo> getChatNew()
|
||||
// {
|
||||
// std::list<ChatInfo> newList = mChatList;
|
||||
// mChatList.clear();
|
||||
// return newList;
|
||||
// }
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
|
||||
@ -160,10 +145,6 @@ void fillLists(); /* create some dummy data to display */
|
||||
std::list<PersonInfo> mRemoteDirList;
|
||||
std::list<PersonInfo> mLocalDirList;
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
//std::list<MessageInfo> mMessageList;
|
||||
std::map<RsChanId, ChannelInfo> mChannelMap;
|
||||
std::map<RsChanId, ChannelInfo> mChannelOwnMap;
|
||||
//std::list<ChatInfo> mChatList;
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
bool mChanged[NumOfFlags];
|
||||
@ -218,20 +199,6 @@ virtual int FileCancel(std::string fname, std::string hash, uint32_t size) = 0;
|
||||
virtual int FileClearCompleted() = 0;
|
||||
virtual int FileSetBandwidthTotals(float outkB, float inkB) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Message Items */
|
||||
//virtual int MessageSend(MessageInfo &info) = 0;
|
||||
//virtual int MessageDelete(std::string mid) = 0;
|
||||
//virtual int MessageRead(std::string mid) = 0;
|
||||
|
||||
/* Channel Items */
|
||||
virtual int ChannelCreateNew(ChannelInfo &info) = 0;
|
||||
virtual int ChannelSendMsg(ChannelInfo &info) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Chat */
|
||||
//virtual int ChatSend(ChatInfo &ci) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
|
@ -75,8 +75,8 @@ static const int kRsFiStatusDone = 2;
|
||||
std::string hash;
|
||||
std::string ext;
|
||||
|
||||
int size;
|
||||
int avail; /* how much we have */
|
||||
uint64_t size;
|
||||
uint64_t avail; /* how much we have */
|
||||
int status;
|
||||
|
||||
bool inRecommend;
|
||||
@ -138,26 +138,6 @@ class FileTransferInfo: public FileInfo
|
||||
int downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
};
|
||||
|
||||
class ChannelInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
ChannelInfo() :publisher(false) {}
|
||||
RsChanId chanId;
|
||||
bool publisher;
|
||||
std::string chanName;
|
||||
//std::list<MessageInfo> msglist;
|
||||
|
||||
/* details */
|
||||
int mode;
|
||||
float rank;
|
||||
|
||||
bool inBroadcast;
|
||||
bool inSubscribe;
|
||||
|
||||
int size; /* total of msgs */
|
||||
int count; /* msg count */
|
||||
};
|
||||
|
||||
/* matched to the uPnP states */
|
||||
#define UPNP_STATE_UNINITIALISED 0
|
||||
#define UPNP_STATE_UNAVAILABILE 1
|
||||
@ -230,7 +210,6 @@ class SearchRequest
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const PersonInfo &info);
|
||||
std::ostream &print(std::ostream &out, const DirInfo &info, int indentLvl);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user