Fix for #12920 - Prusa Slicer 2.8 rc 2 / iCCP: known incorrect sRGB profile

(SPE-2485)
This commit is contained in:
YuSanka 2024-09-18 12:36:04 +02:00 committed by Lukas Matena
parent 33bafd28e3
commit 90017e5e6d
2 changed files with 45 additions and 0 deletions

View File

@ -1256,6 +1256,10 @@ bool GUI_App::on_init_inner()
// Set initialization of image handlers before any UI actions - See GH issue #7469
wxInitAllImageHandlers();
// Set our own gui log as an active target
m_log_gui = new LogGui();
wxLog::SetActiveTarget(m_log_gui);
#if defined(_WIN32) && ! defined(_WIN64)
// Win32 32bit build.
if (wxPlatformInfo::Get().GetArchName().substr(0, 2) == "64") {
@ -4146,5 +4150,31 @@ void GUI_App::show_printer_webview_tab()
mainframe->show_printer_webview_tab(preset_bundle->physical_printers.get_selected_printer_config());
}
bool LogGui::ignorred_message(const wxString& msg)
{
for(const wxString& err : std::initializer_list<wxString>{ wxString("cHRM chunk does not match sRGB"),
wxString("known incorrect sRGB profile") }) {
if (msg.Contains(err))
return true;
}
return false;
}
void LogGui::DoLogText(const wxString& msg)
{
if (ignorred_message(msg))
return;
wxLogGui::DoLogText(msg);
}
void LogGui::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info)
{
if (ignorred_message(msg))
return;
wxLogGui::DoLogRecord(level, msg, info);
}
} // GUI
} //Slic3r

View File

@ -119,6 +119,20 @@ static wxString dots("…", wxConvUTF8);
#define SUPPORTS_MARKUP
#endif
// A wrapper class to allow ignoring some known warnings
// and not bothering users with redundant messages.
// see https://github.com/prusa3d/PrusaSlicer/issues/12920
class LogGui : public wxLogGui
{
protected:
void DoLogText(const wxString& msg) override;
void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) override;
private:
bool ignorred_message(const wxString& msg);
};
class GUI_App : public wxApp
{
public:
@ -181,6 +195,7 @@ private:
size_t m_instance_hash_int;
Search::OptionsSearcher* m_searcher{ nullptr };
LogGui* m_log_gui { nullptr };
public:
bool OnInit() override;