[LYN-2515] Project Manager Gem List Base (#603)

* [LYN-2515] Project Manager Gem List Base

* Added gem model based on a standard item model
* Added list view using the gem model
* Added item delegate for a gem according to the UX design
* Removed th gem catalog ui file and replaced it with code
* Moved the gem catalog files into a sub folder
main
Benjamin Jillich 5 years ago committed by GitHub
parent 8afb35cb10
commit 5e65c5c710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,47 +0,0 @@
/*
* 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.h>
#include <Source/ui_GemCatalog.h>
namespace O3DE::ProjectManager
{
GemCatalog::GemCatalog(ProjectManagerWindow* window)
: ScreenWidget(window)
, m_ui(new Ui::GemCatalogClass())
{
m_ui->setupUi(this);
ConnectSlotsAndSignals();
}
GemCatalog::~GemCatalog()
{
}
void GemCatalog::ConnectSlotsAndSignals()
{
QObject::connect(m_ui->backButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
QObject::connect(m_ui->confirmButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
}
void GemCatalog::HandleBackButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
}
void GemCatalog::HandleConfirmButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
}
} // namespace O3DE::ProjectManager

@ -1,231 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GemCatalogClass</class>
<widget class="QWidget" name="GemCatalogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>806</width>
<height>566</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Gem Catalog</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>Cart</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>Hamburger Menu</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Atom</string>
</property>
</item>
<item>
<property name="text">
<string>Audio</string>
</property>
</item>
<item>
<property name="text">
<string>Camera</string>
</property>
</item>
<item>
<property name="text">
<string>PhysX</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="confirmButton">
<property name="text">
<string>Create Project</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,103 @@
/*
* 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/GemCatalog.h>
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
namespace O3DE::ProjectManager
{
GemCatalog::GemCatalog(ProjectManagerWindow* window)
: ScreenWidget(window)
{
ConnectSlotsAndSignals();
m_gemModel = new GemModel(this);
QVBoxLayout* vLayout = new QVBoxLayout();
setLayout(vLayout);
QHBoxLayout* hLayout = new QHBoxLayout();
vLayout->addLayout(hLayout);
QWidget* filterPlaceholderWidget = new QWidget();
filterPlaceholderWidget->setFixedWidth(250);
hLayout->addWidget(filterPlaceholderWidget);
m_gemListView = new GemListView(m_gemModel, this);
hLayout->addWidget(m_gemListView);
QWidget* inspectorPlaceholderWidget = new QWidget();
inspectorPlaceholderWidget->setFixedWidth(250);
hLayout->addWidget(inspectorPlaceholderWidget);
// Temporary back and next buttons until they are centralized and shared.
QDialogButtonBox* backNextButtons = new QDialogButtonBox();
vLayout->addWidget(backNextButtons);
QPushButton* tempBackButton = backNextButtons->addButton("Back", QDialogButtonBox::RejectRole);
QPushButton* tempNextButton = backNextButtons->addButton("Next", QDialogButtonBox::AcceptRole);
connect(tempBackButton, &QPushButton::pressed, this, &GemCatalog::HandleBackButton);
connect(tempNextButton, &QPushButton::pressed, this, &GemCatalog::HandleConfirmButton);
// Start: Temporary gem test data
{
m_gemModel->AddGem(GemInfo("EMotion FX",
"O3DE Foundation",
"EMFX is a real-time character animation system. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
(GemInfo::Android | GemInfo::iOS | GemInfo::Windows | GemInfo::Linux),
true));
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Atom",
"O3DE Foundation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
true));
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("PhysX",
"O3DE Foundation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
GemInfo::Android | GemInfo::Linux,
false));
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Certificate Manager",
"O3DE Foundation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
GemInfo::Windows,
false));
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Cloud Gem Framework",
"O3DE Foundation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
GemInfo::iOS | GemInfo::Linux,
false));
m_gemModel->AddGem(O3DE::ProjectManager::GemInfo("Achievements",
"O3DE Foundation",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
GemInfo::Android | GemInfo::Windows | GemInfo::Linux,
false));
}
// End: Temporary gem test data
}
void GemCatalog::HandleBackButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::NewProjectSettings);
}
void GemCatalog::HandleConfirmButton()
{
m_projectManagerWindow->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
}
} // namespace O3DE::ProjectManager

@ -13,32 +13,25 @@
#if !defined(Q_MOC_RUN) #if !defined(Q_MOC_RUN)
#include <ScreenWidget.h> #include <ScreenWidget.h>
#include <GemCatalog/GemListView.h>
#include <GemCatalog/GemModel.h>
#endif #endif
namespace Ui
{
class GemCatalogClass;
}
namespace O3DE::ProjectManager namespace O3DE::ProjectManager
{ {
class GemCatalog class GemCatalog
: public ScreenWidget : public ScreenWidget
{ {
public: public:
explicit GemCatalog(ProjectManagerWindow* window); explicit GemCatalog(ProjectManagerWindow* window);
~GemCatalog(); ~GemCatalog() = default;
protected:
void ConnectSlotsAndSignals() override;
protected slots: protected slots:
void HandleBackButton(); void HandleBackButton();
void HandleConfirmButton(); void HandleConfirmButton();
private: private:
QScopedPointer<Ui::GemCatalogClass> m_ui; GemListView* m_gemListView = nullptr;
GemModel* m_gemModel = nullptr;
}; };
} // namespace O3DE::ProjectManager } // namespace O3DE::ProjectManager

@ -0,0 +1,135 @@
/*
* 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 "GemItemDelegate.h"
#include "GemModel.h"
#include <QEvent>
#include <QPainter>
#include <QMouseEvent>
namespace O3DE::ProjectManager
{
GemItemDelegate::GemItemDelegate(GemModel* gemModel, QObject* parent)
: QStyledItemDelegate(parent)
, m_gemModel(gemModel)
{
}
void GemItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const
{
if (!modelIndex.isValid())
{
return;
}
QStyleOptionViewItem options(option);
initStyleOption(&options, modelIndex);
painter->setRenderHint(QPainter::Antialiasing);
QRect fullRect, itemRect, contentRect;
CalcRects(options, modelIndex, fullRect, itemRect, contentRect);
QFont standardFont(options.font);
standardFont.setPixelSize(s_fontSize);
painter->save();
painter->setClipping(true);
painter->setClipRect(fullRect);
painter->setFont(options.font);
// Draw background
painter->fillRect(fullRect, m_backgroundColor);
// Draw item background
const QColor itemBackgroundColor = options.state & QStyle::State_MouseOver ? m_itemBackgroundColor.lighter(120) : m_itemBackgroundColor;
painter->fillRect(itemRect, itemBackgroundColor);
// Draw border
if (options.state & QStyle::State_Selected)
{
painter->save();
QPen borderPen(m_borderColor);
borderPen.setWidth(s_borderWidth);
painter->setPen(borderPen);
painter->drawRect(itemRect);
painter->restore();
}
// Gem name
const QString gemName = m_gemModel->GetName(modelIndex);
QFont gemNameFont(options.font);
gemNameFont.setPixelSize(s_gemNameFontSize);
gemNameFont.setBold(true);
QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize);
gemNameRect.moveTo(contentRect.left(), contentRect.top());
painter->setFont(gemNameFont);
painter->setPen(m_textColor);
painter->drawText(gemNameRect, Qt::TextSingleLine, gemName);
// Gem creator
const QString gemCreator = m_gemModel->GetCreator(modelIndex);
QRect gemCreatorRect = GetTextRect(standardFont, gemCreator, s_fontSize);
gemCreatorRect.moveTo(contentRect.left(), contentRect.top() + gemNameRect.height());
painter->setFont(standardFont);
painter->setPen(m_linkColor);
painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
// Gem summary
const QSize summarySize = QSize(contentRect.width() - s_summaryStartX - s_itemMargins.right() * 4, contentRect.height());
const QRect summaryRect = QRect(/*topLeft=*/QPoint(contentRect.left() + s_summaryStartX, contentRect.top()), summarySize);
painter->setFont(standardFont);
painter->setPen(m_textColor);
const QString summary = m_gemModel->GetSummary(modelIndex);
painter->drawText(summaryRect, Qt::AlignLeft | Qt::TextWordWrap, summary);
painter->restore();
}
QSize GemItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const
{
QStyleOptionViewItem options(option);
initStyleOption(&options, modelIndex);
int marginsHorizontal = s_itemMargins.left() + s_itemMargins.right() + s_contentMargins.left() + s_contentMargins.right();
return QSize(marginsHorizontal + s_summaryStartX, s_height);
}
bool GemItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex)
{
if (!modelIndex.isValid())
{
return false;
}
return QStyledItemDelegate::editorEvent(event, model, option, modelIndex);
}
void GemItemDelegate::CalcRects(const QStyleOptionViewItem& option, const QModelIndex& modelIndex, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const
{
const bool isFirst = modelIndex.row() == 0;
outFullRect = QRect(option.rect);
outItemRect = QRect(outFullRect.adjusted(s_itemMargins.left(), isFirst ? s_itemMargins.top() * 2 : s_itemMargins.top(), -s_itemMargins.right(), -s_itemMargins.bottom()));
outContentRect = QRect(outItemRect.adjusted(s_contentMargins.left(), s_contentMargins.top(), -s_contentMargins.right(), -s_contentMargins.bottom()));
}
QRect GemItemDelegate::GetTextRect(QFont& font, const QString& text, qreal fontSize) const
{
font.setPixelSize(fontSize);
return QFontMetrics(font).boundingRect(text);
}
} // namespace O3DE::ProjectManager

@ -0,0 +1,62 @@
/*
* 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 <QStyledItemDelegate>
#include "GemInfo.h"
#include "GemModel.h"
#endif
QT_FORWARD_DECLARE_CLASS(QEvent)
namespace O3DE::ProjectManager
{
class GemItemDelegate
: public QStyledItemDelegate
{
Q_OBJECT // AUTOMOC
public:
explicit GemItemDelegate(GemModel* gemModel, QObject* parent = nullptr);
~GemItemDelegate() = default;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) override;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
private:
void CalcRects(const QStyleOptionViewItem& option, const QModelIndex& modelIndex, QRect& outFullRect, QRect& outItemRect, QRect& outContentRect) const;
QRect GetTextRect(QFont& font, const QString& text, qreal fontSize) const;
GemModel* m_gemModel = nullptr;
// Colors
const QColor m_textColor = QColor("#FFFFFF");
const QColor m_linkColor = QColor("#94D2FF");
const QColor m_backgroundColor = QColor("#333333"); // Outside of the actual gem item
const QColor m_itemBackgroundColor = QColor("#404040"); // Background color of the gem item
const QColor m_borderColor = QColor("#1E70EB");
// Item
inline constexpr static int s_height = 140; // Gem item total height
inline constexpr static qreal s_gemNameFontSize = 16.0;
inline constexpr static qreal s_fontSize = 15.0;
inline constexpr static int s_summaryStartX = 200;
// Margin and borders
inline constexpr static QMargins s_itemMargins = QMargins(/*left=*/20, /*top=*/10, /*right=*/20, /*bottom=*/10); // Item border distances
inline constexpr static QMargins s_contentMargins = QMargins(/*left=*/15, /*top=*/12, /*right=*/12, /*bottom=*/12); // Distances of the elements within an item to the item borders
inline constexpr static int s_borderWidth = 4;
};
} // namespace O3DE::ProjectManager

@ -0,0 +1,34 @@
/*
* 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 "GemListView.h"
#include "GemItemDelegate.h"
#include <QStandardItemModel>
#include <QDateTime>
#include <QPalette>
namespace O3DE::ProjectManager
{
GemListView::GemListView(GemModel* model, QWidget *parent) :
QListView(parent)
{
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
QPalette palette;
palette.setColor(QPalette::Window, QColor("#333333"));
setPalette(palette);
setModel(model);
setSelectionModel(model->GetSelectionModel());
setItemDelegate(new GemItemDelegate(model, this));
}
} // 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 "GemInfo.h"
#include "GemModel.h"
#include <QListView>
#endif
namespace O3DE::ProjectManager
{
class GemListView
: public QListView
{
Q_OBJECT // AUTOMOC
public:
explicit GemListView(GemModel* model, QWidget *parent = nullptr);
~GemListView() = default;
};
} // namespace O3DE::ProjectManager

@ -0,0 +1,72 @@
/*
* 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 "GemModel.h"
namespace O3DE::ProjectManager
{
GemModel::GemModel(QObject* parent)
: QStandardItemModel(parent)
{
m_selectionModel = new QItemSelectionModel(this, parent);
}
QItemSelectionModel* GemModel::GetSelectionModel() const
{
return m_selectionModel;
}
void GemModel::AddGem(const GemInfo& gemInfo)
{
QStandardItem* item = new QStandardItem();
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(gemInfo.m_name, RoleName);
item->setData(gemInfo.m_creator, RoleCreator);
item->setData(static_cast<int>(gemInfo.m_platforms), RolePlatforms);
item->setData(gemInfo.m_summary, RoleSummary);
item->setData(gemInfo.m_isAdded, RoleIsAdded);
appendRow(item);
}
void GemModel::Clear()
{
clear();
}
QString GemModel::GetName(const QModelIndex& modelIndex) const
{
return modelIndex.data(RoleName).toString();
}
QString GemModel::GetCreator(const QModelIndex& modelIndex) const
{
return modelIndex.data(RoleCreator).toString();
}
int GemModel::GetPlatforms(const QModelIndex& modelIndex) const
{
return static_cast<GemInfo::Platforms>(modelIndex.data(RolePlatforms).toInt());
}
QString GemModel::GetSummary(const QModelIndex& modelIndex) const
{
return modelIndex.data(RoleSummary).toString();
}
bool GemModel::IsAdded(const QModelIndex& modelIndex) const
{
return modelIndex.data(RoleIsAdded).toBool();
}
} // namespace O3DE::ProjectManager

@ -0,0 +1,53 @@
/*
* 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 "GemInfo.h"
#include <QStandardItemModel>
#include <QItemSelectionModel>
#endif
namespace O3DE::ProjectManager
{
class GemModel
: public QStandardItemModel
{
Q_OBJECT // AUTOMOC
public:
explicit GemModel(QObject* parent = nullptr);
QItemSelectionModel* GetSelectionModel() const;
void AddGem(const GemInfo& gemInfo);
void Clear();
QString GetName(const QModelIndex& modelIndex) const;
QString GetCreator(const QModelIndex& modelIndex) const;
int GetPlatforms(const QModelIndex& modelIndex) const;
QString GetSummary(const QModelIndex& modelIndex) const;
bool IsAdded(const QModelIndex& modelIndex) const;
private:
enum UserRole
{
RoleName = Qt::UserRole,
RoleCreator,
RolePlatforms,
RoleSummary,
RoleIsAdded
};
QItemSelectionModel* m_selectionModel = nullptr;
};
} // namespace O3DE::ProjectManager

@ -13,7 +13,7 @@
#include <FirstTimeUse.h> #include <FirstTimeUse.h>
#include <NewProjectSettings.h> #include <NewProjectSettings.h>
#include <GemCatalog.h> #include <GemCatalog/GemCatalog.h>
#include <ProjectsHome.h> #include <ProjectsHome.h>
#include <ProjectSettings.h> #include <ProjectSettings.h>
#include <EngineSettings.h> #include <EngineSettings.h>

@ -30,7 +30,7 @@ namespace O3DE::ProjectManager
} }
protected: protected:
virtual void ConnectSlotsAndSignals() = 0; virtual void ConnectSlotsAndSignals() {}
ProjectManagerWindow* m_projectManagerWindow; ProjectManagerWindow* m_projectManagerWindow;
}; };

@ -25,9 +25,6 @@ set(FILES
Source/NewProjectSettings.h Source/NewProjectSettings.h
Source/NewProjectSettings.cpp Source/NewProjectSettings.cpp
Source/NewProjectSettings.ui Source/NewProjectSettings.ui
Source/GemCatalog.h
Source/GemCatalog.cpp
Source/GemCatalog.ui
Source/ProjectsHome.h Source/ProjectsHome.h
Source/ProjectsHome.cpp Source/ProjectsHome.cpp
Source/ProjectsHome.ui Source/ProjectsHome.ui
@ -37,6 +34,14 @@ set(FILES
Source/EngineSettings.h Source/EngineSettings.h
Source/EngineSettings.cpp Source/EngineSettings.cpp
Source/EngineSettings.ui Source/EngineSettings.ui
Source/GemCatalog/GemCatalog.h
Source/GemCatalog/GemCatalog.cpp
Source/GemCatalog/GemInfo.h Source/GemCatalog/GemInfo.h
Source/GemCatalog/GemInfo.cpp Source/GemCatalog/GemInfo.cpp
Source/GemCatalog/GemItemDelegate.h
Source/GemCatalog/GemItemDelegate.cpp
Source/GemCatalog/GemListView.h
Source/GemCatalog/GemListView.cpp
Source/GemCatalog/GemModel.h
Source/GemCatalog/GemModel.cpp
) )

Loading…
Cancel
Save