void EtherIPC::connectToServer() { fActiveRequest = RequestIPC(Full); emit busyChanged(getBusy()); if ( fSocket.state() != QLocalSocket::UnconnectedState ) { setError("Already connected"); return bail(); } fSocket.connectToServer(fPath); if ( fConnectAttempts == 0 ) { if ( fStarting == 1 ) { EtherLog::logMsg("Checking to see if there is an already running geth..."); } else { EtherLog::logMsg("Connecting to IPC socket " + fPath); } } QTimer::singleShot(2000, this, SLOT(waitConnect())); }
void VotingManager::vote(const QString &id, VotingManager::VoteType voteType) { Q_ASSERT(m_manager != 0); if (m_reply != 0) { m_reply->disconnect(); m_reply->deleteLater(); m_reply = 0; } if (m_isBusy != true) { m_isBusy = true; emit busyChanged(); } QUrl voteUrl("http://9gag.com/vote/"+ enumToString(voteType).toLower() +"/id/" + id); m_reply = m_manager->networkManager()->createPostRequest(voteUrl, QByteArray()); m_reply->setParent(this); connect(m_reply, SIGNAL(finished()), this, SLOT(onReplyFinished())); }
void EtherIPC::connectToServer(const QString& path) { if ( fAborted ) { bail(); return; } fActiveRequest = RequestIPC(Full); emit busyChanged(getBusy()); fPath = path; if ( fSocket.state() != QLocalSocket::UnconnectedState ) { setError("Already connected"); return bail(); } fSocket.connectToServer(path); EtherLog::logMsg("Connecting to IPC socket"); qDebug() << "Debug-->Connected to IPC Socket"; QTimer::singleShot(2000, this, SLOT(connectionTimeout())); }
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(); } }
void QmlScanner::processingFinished(const QImage& image) { processed(image); m_busy = false; busyChanged(); }
void QSpotifySearch::setBusy(bool busy) { m_busy = busy; emit busyChanged(); }
void NfcPeerToPeer::doApplySettings() { if (!(m_isResetting && m_isBusy) || !m_appSettings) { // Allow running this method only if called through applySettings(). // Also, don't run this method if m_appSettings isn't set. return; } // This setting doesn't need any restarting of services, // so can always be copied from the settings object // to the currently used config. m_sendThroughServerSocket = m_appSettings->sendThroughServerSocket(); // Now check for individual changes that affect the // communication and in most cases requires restarting services. if (m_appSettings->useConnectionLess() != m_useConnectionLess) { // Switched between connection-oriented and connection-less mode m_useConnectionLess = m_appSettings->useConnectionLess(); // Close all current connections resetAll(); // Start services again initAndStartNfc(); } else if (m_useConnectionLess && m_appSettings->nfcPort() != m_nfcPort) { // Connection-less mode // Changed port m_nfcPort = m_appSettings->nfcPort(); // Close all current connections resetAll(); // Start services again initAndStartNfc(); } else if (!m_useConnectionLess) { // Connection-oriented mode bool restartOrShutdownServer = false; bool restartOrShutdownClient = false; // Connection-oriented: check if URI changed if (m_appSettings->nfcUri() != QString(m_nfcUri)) { // New URI - restart socket server copyNfcUriFromAppSettings(); restartOrShutdownServer = true; restartOrShutdownClient = true; } if (m_appSettings->connectClientSocket() != m_connectClientSocket) { m_connectClientSocket = m_appSettings->connectClientSocket(); restartOrShutdownClient = true; } if (m_appSettings->connectServerSocket() != m_connectServerSocket) { m_connectServerSocket = m_appSettings->connectServerSocket(); restartOrShutdownServer = true; } if (restartOrShutdownServer || restartOrShutdownClient) { // We could also differentiate here which socket to // re-establish, based on the two boolean variables. // But for now, just reset everything. // Close all current connections resetAll(); // Start services again initAndStartNfc(); } } m_isResetting = false; m_isBusy = false; emit busyChanged(); emit settingsApplied(); }