Commit b32988d1 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Fix translatability

Change-Id: I32d4573d24f30347de2f3753b973cf8e454d3378
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>
parent a1071b50
......@@ -298,7 +298,7 @@ bool ClassItem::extendContextMenu(QMenu *menu)
{
bool extended = false;
if (diagramSceneModel()->diagramSceneController()->elementTasks()->hasClassDefinition(object(), diagramSceneModel()->diagram())) {
menu->addAction(new ContextMenuAction(QObject::tr("Show Definition"), QStringLiteral("showDefinition"), menu));
menu->addAction(new ContextMenuAction(tr("Show Definition"), QStringLiteral("showDefinition"), menu));
extended = true;
}
return extended;
......
......@@ -739,36 +739,36 @@ void ObjectItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
bool addSeparator = false;
if (diagramSceneModel()->diagramSceneController()->elementTasks()->hasDiagram(m_object, m_diagramSceneModel->diagram())) {
menu.addAction(new ContextMenuAction(QObject::tr("Open Diagram"), QStringLiteral("openDiagram"), &menu));
menu.addAction(new ContextMenuAction(tr("Open Diagram"), QStringLiteral("openDiagram"), &menu));
addSeparator = true;
} else if (diagramSceneModel()->diagramSceneController()->elementTasks()->mayCreateDiagram(m_object, m_diagramSceneModel->diagram())) {
menu.addAction(new ContextMenuAction(QObject::tr("Create Diagram"), QStringLiteral("createDiagram"), &menu));
menu.addAction(new ContextMenuAction(tr("Create Diagram"), QStringLiteral("createDiagram"), &menu));
addSeparator = true;
}
if (extendContextMenu(&menu))
addSeparator = true;
if (addSeparator)
menu.addSeparator();
menu.addAction(new ContextMenuAction(QObject::tr("Remove"), QStringLiteral("remove"),
menu.addAction(new ContextMenuAction(tr("Remove"), QStringLiteral("remove"),
QKeySequence(QKeySequence::Delete), &menu));
menu.addAction(new ContextMenuAction(QObject::tr("Delete"), QStringLiteral("delete"),
menu.addAction(new ContextMenuAction(tr("Delete"), QStringLiteral("delete"),
QKeySequence(Qt::CTRL + Qt::Key_D), &menu));
//menu.addAction(new ContextMenuAction(QObject::tr("Select in Model Tree"), QStringLiteral("selectInModelTree"), &menu));
//menu.addAction(new ContextMenuAction(tr("Select in Model Tree"), QStringLiteral("selectInModelTree"), &menu));
QMenu alignMenu;
alignMenu.setTitle(QObject::tr("Align Objects"));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Align Left"), QStringLiteral("alignLeft"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Center Vertically"), QStringLiteral("centerVertically"),
alignMenu.setTitle(tr("Align Objects"));
alignMenu.addAction(new ContextMenuAction(tr("Align Left"), QStringLiteral("alignLeft"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Center Vertically"), QStringLiteral("centerVertically"),
&alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Align Right"), QStringLiteral("alignRight"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Align Right"), QStringLiteral("alignRight"), &alignMenu));
alignMenu.addSeparator();
alignMenu.addAction(new ContextMenuAction(QObject::tr("Align Top"), QStringLiteral("alignTop"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Center Horizontally"), QStringLiteral("centerHorizontally"),
alignMenu.addAction(new ContextMenuAction(tr("Align Top"), QStringLiteral("alignTop"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Center Horizontally"), QStringLiteral("centerHorizontally"),
&alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Align Bottom"), QStringLiteral("alignBottom"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Align Bottom"), QStringLiteral("alignBottom"), &alignMenu));
alignMenu.addSeparator();
alignMenu.addAction(new ContextMenuAction(QObject::tr("Same Width"), QStringLiteral("sameWidth"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Same Height"), QStringLiteral("sameHeight"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(QObject::tr("Same Size"), QStringLiteral("sameSize"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Same Width"), QStringLiteral("sameWidth"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Same Height"), QStringLiteral("sameHeight"), &alignMenu));
alignMenu.addAction(new ContextMenuAction(tr("Same Size"), QStringLiteral("sameSize"), &alignMenu));
alignMenu.setEnabled(m_diagramSceneModel->hasMultiObjectsSelection());
menu.addMenu(&alignMenu);
......
......@@ -38,6 +38,8 @@
#include "qmt/stereotype/stereotypeicon.h"
#include <QCoreApplication>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
......@@ -68,6 +70,8 @@ class ObjectItem :
public IAlignable,
public IEditable
{
Q_DECLARE_TR_FUNCTIONS(ObjectItem)
protected:
enum ResizeFlags {
ResizeUnlocked,
......
......@@ -33,7 +33,7 @@ Exception::Exception(const QString &errorMessage)
}
NullPointerException::NullPointerException()
: Exception(QStringLiteral("unacceptable null object"))
: Exception(tr("Unacceptable null object."))
{
}
......
......@@ -29,11 +29,14 @@
#include "qmt_global.h"
#include <QString>
#include <QCoreApplication>
namespace qmt {
class QMT_EXPORT Exception
{
Q_DECLARE_TR_FUNCTIONS(Exception)
public:
explicit Exception(const QString &errorMessage);
virtual ~Exception() = default;
......
......@@ -24,6 +24,7 @@
****************************************************************************/
#include "ioexceptions.h"
#include <QObject>
namespace qmt {
......@@ -40,32 +41,32 @@ FileIOException::FileIOException(const QString &errorMsg, const QString &fileNam
}
FileNotFoundException::FileNotFoundException(const QString &fileName)
: FileIOException(QStringLiteral("file not found"), fileName)
: FileIOException(tr("File not found."), fileName)
{
}
FileCreationException::FileCreationException(const QString &fileName)
: FileIOException(QStringLiteral("unable to create file"), fileName)
: FileIOException(tr("Unable to create file."), fileName)
{
}
FileWriteError::FileWriteError(const QString &fileName, int lineNumber)
: FileIOException(QStringLiteral("writing to file failed"), fileName, lineNumber)
: FileIOException(tr("Writing to file failed."), fileName, lineNumber)
{
}
FileReadError::FileReadError(const QString &fileName, int lineNumber)
: FileIOException(QStringLiteral("reading from file failed"), fileName, lineNumber)
: FileIOException(tr("Reading from file failed."), fileName, lineNumber)
{
}
IllegalXmlFile::IllegalXmlFile(const QString &fileName, int lineNumber)
: FileIOException(QStringLiteral("illegal xml file"), fileName, lineNumber)
: FileIOException(tr("Illegal XML file."), fileName, lineNumber)
{
}
UnknownFileVersion::UnknownFileVersion(int version, const QString &fileName, int lineNumber)
: FileIOException(QString(QStringLiteral("unable to handle file version %1")).arg(version), fileName, lineNumber)
: FileIOException(tr("Unable to handle file version %1.").arg(version), fileName, lineNumber)
{
}
......
......@@ -498,7 +498,7 @@ void PropertiesView::MView::visitMClass(const MClass *klass)
if (m_classMembersStatusLabel == 0) {
QMT_CHECK(!m_classMembersParseButton);
m_classMembersStatusLabel = new QLabel(m_topWidget);
m_classMembersParseButton = new QPushButton(QStringLiteral("Clean Up"), m_topWidget);
m_classMembersParseButton = new QPushButton(tr("Clean Up"), m_topWidget);
auto layout = new QHBoxLayout();
layout->addWidget(m_classMembersStatusLabel);
layout->addWidget(m_classMembersParseButton);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment