예제 #1
0
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list, int privacyLevel, QWidget *parent, Qt::WFlags flags) :
	QDialog(parent, flags)
{
	ui = new Ui::CreateLobbyDialog() ;
	ui->setupUi(this);

	std::string default_nick ;
	rsMsgs->getDefaultNickNameForChatLobby(default_nick) ;

#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->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( createLobby( ) ) );
	connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
	connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
	connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );

	/* initialize key share list */
	ui->keyShareList->setHeaderText(tr("Contacts:"));
	ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
	ui->keyShareList->start();
	ui->keyShareList->setSelectedSslIds(peer_list, false);

	if (privacyLevel) {
		ui->security_CB->setCurrentIndex((privacyLevel == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
	}

	checkTextFields();
}
예제 #2
0
CreateLobbyDialog::CreateLobbyDialog(const std::set<RsPeerId>& peer_list, int privacyLevel, QWidget *parent) :
	QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
	ui = new Ui::CreateLobbyDialog() ;
	ui->setupUi(this);

	ui->headerFrame->setHeaderImage(QPixmap(":/images/chat_64.png"));
	ui->headerFrame->setHeaderText(tr("Create Chat Lobby"));

    RsGxsId default_identity ;
    rsMsgs->getDefaultIdentityForChatLobby(default_identity) ;

    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->lobbyTopic_LE->setPlaceholderText(tr("Set a descriptive topic here"));
#endif

	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->idChooser_CB, SIGNAL( currentIndexChanged ( int ) ), this, SLOT( checkTextFields( ) ) );
    connect( ui->pgp_signed_CB, SIGNAL( toggled ( bool ) ), this, SLOT( checkTextFields( ) ) );

	/* initialize key share list */
	ui->keyShareList->setHeaderText(tr("Contacts:"));
	ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
	ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
	ui->keyShareList->start();
    ui->keyShareList->setSelectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(peer_list, false);

	if (privacyLevel) {
        ui->security_CB->setCurrentIndex((privacyLevel == CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? 0 : 1);
	}

	checkTextFields();

	ui->lobbyName_LE->setFocus();
}
예제 #3
0
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWidget *parent, Qt::WFlags flags, std::string grpId, int grpType) :
        QDialog(parent, flags), mGrpId(grpId), mGrpType(grpType)
{
	ui = new Ui::CreateLobbyDialog() ;
    ui->setupUi(this);

	 std::string default_nick ;
	 rsMsgs->getDefaultNickNameForChatLobby(default_nick) ;

	 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)")) ;
	 ui->nickName_LE->setText(QString::fromStdString(default_nick)) ;

    connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( createLobby( ) ) );
    connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
    connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
    connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );

    connect(ui->keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
            this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));

    setShareList(peer_list);
	 checkTextFields() ;
}