mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-31 20:04:36 -04:00
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:
parent
814c5d1619
commit
1bef23042f
4 changed files with 664 additions and 613 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ private slots:
|
|||
void subscribeChannel();
|
||||
void unsubscribeChannel();
|
||||
void setAllAsReadClicked();
|
||||
void toggleAutoDownload();
|
||||
|
||||
void createMsg();
|
||||
|
||||
|
|
|
@ -506,6 +506,13 @@ border-image: url(:/images/btn_26_pressed.png) 4;
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="autoDownload">
|
||||
<property name="text">
|
||||
<string>Enable Auto-download</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -542,8 +549,8 @@ border-image: url(:/images/btn_26_pressed.png) 4;
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>404</width>
|
||||
<height>331</height>
|
||||
<width>407</width>
|
||||
<height>330</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue