3
0

UnsavedChangesDialog.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "UnsavedChangesDialog.h"
  9. #include <QPushButton>
  10. #include "Editor/View/Dialogs/ui_UnsavedChangesDialog.h"
  11. namespace ScriptCanvasEditor
  12. {
  13. UnsavedChangesDialog::UnsavedChangesDialog(const QString& filename, QWidget* pParent /*=nullptr*/)
  14. : QDialog(pParent)
  15. , ui(new Ui::UnsavedChangesDialog)
  16. {
  17. ui->setupUi(this);
  18. ui->m_saveLabel->setText(filename);
  19. QObject::connect(ui->m_saveButton, &QPushButton::clicked, this, &UnsavedChangesDialog::OnSaveButton);
  20. QObject::connect(ui->m_continueButton, &QPushButton::clicked, this, &UnsavedChangesDialog::OnContinueWithoutSavingButton);
  21. QObject::connect(ui->m_cancelButton, &QPushButton::clicked, this, &UnsavedChangesDialog::OnCancelWithoutSavingButton);
  22. }
  23. void UnsavedChangesDialog::OnSaveButton(bool)
  24. {
  25. m_result = UnsavedChangesOptions::SAVE;
  26. accept();
  27. }
  28. void UnsavedChangesDialog::OnContinueWithoutSavingButton(bool)
  29. {
  30. m_result = UnsavedChangesOptions::CONTINUE_WITHOUT_SAVING;
  31. accept();
  32. }
  33. void UnsavedChangesDialog::OnCancelWithoutSavingButton([[maybe_unused]] bool clicked)
  34. {
  35. m_result = UnsavedChangesOptions::CANCEL_WITHOUT_SAVING;
  36. accept();
  37. }
  38. #include <Editor/View/Dialogs/moc_UnsavedChangesDialog.cpp>
  39. }