EditSeedDialog.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <source/ui/EditSeedDialog.h>
  9. #include <source/ui/ui_EditSeedDialog.h>
  10. #include <source/ui/PlatformSelectionWidget.h>
  11. #include <QPushButton>
  12. namespace AssetBundler
  13. {
  14. EditSeedDialog::EditSeedDialog(
  15. QWidget* parent,
  16. const AzFramework::PlatformFlags& enabledPlatforms,
  17. const AzFramework::PlatformFlags& selectedPlatforms,
  18. const AzFramework::PlatformFlags& partiallySelectedPlatforms)
  19. : QDialog(parent)
  20. {
  21. m_ui.reset(new Ui::EditSeedDialog);
  22. m_ui->setupUi(this);
  23. m_ui->platformSelectionWidget->Init(enabledPlatforms);
  24. m_ui->platformSelectionWidget->SetSelectedPlatforms(selectedPlatforms, partiallySelectedPlatforms);
  25. connect(m_ui->platformSelectionWidget,
  26. &PlatformSelectionWidget::PlatformsSelected,
  27. this,
  28. &EditSeedDialog::OnPlatformSelectionChanged);
  29. // Set up confirm and cancel buttons
  30. connect(m_ui->applyChangesButton, &QPushButton::clicked, this, &QDialog::accept);
  31. connect(m_ui->cancelButton, &QPushButton::clicked, this, &QDialog::reject);
  32. }
  33. AzFramework::PlatformFlags EditSeedDialog::GetPlatformFlags()
  34. {
  35. return m_ui->platformSelectionWidget->GetSelectedPlatforms();
  36. }
  37. AzFramework::PlatformFlags EditSeedDialog::GetPartiallySelectedPlatformFlags()
  38. {
  39. return m_ui->platformSelectionWidget->GetPartiallySelectedPlatforms();
  40. }
  41. void EditSeedDialog::OnPlatformSelectionChanged(
  42. const AzFramework::PlatformFlags& selectedPlatforms,
  43. const AzFramework::PlatformFlags& partiallySelectedPlatforms)
  44. {
  45. // Disable the "Apply Changes" button if no platforms are selected
  46. bool areAnyPlatformsSelected = selectedPlatforms != AzFramework::PlatformFlags::Platform_NONE ||
  47. partiallySelectedPlatforms != AzFramework::PlatformFlags::Platform_NONE;
  48. m_ui->applyChangesButton->setEnabled(areAnyPlatformsSelected);
  49. }
  50. } // namespace AssetBundler
  51. #include <source/ui/moc_EditSeedDialog.cpp>