Ejemplo n.º 1
0
void doubanLogin::onLoginButtonClicked()
{
    qDebug() << Q_FUNC_INFO;
    emit loginRequest(ui->aliasInput->text().trimmed(),ui->passwdInput->text().trimmed(),ui->verificaitonInput->text().trimmed());
//    ui->loginButton->setEnabled(false);
//    ui->cancleButton->setEnabled(false);
//    ui->aliasInput->setEnabled(false);
//    ui->passwdInput->setEnabled(false);
//    ui->verificaitonInput->setEnabled(false);
}
Ejemplo n.º 2
0
void
add_prog_1(char *host)
{
	CLIENT *clnt;
	outData  *result_1;
	inData  register_1_arg;
	outData  *result_2;
	//inData  login_1_arg;

#ifndef	DEBUG
	clnt = clnt_create (host, ADD_PROG, ADD_VERS, "udp");
	if (clnt == NULL) {
		clnt_pcreateerror (host);
		exit (1);
	}
#endif	/* DEBUG */
// Neeraj Start
	int value = 1;
	char* userName;
	char* password;
	char str[20],c=' ';
	int i = 0;

	printf("\n1. Register\n2. Login");
	printf("\nPlease provide your choice: ");
	scanf("%d", &register_1_arg.mode);
	if(register_1_arg.mode != 1 && register_1_arg.mode != 2) {
		printf("\nSorry, you have choosen wrong input.\n");
	} 
	else {
		printf("Enter the username: "******"%s", &register_1_arg.user);
		printf("Enter the password: "******"%s", &register_1_arg.pass);
		if(register_1_arg.mode == 1) {
			result_1 = registerRequest(&register_1_arg, clnt);
			if (result_1 == (outData *) NULL) {
				clnt_perror (clnt, "call failed");
			}
			else {
				if(result_1->rCode == 1){
					char input;
					printf("\nDo you want to login[y/n]?");
					scanf(" %c", &input);
					if(input == 'y') {
						result_2 = loginRequest(&register_1_arg, clnt);
					}
				}
			}
		}
		else if(register_1_arg.mode == 2) {
			result_2 = loginRequest(&register_1_arg, clnt);
			if (result_2 == (outData *) NULL) {
				clnt_perror (clnt, "call failed");
			}
		}
		
		
	}
#ifndef	DEBUG
	clnt_destroy (clnt);
#endif	 /* DEBUG */
}
Ejemplo n.º 3
0
doubanFM::doubanFM(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::doubanFM)
{
    qDebug() << Q_FUNC_INFO;
    ui->setupUi(this);


    currentSongIndex = 0;
    pauseState = false;

    _channelListWidget = new channelList(this);
    _channelListWidget->setchannelId(currentChannelId);
    _channelListWidget->move(-_channelListWidget->getInvisibleWidth(),this->geometry().y());

    _pauseMaskWidget = new pauseMaskWidget(this);
    _pauseMaskWidget->move(250,0);
    _pauseMaskWidget->setVisible(false);


    _loginwidget = new doubanLogin(this);
    _loginwidget->move(this->geometry().x(),-_loginwidget->geometry().height());

    _mediaObject = new Phonon::MediaObject(this);
    _audioOutput = new Phonon::AudioOutput(this);
    Phonon::createPath(_mediaObject,_audioOutput);
    ui->seekSlider->setMediaObject(_mediaObject);


    albumImageManager = new QNetworkAccessManager(this);
    _mydouban = new Douban(this);

    readSettings();
    qDebug() << "read setting" << _mydouban->hasLogin();
    if(_mydouban->hasLogin())
    {
        ui->userLoginButton->setToolTip(tr("click to logout"));
        ui->userLabel->setText(_mydouban->getDoubanUser().name);
    }
    else
    {
        ui->userLoginButton->setToolTip(tr("click to login"));
        ui->userLabel->setText(tr("Logout"));
    }

    nextShortCut = new QxtGlobalShortcut(QKeySequence("Alt+s"),this);
    pauseShortCut = new QxtGlobalShortcut(QKeySequence("Alt+p"),this);
    rateShortCut = new QxtGlobalShortcut(QKeySequence("Alt+r"),this);
    trashShortCut = new QxtGlobalShortcut(QKeySequence("Alt+t"),this);

    connect(nextShortCut,SIGNAL(activated()),this,SLOT(onSkipButtonClicked()));
    connect(pauseShortCut,SIGNAL(activated()),this,SLOT(onPauseButtonClicked()));
    connect(rateShortCut,SIGNAL(activated()),this,SLOT(onRateButtonClicked()));
    connect(trashShortCut,SIGNAL(activated()),this,SLOT(onTrashButtonClicked()));


    //connect the mainwidget signals and the slots
    connect(ui->volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(onVolumneChange(int)));
    connect(ui->pauseButton,SIGNAL(clicked()),this,SLOT(onPauseButtonClicked()));
    connect(ui->userLoginButton,SIGNAL(clicked()),this,SLOT(onLoginButtonClicked()));
    connect(_mediaObject,SIGNAL(tick(qint64)),this,SLOT(playTick(qint64)));
    connect(albumImageManager,SIGNAL(finished(QNetworkReply*)),this,SLOT(receiveAlbumImage(QNetworkReply*)));
    connect(this,SIGNAL(albumImageRequest(QString)),this,SLOT(onAlbumImage(QString)));
    connect(ui->rateSongButton,SIGNAL(clicked()),this,SLOT(onRateButtonClicked()));
    connect(ui->nextSongButton,SIGNAL(clicked()),this,SLOT(onSkipButtonClicked()));
    connect(ui->byeSongButton,SIGNAL(clicked()),this,SLOT(onTrashButtonClicked()));
    connect(_mediaObject,SIGNAL(currentSourceChanged(Phonon::MediaSource)),this,SLOT(sourceChanged(Phonon::MediaSource)));
    connect(_mediaObject,SIGNAL(stateChanged(Phonon::State,Phonon::State)),this,SLOT(stateChanged(Phonon::State,Phonon::State)));

//    connect the mainwidget signals and the slots of other widget
    connect(this,SIGNAL(sendlogoutRequest()),_mydouban,SLOT(logoutRequest()));
    connect(this,SIGNAL(sendSongListRequest(qint32,quint32,double)),_mydouban,SLOT(newSongListRequest(qint32,quint32,double)));
    connect(this,SIGNAL(sendSkipSongRequest(qint32,quint32,double)),_mydouban,SLOT(skipSongRequest(qint32,quint32,double)));
    connect(this,SIGNAL(sendRateSongRequest(qint32,quint32,double,bool)),_mydouban,SLOT(rateSongRequest(qint32,quint32,double,bool)));
    connect(this,SIGNAL(sendEndSongRequest(qint32,quint32,double)),_mydouban,SLOT(endSongRequest(qint32,quint32,double)));
    connect(this,SIGNAL(sendByeSongRequest(qint32,quint32,double)),_mydouban,SLOT(byeSongRequest(qint32,quint32,double)));

//  connect the signals of other widget and the mainwidget slot
    connect(_mydouban,SIGNAL(loginSucceed(DoubanUser)),this,SLOT(loginSucceed(DoubanUser)));
    connect(_mydouban,SIGNAL(sendSongList(QList<DoubanFMSong>)),this,SLOT(receiveSongList(QList<DoubanFMSong>)));
    connect(_mydouban,SIGNAL(sendRateSong(bool)),this,SLOT(receiveRateSong(bool)));
    connect(_mydouban,SIGNAL(sendSkipSong(bool)),this,SLOT(receiveSkipSong(bool)));
    connect(_mydouban,SIGNAL(sendByeSong(bool)),this,SLOT(receiveByeSong(bool)));
    connect(_mydouban,SIGNAL(sendEndSong(bool)),this,SLOT(receiveEndSong(bool)));
    connect(_mydouban,SIGNAL(sendChannelList(QList<DoubanChannel>,bool)),this,SLOT(receiveChannelList(QList<DoubanChannel>,bool)));
    connect(_mydouban,SIGNAL(sendLogoutSucceed(bool)),this,SLOT(logoutSucceed(bool)));
    connect(_pauseMaskWidget,SIGNAL(mousePressed()),this,SLOT(pauseMaskWidgetPressed()));
    connect(_channelListWidget,SIGNAL(channelChanged(qint32)),this,SLOT(receiveChannelChange(qint32)));


    //connect the other widget signal and slots
    connect(_mydouban,SIGNAL(captchaImageLoad(QPixmap)),_loginwidget,SLOT(onCaptchaImageLoad(QPixmap)));
    connect(_mydouban,SIGNAL(loginFailed(QString)),_loginwidget,SLOT(onLoginFailed(QString)));
    connect(_mydouban,SIGNAL(sendChannelList(QList<DoubanChannel>,bool)),_channelListWidget,SLOT(onReceiveChannelList(QList<DoubanChannel>,bool)));
    connect(_loginwidget,SIGNAL(loginRequest(QString,QString,QString)),_mydouban,SLOT(loginRequest(QString,QString,QString)));

    _mydouban->channelListRequest();
}
Ejemplo n.º 4
0
void StratumClient::connectedToHost() {
  qDebug() << "Connected!!!";
  loginRequest();
}
Ejemplo n.º 5
0
void CLogInPage::setConnections()
{
	QObject::connect( m_pRegister, SIGNAL( registerClicked() ), this, SIGNAL( registerRequest() ) );
	QObject::connect( m_pRegisterModeButton, SIGNAL( clicked() ), this, SLOT( registerClicled() ) );
	QObject::connect( m_pLogin, SIGNAL( loginClicked() ), this, SIGNAL( loginRequest() ) );
}
Ejemplo n.º 6
0
int clientConnection(int* cli_sock)
{

	int r_size;
	int control;
	char* firstCommand;
	int firstComm,secondComm;

	char* user = malloc(MAX_USERNAME_LENGTH);
	char* password = malloc(MAX_PASSWORD_LENGTH);

	firstCommand=malloc(ANSWER_LENGTH);	

	//Client should login

	/*do {
		if ((r_size = read(cli_sock, user, MAX_USERNAME_LENGTH)) == -1){
			perror("Read error");
		}

		if ((r_size = read(cli_sock, password, MAX_PASSWORD_LENGTH)) == -1){
			perror("Read error");
		}


		/*if ((control = write(cli_sock, buff, r_size)) == -1){
			perror("Write error");
		}

	}while (r_size > 0);

	if(checkUserLogin(user,password)==1)
		puts("User Logged");
	else
		puts("Bad Login");*/

	
	//Si mette in attesa del comando da parte del client

	do{
		puts("Waiting for client first command");
		read(cli_sock, firstCommand, CLIENT_COMMAND_LENGTH);
		
		#ifdef DEBUG
		puts("Comando preso in input:");
		puts(firstCommand);
		#endif

	} while (getClientFirstCommand(firstCommand)==-1);


	
	if(firstComm=='0')
	{
		//Client Registration
		if(registrationRequest(cli_sock)==-1)
			puts("Registrazione al servizio fallita");
		else
			puts("Registrazione al servizio avvenuta con successo");

		
	}
	else if(firstComm=='1')
	{
		//Client login

		if(loginRequest(cli_sock)==-1)
			puts("Login al servizio falita");
		else
			puts("Login al servizio avvenuta con successo");
	}

	
	do{
		puts("Waiting for client second command");
		read(cli_sock, secondComm, CLIENT_COMMAND_LENGTH);
		
		#ifdef DEBUG
		puts("Comando preso in input:");
		puts(secondComm);
		#endif

	} while (getClientSecondCommand(secondComm)==-1);

	if(secondComm=='2')
	{
		//Client Logout
		if(logoutRequest(cli_sock)==-1)
			puts("Logout al servizio fallito");
		else
			puts("Logout al servizio avvenuta con successo");
		
		//Terminates thread

		pthread_exit(-1);

		
	}
	else if(secondComm=='3')
	{
		//Client status 'available'

		if(availableRequest(cli_sock)==-1)
			puts("Aggiornamento di statocdisponibile fallito");
		else
			puts("Aggiornamento di stato disponibile avvenuto con successo");
	}
	else if(secondComm=='4')
	{
		//Client status 'busy'

		if(busyRequest(cli_sock)==-1)
			puts("Aggiornamento di statocdisponibile fallito");
		else
			puts("Aggiornamento di stato occupato avvenuto con successo");
	}
	else if(secondComm=='5')
	{
		//Retrieve available user list

		if(retrieveListRequest(cli_sock)==-1)
			puts("Richiesta lista utenti disponibili al servizio fallita");
		else
			puts("Richeiesta lista utenti disponibili al servizio avvenuta con successo");
	}
	
	
	

	pthread_exit(1);
	
}