mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Start the CreateLobbyDialog from the list of chat lobbies with the privacy level of the selected item.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4866 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
75f152a21f
commit
55d53e6dd4
@ -19,6 +19,7 @@
|
|||||||
#define ROLE_SORT Qt::UserRole
|
#define ROLE_SORT Qt::UserRole
|
||||||
#define ROLE_ID Qt::UserRole + 1
|
#define ROLE_ID Qt::UserRole + 1
|
||||||
#define ROLE_SUBSCRIBED Qt::UserRole + 2
|
#define ROLE_SUBSCRIBED Qt::UserRole + 2
|
||||||
|
#define ROLE_PRIVACYLEVEL Qt::UserRole + 3
|
||||||
|
|
||||||
#define TYPE_FOLDER 0
|
#define TYPE_FOLDER 0
|
||||||
#define TYPE_LOBBY 1
|
#define TYPE_LOBBY 1
|
||||||
@ -65,11 +66,13 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
|||||||
privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
||||||
privateLobbyItem->setText(COLUMN_NAME, tr("Private Lobbies"));
|
privateLobbyItem->setText(COLUMN_NAME, tr("Private Lobbies"));
|
||||||
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
|
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
|
||||||
|
privateLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
|
||||||
lobbyTreeWidget->insertTopLevelItem(0, privateLobbyItem);
|
lobbyTreeWidget->insertTopLevelItem(0, privateLobbyItem);
|
||||||
|
|
||||||
publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
||||||
publicLobbyItem->setText(COLUMN_NAME, tr("Public Lobbies"));
|
publicLobbyItem->setText(COLUMN_NAME, tr("Public Lobbies"));
|
||||||
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
|
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
|
||||||
|
publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
|
||||||
lobbyTreeWidget->insertTopLevelItem(1, publicLobbyItem);
|
lobbyTreeWidget->insertTopLevelItem(1, publicLobbyItem);
|
||||||
|
|
||||||
lobbyTreeWidget->expandAll();
|
lobbyTreeWidget->expandAll();
|
||||||
@ -83,11 +86,15 @@ ChatLobbyWidget::~ChatLobbyWidget()
|
|||||||
|
|
||||||
void ChatLobbyWidget::lobbyTreeWidgetCostumPopupMenu()
|
void ChatLobbyWidget::lobbyTreeWidgetCostumPopupMenu()
|
||||||
{
|
{
|
||||||
|
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
|
||||||
|
|
||||||
QMenu contextMnu(this);
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
contextMnu.addAction(QIcon(IMAGE_CREATE), tr("Create chat lobby"), this, SLOT(createChatLobby()));
|
if (item && item->type() == TYPE_FOLDER) {
|
||||||
|
QAction *action = contextMnu.addAction(QIcon(IMAGE_CREATE), tr("Create chat lobby"), this, SLOT(createChatLobby()));
|
||||||
|
action->setData(item->data(COLUMN_DATA, ROLE_PRIVACYLEVEL).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
|
|
||||||
if (item && item->type() == TYPE_LOBBY) {
|
if (item && item->type() == TYPE_LOBBY) {
|
||||||
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool()) {
|
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool()) {
|
||||||
contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeItem()));
|
contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeItem()));
|
||||||
@ -96,6 +103,10 @@ void ChatLobbyWidget::lobbyTreeWidgetCostumPopupMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contextMnu.children().count() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,8 +283,14 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
|
|
||||||
void ChatLobbyWidget::createChatLobby()
|
void ChatLobbyWidget::createChatLobby()
|
||||||
{
|
{
|
||||||
|
int privacyLevel = 0;
|
||||||
|
QAction *action = qobject_cast<QAction*>(sender());
|
||||||
|
if (action) {
|
||||||
|
privacyLevel = action->data().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::string> friends;
|
std::list<std::string> friends;
|
||||||
CreateLobbyDialog(friends).exec();
|
CreateLobbyDialog(friends, privacyLevel).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void subscribeLobby(QTreeWidgetItem *item)
|
static void subscribeLobby(QTreeWidgetItem *item)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "ChatDialog.h"
|
#include "ChatDialog.h"
|
||||||
|
|
||||||
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWidget *parent, Qt::WFlags flags) :
|
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, int privacyLevel, QWidget *parent, Qt::WFlags flags) :
|
||||||
QDialog(parent, flags)
|
QDialog(parent, flags)
|
||||||
{
|
{
|
||||||
ui = new Ui::CreateLobbyDialog() ;
|
ui = new Ui::CreateLobbyDialog() ;
|
||||||
@ -56,6 +56,10 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWi
|
|||||||
ui->keyShareList->start();
|
ui->keyShareList->start();
|
||||||
ui->keyShareList->setSelectedSslIds(peer_list, false);
|
ui->keyShareList->setSelectedSslIds(peer_list, false);
|
||||||
|
|
||||||
|
if (privacyLevel) {
|
||||||
|
ui->security_CB->setCurrentIndex((privacyLevel == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
checkTextFields();
|
checkTextFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
|
|
||||||
class CreateLobbyDialog : public QDialog {
|
class CreateLobbyDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
*@param chanId The channel id to send request for
|
*@param chanId The channel id to send request for
|
||||||
*/
|
*/
|
||||||
CreateLobbyDialog(const std::list<std::string>& friends_list,QWidget *parent = 0, Qt::WFlags flags = 0);
|
CreateLobbyDialog(const std::list<std::string>& friends_list, int privacyLevel = 0, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
~CreateLobbyDialog();
|
~CreateLobbyDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user