Added back the Subscribe Button to Channels

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6905 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2013-11-21 00:02:33 +00:00
parent c447ab2829
commit eab486f5db
3 changed files with 89 additions and 35 deletions

View File

@ -78,6 +78,8 @@ ChannelFeed::ChannelFeed(QWidget *parent)
connect(treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
connect(treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
connect( subscribeButton , SIGNAL( clicked() ), this, SLOT( subscribeChannel() ) );
mChannelId.clear();
@ -107,6 +109,9 @@ ChannelFeed::ChannelFeed(QWidget *parent)
updateChannelList();
nameLabel->setMinimumWidth(20);
unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), this );
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
/* load settings */
processSettings(true);
@ -185,9 +190,6 @@ void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ )
QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu);
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu);
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu);
connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) );
@ -589,6 +591,8 @@ void ChannelFeed::updateChannelMsgs()
delete (*mit);
}
mChanMsgItems.clear();
QMenu *subscribemenu = new QMenu();
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
@ -596,9 +600,15 @@ void ChannelFeed::updateChannelMsgs()
nameLabel->setText(tr("No Channel Selected"));
logoLabel->setPixmap(QPixmap(":/images/channels.png"));
logoLabel->setEnabled(false);
subscribeButton->setEnabled(false);
subscribeButton->setPopupMode(QToolButton::InstantPopup);
subscribeButton->setMenu(NULL);
subscribeButton->setIcon(QIcon(""));
subscribeButton->setText(tr("Subscribe"));
return;
}
QPixmap chanImage;
if (ci.pngImageLen != 0) {
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
@ -619,8 +629,25 @@ void ChannelFeed::updateChannelMsgs()
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
actionEnable_Auto_Download->setEnabled(true);
subscribeButton->setEnabled(true);
subscribeButton->setPopupMode(QToolButton::MenuButtonPopup);
subscribeButton->setIcon(QIcon(":/images/accepted16.png"));
subscribeButton->setText(tr("Subscribed"));
//subscribemenu->addAction(autochannelAct );
subscribemenu->addSeparator();
subscribemenu->addAction(unsubscribechannelAct);
subscribeButton->setMenu(subscribemenu);
} else {
actionEnable_Auto_Download->setEnabled(false);
subscribeButton->setEnabled(true);
subscribeButton->setPopupMode(QToolButton::InstantPopup);
subscribeButton->setMenu(NULL);
subscribeButton->setIcon(QIcon(""));
subscribeButton->setText(tr("Subscribe"));
}
#ifdef USE_THREAD

View File

@ -106,12 +106,17 @@ private:
QList<ChanMsgItem *> mChanMsgItems;
std::map<std::string, uint32_t> mChanSearchScore; //chanId, score
QTreeWidgetItem *ownChannels;
QTreeWidgetItem *subcribedChannels;
QTreeWidgetItem *popularChannels;
QTreeWidgetItem *otherChannels;
QTreeWidgetItem *ownChannels;
QTreeWidgetItem *subcribedChannels;
QTreeWidgetItem *popularChannels;
QTreeWidgetItem *otherChannels;
ChannelFillThread *fillThread;
/** Defines the actions for the context menu */
QAction* unsubscribechannelAct;
ChannelFillThread *fillThread;
};
class ChannelFillThread : public QThread

View File

@ -77,8 +77,14 @@
</item>
<item>
<widget class="QToolButton" name="helpButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
@ -184,29 +190,6 @@
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="postButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Post to Channel</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -220,6 +203,45 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="subscribeButton">
<property name="text">
<string>Subscribe</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="postButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Post to Channel</string>
</property>
<property name="text">
<string>Post</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -254,7 +276,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>513</width>
<width>534</width>
<height>16</height>
</rect>
</property>