void ImgurImagesList::slotAddImages(const QList<QUrl>& list) { /* Replaces the KPImagesList::slotAddImages method, so that * ImgurImageListViewItems can be added instead of ImagesListViewItems */ // Figure out which of the supplied URL's should actually be added and which // of them already exist. bool found; for (QList<QUrl>::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) { QUrl imageUrl = *it; found = false; if (iface()) { QPointer<MetadataProcessor> meta = iface()->createMetadataProcessor(); if (meta && meta->load(imageUrl)) { const QString sUrl = meta->getXmpTagString(QLatin1String("Xmp.kipi.Imgur.Hash")); const QString sDeleteUrl = meta->getXmpTagString(QLatin1String("Xmp.kipi.Imgur.Delete")); for (int i = 0; i < listView()->topLevelItemCount(); ++i) { ImgurImageListViewItem* const currItem = dynamic_cast<ImgurImageListViewItem*>(listView()->topLevelItem(i)); if (currItem && currItem->url() == imageUrl) { found = true; if (!sUrl.isEmpty()) { currItem->setUrl(sUrl); } if (!sDeleteUrl.isEmpty()) { currItem->setDeleteUrl(sDeleteUrl); } break; } } if (!found) { new ImgurImageListViewItem(listView(), imageUrl); } } } } // Duplicate the signalImageListChanged of the ImageWindow, to enable the // upload button again. emit signalImageListChanged(); emit signalAddItems(list); }
ItemsPage::ItemsPage(Manager* const mngr, KAssistantDialog* const dlg) : KPWizardPage(dlg, i18n("<b>Set Bracketed Images</b>")), d(new ItemsPagePriv) { d->mngr = mngr; KVBox* vbox = new KVBox(this); QLabel* label1 = new QLabel(vbox); label1->setWordWrap(true); label1->setText(i18n("<qt>" "<p>Set here the list of your bracketed images to fuse. Please follow these conditions:</p>" "<ul><li>At least 2 images from the same subject must be added to the stack.</li>" "<li>Do not mix images with different color depth.</li>" "<li>All images must have the same dimensions.</li></ul>" "</qt>")); d->list = new KPImagesList(vbox); d->list->listView()->setColumn(KPImagesListView::User1, i18n("Exposure (EV)"), true); d->list->slotAddImages(d->mngr->itemsList()); setPageWidget(vbox); QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_expoblending/pics/assistant-stack.png"); setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation)); connect(d->mngr->thread(), SIGNAL(starting(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); connect(d->mngr->thread(), SIGNAL(finished(KIPIExpoBlendingPlugin::ActionData)), this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData))); connect(d->list, SIGNAL(signalAddItems(KUrl::List)), this, SLOT(slotAddItems(KUrl::List))); connect(d->list, SIGNAL(signalImageListChanged()), this, SLOT(slotImageListChanged())); QTimer::singleShot(0, this, SLOT(slotSetupList())); }
void BracketStackList::addItems(const KUrl::List& list) { if (list.count() == 0) return; KUrl::List urls; for ( KUrl::List::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) { KUrl imageUrl = *it; // Check if the new item already exist in the list. bool found = false; QTreeWidgetItemIterator iter(this); while (*iter) { BracketStackItem* item = dynamic_cast<BracketStackItem*>(*iter); if (item->url() == imageUrl) found = true; ++iter; } if (!found) { BracketStackItem* item = new BracketStackItem(this); item->setUrl(imageUrl); item->setOn(true); urls.append(imageUrl); } } if (d->iface) { d->iface->thumbnails(urls, iconSize().width()); } else { #if KDE_IS_VERSION(4,7,0) KFileItemList items; for (KUrl::List::ConstIterator it = urls.begin() ; it != urls.end() ; ++it) { if ((*it).isValid()) items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, *it, true)); } KIO::PreviewJob* job = KIO::filePreview(items, iconSize()); #else KIO::PreviewJob *job = KIO::filePreview(urls, iconSize().width()); #endif connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), this, SLOT(slotKDEPreview(KFileItem,QPixmap))); connect(job, SIGNAL(failed(KFileItem)), this, SLOT(slotKDEPreviewFailed(KFileItem))); } emit signalAddItems(urls); }