소스 검색

Prism/fix gem catalog text 7223 (#10529)

* add refresh hover and remove duplicate css

Signed-off-by: Alex Peterson <[email protected]>

* add refresh button, init when active screen only

Avoid the performance hit of rebuilding the Gem Catalog and Gem Repo screen every time the Update Project screen is shown and don't assume the catalog changes every time we visit it - usually it doesn't.  But give the user a refresh button in case they know it has changed and want to load latest from disk.

Signed-off-by: Alex Peterson <[email protected]>

* Only init the read-only Gem Catalog once

Signed-off-by: Alex Peterson <[email protected]>

* Remove commented code

Signed-off-by: Alex Peterson <[email protected]>
Alex Peterson 3 년 전
부모
커밋
f7649a0bb7

+ 1 - 0
Code/Tools/ProjectManager/Resources/ProjectManager.qrc

@@ -37,6 +37,7 @@
         <file>Backgrounds/FtueBackground.jpg</file>
         <file>X.svg</file>
         <file>Refresh.svg</file>
+        <file>Refresh_Hover.svg</file>
         <file>Edit.svg</file>
         <file>Delete.svg</file>
         <file>Download.svg</file>

+ 33 - 8
Code/Tools/ProjectManager/Resources/ProjectManager.qss

@@ -601,6 +601,19 @@ QProgressBar::chunk {
     font-weight: 600;
 }
 
+#RefreshButton {
+    background:transparent url(:/Refresh.svg) no-repeat center center;
+    qproperty-flat: true;
+    max-width:24px;
+    min-width:24px;
+    max-height:24px;
+    min-height:24px;
+}
+
+#RefreshButton:hover {
+    background:transparent url(:/Refresh_Hover.svg) no-repeat center center;
+}
+
 #gemCatalogMenuButton {
     qproperty-flat: true;
     max-width:36px;
@@ -621,14 +634,6 @@ QProgressBar::chunk {
     background-color: #444444;
 }
 
-#gemCatalogMenuButton {
-    qproperty-flat: true;
-    max-width:36px;
-    min-width:36px;
-    max-height:24px;
-    min-height:24px;
-}
-
 #adjustableHeaderWidget QHeaderView::section { 
     background-color: transparent;
 }
@@ -743,6 +748,26 @@ QProgressBar::chunk {
 #GemCatalogFilterCategoryTitle {
     font-size: 12px;
     font-weight: 600;
+    color: #ffffff;
+}
+
+#GemCatalogFilterWidget #FilterByLabel {
+    color: #ffffff;
+}
+#GemCatalogFilterWidget QLabel {
+    color: #ffffff;
+}
+
+#GemCatalogFilterWidget #CountLabel {
+    font-size: 12px; 
+    background-color: #333333; 
+    border-radius: 3px; 
+    color: #94D2FF;
+}
+
+#GemCatalogFilterWidget QCheckbox {
+    color: #ffffff;
+    font-size: 12px;
 }
 
 /************** Engine **************/

+ 4 - 0
Code/Tools/ProjectManager/Resources/Refresh_Hover.svg

@@ -0,0 +1,4 @@
+<svg width="15" height="12" viewBox="0 0 15 12" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M13.046 5.85448C13.046 5.869 13.0436 5.66561 13.0436 5.68014H14.5278L12.3341 8.22252L10.1114 5.68014H11.6481C11.6481 5.66561 11.6513 5.869 11.6513 5.85448C11.6513 3.42833 9.77724 1.46707 7.46731 1.46707C6.42131 1.46707 5.46247 1.87385 4.73608 2.54213L3.8063 1.43801C4.79419 0.537286 6.07264 -0.000244141 7.46731 -0.000244141C10.5472 -0.000244141 13.046 2.6293 13.046 5.85448Z" fill="#1e70eb"/>
+<path d="M1.48184 6.14503C1.48184 6.13051 1.48428 6.3339 1.48428 6.31937H0L2.1937 3.777L4.41646 6.31937H2.87975C2.87975 6.3339 2.87651 6.13051 2.87651 6.14503C2.87651 8.57118 4.7506 10.5324 7.06053 10.5324C8.10654 10.5324 9.06537 10.1257 9.79177 9.45738L10.7215 10.5615C9.73366 11.4622 8.4552 11.9998 7.06053 11.9998C3.98063 11.9998 1.48184 9.37022 1.48184 6.14503Z" fill="#1e70eb"/>
+</svg>

+ 10 - 10
Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp

@@ -24,7 +24,6 @@
 
 #include <QVBoxLayout>
 #include <QHBoxLayout>
-#include <QPushButton>
 #include <QTimer>
 #include <PythonBindingsInterface.h>
 #include <QMessageBox>
@@ -94,6 +93,7 @@ namespace O3DE::ProjectManager
         filterWidget->setLayout(m_filterWidgetLayout);
 
         GemListHeaderWidget* catalogHeaderWidget = new GemListHeaderWidget(m_proxyModel);
+        connect(catalogHeaderWidget, &GemListHeaderWidget::OnRefresh, this, &GemCatalogScreen::Refresh);
 
         constexpr int minHeaderSectionWidth = 100;
         AdjustableHeaderWidget* listHeaderWidget = new AdjustableHeaderWidget(
@@ -143,21 +143,21 @@ namespace O3DE::ProjectManager
 
     void GemCatalogScreen::NotifyCurrentScreen()
     {
-        if (m_readOnly)
+        if (m_readOnly && m_gemModel->rowCount() == 0)
         {
-            if (m_gemModel->rowCount() == 0)
-            {
-                ReinitForProject(m_projectPath);
-            }
-            else
-            {
-                Refresh();
-            }
+            // init the read only catalog the first time it is shown
+            ReinitForProject(m_projectPath);
         }
     }
 
     void GemCatalogScreen::ReinitForProject(const QString& projectPath)
     {
+        // avoid slow rebuilding, user can manually refresh if needed
+        if (m_gemModel->rowCount() > 0 && QDir(projectPath) == QDir(m_projectPath))
+        {
+            return;
+        }
+
         m_projectPath = projectPath;
         m_gemModel->Clear();
         m_gemsToRegisterWithProject.clear();

+ 2 - 3
Code/Tools/ProjectManager/Source/GemCatalog/GemFilterWidget.cpp

@@ -80,14 +80,13 @@ namespace O3DE::ProjectManager
                 elementWidget->setLayout(elementLayout);
 
                 QCheckBox* checkbox = new QCheckBox(elementNames[i]);
-                checkbox->setStyleSheet("font-size: 12px;");
                 m_buttonGroup->addButton(checkbox);
                 elementLayout->addWidget(checkbox);
 
                 elementLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
 
                 QLabel* countLabel = new QLabel(QString::number(elementCounts[i]));
-                countLabel->setStyleSheet("font-size: 12px; background-color: #333333; border-radius: 3px; color: #94D2FF;");
+                countLabel->setObjectName("CountLabel");
                 elementLayout->addWidget(countLabel);
 
                 m_elementWidgets.push_back(elementWidget);
@@ -205,7 +204,7 @@ namespace O3DE::ProjectManager
         mainWidget->setLayout(mainLayout);
 
         QLabel* filterByLabel = new QLabel("Filter by");
-        filterByLabel->setStyleSheet("font-size: 16px;");
+        filterByLabel->setObjectName("FilterByLabel");
         mainLayout->addWidget(filterByLabel);
 
         QWidget* filterSection = new QWidget(this);

+ 5 - 0
Code/Tools/ProjectManager/Source/GemCatalog/GemListHeaderWidget.cpp

@@ -61,6 +61,11 @@ namespace O3DE::ProjectManager
         showCountLabel->setObjectName("GemCatalogHeaderShowCountLabel");
         topLayout->addWidget(showCountLabel);
 
+        QPushButton* refreshButton = new QPushButton();
+        refreshButton->setObjectName("RefreshButton");
+        connect( refreshButton, &QPushButton::clicked, [this] { emit OnRefresh(); });
+        topLayout->addWidget(refreshButton);
+
         auto refreshGemCountUI = [=]() {
                 const int numGemsShown = proxyModel->rowCount();
                 showCountLabel->setText(QString(tr("showing %1 Gems")).arg(numGemsShown));

+ 2 - 0
Code/Tools/ProjectManager/Source/GemCatalog/GemListHeaderWidget.h

@@ -24,5 +24,7 @@ namespace O3DE::ProjectManager
     public:
         explicit GemListHeaderWidget(GemSortFilterProxyModel* proxyModel, QWidget* parent = nullptr);
         ~GemListHeaderWidget() = default;
+    signals:
+        void OnRefresh();
     };
 } // namespace O3DE::ProjectManager

+ 3 - 6
Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp

@@ -112,12 +112,6 @@ namespace O3DE::ProjectManager
     {
         m_stack->setCurrentIndex(ScreenOrder::Settings);
         Update();
-
-        // Gather the available gems that will be shown in the gem catalog.
-        m_projectGemCatalogScreen->ReinitForProject(m_projectInfo.m_path);
-
-        // make sure the gem repo has the latest repo details
-        m_gemRepoScreen->Reinit();
     }
 
     void UpdateProjectCtrl::OnChangeScreenRequest(ProjectManagerScreen screen)
@@ -125,10 +119,12 @@ namespace O3DE::ProjectManager
         if (screen == ProjectManagerScreen::GemRepos)
         {
             m_stack->setCurrentWidget(m_gemRepoScreen);
+            m_gemRepoScreen->Reinit();
             Update();
         }
         else if (screen == ProjectManagerScreen::ProjectGemCatalog)
         {
+            m_projectGemCatalogScreen->ReinitForProject(m_projectInfo.m_path);
             m_stack->setCurrentWidget(m_projectGemCatalogScreen);
             Update();
         }
@@ -147,6 +143,7 @@ namespace O3DE::ProjectManager
     {
         if (UpdateProjectSettings(true))
         {
+            m_projectGemCatalogScreen->ReinitForProject(m_projectInfo.m_path);
             m_stack->setCurrentWidget(m_projectGemCatalogScreen);
             Update();
         }