Review changes

Changed text case, removed ClearText API and added GameStartup motify listening.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
This commit is contained in:
sphrose
2021-07-14 10:14:25 +01:00
parent 4c627405f2
commit 93cbb7c981
4 changed files with 23 additions and 13 deletions
+19 -4
View File
@@ -337,6 +337,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]
@@ -375,6 +377,8 @@ CConsoleSCB::~CConsoleSCB()
{
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
GetIEditor()->UnregisterNotifyListener(this);
s_consoleSCB = nullptr;
CLogFile::AttachEditBox(nullptr);
}
@@ -537,10 +541,6 @@ void CConsoleSCB::AddToPendingLines(const QString& text, bool bNewLine)
s_pendingLines.push_back({ text, bNewLine });
}
void CConsoleSCB::ClearText()
{
ui->textEdit->clear();
}
/**
* When a CVar variable is updated, we need to tell alert our console variables
* pane so it can update the corresponding row
@@ -1355,4 +1355,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>
+3 -2
View File
@@ -158,6 +158,7 @@ private:
class CConsoleSCB
: public QWidget
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
, public IEditorNotifyListener
{
Q_OBJECT
public:
@@ -174,8 +175,6 @@ public:
static void AddToPendingLines(const QString& text, bool bNewLine); // call this function instead of AddToConsole() until an instance of CConsoleSCB exists to prevent messages from getting lost
void ClearText();
// EditorPreferencesNotificationBus...
void OnEditorPreferencesChanged() override;
@@ -188,6 +187,8 @@ private Q_SLOTS:
void findNext();
private:
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
QScopedPointer<Ui::Console> ui;
int m_richEditTextLength;
+1 -1
View File
@@ -78,7 +78,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->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")
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")
-6
View File
@@ -29,7 +29,6 @@
// Editor
#include "IEditorImpl.h"
#include "Controls/ConsoleSCB.h"
#include "CryEditDoc.h"
#include "Settings.h"
@@ -567,11 +566,6 @@ void CGameEngine::SwitchToInGame()
wait.acquire();
}
if (gSettings.clearConsoleOnGameModeStart)
{
CConsoleSCB::GetCreatedInstance()->ClearText();
}
GetIEditor()->Notify(eNotify_OnBeginGameMode);
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);