Skip to content

Commit

Permalink
Fix for prusa3d#12920 - Prusa Slicer 2.8 rc 2 / iCCP: known incorrect…
Browse files Browse the repository at this point in the history
… sRGB profile

(SPE-2485)
  • Loading branch information
YuSanka authored and lukasmatena committed Sep 18, 2024
1 parent 33bafd2 commit 90017e5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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
15 changes: 15 additions & 0 deletions src/slic3r/GUI/GUI_App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -181,6 +195,7 @@ class GUI_App : public wxApp
size_t m_instance_hash_int;

Search::OptionsSearcher* m_searcher{ nullptr };
LogGui* m_log_gui { nullptr };

public:
bool OnInit() override;
Expand Down

0 comments on commit 90017e5

Please sign in to comment.