Clang/Clazy pass over AzCore (#5045)

* Multiple cleanups ( tidy etc. )

Coalesce nested namespaces.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Multiple cleanups ( tidy etc. ) cntd.

Converted Uuid into POD ( defaulted the constructor )
Add `&/const &` to `for` loops that benefit from their use
Some Qt optimizations ( string ref, prevent container detaches, etc. )
Replace `::bind` in a few places.
Replaced the use of AZ_CRC with AZ_CRC_CE in a few places.
Replace a few `typedef`s with `using`s

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Linux compilation fix.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Apply review suggestions.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix vs2019 build

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Small clang re-format in StringFunc.cpp

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Apply reviewer's suggestions.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
Artur K
2021-11-18 11:09:22 +01:00
committed by GitHub
parent 239e0306a8
commit dc98a56d45
85 changed files with 14051 additions and 14199 deletions
@@ -2640,7 +2640,7 @@ QSize OutlinerItemDelegate::sizeHint(const QStyleOptionViewItem& option, const Q
m_cachedBoundingRectOfTallCharacter = QRect();
};
QTimer::singleShot(0, resetFunction);
QTimer::singleShot(0, this, resetFunction);
}
// And add 8 to it gives the outliner roughly the visible spacing we're looking for.
@@ -121,6 +121,18 @@ namespace
SortEntityChildrenRecursively(childId, comparer);
}
}
QModelIndex nextIndexForTree(bool direction, OutlinerTreeView *tree, QModelIndex current)
{
if (direction)
{
return tree->indexAbove(current);
}
else
{
return tree->indexBelow(current);
}
}
}
OutlinerWidget::OutlinerWidget(QWidget* pParent, Qt::WindowFlags flags)
@@ -891,9 +903,7 @@ void OutlinerWidget::DoSelectSliceRootNextToSelection(bool isTraversalUpwards)
return;
}
AZStd::function<QModelIndex(QModelIndex)> getNextIdxFunction =
AZStd::bind(isTraversalUpwards ? &QTreeView::indexAbove : &QTreeView::indexBelow, treeView, AZStd::placeholders::_1);
QModelIndex nextIdx = getNextIdxFunction(currentIdx);
QModelIndex nextIdx = nextIndexForTree(isTraversalUpwards,treeView,currentIdx);
bool foundSliceRoot = false;
while (nextIdx.isValid() && !foundSliceRoot)
@@ -904,7 +914,7 @@ void OutlinerWidget::DoSelectSliceRootNextToSelection(bool isTraversalUpwards)
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
foundSliceRoot, &AzToolsFramework::ToolsApplicationRequests::IsSliceRootEntity, currentEntityId);
nextIdx = getNextIdxFunction(currentIdx);
nextIdx = nextIndexForTree(isTraversalUpwards, treeView, currentIdx);
}
if (foundSliceRoot)
@@ -934,13 +944,10 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
}
QModelIndex currentIdx;
AZStd::function<QModelIndex(QModelIndex)> getNextIdxFunction;
if (shouldSelectTopMostSlice)
{
currentIdx = itemModel->index(0, OutlinerListModel::ColumnName);
getNextIdxFunction =
AZStd::bind(&QTreeView::indexBelow, treeView, AZStd::placeholders::_1);
}
else
{
@@ -949,9 +956,6 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
{
currentIdx = itemModel->index(itemModel->rowCount(currentIdx) - 1, OutlinerListModel::ColumnName, currentIdx);
}
getNextIdxFunction =
AZStd::bind(&QTreeView::indexAbove, treeView, AZStd::placeholders::_1);
}
QModelIndex nextIdx = currentIdx;
@@ -964,7 +968,7 @@ void OutlinerWidget::DoSelectEdgeSliceRoot(bool shouldSelectTopMostSlice)
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
foundSliceRoot, &AzToolsFramework::ToolsApplicationRequests::IsSliceRootEntity, currentEntityId);
nextIdx = getNextIdxFunction(currentIdx);
nextIdx = nextIndexForTree(shouldSelectTopMostSlice,treeView,currentIdx);
} while (nextIdx.isValid() && !foundSliceRoot);
if (foundSliceRoot)
@@ -1416,7 +1420,10 @@ void OutlinerWidget::SortContent()
}
m_entitiesToSort.clear();
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, m_sortMode);
auto comparer = [sortMode = m_sortMode](AZ::EntityId left, AZ::EntityId right) -> bool
{
return CompareEntitiesForSorting(left, right, sortMode);
};
for (const AZ::EntityId& entityId : parentsToSort)
{
SortEntityChildren(entityId, comparer);
@@ -1433,7 +1440,10 @@ void OutlinerWidget::OnSortModeChanged(EntityOutliner::DisplaySortMode sortMode)
if (sortMode != EntityOutliner::DisplaySortMode::Manually)
{
AZ_PROFILE_FUNCTION(AzToolsFramework);
auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode);
auto comparer = [sortMode = m_sortMode](AZ::EntityId left, AZ::EntityId right) -> bool
{
return CompareEntitiesForSorting(left, right, sortMode);
};
SortEntityChildrenRecursively(AZ::EntityId(), comparer);
}