ImageViewer: Convert to Tr::tr

Change-Id: Id12dc265ed60be942ec68ac5a80f57144c2d086f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2022-07-08 18:51:09 +02:00
parent 4a9b74c670
commit 3de1fffbeb
29 changed files with 220 additions and 569 deletions

View File

@@ -25,26 +25,29 @@
****************************************************************************/
#include "imageviewerfile.h"
#include "imageviewer.h"
#include "imageviewerconstants.h"
#include "imageviewertr.h"
#include <coreplugin/editormanager/documentmodel.h>
#include <utils/fileutils.h>
#include <coreplugin/editormanager/ieditor.h>
#include <utils/filepath.h>
#include <utils/mimeutils.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
#include <QGraphicsPixmapItem>
#ifndef QT_NO_SVG
#include <QGraphicsSvgItem>
#endif
#include <QImageReader>
#include <QMovie>
#include <QPainter>
#include <QPixmap>
namespace ImageViewer {
namespace Internal {
#ifndef QT_NO_SVG
#include <QGraphicsSvgItem>
#endif
namespace ImageViewer::Internal {
class MovieItem : public QObject, public QGraphicsPixmapItem
{
@@ -103,7 +106,7 @@ Core::IDocument::OpenResult ImageViewerFile::openImpl(QString *errorString,
// if it is impossible to recognize a file format - file will not be open correctly
if (format.isEmpty()) {
if (errorString)
*errorString = tr("Image format not supported.");
*errorString = Tr::tr("Image format not supported.");
return OpenResult::CannotHandle;
}
@@ -115,7 +118,7 @@ Core::IDocument::OpenResult ImageViewerFile::openImpl(QString *errorString,
delete m_tempSvgItem;
m_tempSvgItem = nullptr;
if (errorString)
*errorString = tr("Failed to read SVG image.");
*errorString = Tr::tr("Failed to read SVG image.");
return OpenResult::CannotHandle;
}
m_type = TypeSvg;
@@ -128,7 +131,7 @@ Core::IDocument::OpenResult ImageViewerFile::openImpl(QString *errorString,
m_movie->jumpToNextFrame();
if (!m_movie->isValid()) {
if (errorString)
*errorString = tr("Failed to read image.");
*errorString = Tr::tr("Failed to read image.");
delete m_movie;
m_movie = nullptr;
return OpenResult::CannotHandle;
@@ -152,7 +155,7 @@ Core::IDocument::OpenResult ImageViewerFile::openImpl(QString *errorString,
m_pixmap = new QPixmap(fileName);
if (m_pixmap->isNull()) {
if (errorString)
*errorString = tr("Failed to read image.");
*errorString = Tr::tr("Failed to read image.");
delete m_pixmap;
m_pixmap = nullptr;
return OpenResult::CannotHandle;
@@ -243,7 +246,7 @@ void ImageViewerFile::updateVisibility()
if (!m_movie || m_isPaused)
return;
bool visible = false;
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForDocument(this)) {
for (Core::IEditor *editor : Core::DocumentModel::editorsForDocument(this)) {
if (editor->widget()->isVisible()) {
visible = true;
break;
@@ -265,5 +268,4 @@ void ImageViewerFile::cleanUp()
m_type = TypeInvalid;
}
} // namespace Internal
} // namespace ImageViewer
} // ImageViewer::Internal