[glass] NetworkTablesSetting: Allow disable of server option (#3227)

This commit is contained in:
Peter Johnson
2021-03-07 21:24:59 -08:00
committed by GitHub
parent fe341a16f5
commit 79d1bd6c8f
2 changed files with 7 additions and 1 deletions

View File

@@ -110,7 +110,7 @@ void NetworkTablesSettings::Update() {
bool NetworkTablesSettings::Display() {
static const char* modeOptions[] = {"Disabled", "Client", "Server"};
ImGui::Combo("Mode", m_pMode, modeOptions, 3);
ImGui::Combo("Mode", m_pMode, modeOptions, m_serverOption ? 3 : 2);
switch (*m_pMode) {
case 1:
ImGui::InputText("Team/IP", m_pServerTeam);

View File

@@ -22,11 +22,17 @@ class NetworkTablesSettings {
NT_Inst inst = nt::GetDefaultInstance(),
const char* storageName = "NetworkTables Settings");
/**
* Enables or disables the server option. Default is enabled.
*/
void EnableServerOption(bool enable) { m_serverOption = enable; }
void Update();
bool Display();
private:
bool m_restart = true;
bool m_serverOption = true;
int* m_pMode;
std::string* m_pIniName;
std::string* m_pServerTeam;