IEditor: Mark strings as translatable where applicable

This commit is contained in:
Lioncash 2020-06-28 06:32:25 -04:00
parent 33840696c2
commit eafb7f21d0
2 changed files with 12 additions and 9 deletions

View File

@ -18,8 +18,8 @@ IEditor::IEditor(QWidget* pParent)
QAction *pRedoAction = mUndoStack.createRedoAction(this);
pUndoAction->setShortcut(QKeySequence::Undo);
pRedoAction->setShortcut(QKeySequence::Redo);
pUndoAction->setIcon(QIcon(":/icons/Undo.svg"));
pRedoAction->setIcon(QIcon(":/icons/Redo.svg"));
pUndoAction->setIcon(QIcon(QStringLiteral(":/icons/Undo.svg")));
pRedoAction->setIcon(QIcon(QStringLiteral(":/icons/Redo.svg")));
mUndoActions.push_back(pUndoAction);
mUndoActions.push_back(pRedoAction);
@ -48,19 +48,21 @@ bool IEditor::CheckUnsavedChanges()
if (!OkToClear)
{
int Result = QMessageBox::warning(this, "Save", "You have unsaved changes. Save?", QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
const int Result = QMessageBox::warning(this, tr("Save"), tr("You have unsaved changes. Save?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
if (Result == QMessageBox::Yes)
{
OkToClear = Save();
}
else if (Result == QMessageBox::No)
{
mUndoStack.setIndex(0); // Revert all changes
OkToClear = true;
}
else if (Result == QMessageBox::Cancel)
{
OkToClear = false;
}
}
return OkToClear;

View File

@ -19,14 +19,15 @@ protected:
QList<QAction*> mUndoActions;
public:
IEditor(QWidget* pParent);
explicit IEditor(QWidget* pParent);
QUndoStack& UndoStack();
void AddUndoActions(QToolBar* pToolBar, QAction* pBefore = 0);
void AddUndoActions(QMenu* pMenu, QAction* pBefore = 0);
void AddUndoActions(QToolBar* pToolBar, QAction* pBefore = nullptr);
void AddUndoActions(QMenu* pMenu, QAction* pBefore = nullptr);
bool CheckUnsavedChanges();
/** QMainWindow overrides */
virtual void closeEvent(QCloseEvent*);
void closeEvent(QCloseEvent*) override;
/** Interface */
virtual void EditorTick(float /*DeltaTime*/) { }