Skip to content

Commit

Permalink
fix: [tip] Prompt to add incorrect image information
Browse files Browse the repository at this point in the history
Prompt to add incorrect image information

Log: Prompt to add incorrect image information
Bug: https://pms.uniontech.com/bug-view-276941.html
  • Loading branch information
pppanghu77 committed Oct 19, 2024
1 parent 522bb08 commit 989ca1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ void SlideshowScreenSaver::onUpdateImage()
}

m_pixmap.reset(new QPixmap(m_playOrder.value(m_currentIndex)));

if (m_pixmap && !m_pixmap->isNull()) {
m_invaildPath.clear();
} else {
m_invaildPath = m_playOrder.value(m_currentIndex);
qWarning() << "There is an issue with the format of the image" << m_invaildPath;
}
scaledPixmap();
update();
return;
Expand Down Expand Up @@ -139,7 +146,7 @@ void SlideshowScreenSaver::showDefaultBlack(QPaintEvent *event)
QPainter pa(&pip);
pa.setPen(Qt::white);
pa.drawText(pip.rect(), Qt::AlignCenter,
tr("Please select a valid image path in the Custom Screensaver \"Screensaver Setting\"."));
tr("Please select a valid image path in the Custom Screensaver \"Screensaver Setting\".") + m_invaildPath);

const auto &pix = pip.scaled(mapFromHandle(this->geometry().size()), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
QPainter p(this);
Expand Down Expand Up @@ -187,11 +194,8 @@ void SlideshowScreenSaver::loadSlideshowImages()
int idx = 1;
for (auto info : infoList) {
if (info.size() < IMAGE_MAX_SIZE && validSuffix.contains(info.suffix(), Qt::CaseInsensitive)) {
QScopedPointer<QPixmap> pixmapPointer(new QPixmap(info.absoluteFilePath()));
if (pixmapPointer && !pixmapPointer->isNull()){
m_imagefiles.append(info.absoluteFilePath()); // 记录图片列表
m_playOrder.insert(idx, info.absoluteFilePath());
}
m_imagefiles.append(info.absoluteFilePath()); // 记录图片列表
m_playOrder.insert(idx, info.absoluteFilePath());
idx++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private slots:
QScopedPointer<QTimer> m_timer;

QString m_path; // 图片路径
QString m_invaildPath; // 无效图片路径提示
bool m_shuffle { false }; // 随机轮播
int m_intervalTime { 0 }; // 轮播间隔
int m_currentIndex { 0 };
Expand Down

0 comments on commit 989ca1d

Please sign in to comment.