ProcessingAssetsDialog.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 "EditorDefs.h"
  9. #include "ProcessingAssetsDialog.h"
  10. // Qt
  11. #include <QPushButton>
  12. #include <QStyle>
  13. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  14. #include <AssetImporter/UI/ui_ProcessingAssetsDialog.h>
  15. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  16. ProcessingAssetsDialog::ProcessingAssetsDialog(int numberOfProcessedFiles, QWidget* parent)
  17. : QDialog(parent)
  18. , m_ui(new Ui::ProcessingAssetsDialog)
  19. {
  20. m_ui->setupUi(this);
  21. UpdateTextsAndTitle(numberOfProcessedFiles);
  22. InitializeButtons();
  23. }
  24. ProcessingAssetsDialog::~ProcessingAssetsDialog()
  25. {
  26. }
  27. void ProcessingAssetsDialog::InitializeButtons()
  28. {
  29. QPushButton* viewStatusButton = m_ui->buttonBox->addButton(tr("View status"), QDialogButtonBox::AcceptRole);
  30. QPushButton* closeButton = m_ui->buttonBox->addButton(tr("Close"), QDialogButtonBox::RejectRole);
  31. viewStatusButton->setDefault(true);
  32. viewStatusButton->setProperty("class", "AssetImporterLargerButton");
  33. viewStatusButton->style()->unpolish(viewStatusButton);
  34. viewStatusButton->style()->polish(viewStatusButton);
  35. viewStatusButton->update();
  36. closeButton->setProperty("class", "AssetImporterButton");
  37. closeButton->style()->unpolish(closeButton);
  38. closeButton->style()->polish(closeButton);
  39. closeButton->update();
  40. connect(viewStatusButton, &QPushButton::clicked, this, &ProcessingAssetsDialog::accept);
  41. connect(closeButton, &QPushButton::clicked, this, &ProcessingAssetsDialog::reject);
  42. }
  43. void ProcessingAssetsDialog::accept()
  44. {
  45. Q_EMIT OpenLogDialog();
  46. QDialog::accept();
  47. }
  48. void ProcessingAssetsDialog::reject()
  49. {
  50. Q_EMIT CloseProcessingAssetsDialog();
  51. QDialog::reject();
  52. }
  53. void ProcessingAssetsDialog::UpdateTextsAndTitle(int numberOfProcessedFiles)
  54. {
  55. if (numberOfProcessedFiles > 1)
  56. {
  57. setWindowTitle("Processing assets");
  58. m_ui->label->setText("The Asset Processor will process your assets and when they are finished they will appear in the Asset Browser. You can view the status of your assets in the Asset Processor.");
  59. }
  60. else
  61. {
  62. setWindowTitle("Processing asset");
  63. m_ui->label->setText("The Asset Processor will process your asset and when it is finished it will appear in the Asset Browser. You can view the status of your asset in the Asset Processor.");
  64. }
  65. }
  66. #include <AssetImporter/UI/moc_ProcessingAssetsDialog.cpp>