Added comments and did some code clean up
Changes in this commit: - Added comments to dialog code in CryEdit.cpp and CryEditDoc.cpp - Moved Code/Framework/AzQtComponents/AzQtComponents/Components/img/UI20/Cards/warning.svg to Code/Framework/AzQtComponents/AzQtComponents/Images/Notifications/warning.svg - Improved the hover message over prefab settings in EditorPreferencesPageGeneral.cpp - Fixed a syntax error in Editor.qss Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
+21
-11
@@ -747,55 +747,65 @@ void CCryEditApp::OnFileSave()
|
||||
else if (savePrefabsPreference == AzToolsFramework::SavePrefabsPreference::Unspecified)
|
||||
{
|
||||
QDialog saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
|
||||
|
||||
// Main Content section begins.
|
||||
saveModifiedMessageBox.setObjectName("SaveAllPrefabsDialog");
|
||||
QBoxLayout* contentLayout = new QVBoxLayout(&saveModifiedMessageBox);
|
||||
|
||||
QFrame* levelSavedMessageFrame = new QFrame(&saveModifiedMessageBox);
|
||||
QHBoxLayout* levelSavedMessageLayout = new QHBoxLayout(&saveModifiedMessageBox);
|
||||
levelSavedMessageFrame->setObjectName("LevelSavedMessageFrame");
|
||||
|
||||
// Add a checkMark icon next to the level entities saved message.
|
||||
QPixmap checkMarkIcon(QString(":/Notifications/checkmark.svg"));
|
||||
QLabel* levelSavedSuccessfullyIcon = new QLabel();
|
||||
levelSavedSuccessfullyIcon->setPixmap(checkMarkIcon);
|
||||
levelSavedSuccessfullyIcon->setFixedWidth(checkMarkIcon.width());
|
||||
QLabel* levelSavedSuccessfullyIconContainer = new QLabel();
|
||||
levelSavedSuccessfullyIconContainer->setPixmap(checkMarkIcon);
|
||||
levelSavedSuccessfullyIconContainer->setFixedWidth(checkMarkIcon.width());
|
||||
|
||||
// Add a message that level entities are saved successfully.
|
||||
QLabel* levelSavedSuccessfullyLabel = new QLabel("All entities inside level have been saved successfully.");
|
||||
levelSavedSuccessfullyLabel->setObjectName("LevelSavedSuccessfullyLabel");
|
||||
levelSavedMessageLayout->addWidget(levelSavedSuccessfullyIcon);
|
||||
levelSavedMessageLayout->addWidget(levelSavedSuccessfullyIconContainer);
|
||||
levelSavedMessageLayout->addWidget(levelSavedSuccessfullyLabel);
|
||||
levelSavedMessageFrame->setLayout(levelSavedMessageLayout);
|
||||
|
||||
|
||||
QFrame* prefabSaveQuestionFrame = new QFrame(&saveModifiedMessageBox);
|
||||
QHBoxLayout* prefabSaveQuestionLayout = new QHBoxLayout(&saveModifiedMessageBox);
|
||||
|
||||
// Add a warning icon next to prefabs save question.
|
||||
QLabel* warningIconContainer = new QLabel();
|
||||
QPixmap warningIcon(QString(":/Cards/img/UI20/Cards/warning.svg"));
|
||||
QPixmap warningIcon(QString(":/Notifications/warning.svg"));
|
||||
warningIconContainer->setPixmap(warningIcon);
|
||||
warningIconContainer->setFixedWidth(warningIcon.width());
|
||||
prefabSaveQuestionLayout->addWidget(warningIconContainer);
|
||||
|
||||
// Ask if user wants all prefabs saved.
|
||||
QLabel* prefabSaveQuestionLabel = new QLabel("Do you want to save all unsaved prefabs?");
|
||||
prefabSaveQuestionFrame->setObjectName("PrefabSaveQuestionFrame");
|
||||
prefabSaveQuestionLayout->addWidget(prefabSaveQuestionLabel);
|
||||
prefabSaveQuestionFrame->setLayout(prefabSaveQuestionLayout);
|
||||
|
||||
contentLayout->addWidget(levelSavedMessageFrame);
|
||||
contentLayout->addWidget(prefabSaveQuestionFrame);
|
||||
|
||||
|
||||
// Footer section begins.
|
||||
QFrame* footerSeparatorLine = new QFrame();
|
||||
footerSeparatorLine->setObjectName("FooterSeparatorLine");
|
||||
footerSeparatorLine->setFrameShape(QFrame::HLine);
|
||||
contentLayout->addWidget(footerSeparatorLine);
|
||||
QHBoxLayout* footerLayout = new QHBoxLayout(&saveModifiedMessageBox);
|
||||
|
||||
// Provide option for user to remember their prefab save preference.
|
||||
QCheckBox* saveAllPrefabsPreference = new QCheckBox("Remember my preference.");
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(saveAllPrefabsPreference);
|
||||
QVBoxLayout* footerPreferenceLayout = new QVBoxLayout(&saveModifiedMessageBox);
|
||||
footerPreferenceLayout->addWidget(saveAllPrefabsPreference);
|
||||
QLabel* prefabSavePreferenceHint = new QLabel("You can change this anytime in Edit->GlobalPreferences.");
|
||||
QLabel* prefabSavePreferenceHint = new QLabel("You can change this anytime in Edit -> Editor Settings -> GlobalPreferences.");
|
||||
prefabSavePreferenceHint->setObjectName("PrefabSavePreferenceHint");
|
||||
footerPreferenceLayout->addWidget(prefabSavePreferenceHint);
|
||||
footerLayout->addLayout(footerPreferenceLayout);
|
||||
QDialogButtonBox* prefabSaveConfirmationButtons = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::No);
|
||||
footerLayout->addWidget(prefabSaveConfirmationButtons);
|
||||
|
||||
contentLayout->addLayout(footerLayout);
|
||||
|
||||
connect(prefabSaveConfirmationButtons, &QDialogButtonBox::accepted, &saveModifiedMessageBox, &QDialog::accept);
|
||||
connect(prefabSaveConfirmationButtons, &QDialogButtonBox::rejected, &saveModifiedMessageBox, &QDialog::reject);
|
||||
AzQtComponents::StyleManager::setStyleSheet(saveModifiedMessageBox.parentWidget(), QStringLiteral("style:Editor.qss"));
|
||||
|
||||
+35
-64
@@ -672,7 +672,29 @@ bool CCryEditDoc::SaveModified()
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
if (usePrefabSystemForLevels)
|
||||
if (!usePrefabSystemForLevels)
|
||||
{
|
||||
QMessageBox saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
|
||||
saveModifiedMessageBox.setText(QString("Save changes to %1?").arg(GetTitle()));
|
||||
saveModifiedMessageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
saveModifiedMessageBox.setIcon(QMessageBox::Icon::Question);
|
||||
|
||||
auto button = QMessageBox::question(
|
||||
AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
switch (button)
|
||||
{
|
||||
case QMessageBox::Cancel:
|
||||
return false;
|
||||
case QMessageBox::Yes:
|
||||
return DoFileSave();
|
||||
case QMessageBox::No:
|
||||
SetModifiedFlag(false);
|
||||
return true;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
|
||||
auto prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
|
||||
@@ -681,21 +703,26 @@ bool CCryEditDoc::SaveModified()
|
||||
QDialog saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
|
||||
saveModifiedMessageBox.setObjectName("SaveDirtyLevelDialog");
|
||||
|
||||
// Main Content section begins.
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(&saveModifiedMessageBox);
|
||||
QFrame* levelEntitiesSaveQuestionFrame = new QFrame(&saveModifiedMessageBox);
|
||||
QHBoxLayout* levelEntitiesSaveQuestionLayout = new QHBoxLayout(&saveModifiedMessageBox);
|
||||
levelEntitiesSaveQuestionFrame->setObjectName("LevelEntitiesSaveQuestionFrame");
|
||||
QLabel* levelEntitiesSaveQuestionLabel = new QLabel("Do you want to save unsaved entities in the level?");
|
||||
|
||||
|
||||
// Add a warning icon next to save entities question.
|
||||
levelEntitiesSaveQuestionFrame->setLayout(levelEntitiesSaveQuestionLayout);
|
||||
QPixmap warningIcon(QString(":/Cards/img/UI20/Cards/warning.svg"));
|
||||
QPixmap warningIcon(QString(":/Notifications/warning.svg"));
|
||||
QLabel* warningIconContainer = new QLabel();
|
||||
warningIconContainer->setPixmap(warningIcon);
|
||||
warningIconContainer->setFixedWidth(warningIcon.width());
|
||||
levelEntitiesSaveQuestionLayout->addWidget(warningIconContainer);
|
||||
|
||||
// Ask user if they want to save entities in level.
|
||||
QLabel* levelEntitiesSaveQuestionLabel = new QLabel("Do you want to save unsaved entities in the level?");
|
||||
levelEntitiesSaveQuestionLayout->addWidget(levelEntitiesSaveQuestionLabel);
|
||||
contentLayout->addWidget(levelEntitiesSaveQuestionFrame);
|
||||
|
||||
// Ask user if they want to save unsaved prefabs in the level too.
|
||||
QCheckBox* saveAllPrefabsCheckbox = new QCheckBox("Save all unsaved prefabs in the level too.");
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(saveAllPrefabsCheckbox);
|
||||
saveAllPrefabsCheckbox->setObjectName("SaveAllPrefabsCheckbox");
|
||||
@@ -708,11 +735,15 @@ bool CCryEditDoc::SaveModified()
|
||||
: AzToolsFramework::SavePrefabsPreference::SaveNone;
|
||||
});
|
||||
contentLayout->addWidget(saveAllPrefabsCheckbox);
|
||||
|
||||
// Footer section begins.
|
||||
QFrame* footerSeparatorLine = new QFrame();
|
||||
footerSeparatorLine->setObjectName("FooterSeparatorLine");
|
||||
footerSeparatorLine->setFrameShape(QFrame::HLine);
|
||||
contentLayout->addWidget(footerSeparatorLine);
|
||||
QHBoxLayout* footerLayout = new QHBoxLayout(&saveModifiedMessageBox);
|
||||
|
||||
// Provide option for user to remember their prefab save preference.
|
||||
QCheckBox* saveAllPrefabsPreferenceCheckBox = new QCheckBox("Remember my preference.");
|
||||
AzQtComponents::CheckBox::applyToggleSwitchStyle(saveAllPrefabsPreferenceCheckBox);
|
||||
if (savePrefabsPreference == AzToolsFramework::SavePrefabsPreference::SaveAll)
|
||||
@@ -728,9 +759,7 @@ bool CCryEditDoc::SaveModified()
|
||||
footerLayout->addLayout(footerPreferenceLayout);
|
||||
QDialogButtonBox* prefabSaveConfirmationButtons = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
|
||||
footerLayout->addWidget(prefabSaveConfirmationButtons);
|
||||
|
||||
contentLayout->addLayout(footerLayout);
|
||||
|
||||
connect(prefabSaveConfirmationButtons, &QDialogButtonBox::accepted, &saveModifiedMessageBox, &QDialog::accept);
|
||||
connect(prefabSaveConfirmationButtons, &QDialogButtonBox::rejected, &saveModifiedMessageBox, &QDialog::reject);
|
||||
AzQtComponents::StyleManager::setStyleSheet(saveModifiedMessageBox.parentWidget(), QStringLiteral("style:Editor.qss"));
|
||||
@@ -757,28 +786,6 @@ bool CCryEditDoc::SaveModified()
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox saveModifiedMessageBox(AzToolsFramework::GetActiveWindow());
|
||||
saveModifiedMessageBox.setText(QString("Save changes to %1?").arg(GetTitle()));
|
||||
saveModifiedMessageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
saveModifiedMessageBox.setIcon(QMessageBox::Icon::Question);
|
||||
|
||||
auto button = QMessageBox::question(
|
||||
AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
switch (button)
|
||||
{
|
||||
case QMessageBox::Cancel:
|
||||
return false;
|
||||
case QMessageBox::Yes:
|
||||
return DoFileSave();
|
||||
case QMessageBox::No:
|
||||
SetModifiedFlag(false);
|
||||
return true;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::OnFileSaveAs()
|
||||
@@ -1360,42 +1367,6 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
if (openResult)
|
||||
{
|
||||
AZ::IO::FileIOStream stream(tempSaveFileHandle, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary, false);
|
||||
//SaveAllPrefabsDialog dlg(MainWindow::instance());
|
||||
//dlg.exec();
|
||||
/*
|
||||
AzToolsFramework::SavePrefabsPreference savePrefabsPreference =
|
||||
prefabEditorEntityOwnershipInterface->GetSavePrefabsPreference();
|
||||
if (savePrefabsPreference == AzToolsFramework::SavePrefabsPreference::Unspecified && !m_modified)
|
||||
{
|
||||
QMessageBox prefabSavePreferenceBox(AzToolsFramework::GetActiveWindow());
|
||||
prefabSavePreferenceBox.setText(QString("Save all prefabs in %1?").arg(GetTitle()));
|
||||
prefabSavePreferenceBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
QCheckBox* checkbox = new QCheckBox("Remember my preference.");
|
||||
prefabSavePreferenceBox.setCheckBox(checkbox);
|
||||
prefabSavePreferenceBox.checkBox();
|
||||
int button = prefabSavePreferenceBox.exec();
|
||||
switch (button)
|
||||
{
|
||||
case QMessageBox::Yes:
|
||||
if (checkbox->checkState() == Qt::CheckState::Checked)
|
||||
{
|
||||
prefabEditorEntityOwnershipInterface->SetSavePrefabsPreference(
|
||||
AzToolsFramework::SavePrefabsPreference::SaveAll);
|
||||
gSettings.SetSavePrefabsPreference(AzToolsFramework::SavePrefabsPreference::SaveAll);
|
||||
}
|
||||
prefabEditorEntityOwnershipInterface->SetSaveAllPrefabs(true);
|
||||
break;
|
||||
case QMessageBox::No:
|
||||
if (checkbox->checkState() == Qt::CheckState::Checked)
|
||||
{
|
||||
prefabEditorEntityOwnershipInterface->SetSavePrefabsPreference(
|
||||
AzToolsFramework::SavePrefabsPreference::SaveNone);
|
||||
gSettings.SetSavePrefabsPreference(AzToolsFramework::SavePrefabsPreference::SaveNone);
|
||||
}
|
||||
prefabEditorEntityOwnershipInterface->SetSaveAllPrefabs(false);
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
contentsAllSaved = prefabEditorEntityOwnershipInterface->SaveToStream(stream, AZStd::string_view(filenameStrData.data(), filenameStrData.size()));
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
|
||||
editContext->Class<PrefabSettings>("Prefabs", "")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::ComboBox, &PrefabSettings::m_savePrefabsPreference, "Save Prefabs Preference","Save Prefabs Preference")
|
||||
AZ::Edit::UIHandlers::ComboBox, &PrefabSettings::m_savePrefabsPreference, "Save Prefabs Preference",
|
||||
"When saving levels, this option controls whether and how prefabs should be saved along with the level.")
|
||||
->EnumAttribute(AzToolsFramework::SavePrefabsPreference::Unspecified, "Unspecified")
|
||||
->EnumAttribute(AzToolsFramework::SavePrefabsPreference::SaveAll, "Save All")
|
||||
->EnumAttribute(AzToolsFramework::SavePrefabsPreference::SaveNone, "Save None");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <QSettings>
|
||||
|
||||
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
#include <AzCore/JSON/document.h>
|
||||
|
||||
#include <AzQtComponents/Components/Widgets/ToolBar.h>
|
||||
|
||||
@@ -252,7 +252,8 @@ QTableWidget#recentLevelTable::item {
|
||||
padding: 5px 2px 5px 2px;
|
||||
}
|
||||
|
||||
#SaveAllPrefabsDialog #PrefabSaveQuestionFrame, #SaveDirtyLevelDialog #LevelEntitiesSaveQuestionFrame, #SaveAllPrefabsCheckbox{
|
||||
#SaveAllPrefabsDialog #PrefabSaveQuestionFrame, #SaveDirtyLevelDialog #LevelEntitiesSaveQuestionFrame, #SaveAllPrefabsCheckbox
|
||||
{
|
||||
border: 1px solid orange;
|
||||
border-radius: 2px;
|
||||
margin: 5px 20px 5px 20px;
|
||||
@@ -260,11 +261,13 @@ QTableWidget#recentLevelTable::item {
|
||||
color : white;
|
||||
}
|
||||
|
||||
#SaveAllPrefabsDialog #FooterSeparatorLine, #SaveDirtyLevelDialog #FooterSeparatorLine{
|
||||
#SaveAllPrefabsDialog #FooterSeparatorLine, #SaveDirtyLevelDialog #FooterSeparatorLine
|
||||
{
|
||||
color: gray;
|
||||
}
|
||||
|
||||
#SaveAllPrefabsDialog #PrefabSavePreferenceHint, #SaveDirtyLevelDialog #PrefabSavePreferenceHint{
|
||||
#SaveAllPrefabsDialog #PrefabSavePreferenceHint, #SaveDirtyLevelDialog #PrefabSavePreferenceHint
|
||||
{
|
||||
font: italic;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace AzQtComponents
|
||||
config.toolTipPaddingInPixels = 5;
|
||||
config.headerIconSizeInPixels = CardHeader::defaultIconSize();
|
||||
config.rootLayoutSpacing = 0;
|
||||
config.warningIcon = QStringLiteral(":/Cards/img/UI20/Cards/warning.svg");
|
||||
config.warningIcon = QStringLiteral(":/Notifications/warning.svg");
|
||||
config.warningIconSize = {24, 24};
|
||||
config.disabledIconAlpha = 0.25;
|
||||
|
||||
|
||||
@@ -424,7 +424,6 @@
|
||||
<file>img/UI20/Cards/menu_ico.png</file>
|
||||
<file>img/UI20/Cards/error_icon.png</file>
|
||||
<file>img/UI20/Cards/warning.png</file>
|
||||
<file>img/UI20/Cards/warning.svg</file>
|
||||
<file>img/UI20/Cards/search.png</file>
|
||||
<file>img/UI20/Cards/close.png</file>
|
||||
<file>img/UI20/Cards/error-conclict-state.svg</file>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -30,6 +30,7 @@
|
||||
<file alias="checkmark.svg">Notifications/checkmark.svg</file>
|
||||
<file alias="download.svg">Notifications/download.svg</file>
|
||||
<file alias="link.svg">Notifications/link.svg</file>
|
||||
<file alias="warning.svg">Notifications/warning.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Outliner">
|
||||
<file alias="sort_a_to_z.svg">Outliner/sort_a_to_z.svg</file>
|
||||
|
||||
Reference in New Issue
Block a user