Implemented "Details" section enclosing OpenGL extensions when copying
sysinfo to clipboard for inserting into github issue. Fix of [Feature Request] Help => System Info => Copy to Clipboard: wrap list of extensions with <details> tag #6830
This commit is contained in:
parent
0bc2448e22
commit
ae62801250
5 changed files with 28 additions and 13 deletions
|
@ -721,9 +721,11 @@ GUI_App::~GUI_App()
|
|||
delete preset_updater;
|
||||
}
|
||||
|
||||
std::string GUI_App::get_gl_info(bool format_as_html, bool extensions)
|
||||
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
std::string GUI_App::get_gl_info(bool for_github)
|
||||
{
|
||||
return OpenGLManager::get_gl_info().to_string(format_as_html, extensions);
|
||||
return OpenGLManager::get_gl_info().to_string(for_github);
|
||||
}
|
||||
|
||||
wxGLContext* GUI_App::init_glcontext(wxGLCanvas& canvas)
|
||||
|
|
|
@ -172,7 +172,9 @@ public:
|
|||
// Process command line parameters cached in this->init_params,
|
||||
// load configs, STLs etc.
|
||||
void post_init();
|
||||
static std::string get_gl_info(bool format_as_html, bool extensions);
|
||||
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
static std::string get_gl_info(bool for_github);
|
||||
wxGLContext* init_glcontext(wxGLCanvas& canvas);
|
||||
bool init_opengl();
|
||||
|
||||
|
|
|
@ -157,13 +157,16 @@ bool OpenGLManager::GLInfo::is_glsl_version_greater_or_equal_to(unsigned int maj
|
|||
return version_greater_or_equal_to(m_glsl_version, major, minor);
|
||||
}
|
||||
|
||||
std::string OpenGLManager::GLInfo::to_string(bool format_as_html, bool extensions) const
|
||||
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
std::string OpenGLManager::GLInfo::to_string(bool for_github) const
|
||||
{
|
||||
if (!m_detected)
|
||||
detect();
|
||||
|
||||
std::stringstream out;
|
||||
|
||||
const bool format_as_html = ! for_github;
|
||||
std::string h2_start = format_as_html ? "<b>" : "";
|
||||
std::string h2_end = format_as_html ? "</b>" : "";
|
||||
std::string b_start = format_as_html ? "<b>" : "";
|
||||
|
@ -176,18 +179,24 @@ std::string OpenGLManager::GLInfo::to_string(bool format_as_html, bool extension
|
|||
out << b_start << "Renderer: " << b_end << m_renderer << line_end;
|
||||
out << b_start << "GLSL version: " << b_end << m_glsl_version << line_end;
|
||||
|
||||
if (extensions) {
|
||||
{
|
||||
std::vector<std::string> extensions_list;
|
||||
std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_off);
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
|
||||
if (!extensions_list.empty()) {
|
||||
out << h2_start << "Installed extensions:" << h2_end << line_end;
|
||||
if (for_github)
|
||||
out << "<details>\n<summary>Installed extensions:</summary>\n";
|
||||
else
|
||||
out << h2_start << "Installed extensions:" << h2_end << line_end;
|
||||
|
||||
std::sort(extensions_list.begin(), extensions_list.end());
|
||||
for (const std::string& ext : extensions_list) {
|
||||
out << ext << line_end;
|
||||
}
|
||||
for (const std::string& ext : extensions_list)
|
||||
if (! ext.empty())
|
||||
out << ext << line_end;
|
||||
|
||||
if (for_github)
|
||||
out << "</details>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ public:
|
|||
bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
||||
bool is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
||||
|
||||
std::string to_string(bool format_as_html, bool extensions) const;
|
||||
// If formatted for github, plaintext with OpenGL extensions enclosed into <details>.
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
std::string to_string(bool for_github) const;
|
||||
|
||||
private:
|
||||
void detect() const;
|
||||
|
|
|
@ -158,7 +158,7 @@ SysInfoDialog::SysInfoDialog()
|
|||
"</body>"
|
||||
"</html>", bgr_clr_str, text_clr_str, text_clr_str,
|
||||
blacklisted_libraries_message,
|
||||
get_mem_info(true), wxGetApp().get_gl_info(true, true),
|
||||
get_mem_info(true), wxGetApp().get_gl_info(false),
|
||||
"<b>" + _L("Eigen vectorization supported:") + "</b> " + Eigen::SimdInstructionSetsInUse());
|
||||
|
||||
m_opengl_info_html->SetPage(text);
|
||||
|
@ -215,7 +215,7 @@ void SysInfoDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
void SysInfoDialog::onCopyToClipboard(wxEvent &)
|
||||
{
|
||||
wxTheClipboard->Open();
|
||||
const auto text = get_main_info(false) + "\n" + wxGetApp().get_gl_info(false, true);
|
||||
const auto text = get_main_info(false) + "\n" + wxGetApp().get_gl_info(true);
|
||||
wxTheClipboard->SetData(new wxTextDataObject(text));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue