Code cleanup and review changes

Signed-off-by: igarri <igarri@amazon.com>
This commit is contained in:
igarri
2021-06-30 15:16:23 +01:00
parent a07445c2da
commit b0ddd93824
5 changed files with 17 additions and 21 deletions
@@ -89,17 +89,17 @@ namespace AzToolsFramework
int AssetBrowserTableModel::BuildTableModelMap(
const QAbstractItemModel* model, const QModelIndex& parent /*= QModelIndex()*/, int row /*= 0*/)
{
static int cont = 0;
static int displayedItemsCounter = 0;
int rows = model ? model->rowCount(parent) : 0;
if (parent == QModelIndex())
{
cont = 0;
displayedItemsCounter = 0;
}
for (int i = 0; i < rows; ++i)
{
if (cont < m_numberOfItemsDisplayed)
if (displayedItemsCounter < m_numberOfItemsDisplayed)
{
QModelIndex index = model->index(i, 0, parent);
AssetBrowserEntry* entry = GetAssetEntry(m_filterModel->mapToSource(index));
@@ -112,18 +112,15 @@ namespace AzToolsFramework
Q_EMIT dataChanged(index, index);
++row;
++cont;
++displayedItemsCounter;
}
if (model->hasChildren(index) && cont < 10)
if (model->hasChildren(index))
{
row = BuildTableModelMap(model, index, row);
}
}
else
{
break;
}
}
return row;
}
@@ -42,10 +42,9 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Field("MaxCount", &AutoBackup::m_maxCount)
->Field("RemindTime", &AutoBackup::m_remindTime);
serialize
.Class<AssetBrowserSearch>()
serialize.Class<AssetBrowserSearch>()
->Version(1)
->Field("Max number of items displayed", &AssetBrowserSearch::m_numOfItemsShown);
->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
serialize.Class<CEditorPreferencesPage_Files>()
->Version(1)
@@ -86,10 +85,10 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_numOfItemsShown, "Maximum number of displayed items",
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
"Maximum number of displayed items displayed in the Search View")
->Attribute(AZ::Edit::Attributes::Min, 100)
->Attribute(AZ::Edit::Attributes::Max, 1000);
->Attribute(AZ::Edit::Attributes::Min, 50)
->Attribute(AZ::Edit::Attributes::Max, 5000);
editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
@@ -137,7 +136,7 @@ void CEditorPreferencesPage_Files::OnApply()
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
gSettings.numberOfItemsShownInSearch = m_assetBrowserSearch.m_numOfItemsShown;
gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
}
void CEditorPreferencesPage_Files::InitializeSettings()
@@ -163,5 +162,5 @@ void CEditorPreferencesPage_Files::InitializeSettings()
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
m_assetBrowserSearch.m_numOfItemsShown = gSettings.numberOfItemsShownInSearch;
m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
}
@@ -72,7 +72,7 @@ private:
{
AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
int m_numOfItemsShown;
int m_maxNumberOfItemsShownInSearch;
};
Files m_files;
+3 -3
View File
@@ -498,7 +498,7 @@ void SEditorSettings::Save()
SaveValue("Settings", "AutoBackupTime", autoBackupTime);
SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
SaveValue("Settings", "AutoRemindTime", autoRemindTime);
SaveValue("Settings", "MaxDisplayedItemsNumInSearch", numberOfItemsShownInSearch);
SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
SaveValue("Settings", "StylusMode", stylusMode);
@@ -711,7 +711,7 @@ void SEditorSettings::Load()
LoadValue("Settings", "AutoBackupTime", autoBackupTime);
LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
LoadValue("Settings", "AutoRemindTime", autoRemindTime);
LoadValue("Settings", "MaxDisplayedItemsNumInSearch", numberOfItemsShownInSearch);
LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
LoadValue("Settings", "StylusMode", stylusMode);
@@ -1208,5 +1208,5 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
{
return SEditorSettings::numberOfItemsShownInSearch;
return SEditorSettings::maxNumberOfItemsShownInSearch;
}
+1 -1
View File
@@ -382,7 +382,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
// Asset Browser Search View.
//////////////////////////////////////////////////////////////////////////
//! Current maximum number of items that can be displayed in the AssetBrowser Search View.
int numberOfItemsShownInSearch;
int maxNumberOfItemsShownInSearch;
//////////////////////////////////////////////////////////////////////////