[LYN-2522] Gem catalog header widgets (#919)

* Added header widget with the name based filter
* Added column title header together with the the number of currently shown/filtered gems
main
Benjamin Jillich 5 years ago committed by GitHub
parent 37813945cf
commit 05f3144055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,5 +15,7 @@
<file>ArrowDownLine.svg</file>
<file>ArrowUpLine.svg</file>
<file>Backgrounds/FirstTimeBackgroundImage.jpg</file>
<file>ArrowDownLine.svg</file>
<file>ArrowUpLine.svg</file>
</qresource>
</RCC>

@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzQtComponents/Components/SearchLineEdit.h>
#include <GemCatalog/GemCatalogHeaderWidget.h>
#include <QHBoxLayout>
#include <QLabel>
namespace O3DE::ProjectManager
{
GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemSortFilterProxyModel* filterProxyModel, QWidget* parent)
: QFrame(parent)
{
QHBoxLayout* hLayout = new QHBoxLayout();
hLayout->setAlignment(Qt::AlignLeft);
hLayout->setMargin(0);
setLayout(hLayout);
setStyleSheet("background-color: #1E252F;");
QLabel* titleLabel = new QLabel(tr("Gem Catalog"));
titleLabel->setStyleSheet("font-size: 21px;");
hLayout->addWidget(titleLabel);
hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
AzQtComponents::SearchLineEdit* filterLineEdit = new AzQtComponents::SearchLineEdit();
filterLineEdit->setStyleSheet("background-color: #DDDDDD;");
connect(filterLineEdit, &QLineEdit::textChanged, this, [=](const QString& text)
{
filterProxyModel->SetSearchString(text);
});
hLayout->addWidget(filterLineEdit);
hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
hLayout->addSpacerItem(new QSpacerItem(220, 0, QSizePolicy::Fixed));
setFixedHeight(60);
}
} // namespace O3DE::ProjectManager

@ -0,0 +1,31 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <GemCatalog/GemSortFilterProxyModel.h>
#include <QFrame>
#endif
namespace O3DE::ProjectManager
{
class GemCatalogHeaderWidget
: public QFrame
{
Q_OBJECT // AUTOMOC
public:
explicit GemCatalogHeaderWidget(GemSortFilterProxyModel* filterProxyModel, QWidget* parent = nullptr);
~GemCatalogHeaderWidget() = default;
};
} // namespace O3DE::ProjectManager

@ -12,6 +12,8 @@
#include <GemCatalog/GemCatalogScreen.h>
#include <PythonBindingsInterface.h>
#include <GemCatalog/GemCatalogHeaderWidget.h>
#include <GemCatalog/GemListHeaderWidget.h>
#include <GemCatalog/GemSortFilterProxyModel.h>
#include <GemCatalog/GemFilterWidget.h>
#include <QVBoxLayout>
@ -34,6 +36,9 @@ namespace O3DE::ProjectManager
vLayout->setSpacing(0);
setLayout(vLayout);
GemCatalogHeaderWidget* headerWidget = new GemCatalogHeaderWidget(proxyModel);
vLayout->addWidget(headerWidget);
QHBoxLayout* hLayout = new QHBoxLayout();
hLayout->setMargin(0);
vLayout->addLayout(hLayout);
@ -64,9 +69,12 @@ namespace O3DE::ProjectManager
GemFilterWidget* filterWidget = new GemFilterWidget(proxyModel);
filterWidget->setFixedWidth(250);
GemListHeaderWidget* listHeaderWidget = new GemListHeaderWidget(proxyModel);
QVBoxLayout* middleVLayout = new QVBoxLayout();
middleVLayout->setMargin(0);
middleVLayout->setSpacing(0);
middleVLayout->addWidget(listHeaderWidget);
middleVLayout->addWidget(m_gemListView);
hLayout->addWidget(filterWidget);

@ -124,12 +124,12 @@ namespace O3DE::ProjectManager
{
if (m_collapseButton->isChecked())
{
m_collapseButton->setIcon(QIcon(":/Resources/ArrowDownLine.svg"));
m_collapseButton->setIcon(QIcon(":/ArrowDownLine.svg"));
m_mainWidget->hide();
}
else
{
m_collapseButton->setIcon(QIcon(":/Resources/ArrowUpLine.svg"));
m_collapseButton->setIcon(QIcon(":/ArrowUpLine.svg"));
m_mainWidget->show();
}
}

@ -62,20 +62,20 @@ namespace O3DE::ProjectManager
bool IsValid() const;
QString m_path;
QString m_name;
QString m_displayName;
QString m_name = "Unknown Gem Name";
QString m_displayName = "Unknown Gem Name";
AZ::Uuid m_uuid;
QString m_creator;
QString m_creator = "Unknown Creator";
GemOrigin m_gemOrigin = Local;
bool m_isAdded = false; //! Is the gem currently added and enabled in the project?
QString m_summary;
QString m_summary = "No summary provided.";
Platforms m_platforms;
Types m_types; //! Asset and/or Code and/or Tool
QStringList m_features;
QString m_directoryLink;
QString m_documentationLink;
QString m_version;
QString m_lastUpdatedDate;
QString m_version = "Unknown Version";
QString m_lastUpdatedDate = "Unknown Date";
int m_binarySizeInKB = 0;
QStringList m_dependingGemUuids;
QStringList m_conflictingGemUuids;

@ -0,0 +1,78 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <GemCatalog/GemItemDelegate.h>
#include <GemCatalog/GemListHeaderWidget.h>
#include <QStandardItemModel>
#include <QLabel>
#include <QVBoxLayout>
namespace O3DE::ProjectManager
{
GemListHeaderWidget::GemListHeaderWidget(GemSortFilterProxyModel* proxyModel, QWidget* parent)
: QFrame(parent)
{
QVBoxLayout* vLayout = new QVBoxLayout();
vLayout->setMargin(0);
setLayout(vLayout);
setStyleSheet("background-color: #333333;");
vLayout->addSpacing(20);
// Top section
QHBoxLayout* topLayout = new QHBoxLayout();
topLayout->setMargin(0);
topLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
QLabel* showCountLabel = new QLabel();
showCountLabel->setStyleSheet("font-size: 11pt; font: italic;");
topLayout->addWidget(showCountLabel);
connect(proxyModel, &GemSortFilterProxyModel::OnInvalidated, this, [=]
{
const int numGemsShown = proxyModel->rowCount();
showCountLabel->setText(QString(tr("showing %1 Gems")).arg(numGemsShown));
});
topLayout->addSpacing(GemItemDelegate::s_contentMargins.right() + GemItemDelegate::s_borderWidth);
vLayout->addLayout(topLayout);
vLayout->addSpacing(20);
// Separating line
QFrame* hLine = new QFrame();
hLine->setFrameShape(QFrame::HLine);
hLine->setStyleSheet("color: #666666;");
vLayout->addWidget(hLine);
vLayout->addSpacing(GemItemDelegate::s_contentMargins.top());
// Bottom section
QHBoxLayout* columnHeaderLayout = new QHBoxLayout();
columnHeaderLayout->setAlignment(Qt::AlignLeft);
columnHeaderLayout->addSpacing(31);
QLabel* gemNameLabel = new QLabel(tr("Gem Name"));
gemNameLabel->setStyleSheet("font-size: 11pt;");
columnHeaderLayout->addWidget(gemNameLabel);
columnHeaderLayout->addSpacing(111);
QLabel* gemSummaryLabel = new QLabel(tr("Gem Summary"));
gemSummaryLabel->setStyleSheet("font-size: 11pt;");
columnHeaderLayout->addWidget(gemSummaryLabel);
vLayout->addLayout(columnHeaderLayout);
}
} // namespace O3DE::ProjectManager

@ -0,0 +1,33 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <GemCatalog/GemSortFilterProxyModel.h>
#include <QAbstractItemModel>
#include <QItemSelectionModel>
#include <QFrame>
#endif
namespace O3DE::ProjectManager
{
class GemListHeaderWidget
: public QFrame
{
Q_OBJECT // AUTOMOC
public:
explicit GemListHeaderWidget(GemSortFilterProxyModel* proxyModel, QWidget* parent = nullptr);
~GemListHeaderWidget() = default;
};
} // namespace O3DE::ProjectManager

@ -58,6 +58,8 @@ set(FILES
Source/LinkWidget.cpp
Source/TagWidget.h
Source/TagWidget.cpp
Source/GemCatalog/GemCatalogHeaderWidget.h
Source/GemCatalog/GemCatalogHeaderWidget.cpp
Source/GemCatalog/GemCatalogScreen.h
Source/GemCatalog/GemCatalogScreen.cpp
Source/GemCatalog/GemFilterWidget.h
@ -70,6 +72,8 @@ set(FILES
Source/GemCatalog/GemItemDelegate.cpp
Source/GemCatalog/GemListView.h
Source/GemCatalog/GemListView.cpp
Source/GemCatalog/GemListHeaderWidget.h
Source/GemCatalog/GemListHeaderWidget.cpp
Source/GemCatalog/GemModel.h
Source/GemCatalog/GemModel.cpp
Source/GemCatalog/GemSortFilterProxyModel.h

Loading…
Cancel
Save