Add a toggle to clear console every time ctrl+G is activated
LYN-3705 As a dev I want a toggle to clear console every time I hit ctrl+G
This commit is contained in:
@@ -338,6 +338,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent)
|
||||
connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious);
|
||||
ui->findPrevButton->addAction(findPreviousAction);
|
||||
|
||||
GetIEditor()->RegisterNotifyListener(this);
|
||||
|
||||
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
|
||||
connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch);
|
||||
connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this]
|
||||
@@ -376,6 +378,8 @@ CConsoleSCB::~CConsoleSCB()
|
||||
{
|
||||
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
|
||||
s_consoleSCB = nullptr;
|
||||
CLogFile::AttachEditBox(nullptr);
|
||||
}
|
||||
@@ -1352,4 +1356,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance()
|
||||
return s_consoleSCB;
|
||||
}
|
||||
|
||||
void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnBeginGameMode:
|
||||
if (gSettings.clearConsoleOnGameModeStart)
|
||||
{
|
||||
ui->textEdit->clear();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Controls/moc_ConsoleSCB.cpp>
|
||||
|
||||
@@ -159,6 +159,7 @@ private:
|
||||
class CConsoleSCB
|
||||
: public QWidget
|
||||
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -187,6 +188,8 @@ private Q_SLOTS:
|
||||
void findNext();
|
||||
|
||||
private:
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
QScopedPointer<Ui::Console> ui;
|
||||
int m_richEditTextLength;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
|
||||
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
|
||||
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
|
||||
->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
|
||||
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
|
||||
->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel)
|
||||
->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole)
|
||||
@@ -77,6 +78,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background")
|
||||
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light")
|
||||
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark")
|
||||
@@ -142,6 +145,7 @@ void CEditorPreferencesPage_General::OnApply()
|
||||
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
|
||||
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
|
||||
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
|
||||
gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
|
||||
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
|
||||
gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole;
|
||||
gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard;
|
||||
@@ -176,6 +180,7 @@ void CEditorPreferencesPage_General::InitializeSettings()
|
||||
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
|
||||
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
|
||||
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
|
||||
m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
|
||||
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
|
||||
m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole;
|
||||
m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup;
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
bool m_previewPanel;
|
||||
bool m_applyConfigSpec;
|
||||
bool m_enableSourceControl;
|
||||
bool m_clearConsoleOnGameModeStart;
|
||||
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
|
||||
bool m_autoLoadLastLevel;
|
||||
bool m_bShowTimeInConsole;
|
||||
|
||||
@@ -566,7 +566,7 @@ void CGameEngine::SwitchToInGame()
|
||||
streamer->QueueRequest(flush);
|
||||
wait.acquire();
|
||||
}
|
||||
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnBeginGameMode);
|
||||
|
||||
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
|
||||
|
||||
@@ -189,6 +189,7 @@ SEditorSettings::SEditorSettings()
|
||||
|
||||
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
|
||||
bShowTimeInConsole = false;
|
||||
clearConsoleOnGameModeStart = false;
|
||||
|
||||
enableSceneInspector = false;
|
||||
|
||||
@@ -527,6 +528,8 @@ void SEditorSettings::Save()
|
||||
|
||||
SaveValue("Settings", "ConsoleBackgroundColorThemeV2", (int)consoleBackgroundColorTheme);
|
||||
|
||||
SaveValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
|
||||
|
||||
SaveValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
|
||||
|
||||
SaveValue("Settings", "EnableSceneInspector", enableSceneInspector);
|
||||
@@ -745,6 +748,8 @@ void SEditorSettings::Load()
|
||||
consoleBackgroundColorTheme = AzToolsFramework::ConsoleColorTheme::Dark;
|
||||
}
|
||||
|
||||
LoadValue("Settings", "ClearConsoleOnGameModeStart", clearConsoleOnGameModeStart);
|
||||
|
||||
LoadValue("Settings", "ShowTimeInConsole", bShowTimeInConsole);
|
||||
|
||||
LoadValue("Settings", "EnableSceneInspector", enableSceneInspector);
|
||||
|
||||
@@ -380,6 +380,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
|
||||
//! Source Control Enabling.
|
||||
bool enableSourceControl;
|
||||
bool clearConsoleOnGameModeStart;
|
||||
|
||||
//! Text editor.
|
||||
QString textEditorForScript;
|
||||
|
||||
Reference in New Issue
Block a user