From eafb7f21d0798152a887d609ac126c64c9cfffa6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 28 Jun 2020 06:32:25 -0400 Subject: [PATCH] IEditor: Mark strings as translatable where applicable --- src/Editor/IEditor.cpp | 12 +++++++----- src/Editor/IEditor.h | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Editor/IEditor.cpp b/src/Editor/IEditor.cpp index 417dd33d..90548dd8 100644 --- a/src/Editor/IEditor.cpp +++ b/src/Editor/IEditor.cpp @@ -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; diff --git a/src/Editor/IEditor.h b/src/Editor/IEditor.h index 0f96c055..bce4c0c9 100644 --- a/src/Editor/IEditor.h +++ b/src/Editor/IEditor.h @@ -19,14 +19,15 @@ protected: QList 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*/) { }