/** * @brief This method toggles between IconView/MapWidgetView and ImportPreview modes, depending on the context. */ void ImportView::slotTogglePreviewMode(const CamItemInfo& info, bool downloadPreview) { if (!d->parent->cameraUseUMSDriver()) { return; } if ( (d->stackedView->viewMode() == ImportStackedView::PreviewCameraMode || d->stackedView->viewMode() == ImportStackedView::MapWidgetMode || downloadPreview) && !info.isNull() ) { d->lastViewMode = d->stackedView->viewMode(); CamItemInfo previous = CamItemInfo(); if (!downloadPreview) { previous = d->iconView->previousInfo(info); } d->stackedView->setPreviewItem(info, previous, d->iconView->nextInfo(info)); } else { // go back to either CameraViewMode or MapWidgetMode d->stackedView->setViewMode(d->lastViewMode); } if(!downloadPreview) { // make sure the next/previous buttons are updated slotImageSelected(); } }
void ImportView::slotEscapePreview() { if (d->stackedView->viewMode() == ImportStackedView::PreviewCameraMode) //TODO: || d->stackedView->viewMode() == ImportStackedView::WelcomePageMode) { return; } // pass a null camera item info, because we want to fall back to the old // view mode slotTogglePreviewMode(CamItemInfo(), false); }
CamItemInfo ImportIconView::camItemInfo(const QString& folder, const QString& file) { QUrl url = QUrl::fromLocalFile(folder); url = url.adjusted(QUrl::StripTrailingSlash); url.setPath(url.path() + QLatin1Char('/') + (file)); QModelIndex indexForCamItemInfo = importFilterModel()->indexForPath(url.toLocalFile()); if(indexForCamItemInfo.isValid()) { return importFilterModel()->camItemInfo(indexForCamItemInfo); } return CamItemInfo(); }
CamItemInfo ImportIconView::camItemInfo(const QString& folder, const QString& file) { KUrl url(folder); url.adjustPath(KUrl::AddTrailingSlash); url.setFileName(file); QModelIndex indexForCamItemInfo = importFilterModel()->indexForPath(url.toLocalFile()); if(indexForCamItemInfo.isValid()) { return importFilterModel()->camItemInfo(indexForCamItemInfo); } return CamItemInfo(); }
void ImportItemPropertiesSideBarImport::slotNoCurrentItem() { d->itemInfo = CamItemInfo(); d->metaData = DMetadata(); d->dirtyMetadataTab = false; d->dirtyCameraItemTab = false; d->dirtyGpsTab = false; d->cameraItemTab->setCurrentItem(); d->metadataTab->setCurrentURL(); #ifdef HAVE_MARBLE d->gpsTab->setCurrentURL(); #endif // HAVE_MARBLE }