upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui.cpp')
-rw-r--r--src/gui.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gui.cpp b/src/gui.cpp
index 53cb6db..db6b69e 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -50,6 +50,7 @@ static int64 g_lastWalletRefresh = 0;
50static bool g_showSend = false; 50static bool g_showSend = false;
51static bool g_showOptions = false; 51static bool g_showOptions = false;
52static bool g_showAbout = false; 52static bool g_showAbout = false;
53static bool g_showDiagnostics = false;
53static bool g_needRefresh = true; 54static bool g_needRefresh = true;
54 55
55static char g_sendAddr[128] = {}; 56static char g_sendAddr[128] = {};
@@ -310,6 +311,7 @@ static void DrawMainWindow()
310 ImGui::EndMenu(); 311 ImGui::EndMenu();
311 } 312 }
312 if (ImGui::MenuItem("Options")) g_showOptions = true; 313 if (ImGui::MenuItem("Options")) g_showOptions = true;
314 if (ImGui::MenuItem("Diagnostics")) g_showDiagnostics = true;
313 if (ImGui::MenuItem("About")) g_showAbout = true; 315 if (ImGui::MenuItem("About")) g_showAbout = true;
314 ImGui::EndMenuBar(); 316 ImGui::EndMenuBar();
315 } 317 }
@@ -815,6 +817,41 @@ static void DrawOptionsDialog()
815// --------------------------------------------------------------------------- 817// ---------------------------------------------------------------------------
816// About dialog 818// About dialog
817// --------------------------------------------------------------------------- 819// ---------------------------------------------------------------------------
820// What the node knows about itself, in the words it writes to the log. Same
821// text in both places on purpose: what a user pastes into an issue is then
822// exactly what a developer has already read a hundred times.
823static void DrawDiagnosticsDialog()
824{
825 if (!g_showDiagnostics) return;
826 ImGui::SetNextWindowSize(ImVec2(720.0f, 460.0f), ImGuiCond_FirstUseEver);
827 ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(),
828 ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
829 if (ImGui::Begin("Diagnostics", &g_showDiagnostics, ImGuiWindowFlags_NoCollapse))
830 {
831 // Rebuilt at most once a second: it walks every peer and takes their
832 // send locks, which is not something to do at frame rate.
833 static std::string strReport;
834 static int64 nLastBuilt = 0;
835 if (GetTime() != nLastBuilt)
836 {
837 nLastBuilt = GetTime();
838 strReport = GetDiagnosticsText();
839 }
840
841 if (ImGui::Button("Copy to clipboard", ImVec2(160.0f, 0.0f)))
842 ImGui::SetClipboardText(strReport.c_str());
843 ImGui::SameLine();
844 ImGui::TextDisabled("The same report goes to debug.log every ten minutes.");
845 ImGui::Separator();
846
847 ImGui::BeginChild("##diagtext", ImVec2(0.0f, 0.0f), false,
848 ImGuiWindowFlags_HorizontalScrollbar);
849 ImGui::TextUnformatted(strReport.c_str());
850 ImGui::EndChild();
851 }
852 ImGui::End();
853}
854
818static void DrawAboutDialog() 855static void DrawAboutDialog()
819{ 856{
820 if (!g_showAbout) return; 857 if (!g_showAbout) return;
@@ -921,6 +958,7 @@ int RunGUI(int argc, char* argv[])
921 DrawMainWindow(); 958 DrawMainWindow();
922 DrawSendDialog(); 959 DrawSendDialog();
923 DrawOptionsDialog(); 960 DrawOptionsDialog();
961 DrawDiagnosticsDialog();
924 DrawAboutDialog(); 962 DrawAboutDialog();
925 DrawStatusBar(); 963 DrawStatusBar();
926 964