Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libimageviewer/quickprint/printimageloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions libimageviewer/quickprint/quickprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DPrinter *, const QVector<int> &>::of(&DPrintPreviewDialog::paintRequested),
this,
&QuickPrintPrivate::asyncPrint);
QOverload<DPrinter *, const QVector<int> &>::of(&DPrintPreviewDialog::paintRequested),
this,
&QuickPrintPrivate::asyncPrint);
#else
connect(&printDialog, SIGNAL(paintRequested(DPrinter *)),
this, SLOT(paintRequestSync(DPrinter *)));
#endif

return printDialog.exec();
}
Expand Down
33 changes: 23 additions & 10 deletions libimageviewer/slideshow/imageanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class LibImageAnimationPrivate : public QWidget
void startSingleNextAnimation();
void startSinglePreAnimation();
void startStatic();
void forceStopCurrentAnimation();
void endSlide()
{
if (m_staticTimer) {
Expand Down Expand Up @@ -545,25 +546,23 @@ 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()
{
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()
Expand All @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion libimageviewer/unionimage/unionimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#include <QDebug>
#include <QUuid>

#include "unionimage/imageutils.h"

Check warning on line 25 in libimageviewer/unionimage/unionimage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "unionimage/imageutils.h" not found.

Check warning on line 25 in libimageviewer/unionimage/unionimage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "unionimage/imageutils.h" not found.
extern "C" {
#include "3rdparty/tiff-tools/converttiff.h"
#include "../../3rdparty/tiff-tools/converttiff.h"
}

#include <cstring>

Check warning on line 30 in libimageviewer/unionimage/unionimage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <cstring> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 30 in libimageviewer/unionimage/unionimage.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <cstring> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#define SAVE_QUAITY_VALUE 100

Expand Down Expand Up @@ -266,6 +266,12 @@
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 {
Expand Down
4 changes: 2 additions & 2 deletions libimageviewer/viewpanel/contents/imgviewdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Loading