Addressed remaining PR feedback

Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>
This commit is contained in:
nggieber
2021-12-09 15:30:32 -08:00
parent 5641bcd5f1
commit 9f4895aaea
9 changed files with 22 additions and 57 deletions
@@ -250,7 +250,6 @@ QTabBar::tab:focus {
margin-top:30px;
}
#projectTemplate {
margin: 25px 0 0 50px;
}
@@ -114,11 +114,6 @@ namespace O3DE::ProjectManager
m_settings = AZStd::make_unique<Settings>();
AZ_Assert(m_settings, "Failed to create Settings");
if (!m_settings->IsInitialized())
{
return false;
}
const AZ::CommandLine* commandLine = GetCommandLine();
AZ_Assert(commandLine, "Failed to get command line");
@@ -85,7 +85,6 @@ namespace O3DE::ProjectManager
void ExternalLinkDialog::SetSkipDialogSetting(bool state)
{
auto settings = SettingsInterface::Get();
settings->Set(QString(settings->ExternalLinkWarningKey), state);
SettingsInterface::Get()->Set(QString(ISettings::ExternalLinkWarningKey), state);
}
} // namespace O3DE::ProjectManager
@@ -31,8 +31,7 @@ namespace O3DE::ProjectManager
{
// Check if user request not to be shown external link warning dialog
bool skipDialog = false;
auto settings = SettingsInterface::Get();
settings->Get(skipDialog, QString(settings->ExternalLinkWarningKey));
SettingsInterface::Get()->Get(skipDialog, QString(ISettings::ExternalLinkWarningKey));
if (!skipDialog)
{
+17 -26
View File
@@ -22,12 +22,6 @@ namespace O3DE::ProjectManager
AZ_Assert(m_settingsRegistry, "Failed to create Settings");
}
bool Settings::IsInitialized()
{
// Settings intialized correctly if it successfuly got the SettingsRegistry
return m_settingsRegistry;
}
bool Settings::Save()
{
AZ::SettingsRegistryMergeUtils::DumperSettings dumperSettings;
@@ -61,6 +55,18 @@ namespace O3DE::ProjectManager
return saved;
}
bool Settings::OnSettingsChanged()
{
if (m_saveToDisk)
{
return Save();
}
else
{
return true;
}
}
bool Settings::Get(QString& result, const QString& settingsKey)
{
bool success = false;
@@ -82,10 +88,7 @@ namespace O3DE::ProjectManager
bool success = false;
success = m_settingsRegistry->Set(settingsKey.toStdString().c_str(), settingsValue.toStdString().c_str());
if (m_saveToDisk)
{
Save();
}
OnSettingsChanged();
return success;
}
@@ -95,10 +98,7 @@ namespace O3DE::ProjectManager
bool success = false;
success = m_settingsRegistry->Set(settingsKey.toStdString().c_str(), settingsValue);
if (m_saveToDisk)
{
Save();
}
OnSettingsChanged();
return success;
}
@@ -108,10 +108,7 @@ namespace O3DE::ProjectManager
bool success = false;
success = m_settingsRegistry->Remove(settingsKey.toStdString().c_str());
if (m_saveToDisk)
{
Save();
}
OnSettingsChanged();
return success;
}
@@ -132,10 +129,7 @@ namespace O3DE::ProjectManager
{
success = m_settingsRegistry->Remove(settingsKeyOrig.toStdString().c_str());
}
if (m_saveToDisk)
{
Save();
}
OnSettingsChanged();
}
}
@@ -190,10 +184,7 @@ namespace O3DE::ProjectManager
}
success = m_settingsRegistry->SetObject<AZStd::set<AZStd::string>>(ProjectsBuiltSuccessfullyKey, builtPathsResult);
if (m_saveToDisk)
{
Save();
}
OnSettingsChanged();
return success;
}
+1 -2
View File
@@ -25,8 +25,6 @@ namespace O3DE::ProjectManager
public:
Settings(bool saveToDisk = true);
bool IsInitialized() override;
bool Get(QString& result, const QString& settingsKey) override;
bool Get(bool& result, const QString& settingsKey) override;
bool Set(const QString& settingsKey, const QString& settingsValue) override;
@@ -41,6 +39,7 @@ namespace O3DE::ProjectManager
private:
bool Save();
bool OnSettingsChanged();
bool GetBuiltSuccessfullyPaths(AZStd::set<AZStd::string>& result);
@@ -28,12 +28,6 @@ namespace O3DE::ProjectManager
ISettings() = default;
virtual ~ISettings() = default;
/**
* This checks if Settings is in a usable state
* @return true Settings is ready to be used, false otherwise
*/
virtual bool IsInitialized() = 0;
/**
* Get the value for a string settings key
* @param result Store string result in this variable
@@ -70,8 +70,8 @@ namespace O3DE::ProjectManager
advancedCollapseLayout->addWidget(m_advancedSettingsCollapseButton);
// Category title
QLabel* advancedLabel = new QLabel("Advanced Settings");
advancedLabel->setObjectName("p");
QLabel* advancedLabel = new QLabel(tr("Advanced Settings"));
advancedLabel->setObjectName("projectSettingsSectionTitle");
advancedCollapseLayout->addWidget(advancedLabel);
m_verticalLayout->addLayout(advancedCollapseLayout);
@@ -86,11 +86,6 @@ namespace O3DE::ProjectManager
AZStd::unique_ptr<AZ::JsonRegistrationContext> m_registrationContext;
};
TEST_F(SettingsTests, Settings_IsIntialized_Success)
{
EXPECT_TRUE(m_settings->IsInitialized());
}
TEST_F(SettingsTests, Settings_GetUnsetPathBool_ReturnsFalse)
{
bool settingsResult = false;
@@ -103,7 +98,6 @@ namespace O3DE::ProjectManager
bool settingsResult = false;
EXPECT_FALSE(m_settings->Get(settingsResult, m_settingsPath));
// Don't save to disk in test
EXPECT_TRUE(m_settings->Set(m_settingsPath, true));
settingsResult = false;
@@ -125,7 +119,6 @@ namespace O3DE::ProjectManager
QString settingsValue = "TestValue";
// Don't save to disk in test
EXPECT_TRUE(m_settings->Set(m_settingsPath, settingsValue));
EXPECT_TRUE(m_settings->Get(settingsResult, m_settingsPath));
@@ -139,7 +132,6 @@ namespace O3DE::ProjectManager
QString settingsValue = "TestValue";
// Don't save to disk in test
EXPECT_TRUE(m_settings->Set(m_settingsPath, settingsValue));
EXPECT_TRUE(m_settings->Copy(m_settingsPath, m_newSettingsPath, /*removeOrig*/ true));
@@ -158,7 +150,6 @@ namespace O3DE::ProjectManager
QString settingsValue = "TestValue";
// Don't save to disk in test
EXPECT_TRUE(m_settings->Set(m_settingsPath, settingsValue));
EXPECT_TRUE(m_settings->Get(settingsResult, m_settingsPath));
@@ -175,7 +166,6 @@ namespace O3DE::ProjectManager
TEST_F(SettingsTests, Settings_SetProjectBuiltSuccessfully_ReturnsTrue)
{
// Don't save to disk in test
EXPECT_TRUE(m_settings->SetProjectBuiltSuccessfully(m_projectInfo, true));
bool buildResult = false;
@@ -185,7 +175,6 @@ namespace O3DE::ProjectManager
TEST_F(SettingsTests, Settings_SetProjectBuiltUnsuccessfully_ReturnsFalse)
{
// Don't save to disk in test
EXPECT_TRUE(m_settings->SetProjectBuiltSuccessfully(m_projectInfo, false));
bool buildResult = false;