当前位置: 首页>>代码示例>>C++>>正文


C++ BatchProcessImagesItem::changeError方法代码示例

本文整理汇总了C++中BatchProcessImagesItem::changeError方法的典型用法代码示例。如果您正苦于以下问题:C++ BatchProcessImagesItem::changeError方法的具体用法?C++ BatchProcessImagesItem::changeError怎么用?C++ BatchProcessImagesItem::changeError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BatchProcessImagesItem的用法示例。


在下文中一共展示了BatchProcessImagesItem::changeError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateListing

void RenameImagesWidget::updateListing()
{
    int pos = 0;
    QTreeWidgetItemIterator it(ui->m_listView);
    for (; *it; ++it)
    {
        BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(*it);
        item->changeNameDest(oldToNewName(item, pos));
        item->changeResult(QString());
        item->changeError(QString());
        item->changeOutputMess(QString());
        pos++;
    }
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:14,代码来源:renameimageswidget.cpp

示例2: processAborted

void BatchProcessImagesDialog::processAborted(bool removeFlag)
{
    kDebug() << "BatchProcessImagesDialog::processAborted";

    BatchProcessImagesItem *item = static_cast<BatchProcessImagesItem*>(**m_listFile2Process_iterator);
    m_listFiles->scrollToItem(m_listFiles->currentItem());

    item->changeResult(i18n("Aborted."));
    item->changeError(i18n("process aborted by user"));

    if (removeFlag == true)
    { // Try to delete de destination !
        KUrl deleteImage = m_ui->m_destinationUrl->url();
        deleteImage.addPath(item->nameDest());

        if (KIO::NetAccess::exists(deleteImage, KIO::NetAccess::DestinationSide, kapp->activeWindow())
                == true)
            KIO::NetAccess::del(deleteImage, kapp->activeWindow());
    }

    endProcess();
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:22,代码来源:batchprocessimagesdialog.cpp

示例3: 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)
                {
//.........这里部分代码省略.........
开发者ID:rickysarraf,项目名称:digikam,代码行数:101,代码来源:batchprocessimagesdialog.cpp

示例4: 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."));
//.........这里部分代码省略.........
开发者ID:rickysarraf,项目名称:digikam,代码行数:101,代码来源:batchprocessimagesdialog.cpp


注:本文中的BatchProcessImagesItem::changeError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。