From a4e0d69e8326ec101417db020b49745c48a0ce5a Mon Sep 17 00:00:00 2001 From: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> Date: Fri, 22 Oct 2021 12:46:06 -0700 Subject: [PATCH] Update Splashscreen and About Us dialogs for General Availability (#4901) * Add new image for splashscreen. Layout changes incoming. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> * Adapt layouts to new splashscreen style with transparent background. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> * Ensure cropping logic works correctly when screen scaling is used. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> * Remove old image. Replace new image with new version with more readable credits. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> --- Code/Editor/AboutDialog.cpp | 14 ++++---- Code/Editor/AboutDialog.h | 6 ++-- Code/Editor/AboutDialog.ui | 12 +++---- Code/Editor/StartupLogoDialog.cpp | 5 +-- Code/Editor/StartupLogoDialog.h | 4 +-- Code/Editor/StartupLogoDialog.qrc | 2 +- Code/Editor/StartupLogoDialog.ui | 35 ++++++++++++++----- .../splashscreen_background_2021_11.jpg | 3 ++ ...ashscreen_background_developer_preview.jpg | 3 -- .../Utilities/PixmapScaleUtilities.cpp | 17 +++++++++ .../Utilities/PixmapScaleUtilities.h | 2 ++ 11 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 Code/Editor/splashscreen_background_2021_11.jpg delete mode 100644 Code/Editor/splashscreen_background_developer_preview.jpg diff --git a/Code/Editor/AboutDialog.cpp b/Code/Editor/AboutDialog.cpp index 2c76526731..c0fd39e1ae 100644 --- a/Code/Editor/AboutDialog.cpp +++ b/Code/Editor/AboutDialog.cpp @@ -6,10 +6,7 @@ * */ - - #include "EditorDefs.h" - #include "AboutDialog.h" // Qt @@ -47,14 +44,17 @@ CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, CAboutDialog > QLabel#link { text-decoration: underline; color: #94D2FF; }"); // Prepare background image - m_backgroundImage = AzQtComponents::ScalePixmapForScreenDpi( - QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg")), - screen(), - QSize(m_enforcedWidth, m_enforcedHeight), + QPixmap image = AzQtComponents::ScalePixmapForScreenDpi( + QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_2021_11.jpg")), + screen(), QSize(m_imageWidth, m_imageHeight), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); + // Crop image to cut out transparent border + QRect cropRect((m_imageWidth - m_enforcedWidth) / 2, (m_imageHeight - m_enforcedHeight) / 2, m_enforcedWidth, m_enforcedHeight); + m_backgroundImage = AzQtComponents::CropPixmapForScreenDpi(image, screen(), cropRect); + // Draw the Open 3D Engine logo from svg m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/o3de_logo.svg")); diff --git a/Code/Editor/AboutDialog.h b/Code/Editor/AboutDialog.h index 229675901e..db079a6ec7 100644 --- a/Code/Editor/AboutDialog.h +++ b/Code/Editor/AboutDialog.h @@ -38,7 +38,9 @@ private: QScopedPointer m_ui; QPixmap m_backgroundImage; - int m_enforcedWidth = 600; - int m_enforcedHeight = 400; + const int m_imageWidth = 668; + const int m_imageHeight = 368; + const int m_enforcedWidth = 600; + const int m_enforcedHeight = 300; }; diff --git a/Code/Editor/AboutDialog.ui b/Code/Editor/AboutDialog.ui index 9341a00d48..a6c5bb5d52 100644 --- a/Code/Editor/AboutDialog.ui +++ b/Code/Editor/AboutDialog.ui @@ -7,7 +7,7 @@ 0 0 600 - 360 + 300 @@ -19,13 +19,13 @@ 600 - 360 + 300 - 600 - 360 + 608 + 300 @@ -69,7 +69,7 @@ 11 - 12 + 10 12 @@ -125,7 +125,7 @@ - Developer Preview + General Availability Qt::AutoText diff --git a/Code/Editor/StartupLogoDialog.cpp b/Code/Editor/StartupLogoDialog.cpp index ab251b1564..135c76cf7f 100644 --- a/Code/Editor/StartupLogoDialog.cpp +++ b/Code/Editor/StartupLogoDialog.cpp @@ -34,11 +34,12 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy m_ui->setupUi(this); s_pLogoWindow = this; - setFixedSize(QSize(600, 300)); + setFixedSize(QSize(m_enforcedWidth, m_enforcedHeight)); + setAttribute(Qt::WA_TranslucentBackground, true); // Prepare background image m_backgroundImage = AzQtComponents::ScalePixmapForScreenDpi( - QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg")), + QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_2021_11.jpg")), screen(), QSize(m_enforcedWidth, m_enforcedHeight), Qt::IgnoreAspectRatio, diff --git a/Code/Editor/StartupLogoDialog.h b/Code/Editor/StartupLogoDialog.h index af80ab7e90..072ad6a905 100644 --- a/Code/Editor/StartupLogoDialog.h +++ b/Code/Editor/StartupLogoDialog.h @@ -50,7 +50,7 @@ private: QScopedPointer m_ui; QPixmap m_backgroundImage; - const int m_enforcedWidth = 600; - const int m_enforcedHeight = 300; + const int m_enforcedWidth = 668; + const int m_enforcedHeight = 368; }; diff --git a/Code/Editor/StartupLogoDialog.qrc b/Code/Editor/StartupLogoDialog.qrc index 38d1d1da2a..2d7dd81e87 100644 --- a/Code/Editor/StartupLogoDialog.qrc +++ b/Code/Editor/StartupLogoDialog.qrc @@ -1,6 +1,6 @@ o3de_logo.svg - splashscreen_background_developer_preview.jpg + splashscreen_background_2021_11.jpg diff --git a/Code/Editor/StartupLogoDialog.ui b/Code/Editor/StartupLogoDialog.ui index 60969f7f7f..c0b8115cb0 100644 --- a/Code/Editor/StartupLogoDialog.ui +++ b/Code/Editor/StartupLogoDialog.ui @@ -6,13 +6,22 @@ 0 0 - 600 - 300 + 668 + 368 + + 50 + + + 42 + + + 42 + - 9 + 42 10 @@ -29,7 +38,7 @@ - 250 + 300 20 @@ -53,7 +62,7 @@ 1 - 28 + 20 24 @@ -94,7 +103,7 @@ - Developer Preview + General Availability @@ -153,20 +162,28 @@ 290 - 0 + 32 290 - 16777215 + 32 + + + 8 + + Starting Editor... + + Qt::PlainText + - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/Code/Editor/splashscreen_background_2021_11.jpg b/Code/Editor/splashscreen_background_2021_11.jpg new file mode 100644 index 0000000000..703884fc53 --- /dev/null +++ b/Code/Editor/splashscreen_background_2021_11.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffcb7614bed0790bf58a2bb7b2d70958289cb2edf562acc8fc841f4c50a55445 +size 2974586 diff --git a/Code/Editor/splashscreen_background_developer_preview.jpg b/Code/Editor/splashscreen_background_developer_preview.jpg deleted file mode 100644 index 59f05a64df..0000000000 --- a/Code/Editor/splashscreen_background_developer_preview.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7105ec99477f124a8ac8d588f2dfc4ee7bb54f39386c8131b7703c86754c0cb8 -size 248690 diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.cpp index fa32b708d7..95c0289f16 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.cpp @@ -28,4 +28,21 @@ namespace AzQtComponents return scaledPixmap; } + + QPixmap CropPixmapForScreenDpi( + QPixmap pixmap, QScreen* screen, QRect rect) + { + qreal screenDpiFactor = QHighDpiScaling::factor(screen); + pixmap.setDevicePixelRatio(screenDpiFactor); + + QRect cropRect( + aznumeric_cast(aznumeric_cast(rect.left()) * screenDpiFactor), + aznumeric_cast(aznumeric_cast(rect.top()) * screenDpiFactor), + aznumeric_cast(aznumeric_cast(rect.width()) * screenDpiFactor), + aznumeric_cast(aznumeric_cast(rect.height()) * screenDpiFactor) + ); + + QPixmap croppedPixmap = pixmap.copy(cropRect); + return croppedPixmap; + } } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.h b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.h index 4b083855d5..4462e3c9a7 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/PixmapScaleUtilities.h @@ -11,9 +11,11 @@ #include #include +#include #include namespace AzQtComponents { AZ_QT_COMPONENTS_API QPixmap ScalePixmapForScreenDpi(QPixmap pixmap, QScreen* screen, QSize size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformationMode); + AZ_QT_COMPONENTS_API QPixmap CropPixmapForScreenDpi(QPixmap pixmap, QScreen* screen, QRect rect); }; // namespace AzQtComponents