示例#1
0
LogInDialog::LogInDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::LogInDialog)
{
    ui->setupUi(this);

    NetManager::GetInstance().DummyInit();

    QObject::connect(&NetManager::GetInstance(), SIGNAL(sigServerConnected()),
                         this, SLOT(ServerConnected()));

    QObject::connect(&NetManager::GetInstance(), SIGNAL(sigServerError(QString)),
                         this, SLOT(ServerError(QString)));

    QObject::connect(&NetManager::GetInstance(), SIGNAL(sigLogInOK()),
                         this, SLOT(WhenLogInOK()));

    QObject::connect(&NetManager::GetInstance(), SIGNAL(sigLogInFAIL(QString)),
                         this, SLOT(WhenlogInFAIL(QString)));


    QObject::connect(ui->btnClose, SIGNAL(clicked()), this, SLOT( ExitNow()));
    QObject::connect(ui->btnLogin, SIGNAL(clicked()), this, SLOT(LogIn()));
    QObject::connect(ui->btnRegister, SIGNAL(clicked()), this, SLOT(RegisterUser()));

    ui->progressMsg->setStyleSheet("QLabel { color : red; }");

    //init state disable
    ui->btnLogin->setEnabled(false);
    ui->btnRegister->setEnabled(false);

    ui->UserPasswdInput->setEchoMode(QLineEdit::Password);
}
示例#2
0
	void UserStatusPage::initializePage ()
	{
		auto cup = qobject_cast<ReportWizard*> (wizard ())->GetChooseUserPage ();

		const auto& login = cup->GetLogin ();
		const auto& pass = cup->GetPassword ();

		if (cup->GetUser () == ChooseUserPage::User::New)
			RegisterUser (login, pass, cup);
	}
示例#3
0
/*
========================
idLobby::AddUsersFromMsg
Called on peer and host.
Simply parses a msg, and adds any new users from it to our own user list.
If we are the host, we will forward this to all peers except the peer that we just received it from.
========================
*/
void idLobby::AddUsersFromMsg( idBitMsg & msg, int fromPeer ) {
	int userStart	= GetNumLobbyUsers();
	int numNewUsers = msg.ReadByte();
	
	assert( lobbyBackend != NULL );

	// Add the new users to our own list
	for ( int u = 0; u < numNewUsers; u++ ) {
		lobbyUser_t newUser;
		
		// Read in the new user
		newUser.ReadFromMsg( msg );

		// Initialize their peerIndex and userID if we are the host
		// (we'll send these back to them in the initial connect)
		if ( IsHost() ) {
			if ( fromPeer != -1 ) {		// -1 means this is the host adding his own users, and this stuff is already computed
				// local users will already have this information filled out.
				newUser.address		= peers[ fromPeer ].address; 
				newUser.peerIndex	= fromPeer;
				if ( lobbyType == TYPE_PARTY ) {
					newUser.partyToken = GetPartyTokenAsHost();
				}
			}
		} else {
			assert( fromPeer == host );
			// The host sends us all user addresses, except his local users, so we compute that here
			if ( newUser.peerIndex == -1 ) {
				newUser.address	= peers[ fromPeer ].address;		
			}
		}

		idLib::Printf( "NET: %s joined (%s) [partyToken = %08x].\n", newUser.gamertag, GetLobbyName(), newUser.partyToken );

		lobbyUser_t * appendedUser = NULL;

		// First, try to replace a disconnected user
		for ( int i = 0; i < GetNumLobbyUsers(); i++ ) {
			lobbyUser_t * user = GetLobbyUser( i );

			if ( user->IsDisconnected() ) {
				userStart = i;
				*user = newUser;
				appendedUser = user;
				break;
			}
		}

		// Add them to our list
		if ( appendedUser == NULL ) {
			appendedUser = AllocUser( newUser );
		}

		// Run platform-specific handler after adding
		assert( appendedUser->peerIndex == newUser.peerIndex );		// paranoia
		assert( appendedUser->lobbyUserID == newUser.lobbyUserID );	// paranoia
		RegisterUser( appendedUser );
	}
	
	// Forward list of the new users to all other peers
	if ( IsHost() ) {
		SendNewUsersToPeers( fromPeer, userStart, numNewUsers );
		
		// Set the lobbies skill level
		lobbyBackend->UpdateLobbySkill( GetAverageSessionLevel() );
	}

	idLib::Printf( "---------------- %s --------------------\n", GetLobbyName() );
	for( int userIndex = 0; userIndex < GetNumLobbyUsers(); ++userIndex ) {
		lobbyUser_t * user = GetLobbyUser( userIndex );
		idLib::Printf( "party %08x user %s\n", user->partyToken, user->gamertag );
	}
	idLib::Printf( "---------------- %s --------------------\n", GetLobbyName() );
}