aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/resourceeditor/qrceditor
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-08-22 14:29:12 +0200
committerhjk <hjk@qt.io>2022-08-22 16:05:33 +0000
commitbc19a26c068de6ac78c8405f622bcc2574f7e4d7 (patch)
tree5c5b5c6026127c11904725bb7b8e01835e13f2d1 /src/plugins/resourceeditor/qrceditor
parent708df011b436e5000b9a6128d453a06efef95940 (diff)
ResourceEditor: Convert to using Tr::tr
Change-Id: Ia9a04dc76bf84e9e9078894be3459fe65fcd5fff Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor/qrceditor')
-rw-r--r--src/plugins/resourceeditor/qrceditor/qrceditor.cpp44
-rw-r--r--src/plugins/resourceeditor/qrceditor/qrceditor.h6
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourcefile.cpp31
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourcefile_p.h17
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourceview.cpp14
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourceview.h6
-rw-r--r--src/plugins/resourceeditor/qrceditor/undocommands.cpp5
-rw-r--r--src/plugins/resourceeditor/qrceditor/undocommands_p.h6
8 files changed, 61 insertions, 68 deletions
diff --git a/src/plugins/resourceeditor/qrceditor/qrceditor.cpp b/src/plugins/resourceeditor/qrceditor/qrceditor.cpp
index ba48327955..e0ef376641 100644
--- a/src/plugins/resourceeditor/qrceditor/qrceditor.cpp
+++ b/src/plugins/resourceeditor/qrceditor/qrceditor.cpp
@@ -24,6 +24,8 @@
****************************************************************************/
#include "qrceditor.h"
+
+#include "resourceeditortr.h"
#include "undocommands_p.h"
#include <aggregation/aggregate.h>
@@ -39,8 +41,7 @@
#include <QPushButton>
#include <QScopedPointer>
-using namespace ResourceEditor;
-using namespace ResourceEditor::Internal;
+namespace ResourceEditor::Internal {
QrcEditor::QrcEditor(RelativeResourceModel *model, QWidget *parent)
: Core::MiniSplitter(Qt::Vertical, parent),
@@ -52,16 +53,16 @@ QrcEditor::QrcEditor(RelativeResourceModel *model, QWidget *parent)
m_treeview->setFrameStyle(QFrame::NoFrame);
m_treeview->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
- auto addPrefixButton = new QPushButton(tr("Add Prefix"));
- m_addFilesButton = new QPushButton(tr("Add Files"));
- m_removeButton = new QPushButton(tr("Remove"));
- m_removeNonExistingButton = new QPushButton(tr("Remove Missing Files"));
+ auto addPrefixButton = new QPushButton(Tr::tr("Add Prefix"));
+ m_addFilesButton = new QPushButton(Tr::tr("Add Files"));
+ m_removeButton = new QPushButton(Tr::tr("Remove"));
+ m_removeNonExistingButton = new QPushButton(Tr::tr("Remove Missing Files"));
- m_aliasLabel = new QLabel(tr("Alias:"));
+ m_aliasLabel = new QLabel(Tr::tr("Alias:"));
m_aliasText = new QLineEdit;
- m_prefixLabel = new QLabel(tr("Prefix:"));
+ m_prefixLabel = new QLabel(Tr::tr("Prefix:"));
m_prefixText = new QLineEdit;
- m_languageLabel = new QLabel(tr("Language:"));
+ m_languageLabel = new QLabel(Tr::tr("Language:"));
m_languageText = new QLineEdit;
using namespace Utils::Layouting;
@@ -74,7 +75,7 @@ QrcEditor::QrcEditor(RelativeResourceModel *model, QWidget *parent)
st,
},
Group {
- title(tr("Properties")),
+ title(Tr::tr("Properties")),
Form {
m_aliasLabel, m_aliasText, br,
m_prefixLabel, m_prefixText, br,
@@ -206,17 +207,18 @@ QAbstractButton *ResolveLocationContext::execLocationMessageBox(QWidget *parent,
{
if (messageBox.isNull()) {
messageBox.reset(new QMessageBox(QMessageBox::Warning,
- QrcEditor::tr("Invalid file location"),
+ Tr::tr("Invalid file location"),
QString(), QMessageBox::NoButton, parent));
- copyButton = messageBox->addButton(QrcEditor::tr("Copy"), QMessageBox::ActionRole);
- abortButton = messageBox->addButton(QrcEditor::tr("Abort"), QMessageBox::RejectRole);
+ copyButton = messageBox->addButton(Tr::tr("Copy"), QMessageBox::ActionRole);
+ abortButton = messageBox->addButton(Tr::tr("Abort"), QMessageBox::RejectRole);
messageBox->setDefaultButton(copyButton);
}
if (wantSkipButton && !skipButton) {
- skipButton = messageBox->addButton(QrcEditor::tr("Skip"), QMessageBox::DestructiveRole);
+ skipButton = messageBox->addButton(Tr::tr("Skip"), QMessageBox::DestructiveRole);
messageBox->setEscapeButton(skipButton);
}
- messageBox->setText(QrcEditor::tr("The file %1 is not in a subdirectory of the resource file. You now have the option to copy this file to a valid location.")
+ messageBox->setText(Tr::tr("The file %1 is not in a subdirectory of the resource file. "
+ "You now have the option to copy this file to a valid location.")
.arg(QDir::toNativeSeparators(file)));
messageBox->exec();
return messageBox->clickedButton();
@@ -226,7 +228,7 @@ QString ResolveLocationContext::execCopyFileDialog(QWidget *parent, const QDir &
{
// Delayed creation of file dialog.
if (copyFileDialog.isNull()) {
- copyFileDialog.reset(new QFileDialog(parent, QrcEditor::tr("Choose Copy Location")));
+ copyFileDialog.reset(new QFileDialog(parent, Tr::tr("Choose Copy Location")));
copyFileDialog->setFileMode(QFileDialog::AnyFile);
copyFileDialog->setAcceptMode(QFileDialog::AcceptSave);
}
@@ -251,15 +253,15 @@ static inline bool copyFile(const QString &file, const QString &copyName, QWidge
{
if (QFile::exists(copyName)) {
if (!QFile::remove(copyName)) {
- QMessageBox::critical(parent, QrcEditor::tr("Overwriting Failed"),
- QrcEditor::tr("Could not overwrite file %1.")
+ QMessageBox::critical(parent, Tr::tr("Overwriting Failed"),
+ Tr::tr("Could not overwrite file %1.")
.arg(QDir::toNativeSeparators(copyName)));
return false;
}
}
if (!QFile::copy(file, copyName)) {
- QMessageBox::critical(parent, QrcEditor::tr("Copying Failed"),
- QrcEditor::tr("Could not copy the file to %1.")
+ QMessageBox::critical(parent, Tr::tr("Copying Failed"),
+ Tr::tr("Could not copy the file to %1.")
.arg(QDir::toNativeSeparators(copyName)));
return false;
}
@@ -446,3 +448,5 @@ void QrcEditor::onRedo()
updateCurrent();
updateHistoryControls();
}
+
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/qrceditor.h b/src/plugins/resourceeditor/qrceditor/qrceditor.h
index 86cf114692..249c32caaf 100644
--- a/src/plugins/resourceeditor/qrceditor/qrceditor.h
+++ b/src/plugins/resourceeditor/qrceditor/qrceditor.h
@@ -36,8 +36,7 @@ class QLineEdit;
class QPushButton;
QT_END_NAMESPACE
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
class QrcEditor : public Core::MiniSplitter
{
@@ -99,5 +98,4 @@ private:
QLineEdit *m_languageText;
};
-} // namespace Internal
-} // namespace ResourceEditor
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
index 42071539d4..3076e6746e 100644
--- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
+++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
@@ -25,9 +25,12 @@
#include "resourcefile_p.h"
+#include "../resourceeditortr.h"
+
#include <coreplugin/fileutils.h>
#include <coreplugin/icore.h>
#include <coreplugin/vcsmanager.h>
+
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/algorithm.h>
@@ -39,21 +42,18 @@
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
+#include <QDomDocument>
#include <QFile>
+#include <QIcon>
+#include <QImageReader>
#include <QMimeData>
-#include <QtAlgorithms>
#include <QTextCodec>
#include <QTextStream>
-
-#include <QIcon>
-#include <QImageReader>
-
-#include <QDomDocument>
+#include <QtAlgorithms>
using namespace Utils;
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
File::File(Prefix *prefix, const QString &_name, const QString &_alias)
: Node(this, prefix)
@@ -116,7 +116,7 @@ Core::IDocument::OpenResult ResourceFile::load()
m_error_message.clear();
if (m_filePath.isEmpty()) {
- m_error_message = tr("The file name is empty.");
+ m_error_message = Tr::tr("The file name is empty.");
return Core::IDocument::OpenResult::ReadError;
}
@@ -142,7 +142,7 @@ Core::IDocument::OpenResult ResourceFile::load()
QString error_msg;
int error_line, error_col;
if (!doc.setContent(data, &error_msg, &error_line, &error_col)) {
- m_error_message = tr("XML error on line %1, col %2: %3")
+ m_error_message = Tr::tr("XML error on line %1, col %2: %3")
.arg(error_line).arg(error_col).arg(error_msg);
return Core::IDocument::OpenResult::CannotHandle;
}
@@ -153,7 +153,7 @@ Core::IDocument::OpenResult ResourceFile::load()
QString error_msg;
int error_line, error_col;
if (!doc.setContent(m_contents, &error_msg, &error_line, &error_col)) {
- m_error_message = tr("XML error on line %1, col %2: %3")
+ m_error_message = Tr::tr("XML error on line %1, col %2: %3")
.arg(error_line).arg(error_col).arg(error_msg);
return Core::IDocument::OpenResult::CannotHandle;
}
@@ -162,7 +162,7 @@ Core::IDocument::OpenResult ResourceFile::load()
QDomElement root = doc.firstChildElement(QLatin1String("RCC"));
if (root.isNull()) {
- m_error_message = tr("The <RCC> root element is missing.");
+ m_error_message = Tr::tr("The <RCC> root element is missing.");
return Core::IDocument::OpenResult::CannotHandle;
}
@@ -241,7 +241,7 @@ bool ResourceFile::save()
m_error_message.clear();
if (m_filePath.isEmpty()) {
- m_error_message = tr("The file name is empty.");
+ m_error_message = Tr::tr("The file name is empty.");
return false;
}
@@ -461,7 +461,7 @@ void ResourceFile::orderList()
}
if (!save())
- m_error_message = tr("Cannot save file.");
+ m_error_message = Tr::tr("Cannot save file.");
}
bool ResourceFile::contains(const QString &prefix, const QString &lang, const QString &file) const
@@ -1268,5 +1268,4 @@ EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index)
}
}
-} // Internal
-} // ResourceEditor
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
index 7c8f3fcf7e..aa79959148 100644
--- a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
+++ b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
@@ -25,18 +25,18 @@
#pragma once
+#include <coreplugin/idocument.h>
+
+#include <utils/textfileformat.h>
+
#include <QAbstractItemModel>
#include <QCoreApplication>
+#include <QIcon>
#include <QMap>
#include <QString>
#include <QStringList>
-#include <QIcon>
-#include <coreplugin/idocument.h>
-#include <utils/textfileformat.h>
-
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
class File;
struct Prefix;
@@ -126,8 +126,6 @@ using PrefixList = QList<Prefix *>;
*/
class ResourceFile
{
- Q_DECLARE_TR_FUNCTIONS(ResourceFile)
-
public:
ResourceFile(const Utils::FilePath &filePath = {}, const QString &contents = {});
~ResourceFile();
@@ -332,5 +330,4 @@ private:
bool m_resourceDragEnabled;
};
-} // namespace Internal
-} // namespace ResourceEditor
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/resourceview.cpp b/src/plugins/resourceeditor/qrceditor/resourceview.cpp
index 33fcab1ecb..2f827eb6c9 100644
--- a/src/plugins/resourceeditor/qrceditor/resourceview.cpp
+++ b/src/plugins/resourceeditor/qrceditor/resourceview.cpp
@@ -25,15 +25,15 @@
#include "resourceview.h"
+#include "../resourceeditortr.h"
#include "undocommands_p.h"
#include <coreplugin/fileutils.h>
#include <coreplugin/icore.h>
-#include <QDebug>
-
#include <QAction>
#include <QApplication>
+#include <QDebug>
#include <QFileDialog>
#include <QHeaderView>
#include <QInputDialog>
@@ -41,8 +41,7 @@
#include <QMouseEvent>
#include <QUndoStack>
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
ResourceView::ResourceView(RelativeResourceModel *model, QUndoStack *history, QWidget *parent) :
Utils::TreeView(parent),
@@ -205,9 +204,9 @@ void ResourceView::refresh()
QStringList ResourceView::fileNamesToAdd()
{
- return QFileDialog::getOpenFileNames(this, tr("Open File"),
+ return QFileDialog::getOpenFileNames(this, Tr::tr("Open File"),
m_qrcModel->absolutePath(QString()),
- tr("All files (*)"));
+ Tr::tr("All files (*)"));
}
QString ResourceView::currentAlias() const
@@ -359,5 +358,4 @@ bool ResourceView::resourceDragEnabled() const
return m_qrcModel->resourceDragEnabled();
}
-} // Internal
-} // ResourceEditor
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/resourceview.h b/src/plugins/resourceeditor/qrceditor/resourceview.h
index a783ec84d8..4a00225624 100644
--- a/src/plugins/resourceeditor/qrceditor/resourceview.h
+++ b/src/plugins/resourceeditor/qrceditor/resourceview.h
@@ -35,8 +35,7 @@ QT_BEGIN_NAMESPACE
class QUndoStack;
QT_END_NAMESPACE
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
class RelativeResourceModel;
@@ -106,5 +105,4 @@ private:
int m_mergeId;
};
-} // namespace Internal
-} // namespace ResourceEditor
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/undocommands.cpp b/src/plugins/resourceeditor/qrceditor/undocommands.cpp
index 247ae51982..0c5ccf6eb0 100644
--- a/src/plugins/resourceeditor/qrceditor/undocommands.cpp
+++ b/src/plugins/resourceeditor/qrceditor/undocommands.cpp
@@ -27,8 +27,7 @@
#include <QModelIndex>
-using namespace ResourceEditor;
-using namespace ResourceEditor::Internal;
+namespace ResourceEditor::Internal {
ViewCommand::ViewCommand(ResourceView *view)
: m_view(view)
@@ -207,3 +206,5 @@ void AddEmptyPrefixCommand::undo()
m_prefixArrayIndex, 0, QModelIndex());
delete m_view->removeEntry(prefixModelIndex);
}
+
+} // ResourceEditor::Internal
diff --git a/src/plugins/resourceeditor/qrceditor/undocommands_p.h b/src/plugins/resourceeditor/qrceditor/undocommands_p.h
index aa871e32cb..4d0e777e48 100644
--- a/src/plugins/resourceeditor/qrceditor/undocommands_p.h
+++ b/src/plugins/resourceeditor/qrceditor/undocommands_p.h
@@ -34,8 +34,7 @@ QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
-namespace ResourceEditor {
-namespace Internal {
+namespace ResourceEditor::Internal {
/*!
\class ViewCommand
@@ -170,5 +169,4 @@ private:
void undo() override;
};
-} // namespace Internal
-} // namespace ResourceEditor
+} // ResourceEditor::Internal