Made some corrections

This commit is contained in:
igarri
2021-06-02 15:32:03 +01:00
parent e7752e3ad4
commit 485a45d3c2
4 changed files with 60 additions and 53 deletions
@@ -26,7 +26,6 @@ AZ_POP_DISABLE_WARNING
AZ_CVAR(
bool, ed_useNewAssetBrowserTableView, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"Use the new AssetBrowser TableView for searching assets.");
#pragma optimize("", off)
namespace AzToolsFramework
{
namespace AssetBrowser
@@ -139,7 +138,7 @@ namespace AzToolsFramework
{
const auto& subFilters = compFilter->GetSubFilters();
const auto compositeFilterIterator = AZStd::find_if(subFilters.begin(), subFilters.end(), [subFilters](FilterConstType filter) -> bool
const auto compositeFilterIterator = AZStd::find_if(subFilters.cbegin(), subFilters.cend(), [subFilters](FilterConstType filter) -> bool
{
const auto assetTypeFilter = qobject_cast<QSharedPointer<const CompositeFilter> >(filter);
return !assetTypeFilter.isNull();
@@ -150,7 +149,7 @@ namespace AzToolsFramework
m_assetTypeFilter = qobject_cast<QSharedPointer<const CompositeFilter> >(*compositeFilterIterator);
}
const auto compStringFilterIter = AZStd::find_if(subFilters.begin(), subFilters.end(), [](FilterConstType filter) -> bool
const auto compStringFilterIter = AZStd::find_if(subFilters.cbegin(), subFilters.cend(), [](FilterConstType filter) -> bool
{
//The real StringFilter is really a CompositeFilter with just one StringFilter in its subfilter list
//To know if it is actually a StringFilter we have to get that subfilter and check if it is a Stringfilter.
@@ -164,7 +163,7 @@ namespace AzToolsFramework
auto strFilter = qobject_cast<QSharedPointer<const StringFilter>>(filt);
return !strFilter.isNull();
};
const auto stringSubfliterConstIter = AZStd::find_if(stringSubfilters.begin(), stringSubfilters.end(), canBeCasted);
const auto stringSubfliterConstIter = AZStd::find_if(stringSubfilters.cbegin(), stringSubfilters.cend(), canBeCasted);
//A Composite StringFilter will only have just one subfilter and nothing more.
if (stringSubfliterConstIter != stringSubfilters.end() && stringSubfilters.size() == 1)
@@ -188,8 +187,7 @@ namespace AzToolsFramework
}
invalidateFilter();
Q_EMIT filterChanged();
bool isNullAB = m_stringFilter.isNull();
emit stringFilterPopulated(!isNullAB);
emit stringFilterPopulated(!m_stringFilter.isNull());
}
void AssetBrowserFilterModel::filterUpdatedSlot()
@@ -209,6 +207,5 @@ namespace AzToolsFramework
} // namespace AssetBrowser
} // namespace AzToolsFramework// namespace AssetBrowser
#pragma optimize("", on)
#include "AssetBrowser/moc_AssetBrowserFilterModel.cpp"
@@ -9,8 +9,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AssetBrowser/AssetBrowserTableModel.h>
#include <AssetBrowser/AssetBrowserFilterModel.h>
#include <AssetBrowser/AssetBrowserTableModel.h>
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h>
namespace AzToolsFramework
@@ -26,7 +26,9 @@ namespace AzToolsFramework
void AssetBrowserTableModel::setSourceModel(QAbstractItemModel* sourceModel)
{
m_filterModel = qobject_cast<AssetBrowserFilterModel*>(sourceModel);
AZ_Assert(m_filterModel, "Error in AssetBrowserTableModel initialization, class expects source model to be an AssetBrowserFilterModel.");
AZ_Assert(
m_filterModel,
"Error in AssetBrowserTableModel initialization, class expects source model to be an AssetBrowserFilterModel.");
QSortFilterProxyModel::setSourceModel(sourceModel);
}
@@ -86,7 +88,8 @@ namespace AzToolsFramework
return !parent.isValid() ? m_indexMap.size() : 0;
}
int AssetBrowserTableModel::BuildTableModelMap(const QAbstractItemModel* model, const QModelIndex& parent /*= QModelIndex()*/, int row /*= 0*/)
int AssetBrowserTableModel::BuildTableModelMap(
const QAbstractItemModel* model, const QModelIndex& parent /*= QModelIndex()*/, int row /*= 0*/)
{
int rows = model ? model->rowCount(parent) : 0;
for (int i = 0; i < rows; ++i)
@@ -134,7 +137,6 @@ namespace AzToolsFramework
}
BuildTableModelMap(sourceModel());
emit layoutChanged();
}
} // namespace AssetBrowser
} // namespace AzToolsFramework
@@ -37,7 +37,6 @@ AZ_PUSH_DISABLE_WARNING(
#include <QPen>
#include <QTimer>
AZ_POP_DISABLE_WARNING
#pragma optimize("", off)
namespace AzToolsFramework
{
namespace AssetBrowser
@@ -128,7 +127,8 @@ namespace AzToolsFramework
QTableView::rowsAboutToBeRemoved(parent, start, end);
}
void AssetBrowserTableView::layoutChangedSlot([[maybe_unused]] const QList<QPersistentModelIndex>& parents,[[maybe_unused]] QAbstractItemModel::LayoutChangeHint hint)
void AssetBrowserTableView::layoutChangedSlot(
[[maybe_unused]] const QList<QPersistentModelIndex>& parents, [[maybe_unused]] QAbstractItemModel::LayoutChangeHint hint)
{
scrollToTop();
}
@@ -159,7 +159,6 @@ namespace AzToolsFramework
void AssetBrowserTableView::OnContextMenu([[maybe_unused]] const QPoint& point)
{
const auto& selectedAssets = GetSelectedAssets();
if (selectedAssets.size() != 1)
{
@@ -167,7 +166,8 @@ namespace AzToolsFramework
}
QMenu menu(this);
AssetBrowserInteractionNotificationBus::Broadcast(&AssetBrowserInteractionNotificationBus::Events::AddContextMenuActions, this, &menu, selectedAssets);
AssetBrowserInteractionNotificationBus::Broadcast(
&AssetBrowserInteractionNotificationBus::Events::AddContextMenuActions, this, &menu, selectedAssets);
if (!menu.isEmpty())
{
menu.exec(QCursor::pos());
@@ -175,5 +175,4 @@ namespace AzToolsFramework
}
} // namespace AssetBrowser
} // namespace AzToolsFramework
#pragma optimize("", on)
#include "AssetBrowser/Views/moc_AssetBrowserTableView.cpp"