You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.6 KiB
C++
63 lines
2.6 KiB
C++
/*
|
|
* 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
|
|
|
|
#include <AssetDatabase/AssetDatabase.h>
|
|
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
|
#include <AzToolsFramework/API/AssetDatabaseBus.h>
|
|
#include <native/utilities/ApplicationManagerAPI.h>
|
|
#include <QAbstractItemModel>
|
|
#include <QFileIconProvider>
|
|
#include <QItemSelectionModel>
|
|
|
|
namespace AssetProcessor
|
|
{
|
|
class AssetTreeItem;
|
|
class AssetTreeModel :
|
|
public QAbstractItemModel,
|
|
AzToolsFramework::AssetDatabase::AssetDatabaseNotificationBus::Handler,
|
|
AssetProcessor::ApplicationManagerNotifications::Bus::Handler
|
|
{
|
|
public:
|
|
AssetTreeModel(AZStd::shared_ptr<AzToolsFramework::AssetDatabase::AssetDatabaseConnection> sharedDbConnection, QObject *parent = nullptr);
|
|
virtual ~AssetTreeModel();
|
|
|
|
// ApplicationManagerNotifications::Bus::Handler
|
|
void ApplicationShutdownRequested() override;
|
|
|
|
// QAbstractItemModel
|
|
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
QModelIndex parent(const QModelIndex &index) const override;
|
|
bool hasChildren(const QModelIndex &parent) const override;
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
void Reset();
|
|
|
|
static QFlags<QItemSelectionModel::SelectionFlag> GetAssetTreeSelectionFlags();
|
|
|
|
protected:
|
|
// Called by reset, while a Qt model reset is active.
|
|
virtual void ResetModel() = 0;
|
|
|
|
AZStd::unique_ptr<AssetTreeItem> m_root;
|
|
AZStd::shared_ptr<AzToolsFramework::AssetDatabase::AssetDatabaseConnection> m_sharedDbConnection;
|
|
|
|
QIcon m_errorIcon;
|
|
};
|
|
}
|