Debugger: Add checkbox to enable remote debugger.

It's not a setting though, so maybe a button would be better.  Or, it
could be the startup setting...
This commit is contained in:
Unknown W. Brackets 2018-04-21 14:17:33 -07:00
parent f81fa27abe
commit a2d82cb654
2 changed files with 29 additions and 1 deletions

View File

@ -52,6 +52,7 @@
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/Reporting.h"
#include "Core/WebServer.h"
#include "GPU/Common/PostShader.h"
#include "android/jni/TestRunner.h"
#include "GPU/GPUInterface.h"
@ -1270,6 +1271,12 @@ void DeveloperToolsScreen::CreateViews() {
createTextureIni->SetEnabled(false);
}
#endif
allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER);
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
CheckBox *allowDebugger = new CheckBox(&allowDebugger_, dev->T("Allow remote debugger"));
list->Add(allowDebugger)->OnClick.Handle(this, &DeveloperToolsScreen::OnRemoteDebugger);
allowDebugger->SetEnabledPtr(&canAllowDebugger_);
}
void DeveloperToolsScreen::onFinish(DialogResult result) {
@ -1371,6 +1378,23 @@ UI::EventReturn DeveloperToolsScreen::OnJitAffectingSetting(UI::EventParams &e)
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnRemoteDebugger(UI::EventParams &e) {
if (allowDebugger_) {
StartWebServer(WebServerFlags::DEBUGGER);
} else {
StopWebServer(WebServerFlags::DEBUGGER);
}
// Persist the setting. Maybe should separate?
g_Config.bRemoteDebuggerOnStartup = allowDebugger_;
return UI::EVENT_CONTINUE;
}
void DeveloperToolsScreen::update() {
UIDialogScreenWithBackground::update();
allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER);
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
}
void ProAdhocServerScreen::CreateViews() {
using namespace UI;
I18NCategory *sy = GetI18NCategory("System");

View File

@ -140,13 +140,13 @@ private:
class DeveloperToolsScreen : public UIDialogScreenWithBackground {
public:
DeveloperToolsScreen() {}
void update() override;
void onFinish(DialogResult result) override;
protected:
void CreateViews() override;
private:
UI::EventReturn OnBack(UI::EventParams &e);
UI::EventReturn OnRunCPUTests(UI::EventParams &e);
UI::EventReturn OnLoggingChanged(UI::EventParams &e);
UI::EventReturn OnLoadLanguageIni(UI::EventParams &e);
@ -154,6 +154,10 @@ private:
UI::EventReturn OnOpenTexturesIniFile(UI::EventParams &e);
UI::EventReturn OnLogConfig(UI::EventParams &e);
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
UI::EventReturn OnRemoteDebugger(UI::EventParams &e);
bool allowDebugger_ = false;
bool canAllowDebugger_ = true;
};
class ProAdhocServerScreen : public UIDialogScreenWithBackground {