diff --git a/libimageviewer/quickprint/printimageloader.cpp b/libimageviewer/quickprint/printimageloader.cpp index 8153b713..d492c4ed 100644 --- a/libimageviewer/quickprint/printimageloader.cpp +++ b/libimageviewer/quickprint/printimageloader.cpp @@ -283,6 +283,11 @@ bool PrintImageLoader::loadImageData(PrintImageData::Ptr &imagePtr) reader.jumpToImage(imagePtr->frame); } + if (!reader.canRead()) { + reader.setAutoDetectImageFormat(true); //控制是否通过内容识别格式 + reader.setDecideFormatFromContent(true); // 根据内容识别格式 + reader.setFileName(imagePtr->filePath); //必须重新设置一下文件,才能触发内部加载方式的切换 + } if (!reader.canRead()) { qWarning() << QString("Load multi frame image failed(jump to image): %1").arg(reader.errorString()); imagePtr->state = ContentError; diff --git a/libimageviewer/quickprint/quickprint.cpp b/libimageviewer/quickprint/quickprint.cpp index 5d5803b2..0ced6042 100644 --- a/libimageviewer/quickprint/quickprint.cpp +++ b/libimageviewer/quickprint/quickprint.cpp @@ -129,14 +129,19 @@ int QuickPrintPrivate::showPrintDialog(QWidget *parentWidget) qInfo() << "Showing print dialog for" << loadDataList.size() << "images"; DPrintPreviewDialog printDialog(parentWidget); printDialog.setObjectName("QuickPrint_PrintDialog"); +#if DTK_VERSION > DTK_VERSION_CHECK(5, 4, 10, 0) printDialog.setAsynPreview(loadDataList.size()); // 设置打印文件名,用于 Cups 服务记录打印任务 printDialog.setDocName(loadDataList.first()->filePath); connect(&printDialog, - QOverload &>::of(&DPrintPreviewDialog::paintRequested), - this, - &QuickPrintPrivate::asyncPrint); + QOverload &>::of(&DPrintPreviewDialog::paintRequested), + this, + &QuickPrintPrivate::asyncPrint); +#else + connect(&printDialog, SIGNAL(paintRequested(DPrinter *)), + this, SLOT(paintRequestSync(DPrinter *))); +#endif return printDialog.exec(); } diff --git a/libimageviewer/slideshow/imageanimation.cpp b/libimageviewer/slideshow/imageanimation.cpp index fe0b8734..4fa72826 100644 --- a/libimageviewer/slideshow/imageanimation.cpp +++ b/libimageviewer/slideshow/imageanimation.cpp @@ -119,6 +119,7 @@ class LibImageAnimationPrivate : public QWidget void startSingleNextAnimation(); void startSinglePreAnimation(); void startStatic(); + void forceStopCurrentAnimation(); void endSlide() { if (m_staticTimer) { @@ -545,12 +546,11 @@ void LibImageAnimationPrivate::startSingleNextAnimation() qDebug() << "Starting single next animation"; if (m_isAnimationIng) { qDebug() << "Animation already in progress, stopping"; - m_isAnimationIng = false; - } else { - setImage1(m_imageName2); - setImage2(queue->jumpTonext()); - startAnimation(); + forceStopCurrentAnimation(); } + setImage1(m_imageName2); + setImage2(queue->jumpTonext()); + startAnimation(); } void LibImageAnimationPrivate::startSinglePreAnimation() @@ -558,12 +558,11 @@ void LibImageAnimationPrivate::startSinglePreAnimation() qDebug() << "Starting single previous animation"; if (m_isAnimationIng) { qDebug() << "Animation already in progress, stopping"; - m_isAnimationIng = false; - } else { - setImage1(m_imageName2); - setImage2(queue->jumpTopre()); - startAnimation(); + forceStopCurrentAnimation(); } + setImage1(m_imageName2); + setImage2(queue->jumpTopre()); + startAnimation(); } void LibImageAnimationPrivate::startStatic() @@ -578,6 +577,20 @@ void LibImageAnimationPrivate::startStatic() m_staticTimer->start(SLIDER_TIME); } +void LibImageAnimationPrivate::forceStopCurrentAnimation() +{ + if (m_continuousanimationTimer) { + m_continuousanimationTimer->stop(); + m_continuousanimationTimer->setInterval(0); + m_factor = 0.0f; + m_isAnimationIng = false; + } + if (m_staticTimer) { + m_staticTimer->stop(); + m_staticTimer->setInterval(0); + } +} + void LibImageAnimationPrivate::onContinuousAnimationTimer() { Q_Q(LibImageAnimation); diff --git a/libimageviewer/unionimage/unionimage.cpp b/libimageviewer/unionimage/unionimage.cpp index 3b7f248f..0d5ad125 100644 --- a/libimageviewer/unionimage/unionimage.cpp +++ b/libimageviewer/unionimage/unionimage.cpp @@ -24,7 +24,7 @@ #include "unionimage/imageutils.h" extern "C" { -#include "3rdparty/tiff-tools/converttiff.h" +#include "../../3rdparty/tiff-tools/converttiff.h" } #include @@ -266,6 +266,12 @@ UNIONIMAGESHARED_EXPORT bool loadStaticImageFromFile(const QString &path, QImage QImageReader reader; QImage res_qt; reader.setFileName(path); + //当不能读取数据时,设置以内容判断格式进行加载,这样可以避免后缀名修改后文件无法打开的情况 + if (!reader.canRead()) { + reader.setAutoDetectImageFormat(true); //控制是否通过内容识别格式 + reader.setDecideFormatFromContent(true); // 根据内容识别格式 + reader.setFileName(path); //必须重新设置一下文件,才能触发内部加载方式的切换 + } if (format_bar.isEmpty()) { reader.setFormat(file_suffix_lower.toLatin1()); } else { diff --git a/libimageviewer/viewpanel/contents/imgviewdelegate.cpp b/libimageviewer/viewpanel/contents/imgviewdelegate.cpp index f84c96bc..acfd1dd0 100644 --- a/libimageviewer/viewpanel/contents/imgviewdelegate.cpp +++ b/libimageviewer/viewpanel/contents/imgviewdelegate.cpp @@ -92,8 +92,8 @@ void LibImgViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op QPainter::Antialiasing); QRect backgroundRect = option.rect; if (backgroundRect.width() != LibImgViewListView::ITEM_CURRENT_WH) { - backgroundRect.setTopLeft(QPoint(backgroundRect.topLeft() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET))); - backgroundRect.setBottomRight(QPoint(backgroundRect.bottomRight() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET))); + backgroundRect.setTopLeft(QPoint(backgroundRect.topLeft() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET + 3))); + backgroundRect.setBottomRight(QPoint(backgroundRect.bottomRight() + QPoint(0, NORMAL_ITEM_PAINT_OFFSET + 3))); } else { backgroundRect.setTopLeft(QPoint(backgroundRect.topLeft() + QPoint(0, SELECT_ITEM_PAINT_OFFSET))); backgroundRect.setBottomRight(QPoint(backgroundRect.bottomRight() + QPoint(0, SELECT_ITEM_PAINT_OFFSET)));