uint8_t GSwifi::checkActivity() { static uint8_t continuous_timeouts_ = 0; while ( serial_->available() && ! TIMER_FIRED(timeout_timer_) ) { parseByte( serial_->read() ); if ( gs_failure_ || (gs_ok_ && (gs_response_lines_ == RESPONSE_LINES_ENDED || gs_commandmode_ == GSCOMMANDMODE_NONE)) ) { gs_commandmode_ = GSCOMMANDMODE_NONE; continuous_timeouts_ = 0; setBusy(false); break; } } if ( busy_ && TIMER_FIRED(timeout_timer_) ) { TIMER_STOP(timeout_timer_); GSLOG_PRINTLN("!E24"); did_timeout_ = true; continuous_timeouts_ ++; setBusy(false); } // need a GS hardware reset, which we issue in setup() ASSERT( continuous_timeouts_ <= 5 ); return busy_; }
void KdeObservatory::engineError(const QString &source, const QString &error) { kDebug() << "Source:" << source << "Error:" << error; if (source == "fatal" && m_sourceCounter > 0) { m_viewTransitionTimer->stop(); foreach(QGraphicsWidget *widget, m_views) widget->hide(); m_views.clear(); graphicsWidget(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(255, 0, 0);}")); m_updateLabel->setText(error); setBusy(false); return; } --m_sourceCounter; if (m_sourceCounter == 0) { KDateTime currentTime = KDateTime::currentLocalDateTime(); KLocale *locale = KGlobal::locale(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); setBusy(false); updateViews(); } }
void RemoveRedEyesWindow::startWorkerThread(const QList<QUrl>& urls) { if (urls.isEmpty()) { return; } if (d->busy) { return; } if (!d->locator || !d->saveMethod) { return; } if (!d->thread) { qCCritical(KIPIPLUGINS_LOG) << "Creation of WorkerThread failed!"; setBusy(false); return; } // -------------------------------------------------------- d->thread->setImagesList(urls); d->thread->setRunType(d->runtype); d->thread->loadSettings(d->settings); d->thread->setSaveMethod(d->saveMethod); d->thread->setLocator(d->locator); d->thread->setTempFile(d->originalImageTempFile.fileName(), WorkerThread::OriginalImage); d->thread->setTempFile(d->correctedImageTempFile.fileName(), WorkerThread::CorrectedImage); d->thread->setTempFile(d->maskImageTempFile.fileName(), WorkerThread::MaskImage); // -------------------------------------------------------- setBusy(true); initProgressBar(urls.count()); if (d->progress->isHidden()) { d->progress->show(); } connect(d->thread, SIGNAL(calculationFinished(WorkerThreadData*)), this, SLOT(calculationFinished(WorkerThreadData*))); // start image processing if (!d->thread->isRunning()) { d->thread->start(); } }
//----------------------------------------------------------------------------- // Paint the launchers void daisy::paintLaunchers(void) { QList<int> m_paint_order; if ( m_type==QString("media_controller") || m_type==QString("circular_dock") ) { m_paint_order.clear(); if ( m_type==QString("circular_dock") )m_paint_order << 4 << 3 << 7 << 6 << 2 << 8 << 5 << 1 << 0; else if ( m_type==QString("media_controller") )m_paint_order << 6 << 3 << 7 << 1 << 5 << 2 << 4 << 0 << 8; if (m_paint_order[m_to_paint]== m_paint_order[0]) { setBusy(true); m_paint_tmr->setInterval(75); } else if (m_paint_order[m_to_paint]== m_paint_order[7])m_paint_tmr->setInterval(150); m_act_1 = new QAction(KIcon( m_values[m_paint_order[m_to_paint]][2]), "", this); m_widgets[m_paint_order[m_to_paint]]->setAction(m_act_1); if (m_paint_order[m_to_paint]== m_paint_order[8]) { m_to_paint=int(0); m_paint_tmr->stop(); m_trashfull = false; m_watch_trash->setDirty( m_trash_dir ); setBusy(false); return; } m_to_paint++; } else if ( m_type==QString("standard_dock") ) { for (int i = 0; i < m_widgets.size(); ++i) { m_act_1 = new QAction(KIcon( m_values[i][2] ), "", this); m_widgets[i]->setAction(m_act_1); } m_to_paint=int(0); m_paint_tmr->stop(); m_trashfull = false; m_watch_trash->setDirty( m_trash_dir ); m_tracker_tmr->setInterval(m_hidingdelay); m_tracker_tmr->start(); } }
void KdeObservatory::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) { // Prevent for being updated from another instance update request if (data["appletId"].toUInt() != id()) return; QString project = data["project"].toString(); if (sourceName != "topActiveProjects" && !data.contains(project) && !data.contains("error")) return; if (sourceName == "topActiveProjects") m_viewProviders[i18n("Top Active Projects")]->updateViews(data); else if (sourceName == "topProjectDevelopers" && !project.isEmpty()) m_viewProviders[i18n("Top Developers")]->updateViews(data); else if (sourceName == "commitHistory" && !project.isEmpty()) m_viewProviders[i18n("Commit History")]->updateViews(data); else if (sourceName == "krazyReport" && !project.isEmpty()) m_viewProviders[i18n("Krazy Report")]->updateViews(data); --m_sourceCounter; m_collectorProgress->setValue(m_collectorProgress->maximum() - m_sourceCounter); if (m_sourceCounter == 0) { KDateTime currentTime = KDateTime::currentLocalDateTime(); KLocale *locale = KGlobal::locale(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); setBusy(false); updateViews(); } }
/*! \fn kgitView::slotRefreshGitRepo() */ void kgitView::slotRefreshGitRepo() { KProcIO *newProc = new KProcIO; *newProc << "git-diff-files"; *newProc << "--name-only"; newProc->setWorkingDirectory(c_url.path()); connect(newProc,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitTree(KProcess *))); newProc->start(); MainDoc->clear(); KProcIO *newProc2 = new KProcIO; *newProc2 << "git"; *newProc2 << "diff"; newProc2->setWorkingDirectory(c_url.path()); connect(newProc2,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitDiff(KProcess *))); newProc2->start(); KProcIO *newProc3 = new KProcIO; *newProc3 << "git"; *newProc3 << "branch"; newProc3->setWorkingDirectory(c_url.path()); connect(newProc3,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitBranches(KProcess *))); newProc3->start(); ShortLogList->clear(); KProcIO *newProc4 = new KProcIO; *newProc4 << "git"; *newProc4 << "log"; newProc4->setWorkingDirectory(c_url.path()); connect(newProc4,SIGNAL( readReady(KProcIO *)),this,SLOT(slotGitGotLogSummary(KProcIO *))); newProc4->start(); setBusy(); }
void SimilarArtistsApplet::dataUpdated( const QString &source, const Plasma::DataEngine::Data &data ) { DEBUG_BLOCK QString artist = data[ "artist" ].toString(); if( source == "similarArtists" ) { setBusy( false ); if( !artist.isEmpty() ) { m_artist = artist; SimilarArtist::List list = data[ "similar" ].value<SimilarArtist::List>(); if( m_similars != list ) { m_similars = list; updateNavigationIcons(); artistsUpdate(); } } else { setHeaderText( i18n( "Similar Artists" ) ); m_scroll->clear(); m_scroll->hide(); setCollapseOn(); } } }
void SoundCloudService::setSearch(const QString &searchTerm) { if (searchTerm==currentSearch) { return; } clear(); currentSearch=searchTerm; if (currentSearch.isEmpty()) { return; } QUrl searchUrl(constUrl); #if QT_VERSION < 0x050000 QUrl &query=searchUrl; #else QUrlQuery query; #endif query.addQueryItem("client_id", constApiKey); query.addQueryItem("q", searchTerm); #if QT_VERSION >= 0x050000 searchUrl.setQuery(query); #endif QNetworkRequest req(searchUrl); req.setRawHeader("Accept", "application/json"); job=NetworkAccessManager::self()->get(req); connect(job, SIGNAL(finished()), this, SLOT(jobFinished())); emitUpdated(); setBusy(true); }
void RemoveRedEyesWindow::threadFinished() { d->progress->hide(); setBusy(false); QApplication::restoreOverrideCursor(); switch (d->runtype) { case WorkerThread::Testrun: handleUnprocessedImages(); break; case WorkerThread::Correction: // show summary and close the plugin showSummary(); break; case WorkerThread::Preview: // load generated preview images d->previewWidget->setPreviewImage(PreviewWidget::OriginalImage, d->originalImageTempFile.fileName()); d->previewWidget->setPreviewImage(PreviewWidget::CorrectedImage, d->correctedImageTempFile.fileName()); d->previewWidget->setPreviewImage(PreviewWidget::MaskImage, d->maskImageTempFile.fileName()); break; } disconnect(d->thread, SIGNAL(calculationFinished(WorkerThreadData*)), this, SLOT(calculationFinished(WorkerThreadData*))); }
void TTRssFetcher::finishedSignIn() { Settings *s = Settings::instance(); if (!processResponse()) { s->setSignedIn(false); sessionId = ""; apiLevel = 0; return; } else { s->setSignedIn(true); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) sessionId = jsonObj["content"].toObject()["session_id"].toString(); apiLevel = jsonObj["content"].toObject()["api_level"].toInt(); #else sessionId = jsonObj["content"].toMap()["session_id"].toString(); apiLevel = jsonObj["content"].toMap()["api_level"].toInt(); #endif if (busyType == Fetcher::CheckingCredentials) { emit credentialsValid(); setBusy(false); } else { sendApiCall("getConfig", FETCHER_SLOT(finishedConfig)); } } }
void QSpotifySearch::search(bool preview) { setBusy(true); QMutexLocker lock(&g_mutex); if (!m_query.isEmpty()) { if(preview && m_enablePreview) { m_sp_search = sp_search_create( QSpotifySession::instance()->m_sp_session, m_query.toUtf8().constData(), 0, m_numPreviewItems, 0, m_numPreviewItems, 0, m_numPreviewItems, 0, m_numPreviewItems, sp_search_type(m_searchType), callback_search_complete, nullptr); } else { m_sp_search = sp_search_create( QSpotifySession::instance()->m_sp_session, m_query.toUtf8().constData(), 0, m_tracksLimit, 0, m_albumsLimit, 0, m_artistsLimit, 0, m_playlistsLimit, sp_search_type(m_searchType), callback_search_complete, nullptr); } g_searchObjects.insert(m_sp_search, this); } else { populateResults(nullptr); } }
void TTRssFetcher::startJob(Job job) { if (isRunning()) { qWarning() << "Job is running"; return; } disconnect(this, SIGNAL(finished()), 0, 0); currentJob = job; switch (job) { case StoreCategories: case StoreFeeds: connect(this, SIGNAL(finished()), this, SLOT(callNextCmd())); break; case StoreStream: connect(this, SIGNAL(finished()), this, SLOT(finishedStream2())); break; default: qWarning() << "Unknown Job"; emit error(502); setBusy(false); return; } start(QThread::LowPriority); }
void QSpotifySearch::populateResults(sp_search *search) { if (search) { if (sp_search_error(search) != SP_ERROR_OK) return; populateAlbums(search); populateArtists(search); populatePlaylists(search); populateTracks(search); setDidYouMean(search); } else { m_albumResults->clear(); m_artistResults->clear(); m_playlistResults->clear(); m_trackResults->clear(); auto sourceList = QSpotifySession::instance()->playQueue()->m_sourceTrackList; if(sourceList == m_trackResults || sourceList == m_trackResultsPreview) { QSpotifySession::instance()->playQueue()->m_sourceTrackList = nullptr; } if (m_enablePreview) { m_albumResultsPreview->clear(); m_artistResultsPreview->clear(); m_playlistResultsPreview->clear(); m_trackResultsPreview->clear(); } } setBusy(false); emit resultsChanged(); }
void CaptchaManager::onCaptchaNeededFinished(QNetworkReply *reply) { if (reply != 0) { if (reply->error() == QNetworkReply::NoError) { QString response = reply->readAll(); if (response == "false") { m_captchaNeededState = False; qDebug() << "No captcha needed"; } else { m_captchaNeededState = True; qDebug() << "Captcha needed"; } } else { error(reply->errorString()); m_captchaNeededState = Error; } } emit captchaNeededChanged(); m_request->deleteLater(); m_request = 0; setBusy(false); // since this slot is only reached as a step-out request-reply by request(), call it now that we have the captcha-needed state. // unless we don't need a captcha at all, of course. if (m_captchaNeededState != False) request(); }
RenderAf::RenderAf( const std::string & i_store_dir): af::Render(), AfNodeSrv( this, i_store_dir) { //printf("RenderAf::RenderAf:\n"); //printf("this = %p\n", this); // setNode( this); AFINFA("RenderAf::RenderAf(%d)", m_id); initDefaultValues(); int size; char * data = af::fileRead( getStoreFile(), &size); if( data == NULL ) return; rapidjson::Document document; char * res = af::jsonParseData( document, data, size); if( res == NULL ) { delete [] data; return; } if( jsonRead( document)) setStoredOk(); delete [] res; delete [] data; // This render came from store on server start, it can't be online or busy setOffline(); setBusy( false); }
void RenderAf::offline( JobContainer * jobs, uint32_t updateTaskState, MonitorContainer * monitoring, bool toZombie ) { setOffline(); setBusy( false); if( isWOLFalling()) { setWOLFalling( false); setWOLSleeping( true); } if( jobs && updateTaskState) ejectTasks( jobs, monitoring, updateTaskState); // There is need to send pending tasks to offline render. m_re.clearTaskExecs(); appendLog( m_hres.v_generateInfoString()); if( toZombie ) { AFCommon::QueueLog("Render Deleting: " + v_generateInfoString( false)); appendLog("Waiting for deletion."); setZombie(); // AFCommon::saveLog( getLog(), af::Environment::getRendersDir(), m_name); if( monitoring ) monitoring->addEvent( af::Monitor::EVT_renders_del, m_id); } else { AFCommon::QueueLog("Render Offline: " + v_generateInfoString( false)); appendLog("Offline."); m_time_launch = 0; if( monitoring ) monitoring->addEvent( af::Monitor::EVT_renders_change, m_id); store(); } }
void TranslationInterface::translate() { if (m_srcText.isEmpty()) { emit error(tr("Please, enter the source text")); return; } resetTranslation(); #ifdef WITH_ANALYTICS if (m_privacyLevel == NoPrivacy) { QVariantMap props; fillTranslationProperties(props); m_analytics->trackEvent("Translation", props); } #endif if (!m_service->translate(m_sourceLanguage->language(), m_targetLanguage->language(), m_srcText)) { emit error(m_service->errorString()); return; } setBusy(true); }
void Movies::listReceived(const QVariantMap &rsp) { setBusy(false); QList<KodiModelItem*> list; //qDebug() << "got movies:" << rsp.value("result"); QVariantList responseList = rsp.value("result").toMap().value("movies").toList(); int index = 0; m_idIndexMapping.clear(); foreach(const QVariant &itemVariant, responseList) { QVariantMap itemMap = itemVariant.toMap(); LibraryItem *item = new LibraryItem(this); item->setTitle(itemMap.value("label").toString()); item->setSubtitle(itemMap.value("genre").toStringList().join(", ")); item->setMovieId(itemMap.value("movieid").toInt()); item->setYear(itemMap.value("year").toString()); item->setFanart(itemMap.value("fanart").toString()); item->setThumbnail(itemMap.value("thumbnail").toString()); item->setPlaycount(itemMap.value("playcount").toInt()); item->setFileName(itemMap.value("file").toString()); item->setIgnoreArticle(ignoreArticle()); item->setFileType("file"); item->setPlayable(true); item->setResume(itemMap.value("resume").toMap().value("position").toInt()); list.append(item); m_idIndexMapping.insert(item->movieId(), index++); }
/** Executes the request now, i.e. in the main thread and without involving * the manager thread.. This calles prepareOperation, operation, and * afterOperation. */ void Request::executeNow() { assert(isPreparing()); setBusy(); execute(); callback(); setDone(); } // executeNow
void FoursquareVenueSelectionPage::searchNearby(void) { setBusy(); m_list->setLabel(tr("Searching nearby venues")); m_model->fetch(m_storage->get(), m_geoinfo.coordinate().latitude(), m_geoinfo.coordinate().longitude()); }
void SoundCloudService::cancelAll() { if (job) { job->cancelAndDelete(); job=0; } setBusy(false); }
void TTRssFetcher::signIn() { Settings *s = Settings::instance(); if (sessionId != "") { prepareUploadActions(); return; } QString url = s->getUrl(); QString password = s->getPassword(); QString username = s->getUsername(); int type = s->getSigninType(); switch (type) { case 30: { if (password == "" || username == "" || url == "") { qWarning() << "TTRss credentials are invalid"; if (busyType == Fetcher::CheckingCredentials) emit errorCheckingCredentials(400); else emit error(400); setBusy(false); return; } #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QJsonObject params; params["user"] = username; params["password"] = password; #else QString params = "\"user\":\"" + username + "\",\"password\":\"" + password.replace("\\", "\\\\").replace("\"", "\\\"") + "\""; #endif sendApiCall("login", params, FETCHER_SLOT(finishedSignIn)); break; } default: qWarning() << "Invalid sign in type"; emit error(500); setBusy(false); return; } }
/*! \fn void FacebookConnection::cancel() Attempts to cancel the currently active request. The result of the operation success, failure (one reason of which may be the cancellation) is available in the completion signal of the operation in question. */ void FacebookConnection::cancel() { if (m_apiCall == Authenticate) { QMetaObject::invokeMethod(this, "authenticateCompleted", Qt::QueuedConnection, Q_ARG(bool, false)); setBusy(false); setTransmitting(false); setWebInterfaceActive(false); m_apiCall = Undefined; }
void RawImport::slotLoadingStarted() { d->postProcessedImage = DImg(); d->settingsBox->enableUpdateBtn(false); d->settingsBox->histogramBox()->histogram()->setDataLoading(); d->settingsBox->curvesWidget()->setDataLoading(); EditorToolIface::editorToolIface()->setToolStartProgress(i18n("Raw Decoding")); setBusy(true); }
void CaptchaManager::requestCaptchaNeeded() { abortActiveReply(); m_request = manager()->createRedditRequest(this, APIRequest::GET, "/api/needs_captcha"); connect(m_request, SIGNAL(finished(QNetworkReply*)), SLOT(onCaptchaNeededFinished(QNetworkReply*))); setBusy(true); }
void ArchiverWindow::slotFileOpen() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Archive"), QString(), tr("Tar Archives (*.tar *.tar.gz *.tar.xz *.tar.bz2 *.tgz *.tbz2")); if (!fileName.isEmpty()) { setBusy(true); if (m_model->openArchive(fileName)) { setWindowModified(false); setWindowFilePath(fileName); setBusy(false); ui->actionFileSaveAs->setEnabled(false); } } }
void PhotosApplet::photoAdded() { setBusy( false ); setHeaderText( i18ncp( "@title:window Number of photos of artist", "1 Photo: %2", "%1 Photos: %2", m_widget->count(), m_currentArtist ) ); }
void Updater::checkForUpdates() { setBusy(true); if (m_reply && m_reply->isRunning()) m_reply->abort(); QUrl url("https://api.github.com/repos/leppa/taot/releases"); m_reply = m_nam->get(QNetworkRequest(url)); }
void FoursquareVenueSelectionPage::searchLocation(void) { QString loc = m_location->contents(); if (loc == "") return; setBusy(); m_list->setLabel(tr("Searching venues")); m_model->fetch(m_storage->get(), loc); }
void BlackBerryDebugTokenRequestDialog::debugTokenArrived(int status) { QString errorString = tr("Failed to request debug token:") + QLatin1Char(' '); switch (status) { case BlackBerryDebugTokenRequester::Success: accept(); return; case BlackBerryDebugTokenRequester::WrongCskPassword: m_utils.clearCskPassword(); errorString += tr("Wrong CSK password."); break; case BlackBerryDebugTokenRequester::WrongKeystorePassword: m_utils.clearCertificatePassword(); errorString += tr("Wrong keystore password."); break; case BlackBerryDebugTokenRequester::NetworkUnreachable: errorString += tr("Network unreachable."); break; case BlackBerryDebugTokenRequester::IllegalPin: errorString += tr("Illegal device PIN."); break; case BlackBerryDebugTokenRequester::FailedToStartInferiorProcess: errorString += tr("Failed to start inferior process."); break; case BlackBerryDebugTokenRequester::InferiorProcessTimedOut: errorString += tr("Inferior processes timed out."); break; case BlackBerryDebugTokenRequester::InferiorProcessCrashed: errorString += tr("Inferior process has crashed."); break; case BlackBerryDebugTokenRequester::InferiorProcessReadError: case BlackBerryDebugTokenRequester::InferiorProcessWriteError: errorString += tr("Failed to communicate with the inferior process."); break; case BlackBerryDebugTokenRequester::NotYetRegistered: errorString += tr("Not yet registered to request debug tokens."); break; case BlackBerryDebugTokenRequester::UnknownError: default: m_utils.clearCertificatePassword(); m_utils.clearCskPassword(); errorString += tr("An unknwon error has occurred."); break; } QFile file(m_ui->debugTokenPath->path()); if (file.exists()) file.remove(); QMessageBox::critical(this, tr("Error"), errorString); setBusy(false); }