auto download option:

ability to enable and disable channels auto dl added
added gui update to channel feed
msg download not enabled yet

cache opt:
added more enable cache opt #defines to disable cache opt code





git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4133 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2011-04-07 22:10:10 +00:00
parent 814c5d1619
commit 1bef23042f
4 changed files with 664 additions and 613 deletions

View File

@ -42,6 +42,8 @@
#include "notifyqt.h"
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
#define ENABLE_AUTO_DL "Enable Auto-Download"
#define DISABLE_AUTO_DL "Disable Auto-Download"
#define WARNING_LIMIT 3600*24*2
@ -61,6 +63,7 @@ ChannelFeed::ChannelFeed(QWidget *parent)
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
connect(setAllAsReadButton, SIGNAL(clicked()), this, SLOT(setAllAsReadClicked()));
connect(autoDownload, SIGNAL(clicked()), this, SLOT(toggleAutoDownload()));
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
@ -84,6 +87,7 @@ ChannelFeed::ChannelFeed(QWidget *parent)
popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(), false);
otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(), false);
//added from ahead
updateChannelList();
@ -238,6 +242,14 @@ void ChannelFeed::selectChannel(const QString &id)
{
mChannelId = id.toStdString();
bool autoDl = false;
rsChannels->channelGetAutoDl(mChannelId, autoDl);
if(autoDl)
autoDownload->setText(QString(DISABLE_AUTO_DL));
else
autoDownload->setText(QString(ENABLE_AUTO_DL));
updateChannelMsgs();
}
@ -450,14 +462,21 @@ void ChannelFeed::updateChannelMsgs()
subscribeButton->setEnabled(true);
unsubscribeButton->setEnabled(false);
setAllAsReadButton->setEnabled(false);
autoDownload->setEnabled(false);
}
if (ci.channelFlags & RS_DISTRIB_PUBLISH) {
postButton->setEnabled(true);
autoDownload->setEnabled(false);
} else {
postButton->setEnabled(false);
}
if(!(ci.channelFlags & RS_DISTRIB_PUBLISH) &&
(ci.channelFlags & RS_DISTRIB_SUBSCRIBED))
autoDownload->setEnabled(true);
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;
rsChannels->getChannelMsgList(mChannelId, msgs);
@ -482,7 +501,7 @@ void ChannelFeed::unsubscribeChannel()
#endif
if (rsChannels) {
rsChannels->channelSubscribe(mChannelId, false);
rsChannels->channelSubscribe(mChannelId, false, false);
}
updateChannelMsgs();
@ -497,7 +516,7 @@ void ChannelFeed::subscribeChannel()
#endif
if (rsChannels) {
rsChannels->channelSubscribe(mChannelId, true);
rsChannels->channelSubscribe(mChannelId, true, true);
}
updateChannelMsgs();
@ -545,3 +564,27 @@ void ChannelFeed::setAllAsReadClicked()
}
}
}
void ChannelFeed::toggleAutoDownload(){
if(mChannelId.empty())
return;
bool autoDl = true;
if(rsChannels->channelGetAutoDl(mChannelId, autoDl)){
// if auto dl is set true, then set false
if(autoDl){
rsChannels->channelSetAutoDl(mChannelId, false);
autoDownload->setText(QString(ENABLE_AUTO_DL));
}else{
rsChannels->channelSetAutoDl(mChannelId, true);
autoDownload->setText(QString(DISABLE_AUTO_DL));
}
}
else{
std::cerr << "Auto Download failed to set"
<< std::endl;
}
}

View File

@ -61,6 +61,7 @@ private slots:
void subscribeChannel();
void unsubscribeChannel();
void setAllAsReadClicked();
void toggleAutoDownload();
void createMsg();

File diff suppressed because it is too large Load Diff

View File

@ -188,7 +188,7 @@ void ChanNewItem::unsubscribeChannel()
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, false);
rsChannels->channelSubscribe(mChanId, false, false);
}
updateItemStatic();
}
@ -202,7 +202,7 @@ void ChanNewItem::subscribeChannel()
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, true);
rsChannels->channelSubscribe(mChanId, true, true);
}
updateItemStatic();
}