void LoginManager::tryLogin() { disconnect(this, SIGNAL(loginSuccess()), this, SLOT(tryLogin())); connect(this, SIGNAL(getUserSuccess()), this, SLOT(onTryLoginSuccess())); connect(this, SIGNAL(getUserError(QString)), this, SLOT(onTryLoginError(QString))); getUser(); }
void Login::on_pushButton_login_clicked() { QString uname; QString pwd; QSqlQuery query; QString sql = "SELECT name,pwd FROM user WHERE name = '" + ui->lineEdit_uname->text() + "';"; //qDebug() << sql; if ( query.exec( sql ) ) { while(query.next()) { uname = query.value(0).toString(); pwd = query.value(1).toString(); } } if (ui->lineEdit_uname->text() == uname) { if (ui->lineEdit_pwd->text() == pwd) { ui->label_msg->setText("登录成功!"); GSession::uname = uname; emit loginSuccess(); this->close(); } else { ui->label_msg->setText("登录失败,密码错误!"); ui->lineEdit_pwd->selectAll(); } } else { ui->label_msg->setText("登录失败,没有该用户!"); ui->lineEdit_uname->selectAll(); } }
void LoginManager::onAccessTokenReceived(QString token, QString tokenSecret) { //qDebug() << "Access token received: " << token << tokenSecret; _accessToken = token; _accessTokenSecret = tokenSecret; disconnect(_oauthManager, SIGNAL(requestReady(QByteArray)), this, SLOT(onAccessTokenRequestReady(QByteArray))); emit loginSuccess(); }
void MainWindow::login() { oauth = new OAuthN(); oauth->setGeometry(100,0,500,400); //oauth->setParent(this); connect(oauth, SIGNAL(authSuccess(QString,QString)),this, SLOT(getToken(QString, QString))); connect(this,SIGNAL(haveToken()),this, SLOT(loginSuccess())); // FIXME : Change getGroups slot - to Login Succesfull slot acessuble from qml oauth->show(); }
void LoginManager::onTryLoginError(const QString& error) { Q_UNUSED(error); disconnect(this, SIGNAL(getUserSuccess()), this, SLOT(onTryLoginSuccess())); disconnect(this, SIGNAL(getUserError(QString)), this, SLOT(onTryLoginError(QString))); connect(this, SIGNAL(loginSuccess()), this, SLOT(tryLogin())); logout(); mscore->showLoginDialog(); }
void LoginDialog::slotAcceptLogin(bool){ QMessageBox msgBx; if(currentConnection.connected){ QSqlQuery query; unsigned int userId ; QString name; QString passP; QString first; QString last; QString middle; QString emailAddress; QDate birth; query.exec("SELECT user_id, user_name, password, first_name, last_name, middle_name, email, birthdate FROM users"); while (query.next()) { userId = query.value(0).toUInt(); name = query.value(1).toString(); passP = query.value(2).toString(); first = query.value(3).toString(); last = query.value(4).toString(); middle = query.value(5).toString(); emailAddress = query.value(6).toString(); birth = query.value(7).toDate(); } if(name!=userNameLine->text()|| passP!=passwordLine->text()){ msgBx.setText("Error: Please enter a valid username and password"); msgBx.exec(); emit loginSuccess(false); } else{ User currentUser(userId,first,middle,last,name,passP,emailAddress,birth); emit acceptLogin(currentUser); emit loginSuccess(true); } currentConnection.db.close(); } else{ msgBx.setText("Not connected to server"); msgBx.exec(); } }
void LoginManager::onLoginReply(QNetworkReply* reply, int code, const QJsonObject& obj) { if (code == HTTP_OK) { _accessToken = obj["token"].toString(); _refreshToken = obj["refresh_token"].toString(); if (!_accessToken.isEmpty()) emit loginSuccess(); else emit loginError(tr("Wrong response from the server")); } else emit loginError(getErrorString(reply, obj)); }
void LoginManager::onTryLoginError(const QString& error) { Q_UNUSED(error); disconnect(this, SIGNAL(getUserSuccess()), this, SLOT(onTryLoginSuccess())); disconnect(this, SIGNAL(getUserError(QString)), this, SLOT(onTryLoginError(QString))); connect(this, SIGNAL(loginSuccess()), this, SLOT(tryLogin())); logout(); #ifdef USE_WEBENGINE loginInteractive(); #else mscore->showLoginDialog(); #endif }
void FbxAPI::requestSessionFinished() { QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender()); QJsonDocument doc = QJsonDocument::fromJson(reply->readAll()); if (parseResult(doc)) { mRequestLoginAttempt = 0; mSessionToken = doc.object().value("result").toObject().value("session_token").toString(); mPermissions = doc.object().value("result").toObject().value("permissions").toObject().keys(); mLogged = true; emit sessionReceived(); emit loginSuccess(); } }
void ClientSyncer::coreHasData() { QVariant item; while(SignalProxy::readDataFromDevice(_socket, _blockSize, item)) { emit recvPartialItem(1,1); QVariantMap msg = item.toMap(); if(!msg.contains("MsgType")) { // This core is way too old and does not even speak our init protocol... emit connectionError(tr("The Quassel Core you try to connect to is too old! Please consider upgrading.")); disconnectFromCore(); return; } if(msg["MsgType"] == "ClientInitAck") { clientInitAck(msg); } else if(msg["MsgType"] == "ClientInitReject") { emit connectionError(msg["Error"].toString()); disconnectFromCore(); return; } else if(msg["MsgType"] == "CoreSetupAck") { emit coreSetupSuccess(); } else if(msg["MsgType"] == "CoreSetupReject") { emit coreSetupFailed(msg["Error"].toString()); } else if(msg["MsgType"] == "ClientLoginReject") { emit loginFailed(msg["Error"].toString()); } else if(msg["MsgType"] == "ClientLoginAck") { // prevent multiple signal connections disconnect(this, SIGNAL(recvPartialItem(quint32, quint32)), this, SIGNAL(sessionProgress(quint32, quint32))); connect(this, SIGNAL(recvPartialItem(quint32, quint32)), this, SIGNAL(sessionProgress(quint32, quint32))); emit loginSuccess(); } else if(msg["MsgType"] == "SessionInit") { sessionStateReceived(msg["SessionState"].toMap()); break; // this is definitively the last message we process here! } else { emit connectionError(tr("<b>Invalid data received from core!</b><br>Disconnecting.")); disconnectFromCore(); return; } } if(_blockSize > 0) { emit recvPartialItem(_socket->bytesAvailable(), _blockSize); } }
void SpotifySettingsDialog::slotTryLogin() { DEBUG_BLOCK Spotify::Controller* controller = The::SpotifyController(); Q_ASSERT( controller ); if( !controller->running() || !controller->loaded() ) { controller->setFilePath( Collections::SpotifyCollection::resolverPath() ); controller->start(); } connect(controller, SIGNAL(customMessage(QString,QVariantMap)), SLOT(slotCustomMessage(QString,QVariantMap))); connect(controller, SIGNAL(loginSuccess(QString)), SLOT(slotLoginSuccess(QString))); connect(controller, SIGNAL(loginFailed(QString)), SLOT(slotLoginFailed(QString))); controller->login( m_settingsWidget->lineUsername->text(), m_settingsWidget->linePassword->text(), m_settingsWidget->checkHighQuality->isChecked() ); save(); }
void GagBookManager::onLoginFinished() { if(m_loginReply->error() == QNetworkReply::NoError) { const int statusCode = m_loginReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); const QUrl redirectUrl = m_loginReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); // if redirect to 9gag.com, means login success if (statusCode >= 300 && statusCode < 400 && redirectUrl.host() == "9gag.com") { m_settings->setLoggedIn(true); emit loginSuccess(); } else { emit loginFailure("Wrong username or password. Please try again."); } } else { emit loginFailure(m_loginReply->errorString()); } m_loginReply->deleteLater(); m_loginReply = 0; if (m_isBusy != false) { m_isBusy = false; emit busyChanged(); } }
bool sbbs_t::answer() { char str[MAX_PATH+1],str2[MAX_PATH+1],c; char tmp[(MAX_PATH > CRYPT_MAX_TEXTSIZE ? MAX_PATH:CRYPT_MAX_TEXTSIZE)+1]; char tmpname[CRYPT_MAX_TEXTSIZE+1]; char path[MAX_PATH+1]; int i,l,in; struct tm tm; useron.number=0; answertime=logontime=starttime=now=time(NULL); /* Caller ID is IP address */ SAFECOPY(cid,client_ipaddr); memset(&tm,0,sizeof(tm)); localtime_r(&now,&tm); safe_snprintf(str,sizeof(str),"%s %s %s %02d %u Node %3u" ,hhmmtostr(&cfg,&tm,str2) ,wday[tm.tm_wday] ,mon[tm.tm_mon],tm.tm_mday,tm.tm_year+1900,cfg.node_num); logline("@ ",str); safe_snprintf(str,sizeof(str),"%s %s [%s]", connection, client_name, cid); logline("@+:",str); if(client_ident[0]) { safe_snprintf(str,sizeof(str),"Identity: %s",client_ident); logline("@*",str); } online=ON_REMOTE; if(sys_status&SS_RLOGIN) { if(incom(1000)==0) { for(i=0;i<(int)sizeof(str)-1;i++) { in=incom(1000); if(in==0 || in==NOINP) break; str[i]=in; } str[i]=0; for(i=0;i<(int)sizeof(str2)-1;i++) { in=incom(1000); if(in==0 || in==NOINP) break; str2[i]=in; } str2[i]=0; for(i=0;i<(int)sizeof(terminal)-1;i++) { in=incom(1000); if(in==0 || in==NOINP) break; terminal[i]=in; } terminal[i]=0; lprintf(LOG_DEBUG,"Node %d RLogin: '******' / '%.*s' / '%s'" ,cfg.node_num ,LEN_ALIAS*2,str ,LEN_ALIAS*2,str2 ,terminal); SAFECOPY(rlogin_term, terminal); SAFECOPY(rlogin_name, str2); SAFECOPY(rlogin_pass, str); /* Truncate terminal speed (e.g. "/57600") from terminal-type string (but keep full terminal type/speed string in rlogin_term): */ truncstr(terminal,"/"); useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name); if(useron.number) { getuserdat(&cfg,&useron); useron.misc&=~TERM_FLAGS; SAFEPRINTF(path,"%srlogin.cfg",cfg.ctrl_dir); if(!findstr(client.addr,path)) { SAFECOPY(tmp, rlogin_pass); for(i=0;i<3;i++) { if(stricmp(tmp,useron.pass)) { badlogin(useron.alias, tmp); rioctl(IOFI); /* flush input buffer */ bputs(text[InvalidLogon]); if(cfg.sys_misc&SM_ECHO_PW) safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt: '%s'" ,0,useron.alias,tmp); else safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt" ,0,useron.alias); logline(LOG_NOTICE,"+!",str); bputs(text[PasswordPrompt]); console|=CON_R_ECHOX; getstr(tmp,LEN_PASS*2,K_UPPER|K_LOWPRIO|K_TAB); console&=~(CON_R_ECHOX|CON_L_ECHOX); } else { if(REALSYSOP) { rioctl(IOFI); /* flush input buffer */ if(!chksyspass()) bputs(text[InvalidLogon]); else { i=0; break; } } else break; } } if(i) { if(stricmp(tmp,useron.pass)) { badlogin(useron.alias, tmp); bputs(text[InvalidLogon]); if(cfg.sys_misc&SM_ECHO_PW) safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt: '%s'" ,0,useron.alias,tmp); else safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt" ,0,useron.alias); logline(LOG_NOTICE,"+!",str); } lprintf(LOG_WARNING,"Node %d !CLIENT IP NOT LISTED in %s" ,cfg.node_num,path); useron.number=0; hangup(); } } } else lprintf(LOG_INFO,"Node %d RLogin: Unknown user: %s",cfg.node_num,rlogin_name); } if(rlogin_name[0]==0) { lprintf(LOG_NOTICE,"Node %d !RLogin: No user name received",cfg.node_num); sys_status&=~SS_RLOGIN; } } if(!(telnet_mode&TELNET_MODE_OFF)) { /* Disable Telnet Terminal Echo */ request_telnet_opt(TELNET_WILL,TELNET_ECHO); /* Will suppress Go Ahead */ request_telnet_opt(TELNET_WILL,TELNET_SUP_GA); /* Retrieve terminal type and speed from telnet client --RS */ request_telnet_opt(TELNET_DO,TELNET_TERM_TYPE); request_telnet_opt(TELNET_DO,TELNET_TERM_SPEED); request_telnet_opt(TELNET_DO,TELNET_SEND_LOCATION); request_telnet_opt(TELNET_DO,TELNET_NEGOTIATE_WINDOW_SIZE); request_telnet_opt(TELNET_DO,TELNET_NEW_ENVIRON); } #ifdef USE_CRYPTLIB if(sys_status&SS_SSH) { pthread_mutex_lock(&ssh_mutex); cryptGetAttributeString(ssh_session, CRYPT_SESSINFO_USERNAME, tmpname, &i); tmpname[i]=0; SAFECOPY(rlogin_name, tmpname); cryptGetAttributeString(ssh_session, CRYPT_SESSINFO_PASSWORD, tmp, &i); tmp[i]=0; SAFECOPY(rlogin_pass, tmp); pthread_mutex_unlock(&ssh_mutex); lprintf(LOG_DEBUG,"Node %d SSH login: '******'" ,cfg.node_num, tmpname); useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, tmpname); if(useron.number) { getuserdat(&cfg,&useron); useron.misc&=~TERM_FLAGS; for(i=0;i<3;i++) { if(stricmp(tmp,useron.pass)) { badlogin(useron.alias, tmp); rioctl(IOFI); /* flush input buffer */ bputs(text[InvalidLogon]); if(cfg.sys_misc&SM_ECHO_PW) safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt: '%s'" ,0,useron.alias,tmp); else safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt" ,0,useron.alias); /* crash here Sept-12-2010 str 0x06b3fc4c "(0000) Guest FAILED Password attempt: '*****@*****.**'" and Oct-6-2010 str 0x070ffc4c "(0000) Woot903 FAILED Password attempt: 'p67890pppsdsjhsdfhhfhnhnfhfhfdhjksdjkfdskw3902391=`'" char [261] */ logline(LOG_NOTICE,"+!",str); bputs(text[PasswordPrompt]); console|=CON_R_ECHOX; getstr(tmp,LEN_PASS*2,K_UPPER|K_LOWPRIO|K_TAB); console&=~(CON_R_ECHOX|CON_L_ECHOX); } else { if(REALSYSOP) { rioctl(IOFI); /* flush input buffer */ if(!chksyspass()) bputs(text[InvalidLogon]); else { i=0; break; } } else break; } } if(i) { if(stricmp(tmp,useron.pass)) { badlogin(useron.alias, tmp); bputs(text[InvalidLogon]); if(cfg.sys_misc&SM_ECHO_PW) safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt: '%s'" ,0,useron.alias,tmp); else safe_snprintf(str,sizeof(str),"(%04u) %-25s FAILED Password attempt" ,0,useron.alias); logline(LOG_NOTICE,"+!",str); } useron.number=0; hangup(); } } else lprintf(LOG_INFO,"Node %d SSH: Unknown user: %s",cfg.node_num,rlogin_name); } #endif /* Detect terminal type */ mswait(200); rioctl(IOFI); /* flush input buffer */ putcom( "\r\n" /* locate cursor at column 1 */ "\x1b[s" /* save cursor position (necessary for HyperTerm auto-ANSI) */ "\x1b[255B" /* locate cursor as far down as possible */ "\x1b[255C" /* locate cursor as far right as possible */ "\b_" /* need a printable at this location to actually move cursor */ "\x1b[6n" /* Get cursor position */ "\x1b[u" /* restore cursor position */ "\x1b[!_" /* RIP? */ "\x1b[30;40m\xc2\x9f""Zuul.connection.write('\\x1b""Are you the gatekeeper?')\xc2\x9c" /* ZuulTerm? */ "\x1b[0m_" /* "Normal" colors */ "\x1b[2J" /* clear screen */ "\x1b[H" /* home cursor */ "\xC" /* clear screen (in case not ANSI) */ "\r" /* Move cursor left (in case previous char printed) */ ); i=l=0; tos=1; lncntr=0; safe_snprintf(str, sizeof(str), "%s %s", VERSION_NOTICE, COPYRIGHT_NOTICE); strip_ctrl(str, str); center(str); while(i++<50 && l<(int)sizeof(str)-1) { /* wait up to 5 seconds for response */ c=incom(100)&0x7f; if(c==0) continue; i=0; if(l==0 && c!=ESC) // response must begin with escape char continue; str[l++]=c; if(c=='R') { /* break immediately if ANSI response */ mswait(500); break; } } while((c=(incom(100)&0x7f))!=0 && l<(int)sizeof(str)-1) str[l++]=c; str[l]=0; if(l) { c_escape_str(str,tmp,sizeof(tmp),TRUE); lprintf(LOG_DEBUG,"Node %d received terminal auto-detection response: '%s'" ,cfg.node_num,tmp); if(str[0]==ESC && str[1]=='[' && str[l-1]=='R') { int x,y; if(terminal[0]==0) SAFECOPY(terminal,"ANSI"); autoterm|=(ANSI|COLOR); if(sscanf(str+2,"%u;%u",&y,&x)==2) { lprintf(LOG_DEBUG,"Node %d received ANSI cursor position report: %ux%u" ,cfg.node_num, x, y); /* Sanity check the coordinates in the response: */ if(x>=40 && x<=255) cols=x; if(y>=10 && y<=255) rows=y; } } truncsp(str); if(strstr(str,"RIPSCRIP")) { if(terminal[0]==0) SAFECOPY(terminal,"RIP"); logline("@R",strstr(str,"RIPSCRIP")); autoterm|=(RIP|COLOR|ANSI); } else if(strstr(str,"Are you the gatekeeper?")) { if(terminal[0]==0) SAFECOPY(terminal,"HTML"); logline("@H",strstr(str,"Are you the gatekeeper?")); autoterm|=HTML; } } else if(terminal[0]==0) SAFECOPY(terminal,"DUMB"); rioctl(IOFI); /* flush left-over or late response chars */ if(!autoterm && str[0]) { c_escape_str(str,tmp,sizeof(tmp),TRUE); lprintf(LOG_NOTICE,"Node %d terminal auto-detection failed, response: '%s'" ,cfg.node_num, tmp); } /* AutoLogon via IP or Caller ID here */ if(!useron.number && !(sys_status&SS_RLOGIN) && (startup->options&BBS_OPT_AUTO_LOGON) && cid[0]) { useron.number=userdatdupe(0, U_NOTE, LEN_NOTE, cid); if(useron.number) { getuserdat(&cfg, &useron); if(!(useron.misc&AUTOLOGON) || !(useron.exempt&FLAG('V'))) useron.number=0; } } if(!online) return(false); if(stricmp(terminal,"sexpots")==0) { /* dial-up connection (via SexPOTS) */ SAFEPRINTF2(str,"%s connection detected at %lu bps", terminal, cur_rate); logline("@S",str); node_connection = (ushort)cur_rate; SAFEPRINTF(connection,"%lu",cur_rate); SAFECOPY(cid,"Unknown"); SAFECOPY(client_name,"Unknown"); if(telnet_location[0]) { /* Caller-ID info provided */ SAFEPRINTF(str, "CID: %s", telnet_location); logline("@*",str); SAFECOPY(cid,telnet_location); truncstr(cid," "); /* Only include phone number in CID */ char* p=telnet_location; FIND_WHITESPACE(p); SKIP_WHITESPACE(p); if(*p) { SAFECOPY(client_name,p); /* CID name, if provided (maybe 'P' or 'O' if private or out-of-area) */ } } SAFECOPY(client.addr,cid); SAFECOPY(client.host,client_name); client_on(client_socket,&client,TRUE /* update */); } else { if(telnet_location[0]) { /* Telnet Location info provided */ SAFEPRINTF(str, "Telnet Location: %s", telnet_location); logline("@*",str); } } useron.misc&=~TERM_FLAGS; useron.misc|=autoterm; SAFECOPY(useron.comp,client_name); if(!useron.number && rlogin_name[0]!=0 && !(cfg.sys_misc&SM_CLOSED) && !matchuser(&cfg, rlogin_name, /* Sysop alias: */FALSE)) { lprintf(LOG_INFO,"Node %d UNKNOWN %s-specified USERNAME: %s, starting new user signup",cfg.node_num,client.protocol,rlogin_name); bprintf("%s: %s\r\n", text[UNKNOWN_USER], rlogin_name); newuser(); } if(!useron.number) { /* manual/regular logon */ /* Display ANSWER screen */ rioctl(IOSM|PAUSE); sys_status|=SS_PAUSEON; SAFEPRINTF(str,"%sanswer",cfg.text_dir); SAFEPRINTF(path,"%s.rip",str); if((autoterm&RIP) && fexistcase(path)) printfile(path,P_NOABORT); else { SAFEPRINTF(path,"%s.html",str); if((autoterm&HTML) && fexistcase(path)) printfile(path,P_NOABORT); else { SAFEPRINTF(path,"%s.ans",str); if((autoterm&ANSI) && fexistcase(path)) printfile(path,P_NOABORT); else { SAFEPRINTF(path,"%s.asc",str); if(fexistcase(path)) printfile(path, P_NOABORT); } } } sys_status&=~SS_PAUSEON; exec_bin(cfg.login_mod,&main_csi); } else /* auto logon here */ if(logon()==false) return(false); if(!useron.number) hangup(); /* Save the IP to the user's note */ if(cid[0]) { SAFECOPY(useron.note,cid); putuserrec(&cfg,useron.number,U_NOTE,LEN_NOTE,useron.note); } /* Save host name to the user's computer description */ if(client_name[0]) { SAFECOPY(useron.comp,client_name); putuserrec(&cfg,useron.number,U_COMP,LEN_COMP,useron.comp); } if(!online) return(false); if(!(sys_status&SS_USERON)) { errormsg(WHERE,ERR_CHK,"User not logged on",0); hangup(); return(false); } if(useron.pass[0]) loginSuccess(startup->login_attempt_list, &client_addr); return(true); }
void QDiscordWsComponent::initDispatchTable() { _eventDispatchTable = { {"READY", [&](const QJsonObject& dataObject){ _heartbeatTimer.start(dataObject["heartbeat_interval"].toInt()); #ifdef QDISCORD_LIBRARY_DEBUG qDebug()<<this<<"beating every "<< _heartbeatTimer.interval()/1000.<<" seconds"; #endif _tryReconnecting = true; _reconnectAttempts = 0; emit loginSuccess(); emit readyReceived(dataObject); }}, {"GUILD_CREATE", [this](const QJsonObject& dataObject){ emit guildCreateReceived(dataObject); }}, {"MESSAGE_CREATE", [this](const QJsonObject& dataObject){ emit messageCreateReceived(dataObject); }}, {"MESSAGE_DELETE", [this](const QJsonObject& dataObject){ emit messageDeleteReceived(dataObject); }}, {"MESSAGE_UPDATE", [this](const QJsonObject& dataObject){ emit messageUpdateReceived(dataObject); }}, {"TYPING_START", [this](const QJsonObject& dataObject){ emit typingStartReceived(dataObject); }}, {"VOICE_STATE_UPDATE", [this](const QJsonObject& dataObject){ emit voiceStateUpdateReceived(dataObject); }}, {"CHANNEL_CREATE", [this](const QJsonObject& dataObject){ emit channelCreateReceived(dataObject); }}, {"CHANNEL_DELETE", [this](const QJsonObject& dataObject){ emit channelDeleteReceived(dataObject); }}, {"CHANNEL_UPDATE", [this](const QJsonObject& dataObject){ emit channelUpdateReceived(dataObject); }}, {"GUILD_DELETE", [this](const QJsonObject& dataObject){ emit guildDeleteReceived(dataObject); }}, {"GUILD_BAN_ADD", [this](const QJsonObject& dataObject){ emit guildBanAddReceived(dataObject); }}, {"GUILD_BAN_REMOVE", [this](const QJsonObject& dataObject){ emit guildBanRemoveReceived(dataObject); }}, {"GUILD_INTEGRATIONS_UPDATE", [this](const QJsonObject& dataObject){ emit guildIntegrationsUpdateRecevied(dataObject); }}, {"GUILD_MEMBER_ADD", [this](const QJsonObject& dataObject){ emit guildMemberAddReceived(dataObject); }}, {"GUILD_MEMBER_REMOVE", [this](const QJsonObject& dataObject){ emit guildMemberRemoveReceived(dataObject); }}, {"GUILD_MEMBER_UPDATE", [this](const QJsonObject& dataObject){ emit guildMemberUpdateReceived(dataObject); }}, {"GUILD_ROLE_CREATE", [this](const QJsonObject& dataObject){ emit guildRoleCreateReceived(dataObject); }}, {"GUILD_ROLE_DELETE", [this](const QJsonObject& dataObject){ emit guildRoleDeleteReceived(dataObject); }}, {"GUILD_ROLE_UPDATE", [this](const QJsonObject& dataObject){ emit guildRoleUpdateReceived(dataObject); }}, {"GUILD_UPDATE", [this](const QJsonObject& dataObject){ emit guildUpdateReceived(dataObject); }}, {"PRESENCE_UPDATE", [this](const QJsonObject& dataObject){ emit presenceUpdateReceived(dataObject); }}, {"USER_SETTINGS_UPDATE", [this](const QJsonObject& dataObject){ emit userSettingsUpdateReceived(dataObject); }} }; }
void PlayerSetupDialog::setCurrentPlayer(PlayerConnection* con) { if(con == m_con) return; m_stickyConnectionMessage = false; if(m_con) { disconnect(ui->playerName, 0, m_con, 0); disconnect(ui->playerHost, 0, m_con, 0); disconnect(ui->playerUser, 0, m_con, 0); disconnect(ui->playerPass, 0, m_con, 0); disconnect(m_con, 0, this, 0); } if(m_subviewModel) { delete m_subviewModel; m_subviewModel = 0; } m_con = con; if(!con) { ui->boxConnection->setEnabled(false); ui->boxOutput->setEnabled(false); ui->boxSubviewOpts->setEnabled(false); ui->boxSubviews->setEnabled(false); ui->boxKeystone->setEnabled(true); return; } if(con->isConnected()) conConnected(); else conDisconnected(); // Set up the UI with values from the player before connecting slots so we dont needlessly update the object ui->playerName->setText(con->name()); ui->playerHost->setText(con->host()); ui->playerUser->setText(con->user()); ui->playerPass->setText(con->pass()); ui->autoconnectBox->setChecked(con->autoconnect()); ui->optIgnoreAR->setChecked(con->aspectRatioMode() == Qt::IgnoreAspectRatio); QRect screen = con->screenRect(); if(screen.isEmpty()) con->setScreenRect(screen = QRect(0,0,1024,768)); ui->outputX->setValue(screen.x()); ui->outputY->setValue(screen.y()); ui->outputWidth->setValue(screen.width()); ui->outputHeight->setValue(screen.height()); QRect view = con->viewportRect(); if(view.isEmpty()) con->setViewportRect(view = QRect(0,0,1000,750)); ui->viewportX->setValue(view.x()); ui->viewportY->setValue(view.y()); ui->viewportWidth->setValue(view.width()); ui->viewportHeight->setValue(view.height()); connect(ui->playerName, SIGNAL(textChanged(QString)), con, SLOT(setName(QString))); connect(ui->playerHost, SIGNAL(textChanged(QString)), con, SLOT(setHost(QString))); connect(ui->playerUser, SIGNAL(textChanged(QString)), con, SLOT(setUser(QString))); connect(ui->playerPass, SIGNAL(textChanged(QString)), con, SLOT(setPass(QString))); connect(con, SIGNAL(connected()), this, SLOT(conConnected())); connect(con, SIGNAL(disconnected()), this, SLOT(conDisconnected())); connect(con, SIGNAL(loginSuccess()), this, SLOT(conLoginSuccess())); connect(con, SIGNAL(loginFailure()), this, SLOT(conLoginFailure())); connect(con, SIGNAL(playerError(QString)), this, SLOT(conPlayerError(QString))); connect(con, SIGNAL(pingResponseReceived(QString)), this, SLOT(conPingResponseReceived(QString))); connect(con, SIGNAL(testStarted()), this, SLOT(conTestStarted())); connect(con, SIGNAL(testEnded()), this, SLOT(conTestEnded())); connect(con, SIGNAL(testResults(bool)), this, SLOT(conTestResults(bool))); ui->boxConnection->setEnabled(true); ui->boxOutput->setEnabled(true); m_subviewModel = new PlayerSubviewsModel(con); ui->subviewListview->setModel(m_subviewModel); ui->subviewListview->setCurrentIndex(m_subviewModel->index(0,0)); GLWidgetSubview *sub = !con->subviews().isEmpty() ? con->subviews().at(0) : 0; if(!sub) con->addSubview(sub = new GLWidgetSubview()); if(sub->title().isEmpty()) sub->setTitle("Default Subview"); setCurrentSubview(sub); }