QWidget * EventsWindow::createResultsView() { m_resultsView = new EventsView; connect(m_eventsUpdater, SIGNAL(loadingStarted()), m_resultsView, SLOT(loadingStarted())); connect(m_eventsUpdater, SIGNAL(loadingFinished()), m_resultsView, SLOT(loadingFinished())); EventsModel *eventsModel = new EventsModel(m_serverRepository, this); m_resultsView->setModel(eventsModel, m_eventsUpdater->isUpdating()); connect(m_eventsUpdater, SIGNAL(serverEventsAvailable(DVRServer*,QList<EventData*>)), eventsModel, SLOT(setServerEvents(DVRServer*,QList<EventData*>))); m_resultsView->setFrameStyle(QFrame::NoFrame); m_resultsView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_resultsView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(eventContextMenu(QPoint))); connect(m_resultsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(showServerEvent(QModelIndex))); QSettings settings; m_resultsView->header()->restoreState(settings.value(QLatin1String("ui/events/viewHeader")).toByteArray()); m_resultsView->header()->setSortIndicatorShown(true); m_resultsView->header()->setSortIndicator(EventsModel::DateColumn, Qt::DescendingOrder); connect(m_resultsView->header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), m_resultsView, SLOT(sortEvents(int,Qt::SortOrder))); return m_resultsView; }
QmlMapControl::QmlMapControl (QQuickItem *parent) : QQuickPaintedItem(parent) { setOpaquePainting(true); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::AllButtons); layermanager = new LayerManager(this, size); screen_middle = QPoint(size.width()/2, size.height()/2); mousepressed = false; scaleVisible = true; crosshairsVisible = true; mymousemode = Panning; mouse_wheel_events = true; connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew())); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished())); setWidth(size.width()+1); setHeight(size.height()+1); connect( this, SIGNAL(widthChanged()) , SLOT(sizeChanged()) ); connect( this, SIGNAL(heightChanged()), SLOT(sizeChanged()) ); }
void PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel ) { if ( m_model ) { disconnect( m_model, SIGNAL( loadingStarted() ), this, SIGNAL( loadingStarted() ) ); disconnect( m_model, SIGNAL( loadingFinished() ), this, SIGNAL( loadingFinished() ) ); disconnect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), this, SIGNAL( itemCountChanged( unsigned int ) ) ); disconnect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), this, SLOT( onIndexPlayable( QModelIndex ) ) ); disconnect( m_model, SIGNAL( indexResolved( QModelIndex ) ), this, SLOT( onIndexResolved( QModelIndex ) ) ); disconnect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) ); disconnect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expandRequested( QPersistentModelIndex ) ) ); disconnect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( selectRequested( QPersistentModelIndex ) ) ); } m_model = sourceModel; if ( m_model ) { connect( m_model, SIGNAL( loadingStarted() ), SIGNAL( loadingStarted() ) ); connect( m_model, SIGNAL( loadingFinished() ), SIGNAL( loadingFinished() ) ); connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SIGNAL( itemCountChanged( unsigned int ) ) ); connect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onIndexPlayable( QModelIndex ) ) ); connect( m_model, SIGNAL( indexResolved( QModelIndex ) ), SLOT( onIndexResolved( QModelIndex ) ) ); connect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) ); connect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expandRequested( QPersistentModelIndex ) ) ); connect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequested( QPersistentModelIndex ) ) ); } QSortFilterProxyModel::setSourceModel( m_model ); }
QWidget *MainWindow::createRecentEvents() { m_eventsView = new EventsView; m_eventsView->setContextMenuPolicy(Qt::CustomContextMenu); m_eventsView->setFrameStyle(QFrame::NoFrame); m_eventsView->setAttribute(Qt::WA_MacShowFocusRect, false); m_eventsView->setIncompletePlace(EventsProxyModel::IncompleteLast); m_eventsModel = new EventsModel(m_serverRepository, m_eventsView); EventsUpdater *updater = new EventsUpdater(m_serverRepository, m_eventsModel); connect(updater, SIGNAL(serverEventsAvailable(DVRServer*,QList<QSharedPointer<EventData>>)), m_eventsModel, SLOT(setServerEvents(DVRServer*,QList<QSharedPointer<EventData>>))); m_eventsView->setModel(m_eventsModel, updater->isUpdating()); connect(updater, SIGNAL(loadingStarted()), m_eventsView, SLOT(loadingStarted())); connect(updater, SIGNAL(loadingFinished()), m_eventsView, SLOT(loadingFinished())); QSettings settings; updater->setUpdateInterval(settings.value(QLatin1String("ui/main/eventRefreshInterval"), 10000).toInt()); updater->setLimit(50); m_eventsView->header()->restoreState(settings.value(QLatin1String("ui/main/eventsView")).toByteArray()); connect(m_eventsView, SIGNAL(doubleClicked(QModelIndex)), m_eventsView, SLOT(openEvent(QModelIndex))); connect(m_eventsView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(eventsContextMenu(QPoint))); return m_eventsView; }
int qmapcontrol::MapControl::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: mouseEventCoordinate((*reinterpret_cast< const QMouseEvent*(*)>(_a[1])),(*reinterpret_cast< const QPointF(*)>(_a[2]))); break; case 1: boxDragged((*reinterpret_cast< const QRectF(*)>(_a[1]))); break; case 2: geometryClicked((*reinterpret_cast< Geometry*(*)>(_a[1])),(*reinterpret_cast< QPoint(*)>(_a[2]))); break; case 3: viewChanged((*reinterpret_cast< const QPointF(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 4: zoomIn(); break; case 5: zoomOut(); break; case 6: setZoom((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: scrollLeft((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: scrollLeft(); break; case 9: scrollRight((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: scrollRight(); break; case 11: scrollUp((*reinterpret_cast< int(*)>(_a[1]))); break; case 12: scrollUp(); break; case 13: scrollDown((*reinterpret_cast< int(*)>(_a[1]))); break; case 14: scrollDown(); break; case 15: scroll((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 16: updateRequest((*reinterpret_cast< QRect(*)>(_a[1]))); break; case 17: updateRequestNew(); break; case 18: resize((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 19: tick(); break; case 20: loadingFinished(); break; case 21: positionChanged((*reinterpret_cast< Geometry*(*)>(_a[1]))); break; default: ; } _id -= 22; } return _id; }
void HttpRequest::onReplyFinished() { qDebug() << "HttpRequest::onReplyFinished()"; TwtImageScaler::removeTemporaryFile(); if(mRequestTimeoutTimer->isActive()) { mRequestTimeoutTimer->stop(); } mRequestTimeoutTimer->setInterval(KRequestTimeOut); disconnect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished())); QByteArray tempData = mReply->readAll(); QNetworkReply::NetworkError replyError = mReply->error(); if(QNetworkReply::NoError == replyError) { mReply->deleteLater(); mReply = NULL; emit loadingFinished(tempData); } else { qDebug() << "HttpRequest::err: " << mReply->errorString(); QString errStr("Twitter API returned "); errStr += QString::number(mReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()); errStr += " "; errStr += mReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(); mReply->deleteLater(); mReply = NULL; emit loadingError(errStr); } }
void ImageManager::loadingQueueEmpty() { emit(loadingFinished()); //((Layer*)this->parent())->removeZoomImage(); //qDebug() << "size of image-map: " << images.size(); //qDebug() << "size: " << QPixmapCache::cacheLimit(); }
void MapControl::__init() { layermanager = new LayerManager(this, size); screen_middle = QPoint(size.width()/2, size.height()/2); mousepressed = false; connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew())); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished())); this->setMaximumSize(size.width()+1, size.height()+1); mouse_wheel_events = true; }
void SohuMiniBlog::onReplyFinished() { qDebug() << "SohuMiniBlog::onReplyFinished()"; qDebug() << mReply->error(); qDebug() << "Sever respond:"<<QDateTime::currentDateTime().toString(); if(mRequestTimeoutTimer->isActive()) { mRequestTimeoutTimer->stop(); } disconnect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished())); QByteArray tempData = mReply->readAll(); QNetworkReply::NetworkError replyError = mReply->error(); mReply->deleteLater(); mReply = NULL; if(QNetworkReply::NoError == replyError) { emit loadingFinished(tempData); } else if(QNetworkReply::AuthenticationRequiredError == replyError ) { emit loadingError(KUserInfoError); } else { emit loadingError(KNetworkError); } }
void KFileMetaDataConfigurationWidget::Private::loadMetaData() { #ifndef KIO_NO_NEPOMUK m_provider->setItems(m_fileItems); connect(m_provider, SIGNAL(loadingFinished()), q, SLOT(slotLoadingFinished())); #endif }
void LogData::indexingFinished( bool success ) { LOG(logDEBUG) << "Entering LogData::indexingFinished."; // We use the newly created file data or restore the old ones. // (Qt implicit copy makes this fast!) { QMutexLocker locker( &dataMutex_ ); workerThread_.getIndexingData( &fileSize_, &maxLength_, &linePosition_ ); nbLines_ = linePosition_.size(); } LOG(logDEBUG) << "indexingFinished: " << success << ", found " << nbLines_ << " lines."; if ( success ) { // Use the new filename if needed if ( !currentOperation_->getFilename().isNull() ) { QString newFileName = currentOperation_->getFilename(); if ( file_ ) { QMutexLocker locker( &fileMutex_ ); file_->setFileName( newFileName ); } else { QMutexLocker locker( &fileMutex_ ); file_.reset( new QFile( newFileName ) ); } } // Update the modified date/time if the file exists lastModifiedDate_ = QDateTime(); QFileInfo fileInfo( *file_ ); if ( fileInfo.exists() ) lastModifiedDate_ = fileInfo.lastModified(); } if ( file_ ) { // And we watch the file for updates fileChangedOnDisk_ = Unchanged; fileWatcher_.addFile( file_->fileName() ); } emit loadingFinished( success ); // So now the operation is done, let's see if there is something // else to do, in which case, do it! assert( currentOperation_ ); currentOperation_ = nextOperation_; nextOperation_ = nullptr; if ( currentOperation_ ) { LOG(logDEBUG) << "indexingFinished is performing the next operation"; startOperation(); } }
MapControl::MapControl(QSize size, MouseMode mousemode) : size(size), mymousemode(mousemode), scaleVisible(false), cursorPosVisible(false), mapPen(Qt::black) { layermanager = new LayerManager(this, size); screen_middle = QPoint(size.width()/2, size.height()/2); mousepressed = false; connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew())); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished())); this->setMaximumSize(size.width()+1, size.height()+1); distanceList<<5000000<<2000000<<1000000<<1000000<<1000000<<100000<<100000<<50000<<50000<<10000<<10000<<10000<<1000<<1000<<500<<200<<100<<50<<25; }
void ImageLoaderQueue::loadingSuccess(const QPixmap &pixmap, int size) { // We only emit the event if the loading was successful and not cancelled if (!m_cancelNext) { emit finished(pixmap, size); } loadingFinished(); }
void OnyxPlayerView::attachModel(PlayListModel *m) { model_ = m; connect(model_, SIGNAL(firstAdded()), this, SLOT(play())); connect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); connect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_->doCurrentVisibleRequest(); loadSettings(); }
void PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel ) { if ( m_model ) { disconnect( m_model, SIGNAL( loadingStarted() ), this, SIGNAL( loadingStarted() ) ); disconnect( m_model, SIGNAL( loadingFinished() ), this, SIGNAL( loadingFinished() ) ); } m_model = sourceModel; if ( m_model ) { connect( m_model, SIGNAL( loadingStarted() ), SIGNAL( loadingStarted() ) ); connect( m_model, SIGNAL( loadingFinished() ), SIGNAL( loadingFinished() ) ); } QSortFilterProxyModel::setSourceModel( m_model ); }
void EventsUpdater::eventsLoaded(DVRServer *server, bool ok, const QList<EventData *> &events) { if (!server) return; if (ok) emit serverEventsAvailable(server, events); if (m_updatingServers.remove(server) && m_updatingServers.isEmpty()) emit loadingFinished(); }
SourceViewer::SourceViewer(const QString &source, const QString &title, const QUrl &url, QWidget *parent) : QDialog(parent) , m_edit(new QPlainTextEdit(tr("Loading..."), this)) , m_highlighter(new SourceHighlighter(m_edit->document())) , m_plainTextEditSearch(new PlainTextEditSearch(m_edit, this)) , m_layout(new QVBoxLayout(this)) , m_menuBar(new QMenuBar(this)) , m_editMenu(new QMenu(tr("&Edit"), m_menuBar)) , m_findAction(new QAction(tr("&Find"), m_editMenu)) , m_viewMenu(new QMenu(tr("&View"), m_menuBar)) , m_setWrappingAction(new QAction(tr("&Wrap lines"), m_viewMenu)) { setWindowTitle(QString(tr("Source of Page ")).append(title)); resize(640, 480); m_source = new QString(source); m_edit->setLineWrapMode(QPlainTextEdit::NoWrap); m_edit->setReadOnly(true); QFont font = m_edit->font(); font.setFamily(QLatin1String("Monospace")); m_edit->setFont(font); m_edit->setLineWidth(0); m_edit->setFrameShape(QFrame::NoFrame); m_menuBar->addMenu(m_editMenu); m_editMenu->addAction(m_findAction); m_findAction->setShortcuts(QKeySequence::Find); connect(m_findAction, SIGNAL(triggered()), m_plainTextEditSearch, SLOT(showFind())); m_menuBar->addMenu(m_viewMenu); m_viewMenu->addAction(m_setWrappingAction); m_setWrappingAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_W)); m_setWrappingAction->setCheckable(true); connect(m_setWrappingAction, SIGNAL(triggered(bool)), this, SLOT(setWrapping(bool))); m_layout->setSpacing(0); m_layout->setContentsMargins(0, 0, 0, 0); m_layout->addWidget(m_menuBar); m_layout->addWidget(m_plainTextEditSearch); m_layout->addWidget(m_edit); setLayout(m_layout); m_request = new QNetworkRequest(url); m_request->setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); m_reply = BrowserApplication::networkAccessManager()->get(*m_request); connect(m_reply, SIGNAL(finished()), this, SLOT(loadingFinished())); m_reply->setParent(this); }
MapControl::MapControl(QSize size, MouseMode mousemode, QWidget *parent) :QWidget(parent), size(size), mousemode(mousemode) { layermanager = new LayerManager(this, size); MapAdapter *mapadapter = new GoogleMapAdapter(); layermanager->addLayer(new MapLayer("Map", mapadapter)); screen_middle = QPoint(size.width()/2, size.height()/2); mousepressed = false; connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(updateRequestNew())); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(loadingFinished())); this->setMaximumSize(size.width()+1, size.height()+1); // create buttons as controls for zoom QPushButton* zoomin = new QPushButton("+"); QPushButton* zoomout = new QPushButton("-"); zoomin->setMaximumWidth(30); zoomout->setMaximumWidth(30); connect(zoomin, SIGNAL(clicked(bool)), this, SLOT(zoomIn())); connect(zoomout, SIGNAL(clicked(bool)), this, SLOT(zoomOut())); // add zoom buttons to the layout of the MapControl QVBoxLayout* innerlayout = new QVBoxLayout; innerlayout->addWidget(zoomin); innerlayout->addWidget(zoomout); setLayout(innerlayout); }
void EventsView::setModel(EventsModel *model) { bool first = !this->model(); QTreeView::setModel(model); if (first) { header()->setResizeMode(QHeaderView::Interactive); QFontMetrics fm(font()); header()->resizeSection(EventsModel::LocationColumn, fm.width(QLatin1Char('X')) * 20); header()->resizeSection(EventsModel::DurationColumn, fm.width(QLatin1String("99 minutes, 99 seconds")) + 25); header()->resizeSection(EventsModel::LevelColumn, fm.width(QLatin1String("Warning")) + 18); } connect(model, SIGNAL(loadingStarted()), SLOT(loadingStarted())); connect(model, SIGNAL(loadingFinished()), SLOT(loadingFinished())); connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), SLOT(loadingFinished())); connect(model, SIGNAL(modelReset()), SLOT(loadingFinished())); if (model->isLoading()) loadingStarted(); }
OverlayWidget::OverlayWidget( QAbstractItemView* parent ) : QWidget( parent ) // this is on purpose! , m_parent( parent ) , m_itemView( parent ) { init(); if ( m_itemView->model() ) { connect( m_itemView->model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( loadingStarted() ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( loadingFinished() ), SLOT( onViewChanged() ), Qt::UniqueConnection ); }
void OnyxPlayerView::deattachModel() { if (model_ != 0) { // clear data ODatas empty_data; song_list_view_.setData(empty_data); disconnect(model_, SIGNAL(firstAdded()), this, SLOT(play())); disconnect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); disconnect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_ = 0; } }
int qmapcontrol::ImageManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: imageReceived(); break; case 1: loadingFinished(); break; default: ; } _id -= 2; } return _id; }
void DkImageContainerT::imageLoaded() { fetchingImage = false; if (getLoadState() == loading_canceled) { loadState = not_loaded; clear(); return; } // deliver image loader = imageWatcher.result(); loadingFinished(); }
void OverlayWidget::onViewModelChanged() { if ( !m_itemView ) return; if ( m_itemView->model() ) { connect( m_itemView->model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( loadingStarted() ), SLOT( onViewChanged() ), Qt::UniqueConnection ); connect( m_itemView->model(), SIGNAL( loadingFinished() ), SLOT( onViewChanged() ), Qt::UniqueConnection ); onViewChanged(); }
void MapDownloader::download() { downloadListx->clear(); downloadListy->clear(); downloadListz->clear(); connect(ImageManager::instance(), SIGNAL(imageReceived()), this, SLOT(downloadTileList() )); connect(ImageManager::instance(), SIGNAL(loadingFinished()), this, SLOT(downloadfinish() )); downloadProgress->setValue(0); tilesDownloadCount=0; for(int lus=1; lus< comboBoxLayerDepth->currentIndex()+1; lus++) downloadLayer(lus); labelTileCount->setText("Tiles:"+QVariant(tilesDownloadCount).toString() ); m_downloadIndex=0; downloadTileList();downloadTileList();downloadTileList();downloadTileList(); }
KFileMetaDataWidget::Private::Private(KFileMetaDataWidget* parent) : m_rows(), #ifndef KIO_NO_NEPOMUK m_provider(0), #endif m_gridLayout(0), q(parent) { initMetaInfoSettings(); #ifndef KIO_NO_NEPOMUK // TODO: If KFileMetaDataProvider might get a public class in future KDE releases, // the following code should be moved into KFileMetaDataWidget::setModel(): m_provider = new KFileMetaDataProvider(q); connect(m_provider, SIGNAL(loadingFinished()), q, SLOT(slotLoadingFinished())); connect(m_provider, SIGNAL(urlActivated(KUrl)), q, SIGNAL(urlActivated(KUrl))); #endif }
void LogData::indexingFinished( LoadingStatus status ) { LOG(logDEBUG) << "indexingFinished: " << ( status == LoadingStatus::Successful ) << ", found " << indexing_data_.getNbLines() << " lines."; if ( keepFileClosed_ ) { QMutexLocker locker( &fileMutex_ ); attached_file_->close(); } if ( status == LoadingStatus::Successful ) { // Start watching we watch the file for updates fileChangedOnDisk_ = Unchanged; FileWatcher::getFileWatcher().addFile( indexingFileName_ ); // Update the modified date/time if the file exists lastModifiedDate_ = QDateTime(); QFileInfo fileInfo( indexingFileName_ ); if ( fileInfo.exists() ) lastModifiedDate_ = fileInfo.lastModified(); } // FIXME be cleverer here as a notification might have arrived whilst we // were indexing. fileChangedOnDisk_ = Unchanged; LOG(logDEBUG) << "Sending indexingFinished."; emit loadingFinished( status ); // So now the operation is done, let's see if there is something // else to do, in which case, do it! assert( currentOperation_ ); currentOperation_ = std::move( nextOperation_ ); nextOperation_.reset(); if ( currentOperation_ ) { LOG(logDEBUG) << "indexingFinished is performing the next operation"; startOperation(); } }
void Sonos::loadEmptyModels() { QList<QPair<ListModel*, SONOS::LockGuard> > left; { SONOS::Locked<ManagedContents>::pointer mc = m_library.Get(); for (ManagedContents::iterator it = mc->begin(); it != mc->end(); ++it) if (!it->model->m_loaded) left.push_back(qMakePair(it->model, SONOS::LockGuard(it->model->m_lock))); } emit loadingStarted(); if (!left.empty()) { while (!left.isEmpty()) { QPair<ListModel*, SONOS::LockGuard> item = left.front(); item.first->load(); left.pop_front(); } } emit loadingFinished(); }
void EventsModel::eventsLoaded(bool ok, const QList<EventData *> &events) { EventsLoader *eventsLoader = qobject_cast<EventsLoader *>(sender()); Q_ASSERT(eventsLoader); DVRServer *server = eventsLoader->server(); if (!server) return; if (ok) { QList<EventData*> &cache = cachedEvents[server]; qDeleteAll(cache); cache = events; applyFilters(); } if (updatingServers.remove(server) && updatingServers.isEmpty()) emit loadingFinished(); }
void Sonos::loadModel(ListModel* model) { QPair<ListModel*, SONOS::LockGuard> item(0, SONOS::LockGuard()); { SONOS::Locked<ManagedContents>::pointer mc = m_library.Get(); for (ManagedContents::iterator it = mc->begin(); it != mc->end(); ++it) if (it->model == model) { item.first = it->model; item.second = SONOS::LockGuard(it->model->m_lock); break; } } if (item.first) { SONOS::DBG(DBG_INFO, "%s: %p (%s)\n", __FUNCTION__, item.first, item.first->m_root.toUtf8().constData()); emit loadingStarted(); item.first->m_pending = false; // accept add next request in queue item.first->load(); emit loadingFinished(); } }