Files
o3de/Code/Tools/ProjectManager/Source/GemRepo/GemRepoModel.h
T
AMZN-nggieber 24086ab394 Resizable Headers for Gem Catalog and Gem Repo Screen (#6885)
* Initial mostly working attempt at resizable headers

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Add const and constexpr to variables

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Add header tracking for buttons, display items based on header scrollbar position, fix some spacing issues

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Correct styling for adjustable header, and intending header section and alingned item content with header text

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Prevent header resizing larger than table width.

Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>

* Fix resize graphical glitching

Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>

* Remove unecessary qss

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Removed necessary headers

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Remove extra nl and old comment

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Address PR feedback

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Removed unused variables

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Change variable to constexpr

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Remove AUTOMOC from headers, set background color of Gem Catalog to 333333 and adjustable header to transparent

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Change to using update instead of repaint when sections are resized

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

* Change temp directory creation on for gradle

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

Co-authored-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
2022-01-28 10:05:03 -08:00

70 lines
2.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QStandardItemModel>
#include <GemRepo/GemRepoInfo.h>
#include <GemCatalog/GemModel.h>
#endif
QT_FORWARD_DECLARE_CLASS(QItemSelectionModel)
namespace O3DE::ProjectManager
{
class GemRepoModel
: public QStandardItemModel
{
Q_OBJECT
public:
explicit GemRepoModel(QObject* parent = nullptr);
QItemSelectionModel* GetSelectionModel() const;
void AddGemRepo(const GemRepoInfo& gemInfo);
void Clear();
static QString GetName(const QModelIndex& modelIndex);
static QString GetCreator(const QModelIndex& modelIndex);
static QString GetSummary(const QModelIndex& modelIndex);
static QString GetAdditionalInfo(const QModelIndex& modelIndex);
static QString GetDirectoryLink(const QModelIndex& modelIndex);
static QString GetRepoUri(const QModelIndex& modelIndex);
static QDateTime GetLastUpdated(const QModelIndex& modelIndex);
static QString GetPath(const QModelIndex& modelIndex);
static QStringList GetIncludedGemUris(const QModelIndex& modelIndex);
static QVector<Tag> GetIncludedGemTags(const QModelIndex& modelIndex);
static QVector<GemInfo> GetIncludedGemInfos(const QModelIndex& modelIndex);
static bool IsEnabled(const QModelIndex& modelIndex);
static void SetEnabled(QAbstractItemModel& model, const QModelIndex& modelIndex, bool isEnabled);
static bool HasAdditionalInfo(const QModelIndex& modelIndex);
private:
enum UserRole
{
RoleName = Qt::UserRole,
RoleCreator,
RoleSummary,
RoleIsEnabled,
RoleDirectoryLink,
RoleRepoUri,
RoleLastUpdated,
RolePath,
RoleAdditionalInfo,
RoleIncludedGems,
};
QItemSelectionModel* m_selectionModel = nullptr;
GemModel* m_gemModel = nullptr;
};
} // namespace O3DE::ProjectManager