mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Channels: added demo context menu to channel browser
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@285 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d807a5324f
commit
826860bb2e
@ -287,7 +287,7 @@
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt;">Retroshare's Demo Channel</span></p></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt;">Name of Selected Channel</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
@ -443,7 +443,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:italic; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:normal;">Subscribe to this channel to get news on the latest groovy happenings on Retroshare. </span></p></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:normal;">Once a channel is selected in the tree (left), it's description, data, title and icon will appear here in this right hand side panel.<br><br>The user can subscribe / remove subscriptions or change to the relevant page to manage their channels as required via the context menu. </span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignJustify|Qt::AlignTop</set>
|
||||
|
@ -20,10 +20,65 @@
|
||||
****************************************************************/
|
||||
|
||||
#include "channelBrowserDialog.h"
|
||||
|
||||
ChannelBrowserDialog::ChannelBrowserDialog(QWidget * parent) : QDialog (parent)
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKSUBSCRIBE = ":/images/channelsubscribe.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKUNSUBSCRIBE = ":/images/channeldelete.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_MANAGE_SUB = ":/images/channels.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_MANAGE_CHANNEL = ":/images/channels.png";
|
||||
const QString ChannelBrowserDialog::IMAGE_QUICKDELETE = ":/images/channeldelete.png";
|
||||
|
||||
ChannelBrowserDialog::ChannelBrowserDialog(QWidget * parent)
|
||||
: QDialog (parent), browserContextMenu(0)
|
||||
{
|
||||
setupUi(this);
|
||||
channelTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect( channelTreeWidget, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(channelTreeWidgetCustumPopupMenu(QPoint)));
|
||||
|
||||
}
|
||||
|
||||
void ChannelBrowserDialog::channelTreeWidgetCustumPopupMenu( QPoint point )
|
||||
{
|
||||
// block the popup if no results available
|
||||
if ((channelTreeWidget->selectedItems()).size() == 0) return;
|
||||
|
||||
// create the menu as required
|
||||
if (browserContextMenu == 0)
|
||||
{
|
||||
// setup the browser context menu
|
||||
browserContextMenu = new QMenu(this);
|
||||
|
||||
// determine the selected channel and adjust the context menu accordingly i.e. no
|
||||
// quick subscribe entry if the channel is already subscribed to etc
|
||||
quickSubscribeAct = new QAction(QIcon(IMAGE_QUICKSUBSCRIBE), tr( "Subscribe" ), this );
|
||||
connect( quickSubscribeAct, SIGNAL( triggered() ), this, SLOT( quickSubscribe() ) );
|
||||
quickUnsubscribeAct = new QAction(QIcon(IMAGE_QUICKUNSUBSCRIBE), tr( "Remove Subscription" ), this );
|
||||
connect( quickUnsubscribeAct, SIGNAL( triggered() ), this, SLOT( quickSubscribe() ) );
|
||||
subscribeToChannelAct = new QAction(QIcon(IMAGE_MANAGE_SUB), tr( "Manage Subscription" ), this );
|
||||
connect( subscribeToChannelAct, SIGNAL( triggered() ), this, SLOT( subscribeToChannel() ) );
|
||||
editChannelAct = new QAction(QIcon(IMAGE_MANAGE_CHANNEL), tr( "Manage Channel" ), this );
|
||||
connect( editChannelAct, SIGNAL( triggered() ), this, SLOT( manageChannel() ) );
|
||||
quickDeleteAct = new QAction(QIcon(IMAGE_QUICKDELETE), tr( "Quick Delete" ), this );
|
||||
connect( quickDeleteAct, SIGNAL( triggered() ), this, SLOT( quickDelete() ) );
|
||||
|
||||
|
||||
|
||||
browserContextMenu->clear();
|
||||
browserContextMenu->addAction( new QAction("NOTE: Entries will be dynamic!!", this));
|
||||
browserContextMenu->addSeparator();
|
||||
browserContextMenu->addAction( quickSubscribeAct);
|
||||
browserContextMenu->addAction( quickUnsubscribeAct);
|
||||
browserContextMenu->addAction( subscribeToChannelAct);
|
||||
browserContextMenu->addSeparator();
|
||||
browserContextMenu->addAction( quickDeleteAct);
|
||||
browserContextMenu->addAction( editChannelAct);
|
||||
}
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||
Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||
browserContextMenu->exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
void ChannelBrowserDialog::quickSubscribe(){}
|
||||
void ChannelBrowserDialog::quickUnsubscribe(){}
|
||||
void ChannelBrowserDialog::subscribeToChannel(){}
|
||||
void ChannelBrowserDialog::manageChannel(){}
|
||||
void ChannelBrowserDialog::quickDelete(){}
|
||||
|
@ -21,7 +21,8 @@
|
||||
#ifndef _ChannelBrowserDialog_h_
|
||||
#define _ChannelBrowserDialog_h_
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtGui>
|
||||
|
||||
#include "ui_ChannelBrowserDialog.h"
|
||||
|
||||
class ChannelBrowserDialog : public QDialog,
|
||||
@ -32,7 +33,38 @@ public Ui::ChannelBrowserDialog
|
||||
public:
|
||||
ChannelBrowserDialog(QWidget * parent = 0 );
|
||||
|
||||
private slots:
|
||||
void channelTreeWidgetCustumPopupMenu( QPoint point );
|
||||
|
||||
private:
|
||||
/* constants for the image files */
|
||||
static const QString IMAGE_QUICKSUBSCRIBE;
|
||||
static const QString IMAGE_QUICKUNSUBSCRIBE;
|
||||
static const QString IMAGE_MANAGE_SUB;
|
||||
static const QString IMAGE_MANAGE_CHANNEL;
|
||||
static const QString IMAGE_QUICKDELETE;
|
||||
|
||||
QMenu * browserContextMenu;
|
||||
|
||||
// actions for the context menu
|
||||
/** context menu: allows one-click subscription to a channel */
|
||||
QAction* quickSubscribeAct;
|
||||
/** context menu: allows one-click removal of channel subscription*/
|
||||
QAction* quickUnsubscribeAct;
|
||||
/** context menu: switches to the my subscriptions page with this
|
||||
channel selected */
|
||||
QAction* subscribeToChannelAct;
|
||||
/** context menu: switches to my channels page with this channel
|
||||
selected */
|
||||
QAction* editChannelAct;
|
||||
/** conetxt menu: one-click delete (with confirmation pop-up) */
|
||||
QAction* quickDeleteAct;
|
||||
|
||||
void quickSubscribe();
|
||||
void quickUnsubscribe();
|
||||
void subscribeToChannel();
|
||||
void manageChannel();
|
||||
void quickDelete();
|
||||
};
|
||||
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
<file>help/licence.html</file>
|
||||
<file>help/thanks.html</file>
|
||||
<file>images/channels.png</file>
|
||||
<file>images/channeldelete.png</file>
|
||||
<file>images/channelsubscribe.png</file>
|
||||
<file>images/FileTypeAny.png</file>
|
||||
<file>images/FileTypeArchive.png</file>
|
||||
<file>images/FileTypeAudio.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/channeldelete.png
Normal file
BIN
retroshare-gui/src/gui/images/channeldelete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
retroshare-gui/src/gui/images/channelsubscribe.png
Normal file
BIN
retroshare-gui/src/gui/images/channelsubscribe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Loading…
Reference in New Issue
Block a user