Retrieving data from preferences

Signed-off-by: igarri <igarri@amazon.com>
This commit is contained in:
igarri
2021-06-21 13:18:51 +01:00
parent 5d6ab2699c
commit c061802ab0
6 changed files with 21 additions and 13 deletions
@@ -8,6 +8,8 @@
#include <AssetBrowser/AssetBrowserTableModel.h>
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h>
#pragma optimize("", off)
namespace AzToolsFramework
{
namespace AssetBrowser
@@ -151,24 +153,23 @@ namespace AzToolsFramework
endRemoveRows();
}
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome outcome;
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(outcome, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetValue,
"Settings|MaxDisplayedItemsNumInSearch");
//AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(
// outcome, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetValue,
// "Settings\ExperimentalFeatures|TotalIlluminationEnabled");
AzToolsFramework::EditorSettingsAPIRequests::SettingOutcome outcome;
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(outcome, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetValue,
"Settings|MaxDisplayedItemsNumInSearch");
AZStd::any* outcomeValue = &outcome.GetValue<AZStd::any>();
//bool trr = false;
if (outcomeValue->is<int>() == true)
AZStd::any outcomeValue = outcome.GetValue<AZStd::any>();
if (outcomeValue.is<int>() == true)
{
m_numberOfItemsDisplayed = AZStd::any_cast<int>(*outcomeValue);
//trr = AZStd::any_cast<bool>(outcomeValue);
m_numberOfItemsDisplayed = AZStd::any_cast<int>(outcome.GetValue());
}
AzToolsFramework::EditorSettingsAPIBus::BroadcastResult(
m_numberOfItemsDisplayed, &AzToolsFramework::EditorSettingsAPIBus::Handler::GetMaxNumberOfItemsShownInSearchView);
BuildTableModelMap(sourceModel());
emit layoutChanged();
}
} // namespace AssetBrowser
} // namespace AzToolsFramework
#include "AssetBrowser/moc_AssetBrowserTableModel.cpp"
#pragma optimize("", on)
@@ -37,6 +37,7 @@ namespace AzToolsFramework
virtual SettingOutcome GetValue(const AZStd::string_view path) = 0;
virtual SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) = 0;
virtual ConsoleColorTheme GetConsoleColorTheme() const = 0;
virtual int GetMaxNumberOfItemsShownInSearchView() const = 0;
};
using EditorSettingsAPIBus = AZ::EBus<EditorSettingsAPIRequests>;
@@ -78,7 +78,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_ui->m_viewSwitcherCheckBox->setVisible(false);
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(350));
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
if (ed_useNewAssetBrowserTableView)
{
@@ -88,7 +88,7 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_numOfItemsShown, "Maximum number of displayed items",
"Maximum number of displayed items displayed in the Search View")
->Attribute(AZ::Edit::Attributes::Min, 200)
->Attribute(AZ::Edit::Attributes::Min, 10)
->Attribute(AZ::Edit::Attributes::Max, 1000);
editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
+5
View File
@@ -1205,3 +1205,8 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
{
return consoleBackgroundColorTheme;
}
int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
{
return SEditorSettings::numberOfItemsShownInSearch;
}
+1
View File
@@ -302,6 +302,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
SettingOutcome GetValue(const AZStd::string_view path) override;
SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
int GetMaxNumberOfItemsShownInSearchView() const override;
void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);