FirstTimeUseScreen.cpp 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #include <FirstTimeUseScreen.h>
  13. #include <QVBoxLayout>
  14. #include <QHBoxLayout>
  15. #include <QLabel>
  16. #include <QPushButton>
  17. #include <QIcon>
  18. #include <QSpacerItem>
  19. namespace O3DE::ProjectManager
  20. {
  21. FirstTimeUseScreen::FirstTimeUseScreen(QWidget* parent)
  22. : ScreenWidget(parent)
  23. {
  24. QVBoxLayout* vLayout = new QVBoxLayout();
  25. setLayout(vLayout);
  26. vLayout->setContentsMargins(s_contentMargins, s_contentMargins, s_contentMargins, s_contentMargins);
  27. QLabel* titleLabel = new QLabel(this);
  28. titleLabel->setText(tr("Ready. Set. Create!"));
  29. titleLabel->setStyleSheet("font-size: 60px");
  30. vLayout->addWidget(titleLabel);
  31. QLabel* introLabel = new QLabel(this);
  32. introLabel->setTextFormat(Qt::AutoText);
  33. introLabel->setText(tr("<html><head/><body><p>Welcome to O3DE! Start something new by creating a project. Not sure what to create? </p><p>Explore what\342\200\231s available by downloading our sample project.</p></body></html>"));
  34. introLabel->setStyleSheet("font-size: 14px");
  35. vLayout->addWidget(introLabel);
  36. QHBoxLayout* buttonLayout = new QHBoxLayout();
  37. buttonLayout->setSpacing(s_buttonSpacing);
  38. m_createProjectButton = CreateLargeBoxButton(QIcon(":/Add.svg"), tr("Create Project"), this);
  39. m_createProjectButton->setIconSize(QSize(s_iconSize, s_iconSize));
  40. buttonLayout->addWidget(m_createProjectButton);
  41. m_addProjectButton = CreateLargeBoxButton(QIcon(":/Select_Folder.svg"), tr("Add a Project"), this);
  42. m_addProjectButton->setIconSize(QSize(s_iconSize, s_iconSize));
  43. buttonLayout->addWidget(m_addProjectButton);
  44. QSpacerItem* buttonSpacer = new QSpacerItem(s_spacerSize, s_spacerSize, QSizePolicy::Expanding, QSizePolicy::Minimum);
  45. buttonLayout->addItem(buttonSpacer);
  46. vLayout->addItem(buttonLayout);
  47. QSpacerItem* verticalSpacer = new QSpacerItem(s_spacerSize, s_spacerSize, QSizePolicy::Minimum, QSizePolicy::Expanding);
  48. vLayout->addItem(verticalSpacer);
  49. // Using border-image allows for scaling options background-image does not support
  50. setStyleSheet("O3DE--ProjectManager--ScreenWidget { border-image: url(:/Backgrounds/FirstTimeBackgroundImage.jpg) repeat repeat; }");
  51. connect(m_createProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleNewProjectButton);
  52. connect(m_addProjectButton, &QPushButton::pressed, this, &FirstTimeUseScreen::HandleAddProjectButton);
  53. }
  54. ProjectManagerScreen FirstTimeUseScreen::GetScreenEnum()
  55. {
  56. return ProjectManagerScreen::FirstTimeUse;
  57. }
  58. void FirstTimeUseScreen::HandleNewProjectButton()
  59. {
  60. emit ResetScreenRequest(ProjectManagerScreen::CreateProject);
  61. emit ChangeScreenRequest(ProjectManagerScreen::CreateProject);
  62. }
  63. void FirstTimeUseScreen::HandleAddProjectButton()
  64. {
  65. emit ChangeScreenRequest(ProjectManagerScreen::ProjectsHome);
  66. }
  67. QPushButton* FirstTimeUseScreen::CreateLargeBoxButton(const QIcon& icon, const QString& text, QWidget* parent)
  68. {
  69. QPushButton* largeBoxButton = new QPushButton(icon, text, parent);
  70. largeBoxButton->setFixedSize(s_boxButtonWidth, s_boxButtonHeight);
  71. largeBoxButton->setFlat(true);
  72. largeBoxButton->setFocusPolicy(Qt::FocusPolicy::NoFocus);
  73. largeBoxButton->setStyleSheet("QPushButton { font-size: 14px; background-color: rgba(0, 0, 0, 191); }");
  74. return largeBoxButton;
  75. }
  76. } // namespace O3DE::ProjectManager