Browse Source

addressed review feedback and updated tag completions to init via data file

Signed-off-by: T.J. Kotha <[email protected]>
T.J. Kotha 2 years ago
parent
commit
5479e21708

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

@@ -3,6 +3,9 @@
         <file>ProjectManager.qss</file>
         <file>ProjectManagerCompleterPopup.qss</file>
     </qresource>
+    <qresource prefix="/ProjectManager/text">
+        <file>ProjectManagerCompletionTags.txt</file>
+    </qresource>
     <qresource prefix="/">
         <file>Add.svg</file>
         <file>AddOffset.svg</file>

+ 1 - 2
Code/Tools/ProjectManager/Resources/ProjectManager.qss

@@ -185,9 +185,8 @@ QTabBar::tab:focus {
 #formTagField QCheckBox::indicator{
     background-color: transparent;
     image:url(:/X.svg);
-    border:0px;
     width: 10%;
-    padding-left:px;
+    padding-left:3px;
 }
 
 #createAGem #formFrame {

+ 37 - 0
Code/Tools/ProjectManager/Resources/ProjectManagerCompletionTags.txt

@@ -0,0 +1,37 @@
+Achievements
+Animation
+Assets
+AtomShader
+Audio
+Compression
+Content
+Core
+Creation
+DCC
+Debug
+Design
+Digital
+Editor
+Environment
+Framework
+Gameplay
+Input
+Lighting
+Materials
+Multiplayer
+Navigation
+Network
+PBR
+Physics
+Profiler
+RemoteTools
+Rendering
+SDK
+Sample
+Scripting
+Simulation
+Streamer
+Terrain
+Tools
+UI
+Utility

+ 2 - 1
Code/Tools/ProjectManager/Source/CreateAGemScreen.cpp

@@ -269,7 +269,8 @@ namespace O3DE::ProjectManager
         m_licenseURL = new FormLineEditWidget(tr("License URL"), "", tr("Link to the license web site i.e. https://opensource.org/licenses/Apache-2.0"), "");
         gemDetailsLayout->addWidget(m_licenseURL);
 
-        m_userDefinedGemTags = new FormLineEditTagsWidget(tr("User-defined Gem Tags (Press Space or Return with non-empty text to create a new tag)"), "");
+        m_userDefinedGemTags = new FormLineEditTagsWidget(tr("User-defined Gem Tags"), "");
+        m_userDefinedGemTags->setToolTip("Press Space or Return with non-empty text to create a new tag");
         m_userDefinedGemTags->lineEdit()->setValidator(new QRegularExpressionValidator(QRegularExpression("(^$|((\\w+)(\\s?\\w*)*))"), this));
         gemDetailsLayout->addWidget(m_userDefinedGemTags);
 

+ 35 - 41
Code/Tools/ProjectManager/Source/FormLineEditTagsWidget.cpp

@@ -6,32 +6,42 @@
  *
  */
 
-#include <FormLineEditTagsWidget.h>
+#include <AzQtComponents/Components/Widgets/LineEdit.h>
 #include <AzQtComponents/Components/StyledLineEdit.h>
+
+
+#include <FormLineEditTagsWidget.h>
 #include <FormLineEditWidget.h>
-#include <AzQtComponents/Components/Widgets/LineEdit.h>
-#include <QPushButton>
+
 #include <QAbstractItemView>
-#include <QSpacerItem>
+#include <QCheckBox>
 #include <QCompleter>
 #include <QFile>
-#include <QVBoxLayout>
+#include <QFrame>
 #include <QHBoxLayout>
-#include <QCheckBox>
-#include <QLineEdit>
+#include <QKeyEvent>
 #include <QLabel>
-#include <QMovie>
-#include <QFrame>
-#include <QValidator>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSpacerItem>
 #include <QStyle>
-#include <QKeyEvent>
+#include <QValidator>
+#include <QVBoxLayout>
 
 namespace O3DE::ProjectManager
 {
 
     void FormLineEditTagsWidget::setupCompletionTags()
     {
-        m_completionTags << "Audio" << "Animation" << "Physics" << "GameDevelopment" << "IK" << "Blender" << "Rendering" << "Terrain";
+        QFile completionTagFile(":/ProjectManager/text/ProjectManagerCompletionTags.txt");
+        completionTagFile.open(QFile::ReadOnly);
+        while(!completionTagFile.atEnd())
+        {
+            m_completionTags << completionTagFile.readLine().trimmed();
+        }
+
+        m_completionTags.removeDuplicates();
+        m_completionTags.sort();
     }
 
     FormLineEditTagsWidget::FormLineEditTagsWidget(
@@ -59,12 +69,10 @@ namespace O3DE::ProjectManager
         m_completer->popup()->setMouseTracking(true);
         m_completer->popup()->setObjectName("formCompleterPopup");
 
-
-        /* NOTE(tkothadev): Manually setting the stylesheet of this popup widget is not desired.
+        /* Manually setting the stylesheet of this popup widget is not desired.
          * However, the current styling rules of the Project Manager make the background color blend in
          * with surroundings, making it difficult to see. Currently, attempts at rectifying this in the main
          * stylesheet proved very difficult, so a stop-gap measure of hard-coding the stylesheet was used.
-         * I have discussed this with AMZN-alexpete.
          */
         QFile popupStyleSheetFile(":/ProjectManager/style/ProjectManagerCompleterPopup.qss");
         popupStyleSheetFile.open(QFile::ReadOnly);
@@ -87,7 +95,7 @@ namespace O3DE::ProjectManager
         m_tagFrame->setObjectName("formTagField");
         
         QHBoxLayout* tagsLayout = new QHBoxLayout();
-        tagsLayout->setSpacing(8);
+        tagsLayout->setSpacing(tagSpacing);
         tagsLayout->addStretch();
         
         m_tagFrame->setLayout(tagsLayout);
@@ -121,15 +129,15 @@ namespace O3DE::ProjectManager
         // cleanup the tag frame widget and re-add the tag list
         qDeleteAll(m_tagFrame->children());
         QHBoxLayout* layout = new QHBoxLayout(this);
-        layout->setSpacing(8);
+        layout->setSpacing(tagSpacing);
 
-        for (auto t : m_tags)
+        for (auto tag : m_tags)
         {
-            QCheckBox* tc = new QCheckBox(t, this);
-            tc->setLayoutDirection(Qt::RightToLeft);
+            QCheckBox* tagCheckbox = new QCheckBox(tag, this);
+            tagCheckbox->setLayoutDirection(Qt::RightToLeft);
             // connect the checked signal to a good slot
-            connect(tc, &QCheckBox::stateChanged, this, &FormLineEditTagsWidget::processTagDelete);
-            layout->addWidget(tc);
+            connect(tagCheckbox, &QCheckBox::stateChanged, this, &FormLineEditTagsWidget::processTagDelete);
+            layout->addWidget(tagCheckbox);
         }
 
         layout->addStretch();
@@ -156,9 +164,9 @@ namespace O3DE::ProjectManager
             //do tag adding
             QString interim = m_lineEdit->text();
             m_lineEdit->clear();
-            for(auto str : interim.split(" "))
+            for(auto tagStr : interim.split(" "))
             {
-                addToTagList(str);
+                addToTagList(tagStr);
             }
             refreshTagFrame();
         }
@@ -166,25 +174,11 @@ namespace O3DE::ProjectManager
 
     void FormLineEditTagsWidget::processTagDelete([[maybe_unused]] int unused)
     {
-        auto checkBoxes = m_tagFrame->findChildren<QCheckBox* >();
-        QString string;
-        bool found = false;
-        for(auto c : checkBoxes)
-        {
-            if(c->isChecked())
-            {
-                string = c->text();
-                found = true;
-                break;
-            }
-        }
+        //Only a checkbox's stateChanged signal causes this function to run
+        QCheckBox* checkBox = qobject_cast<QCheckBox*>(sender());
 
-        if(!found)
-        {
-            return;
-        }
         //remove the offending string
-        m_tags.removeOne(string);
+        m_tags.removeOne(checkBox->text());
 
         //now reconstruct the tag list
         refreshTagFrame();

+ 7 - 7
Code/Tools/ProjectManager/Source/FormLineEditTagsWidget.h

@@ -13,12 +13,12 @@
 #include <FormLineEditTagsWidget.h>
 #endif
 
-QT_FORWARD_DECLARE_CLASS(QCompleter)
-QT_FORWARD_DECLARE_CLASS(QPushButton)
-QT_FORWARD_DECLARE_CLASS(QLineEdit)
-QT_FORWARD_DECLARE_CLASS(QLabel)
-QT_FORWARD_DECLARE_CLASS(QFrame)
-QT_FORWARD_DECLARE_CLASS(QKeyEvent)
+class QCompleter;
+class QPushButton;
+class QLineEdit;
+class QLabel;
+class QFrame;
+class QKeyEvent;
 
 namespace AzQtComponents
 {
@@ -67,6 +67,6 @@ namespace O3DE::ProjectManager
         QStringList m_completionTags;
         QStringList m_tags;
         QCompleter* m_completer;
-
+        const int tagSpacing = 8;
     };
 } // namespace O3DE::ProjectManager