forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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 ©Name, 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <QMimeData>
|
||||
#include <QtAlgorithms>
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QImageReader>
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QMimeData>
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
#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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,21 +24,21 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "resourceeditorfactory.h"
|
||||
#include "resourceeditorw.h"
|
||||
#include "resourceeditorplugin.h"
|
||||
|
||||
#include "resourceeditorconstants.h"
|
||||
#include "resourceeditorplugin.h"
|
||||
#include "resourceeditorw.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/fsengine/fileiconprovider.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <qdebug.h>
|
||||
|
||||
using namespace ResourceEditor::Internal;
|
||||
using namespace ResourceEditor::Constants;
|
||||
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin)
|
||||
{
|
||||
setId(RESOURCEEDITOR_ID);
|
||||
@@ -52,3 +52,5 @@ ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin)
|
||||
return new ResourceEditorW(Core::Context(C_RESOURCEEDITOR), plugin);
|
||||
});
|
||||
}
|
||||
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
class ResourceEditorPlugin;
|
||||
|
||||
@@ -38,5 +37,4 @@ public:
|
||||
explicit ResourceEditorFactory(ResourceEditorPlugin *plugin);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
|
||||
#include "resourceeditorplugin.h"
|
||||
|
||||
#include "resourceeditorw.h"
|
||||
#include "resourceeditorconstants.h"
|
||||
#include "resourceeditorfactory.h"
|
||||
#include "resourceeditortr.h"
|
||||
#include "resourceeditorw.h"
|
||||
#include "resourcenode.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -63,15 +64,13 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
static const char resourcePrefix[] = ":";
|
||||
static const char urlPrefix[] = "qrc:";
|
||||
const char resourcePrefix[] = ":";
|
||||
const char urlPrefix[] = "qrc:";
|
||||
|
||||
class PrefixLangDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PrefixLangDialog(const QString &title, const QString &prefix, const QString &lang, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -80,11 +79,11 @@ public:
|
||||
auto layout = new QFormLayout(this);
|
||||
m_prefixLineEdit = new QLineEdit(this);
|
||||
m_prefixLineEdit->setText(prefix);
|
||||
layout->addRow(tr("Prefix:"), m_prefixLineEdit);
|
||||
layout->addRow(Tr::tr("Prefix:"), m_prefixLineEdit);
|
||||
|
||||
m_langLineEdit = new QLineEdit(this);
|
||||
m_langLineEdit->setText(lang);
|
||||
layout->addRow(tr("Language:"), m_langLineEdit);
|
||||
layout->addRow(Tr::tr("Language:"), m_langLineEdit);
|
||||
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel,
|
||||
@@ -114,8 +113,6 @@ private:
|
||||
|
||||
class ResourceEditorPluginPrivate : public QObject
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ResourceEditor::Internal::ResourceEditorPlugin)
|
||||
|
||||
public:
|
||||
explicit ResourceEditorPluginPrivate(ResourceEditorPlugin *q);
|
||||
|
||||
@@ -167,9 +164,9 @@ ResourceEditorPluginPrivate::ResourceEditorPluginPrivate(ResourceEditorPlugin *q
|
||||
{
|
||||
// Register undo and redo
|
||||
const Core::Context context(Constants::C_RESOURCEEDITOR);
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
m_redoAction = new QAction(tr("&Redo"), this);
|
||||
m_refreshAction = new QAction(tr("Recheck Existence of Referenced Files"), this);
|
||||
m_undoAction = new QAction(Tr::tr("&Undo"), this);
|
||||
m_redoAction = new QAction(Tr::tr("&Redo"), this);
|
||||
m_refreshAction = new QAction(Tr::tr("Recheck Existence of Referenced Files"), this);
|
||||
Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
|
||||
Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, context);
|
||||
Core::ActionManager::registerAction(m_refreshAction, Constants::REFRESH, context);
|
||||
@@ -184,53 +181,53 @@ ResourceEditorPluginPrivate::ResourceEditorPluginPrivate(ResourceEditorPlugin *q
|
||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT);
|
||||
Core::Command *command = nullptr;
|
||||
|
||||
m_addPrefix = new QAction(tr("Add Prefix..."), this);
|
||||
m_addPrefix = new QAction(Tr::tr("Add Prefix..."), this);
|
||||
command = Core::ActionManager::registerAction(m_addPrefix, Constants::C_ADD_PREFIX, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_addPrefix, &QAction::triggered, this, &ResourceEditorPluginPrivate::addPrefixContextMenu);
|
||||
|
||||
m_renamePrefix = new QAction(tr("Change Prefix..."), this);
|
||||
m_renamePrefix = new QAction(Tr::tr("Change Prefix..."), this);
|
||||
command = Core::ActionManager::registerAction(m_renamePrefix, Constants::C_RENAME_PREFIX, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_renamePrefix, &QAction::triggered, this, &ResourceEditorPluginPrivate::renamePrefixContextMenu);
|
||||
|
||||
m_removePrefix = new QAction(tr("Remove Prefix..."), this);
|
||||
m_removePrefix = new QAction(Tr::tr("Remove Prefix..."), this);
|
||||
command = Core::ActionManager::registerAction(m_removePrefix, Constants::C_REMOVE_PREFIX, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_removePrefix, &QAction::triggered, this, &ResourceEditorPluginPrivate::removePrefixContextMenu);
|
||||
|
||||
m_removeNonExisting = new QAction(tr("Remove Missing Files"), this);
|
||||
m_removeNonExisting = new QAction(Tr::tr("Remove Missing Files"), this);
|
||||
command = Core::ActionManager::registerAction(m_removeNonExisting, Constants::C_REMOVE_NON_EXISTING, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_removeNonExisting, &QAction::triggered, this, &ResourceEditorPluginPrivate::removeNonExisting);
|
||||
|
||||
m_renameResourceFile = new QAction(tr("Rename..."), this);
|
||||
m_renameResourceFile = new QAction(Tr::tr("Rename..."), this);
|
||||
command = Core::ActionManager::registerAction(m_renameResourceFile, Constants::C_RENAME_FILE, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_renameResourceFile, &QAction::triggered, this, &ResourceEditorPluginPrivate::renameFileContextMenu);
|
||||
|
||||
m_removeResourceFile = new QAction(tr("Remove File..."), this);
|
||||
m_removeResourceFile = new QAction(Tr::tr("Remove File..."), this);
|
||||
command = Core::ActionManager::registerAction(m_removeResourceFile, Constants::C_REMOVE_FILE, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_removeResourceFile, &QAction::triggered, this, &ResourceEditorPluginPrivate::removeFileContextMenu);
|
||||
|
||||
m_openInEditor = new QAction(tr("Open in Editor"), this);
|
||||
m_openInEditor = new QAction(Tr::tr("Open in Editor"), this);
|
||||
command = Core::ActionManager::registerAction(m_openInEditor, Constants::C_OPEN_EDITOR, projectTreeContext);
|
||||
folderContextMenu->addAction(command, ProjectExplorer::Constants::G_FOLDER_FILES);
|
||||
connect(m_openInEditor, &QAction::triggered, this, &ResourceEditorPluginPrivate::openEditorContextMenu);
|
||||
|
||||
m_openWithMenu = new QMenu(tr("Open With"), folderContextMenu->menu());
|
||||
m_openWithMenu = new QMenu(Tr::tr("Open With"), folderContextMenu->menu());
|
||||
folderContextMenu->menu()->insertMenu(
|
||||
folderContextMenu->insertLocation(ProjectExplorer::Constants::G_FOLDER_FILES),
|
||||
m_openWithMenu);
|
||||
|
||||
m_copyPath = new Utils::ParameterAction(tr("Copy Path"), tr("Copy Path \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
|
||||
m_copyPath = new Utils::ParameterAction(Tr::tr("Copy Path"), Tr::tr("Copy Path \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
|
||||
command = Core::ActionManager::registerAction(m_copyPath, Constants::C_COPY_PATH, projectTreeContext);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
fileContextMenu->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
|
||||
connect(m_copyPath, &QAction::triggered, this, &ResourceEditorPluginPrivate::copyPathContextMenu);
|
||||
|
||||
m_copyUrl = new Utils::ParameterAction(tr("Copy URL"), tr("Copy URL \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
|
||||
m_copyUrl = new Utils::ParameterAction(Tr::tr("Copy URL"), Tr::tr("Copy URL \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
|
||||
command = Core::ActionManager::registerAction(m_copyUrl, Constants::C_COPY_URL, projectTreeContext);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
fileContextMenu->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
|
||||
@@ -301,7 +298,7 @@ void ResourceEditorPluginPrivate::addPrefixContextMenu()
|
||||
{
|
||||
auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode());
|
||||
QTC_ASSERT(topLevel, return);
|
||||
PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::dialogParent());
|
||||
PrefixLangDialog dialog(Tr::tr("Add Prefix"), QString(), QString(), Core::ICore::dialogParent());
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
QString prefix = dialog.prefix();
|
||||
@@ -315,8 +312,8 @@ void ResourceEditorPluginPrivate::removePrefixContextMenu()
|
||||
auto rfn = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
|
||||
QTC_ASSERT(rfn, return);
|
||||
if (QMessageBox::question(Core::ICore::dialogParent(),
|
||||
tr("Remove Prefix"),
|
||||
tr("Remove prefix %1 and all its files?").arg(rfn->displayName()))
|
||||
Tr::tr("Remove Prefix"),
|
||||
Tr::tr("Remove prefix %1 and all its files?").arg(rfn->displayName()))
|
||||
== QMessageBox::Yes) {
|
||||
ResourceTopLevelNode *rn = rfn->resourceNode();
|
||||
rn->removePrefix(rfn->prefix(), rfn->lang());
|
||||
@@ -344,8 +341,8 @@ void ResourceEditorPluginPrivate::removeFileContextMenu()
|
||||
QTC_ASSERT(parent, return);
|
||||
if (parent->removeFiles({path}) != RemovedFilesFromProject::Ok)
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
tr("File Removal Failed"),
|
||||
tr("Removing file %1 from the project failed.").arg(path.toUserOutput()));
|
||||
Tr::tr("File Removal Failed"),
|
||||
Tr::tr("Removing file %1 from the project failed.").arg(path.toUserOutput()));
|
||||
}
|
||||
|
||||
void ResourceEditorPluginPrivate::openEditorContextMenu()
|
||||
@@ -372,7 +369,7 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu()
|
||||
auto node = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
|
||||
QTC_ASSERT(node, return);
|
||||
|
||||
PrefixLangDialog dialog(tr("Rename Prefix"),
|
||||
PrefixLangDialog dialog(Tr::tr("Rename Prefix"),
|
||||
node->prefix(),
|
||||
node->lang(),
|
||||
Core::ICore::dialogParent());
|
||||
@@ -471,7 +468,4 @@ void ResourceEditorPlugin::onUndoStackChanged(ResourceEditorW const *editor,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
|
||||
#include "resourceeditorplugin.moc"
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
class ResourceEditorW;
|
||||
|
||||
@@ -49,5 +48,4 @@ private:
|
||||
class ResourceEditorPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
#include "resourceeditorconstants.h"
|
||||
#include "resourceeditorplugin.h"
|
||||
|
||||
#include <resourceeditor/qrceditor/qrceditor.h>
|
||||
#include <resourceeditor/qrceditor/resourcefile_p.h>
|
||||
#include "resourceeditortr.h"
|
||||
#include "qrceditor/qrceditor.h"
|
||||
#include "qrceditor/resourcefile_p.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/commandbutton.h>
|
||||
@@ -46,8 +46,7 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
enum { debugResourceEditorW = 0 };
|
||||
|
||||
@@ -85,13 +84,13 @@ ResourceEditorW::ResourceEditorW(const Core::Context &context,
|
||||
m_toolBar->addWidget(refreshButton);
|
||||
|
||||
m_resourceEditor->setResourceDragEnabled(true);
|
||||
m_contextMenu->addAction(tr("Open File"), this, &ResourceEditorW::openCurrentFile);
|
||||
m_openWithMenu = m_contextMenu->addMenu(tr("Open With"));
|
||||
m_renameAction = m_contextMenu->addAction(tr("Rename File..."), this,
|
||||
m_contextMenu->addAction(Tr::tr("Open File"), this, &ResourceEditorW::openCurrentFile);
|
||||
m_openWithMenu = m_contextMenu->addMenu(Tr::tr("Open With"));
|
||||
m_renameAction = m_contextMenu->addAction(Tr::tr("Rename File..."), this,
|
||||
&ResourceEditorW::renameCurrentFile);
|
||||
m_copyFileNameAction = m_contextMenu->addAction(tr("Copy Resource Path to Clipboard"),
|
||||
m_copyFileNameAction = m_contextMenu->addAction(Tr::tr("Copy Resource Path to Clipboard"),
|
||||
this, &ResourceEditorW::copyCurrentResourcePath);
|
||||
m_orderList = m_contextMenu->addAction(tr("Sort Alphabetically"), this, &ResourceEditorW::orderList);
|
||||
m_orderList = m_contextMenu->addAction(Tr::tr("Sort Alphabetically"), this, &ResourceEditorW::orderList);
|
||||
|
||||
connect(m_resourceDocument, &ResourceEditorDocument::loaded,
|
||||
m_resourceEditor, &QrcEditor::loaded);
|
||||
@@ -335,5 +334,4 @@ void ResourceEditorW::onRedo()
|
||||
m_resourceEditor->onRedo();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
@@ -33,8 +33,7 @@ class QMenu;
|
||||
class QToolBar;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ResourceEditor {
|
||||
namespace Internal {
|
||||
namespace ResourceEditor::Internal {
|
||||
|
||||
class RelativeResourceModel;
|
||||
class ResourceEditorPlugin;
|
||||
@@ -125,5 +124,4 @@ public:
|
||||
friend class ResourceEditorDocument;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ResourceEditor
|
||||
} // ResourceEditor::Internal
|
||||
|
||||
Reference in New Issue
Block a user