本文整理汇总了C++中BatchProcessImagesItem::pathSrc方法的典型用法代码示例。如果您正苦于以下问题:C++ BatchProcessImagesItem::pathSrc方法的具体用法?C++ BatchProcessImagesItem::pathSrc怎么用?C++ BatchProcessImagesItem::pathSrc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BatchProcessImagesItem
的用法示例。
在下文中一共展示了BatchProcessImagesItem::pathSrc方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sortList
void RenameImagesWidget::sortList(QAction* action)
{
QTreeWidgetItemIterator it(ui->m_listView->topLevelItem(0));
for (; *it; ++it)
{
BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(*it);
if (action == m_byNameAction)
{
item->changeSortKey(item->nameSrc());
}
else if (action == m_bySizeAction)
{
QFileInfo fi(item->pathSrc());
item->changeSortKey(QString::number(fi.size()));
}
else if (action == m_byDateAction)
{
KUrl url(item->pathSrc());
KIPIPlugins::KPImageInfo info(url);
item->changeSortKey(info.date().toString(Qt::ISODate));
}
}
ui->m_listView->sortByColumn(BatchProcessImagesItem::columnOfSortKey(), Qt::AscendingOrder);
updateListing();
}
示例2: slotImageSelected
void BatchProcessImagesDialog::slotImageSelected(QTreeWidgetItem * item)
{
if (!item || m_listFiles->topLevelItemCount() == 0)
{
m_ui->m_imageLabel->clear();
return;
}
BatchProcessImagesItem *pitem = static_cast<BatchProcessImagesItem*>(item);
m_ui->m_imageLabel->clear();
QString IdemIndexed = "file:" + pitem->pathSrc();
KUrl url(IdemIndexed);
if ( !url.isValid() )
return;
#if KDE_IS_VERSION(4,7,0)
KFileItemList items;
items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true));
KIO::PreviewJob* m_thumbJob = KIO::filePreview(items, QSize(m_ui->m_imageLabel->height(), m_ui->m_imageLabel->height()));
#else
KIO::PreviewJob* m_thumbJob = KIO::filePreview(url, m_ui->m_imageLabel->height());
#endif
connect(m_thumbJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
this, SLOT(slotGotPreview(KFileItem,QPixmap)));
}
示例3: slotImagesFilesButtonRem
void BatchProcessImagesDialog::slotImagesFilesButtonRem()
{
BatchProcessImagesItem *pitem = static_cast<BatchProcessImagesItem*>(m_listFiles->currentItem());
if (pitem) {
m_selectedImageFiles.removeOne(pitem->pathSrc());
delete pitem;
m_nbItem = m_selectedImageFiles.count();
}
}
示例4: listImageFiles
void BatchProcessImagesDialog::listImageFiles()
{
m_nbItem = m_selectedImageFiles.count();
if (m_selectedImageFiles.isEmpty())
return;
for (KUrl::List::Iterator it = m_selectedImageFiles.begin();
it != m_selectedImageFiles.end(); ++it)
{
QString currentFile = (*it).path(); // PENDING(blackie) Handle URLS
QFileInfo* fi = new QFileInfo(currentFile);
// Check if the new item already exist in the list.
bool findItem = false;
QTreeWidgetItemIterator it2(m_listFiles);
while (*it2)
{
BatchProcessImagesItem* pitem = static_cast<BatchProcessImagesItem*>(*it2);
if (pitem->pathSrc() == currentFile.section('/', 0, -1))
findItem = true;
++it2;
}
if (findItem == false)
{
QString oldFileName = fi->fileName();
QString newFileName = oldFileName2NewFileName(oldFileName);
new BatchProcessImagesItem(m_listFiles,
currentFile.section('/', 0, -1),
oldFileName,
newFileName,
""
);
}
delete fi;
}
QTreeWidgetItem* firstItem = m_listFiles->topLevelItem(0);
if (firstItem)
{
m_listFiles->setCurrentItem(firstItem);
slotImageSelected(firstItem);
m_listFiles->scrollToItem(firstItem);
}
}
示例5: slotImageSelected
void RenameImagesWidget::slotImageSelected(QTreeWidgetItem* item)
{
if (!item)
{
ui->m_removeButton->setEnabled(false);
return;
}
ui->m_removeButton->setEnabled(true);
ui->m_pixLabel->clear();
BatchProcessImagesItem* it = static_cast<BatchProcessImagesItem*>(item);
m_interface->thumbnail(KUrl(it->pathSrc()), ui->m_pixLabel->height());
}
示例6: slotPreviewFinished
void BatchProcessImagesDialog::slotPreviewFinished()
{
if (m_PreviewProc->exitStatus() == QProcess::CrashExit)
{
KMessageBox::error(this, i18n("Cannot run properly 'convert' program from 'ImageMagick' package."));
m_ui->m_previewButton->setEnabled(true);
return;
}
BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(m_listFiles->currentItem());
int ValRet = m_PreviewProc->exitCode();
kDebug() << "Convert exit (" << ValRet << ")";
if (ValRet == 0)
{
QString cropTitle = "";
if (m_ui->m_smallPreview->isChecked())
cropTitle = i18n(" - small preview");
QPointer<ImagePreview> previewDialog = new ImagePreview(item->pathSrc(), m_tmpFolder + '/'
+ QString::number(getpid()) + "preview.PNG", m_ui->m_smallPreview->isChecked(),
m_Type->currentText() + cropTitle, item->nameSrc(), this);
previewDialog->exec();
delete previewDialog;
KUrl deletePreviewImage(m_tmpFolder + '/' + QString::number(getpid()) + "preview.PNG");
KIO::NetAccess::del(deletePreviewImage, kapp->activeWindow());
}
else
{
QPointer<KPOutputDialog> infoDialog = new KPOutputDialog(this, i18n("Preview processing error"),
m_previewOutput, i18n("Cannot process preview for image \"%1\"."
"\nThe output messages are:\n", item->nameSrc()));
infoDialog->exec();
delete infoDialog;
}
endPreview();
}
示例7: processDone
void ConvertImagesDialog::processDone()
{
if (m_Type->currentItem() == 0)
{
// JPEG file, we remove IPTC preview.
BatchProcessImagesItem *item = dynamic_cast<BatchProcessImagesItem*>(
m_listFile2Process_iterator->current() );
if (item)
{
QString src = item->pathSrc();
QString tgt = m_destinationURL->url().path() + "/" + item->nameDest();
QFileInfo fi(tgt);
kDebug() << src << endl;
kDebug() << tgt << fi.size()<< endl;
KExiv2Iface::KExiv2 metaSrc(src);
// Update Iptc preview.
// NOTE: see B.K.O #130525. a JPEG segment is limited to 64K. If the IPTC byte array is
// bigger than 64K duing of image preview tag size, the target JPEG image will be
// broken. Note that IPTC image preview tag is limited to 256K!!!
// There is no limitation with TIFF and PNG about IPTC byte array size.
metaSrc.removeIptcTag("Iptc.Application2.Preview");
metaSrc.removeIptcTag("Iptc.Application2.PreviewFormat");
metaSrc.removeIptcTag("Iptc.Application2.PreviewVersion");
KExiv2Iface::KExiv2 metaTgt(tgt);
metaTgt.setIptc(metaSrc.getIptc());
metaTgt.applyChanges();
}
}
BatchProcessImagesDialog::processDone();
}
示例8: slotNext
void RenameImagesWidget::slotNext()
{
QTreeWidgetItem* it = ui->m_listView->selectedItems().first();
if (!it)
{
slotAbort();
return;
}
BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(it);
KUrl src;
src.setPath(item->pathSrc());
KUrl dst = src.upUrl();
dst.addPath(item->text(2));
bool skip = false;
bool overwrite = false;
if (!m_overwriteAll)
{
KDE_struct_stat info;
while (KDE_stat(QFile::encodeName(dst.toLocalFile()), &info) == 0)
{
if (m_autoSkip)
{
skip = true;
break;
}
QPointer<KIO::RenameDialog> dlg = new KIO::RenameDialog(this, i18n("Rename File"),
src.path(), dst.path(),
KIO::RenameDialog_Mode(KIO::M_MULTI | KIO::M_OVERWRITE | KIO::M_SKIP));
int result = dlg->exec();
dst = dlg->newDestUrl();
delete dlg;
switch (result)
{
case KIO::R_CANCEL:
{
slotAbort();
return;
}
case KIO::R_SKIP:
{
skip = true;
break;
}
case KIO::R_AUTO_SKIP:
{
m_autoSkip = true;
skip = true;
break;
}
case KIO::R_OVERWRITE:
{
overwrite = true;
break;
}
case KIO::R_OVERWRITE_ALL:
{
m_overwriteAll = true;
overwrite = true;
break;
}
default:
break;
}
if (skip || overwrite)
break;
}
}
if (skip)
{
item->changeResult(i18nc("batch process result", "Skipped"));
}
else
{
// Get the src info
KIPIPlugins::KPImageInfo srcInfo(src);
if (KDE_rename(QFile::encodeName(src.toLocalFile()),
QFile::encodeName(dst.toLocalFile())) == 0)
{
// Rename XMP sidecar file
KIPIPlugins::KPMetadata::moveSidecar(src, dst);
srcInfo.setName(dst.fileName());
item->changeResult(i18nc("batch process result", "OK"));
}
else
{
item->changeResult(i18nc("batch process result", "Failed"));
}
}
//.........这里部分代码省略.........
示例9: slotFinished
void BatchProcessImagesDialog::slotFinished()
{
if (m_convertStatus == PROCESS_DONE)
{
// processAborted() has already been called. No need to show the warning.
return;
}
BatchProcessImagesItem *item = static_cast<BatchProcessImagesItem*>(**m_listFile2Process_iterator);
m_listFiles->scrollToItem(m_listFiles->currentItem());
if (m_ProcessusProc->exitStatus() == QProcess::CrashExit)
{
int code = KMessageBox::warningContinueCancel(this,
i18n("The 'convert' program from 'ImageMagick' package has been stopped abnormally"),
i18n("Error running 'convert'"));
if (code == KMessageBox::Cancel)
{
processAborted(true);
}
else
{
item->changeResult(i18nc("batch process result", "Failed."));
item->changeError(i18n("'convert' program from 'ImageMagick' package "
"has been stopped abnormally."));
++*m_listFile2Process_iterator;
++m_progressStatus;
m_ui->m_progress->setValue((int)((float) m_progressStatus * (float) 100 / (float) m_nbItem));
if (**m_listFile2Process_iterator)
startProcess();
else
endProcess();
}
return;
}
int ValRet = m_ProcessusProc->exitCode();
kWarning() << "Convert exit (" << ValRet << ")";
switch (ValRet)
{
case 0:
{ // Process finished successfully !
item->changeResult(i18n("OK"));
item->changeError(i18n("no processing error"));
processDone();
KUrl src;
src.setPath(item->pathSrc());
KUrl dest = m_ui->m_destinationUrl->url();
dest.addPath(item->nameDest());
QString errmsg;
KUrl::List urlList;
urlList.append(src);
urlList.append(dest);
iface()->refreshImages(urlList);
if (!item->overWrote())
{
// Do not add an entry if there was an image at the location already.
bool ok = iface()->addImage(dest, errmsg);
if (!ok)
{
int code = KMessageBox::warningContinueCancel(this, i18n(
"<qt>Error adding image to application; error message was: "
"<b>%1</b></qt>", errmsg),
i18n("Error Adding Image to Application"));
if (code == KMessageBox::Cancel)
{
slotProcessStop();
break;
}
else
{
item->changeResult(i18nc("batch process result", "Failed."));
}
}
}
if (src != dest)
{
// Clone data in KIPI host application.
KPImageInfo info(src);
info.cloneData(dest);
// Move XMP sidecar file.
KPMetadata::moveSidecar(src, dest);
}
if (m_ui->m_removeOriginal->isChecked() && src != dest)
{
KUrl deleteImage(item->pathSrc());
if (KIO::NetAccess::del(deleteImage, kapp->activeWindow()) == false)
{
//.........这里部分代码省略.........
示例10: startProcess
bool BatchProcessImagesDialog::startProcess()
{
if (m_convertStatus == STOP_PROCESS)
{
endProcess();
return true;
}
QString targetAlbum = m_ui->m_destinationUrl->url().path();
//TODO check if it is valid also for remote URL's
// this is a workarond for bug 117397
QFileInfo dirInfo(targetAlbum + '/');
if (!dirInfo.isDir() || !dirInfo.isWritable())
{
KMessageBox::error(this, i18n("You must specify a writable path for your output file."));
endProcess();
return true;
}
BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(**m_listFile2Process_iterator);
m_listFiles->setCurrentItem(item);
// Lock current item into KIPI host application
KPFileReadLocker(iface(), item->pathSrc());
if (prepareStartProcess(item, targetAlbum) == false) // If there is a problem during the
{ // preparation -> pass to the next item!
++*m_listFile2Process_iterator;
++m_progressStatus;
m_ui->m_progress->setValue((int)((float)m_progressStatus *(float)100 / (float)m_nbItem));
item = static_cast<BatchProcessImagesItem*>(**m_listFile2Process_iterator);
m_listFiles->setCurrentItem(item);
if (**m_listFile2Process_iterator)
{
startProcess();
return true;
}
else
{
endProcess();
return true;
}
}
KUrl desturl(targetAlbum + '/' + item->nameDest());
if (KIO::NetAccess::exists(desturl, KIO::NetAccess::DestinationSide,
kapp->activeWindow()) == true)
{
switch (overwriteMode())
{
case OVERWRITE_ASK:
{
int ValRet = KMessageBox::warningYesNoCancel(this,
i18n("The destination file \"%1\" already exists;\n"
"do you want overwrite it?", item->nameDest()),
i18n("Overwrite Destination Image File"), KStandardGuiItem::cont());
if (ValRet == KMessageBox::No)
{
item->changeResult(i18n("Skipped."));
item->changeError(i18n("destination image file already exists (skipped by user)."));
++*m_listFile2Process_iterator;
++m_progressStatus;
m_ui->m_progress->setValue((int)((float)m_progressStatus *(float)100 / (float)m_nbItem));
if (**m_listFile2Process_iterator)
{
startProcess();
return true;
}
else
{
endProcess();
return true;
}
}
else if (ValRet == KMessageBox::Cancel)
{
processAborted(false);
return false;
}
else
{
item->setDidOverWrite(true);
}
break;
}
case OVERWRITE_RENAME:
{
QFileInfo Target(targetAlbum + '/' + item->nameDest());
QString newFileName = RenameTargetImageFile(&Target);
if (newFileName.isNull())
{
item->changeResult(i18nc("batch process result", "Failed."));
//.........这里部分代码省略.........