mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 01:08:50 -04:00
merged in new lobbies with GXS ids. Old peers and new peers cannot see each others lobby lists. Invitations still work and can be used to transfer a lobby ID between versions. Messages of old and new peers will not be visible to each other
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7986 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2044575067
commit
f9c78ebd61
22 changed files with 1430 additions and 980 deletions
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "ChatDialog.h"
|
||||
#include "gui/ChatLobbyWidget.h"
|
||||
|
||||
CreateLobbyDialog::CreateLobbyDialog(const std::list<RsPeerId>& peer_list, int privacyLevel, QWidget *parent) :
|
||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
|
@ -41,20 +42,22 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<RsPeerId>& peer_list, int p
|
|||
ui->headerFrame->setHeaderImage(QPixmap(":/images/chat_64.png"));
|
||||
ui->headerFrame->setHeaderText(tr("Create Chat Lobby"));
|
||||
|
||||
std::string default_nick ;
|
||||
rsMsgs->getDefaultNickNameForChatLobby(default_nick) ;
|
||||
RsGxsId default_identity ;
|
||||
rsMsgs->getDefaultIdentityForChatLobby(default_identity) ;
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
ui->lobbyName_LE->setPlaceholderText(tr("Put a sensible lobby name here")) ;
|
||||
ui->nickName_LE->setPlaceholderText(tr("Your nickname for this lobby (Change default name in options->chat)")) ;
|
||||
#endif
|
||||
ui->nickName_LE->setText(QString::fromUtf8(default_nick.c_str())) ;
|
||||
ui->idChooser_CB->loadIds(IDCHOOSER_ID_REQUIRED, default_identity);
|
||||
|
||||
//#if QT_VERSION >= 0x040700
|
||||
// ui->lobbyName_LE->setPlaceholderText(tr("Put a sensible lobby name here")) ;
|
||||
// ui->nickName_LE->setPlaceholderText(tr("Your nickname for this lobby (Change default name in options->chat)")) ;
|
||||
//#endif
|
||||
// ui->nickName_LE->setText(QString::fromUtf8(default_nick.c_str())) ;
|
||||
|
||||
connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(createLobby()));
|
||||
connect( ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
connect( ui->lobbyTopic_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||
connect( ui->idChooser_CB, SIGNAL( currentChanged ( int ) ), this, SLOT( checkTextFields( ) ) );
|
||||
|
||||
/* initialize key share list */
|
||||
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||
|
@ -64,7 +67,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<RsPeerId>& peer_list, int p
|
|||
ui->keyShareList->setSelectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peer_list, false);
|
||||
|
||||
if (privacyLevel) {
|
||||
ui->security_CB->setCurrentIndex((privacyLevel == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
|
||||
ui->security_CB->setCurrentIndex((privacyLevel == CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
|
||||
}
|
||||
|
||||
checkTextFields();
|
||||
|
@ -91,10 +94,17 @@ void CreateLobbyDialog::changeEvent(QEvent *e)
|
|||
|
||||
void CreateLobbyDialog::checkTextFields()
|
||||
{
|
||||
if(ui->lobbyName_LE->text() == "" || ui->nickName_LE->text() == "")
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false) ;
|
||||
else
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true) ;
|
||||
RsGxsId id ;
|
||||
|
||||
switch(ui->idChooser_CB->getChosenId(id))
|
||||
{
|
||||
case GxsIdChooser::NoId:
|
||||
case GxsIdChooser::None: ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false) ;
|
||||
break ;
|
||||
default:
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateLobbyDialog::createLobby()
|
||||
|
@ -102,29 +112,36 @@ void CreateLobbyDialog::createLobby()
|
|||
std::list<RsPeerId> shareList;
|
||||
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
||||
|
||||
// if (shareList.empty()) {
|
||||
// QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
// return;
|
||||
// }
|
||||
// if (shareList.empty()) {
|
||||
// QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// create chat lobby !!
|
||||
std::string lobby_name = ui->lobbyName_LE->text().toUtf8().constData() ;
|
||||
std::string lobby_topic = ui->lobbyTopic_LE->text().toUtf8().constData() ;
|
||||
// create chat lobby !!
|
||||
std::string lobby_name = ui->lobbyName_LE->text().toUtf8().constData() ;
|
||||
std::string lobby_topic = ui->lobbyTopic_LE->text().toUtf8().constData() ;
|
||||
|
||||
// add to group
|
||||
// set nick name !
|
||||
RsGxsId gxs_id ;
|
||||
switch(ui->idChooser_CB->getChosenId(gxs_id))
|
||||
{
|
||||
case GxsIdChooser::NoId:
|
||||
case GxsIdChooser::None:
|
||||
return ;
|
||||
}
|
||||
// add to group
|
||||
|
||||
int lobby_privacy_type = (ui->security_CB->currentIndex() == 0)?RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC:RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE ;
|
||||
ChatLobbyFlags lobby_flags ;
|
||||
|
||||
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, lobby_topic, shareList, lobby_privacy_type);
|
||||
if(ui->security_CB->currentIndex() == 0)
|
||||
lobby_flags |= RS_CHAT_LOBBY_FLAGS_PUBLIC ;
|
||||
|
||||
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
|
||||
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topic, shareList, lobby_flags);
|
||||
|
||||
// set nick name !
|
||||
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
|
||||
|
||||
rsMsgs->setNickNameForChatLobby(id,ui->nickName_LE->text().toUtf8().constData()) ;
|
||||
|
||||
// open chat window !!
|
||||
// open chat window !!
|
||||
ChatDialog::chatFriend(ChatId(id)) ;
|
||||
|
||||
close();
|
||||
close();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue