From eab486f5db9a67aa9c29d8752cf5f072b42bb5cb Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 21 Nov 2013 00:02:33 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/ChannelFeed.cpp | 35 ++++++++++-- retroshare-gui/src/gui/ChannelFeed.h | 15 ++++-- retroshare-gui/src/gui/ChannelFeed.ui | 74 +++++++++++++++++--------- 3 files changed, 89 insertions(+), 35 deletions(-) diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 53bac81be..2be1c0719 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -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 diff --git a/retroshare-gui/src/gui/ChannelFeed.h b/retroshare-gui/src/gui/ChannelFeed.h index a92c4f811..5f21d98c4 100644 --- a/retroshare-gui/src/gui/ChannelFeed.h +++ b/retroshare-gui/src/gui/ChannelFeed.h @@ -106,12 +106,17 @@ private: QList mChanMsgItems; std::map 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 diff --git a/retroshare-gui/src/gui/ChannelFeed.ui b/retroshare-gui/src/gui/ChannelFeed.ui index 2ccf8ce45..0c6241975 100644 --- a/retroshare-gui/src/gui/ChannelFeed.ui +++ b/retroshare-gui/src/gui/ChannelFeed.ui @@ -77,8 +77,14 @@ - - Qt::NoFocus + + + 0 + 0 + + + + @@ -184,29 +190,6 @@ 2 - - - - Qt::NoFocus - - - Post to Channel - - - - :/images/mail_send.png:/images/mail_send.png - - - - 32 - 16 - - - - true - - - @@ -220,6 +203,45 @@ + + + + Subscribe + + + Qt::ToolButtonTextBesideIcon + + + + + + + Qt::NoFocus + + + Post to Channel + + + Post + + + + :/images/mail_send.png:/images/mail_send.png + + + + 16 + 16 + + + + Qt::ToolButtonTextBesideIcon + + + false + + + @@ -254,7 +276,7 @@ 0 0 - 513 + 534 16