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); QAction *pRedoAction = mUndoStack.createRedoAction(this);
pUndoAction->setShortcut(QKeySequence::Undo); pUndoAction->setShortcut(QKeySequence::Undo);
pRedoAction->setShortcut(QKeySequence::Redo); pRedoAction->setShortcut(QKeySequence::Redo);
pUndoAction->setIcon(QIcon(":/icons/Undo.svg")); pUndoAction->setIcon(QIcon(QStringLiteral(":/icons/Undo.svg")));
pRedoAction->setIcon(QIcon(":/icons/Redo.svg")); pRedoAction->setIcon(QIcon(QStringLiteral(":/icons/Redo.svg")));
mUndoActions.push_back(pUndoAction); mUndoActions.push_back(pUndoAction);
mUndoActions.push_back(pRedoAction); mUndoActions.push_back(pRedoAction);
@ -48,19 +48,21 @@ bool IEditor::CheckUnsavedChanges()
if (!OkToClear) 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) if (Result == QMessageBox::Yes)
{
OkToClear = Save(); OkToClear = Save();
}
else if (Result == QMessageBox::No) else if (Result == QMessageBox::No)
{ {
mUndoStack.setIndex(0); // Revert all changes mUndoStack.setIndex(0); // Revert all changes
OkToClear = true; OkToClear = true;
} }
else if (Result == QMessageBox::Cancel) else if (Result == QMessageBox::Cancel)
{
OkToClear = false; OkToClear = false;
}
} }
return OkToClear; return OkToClear;

View File

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