Fix #3121 by asking the user if a slow CLUT scan should be cancelled.

This commit is contained in:
Adam Reichold
2016-01-27 21:18:50 +01:00
parent 24248fcb39
commit 5499974ffa
2 changed files with 30 additions and 12 deletions

View File

@@ -1466,7 +1466,7 @@ TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
TP_FILMSIMULATION_LABEL;Film Simulation
TP_FILMSIMULATION_STRENGTH;Strength
TP_FILMSIMULATION_ZEROCLUTSFOUND;Set HaldCLUT directory in Preferences
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
TP_FLATFIELD_AUTOSELECT;Auto-selection
TP_FLATFIELD_BLURRADIUS;Blur radius
TP_FLATFIELD_BLURTYPE;Blur type

View File

@@ -12,23 +12,35 @@ using namespace rtengine::procparams;
namespace
{
void notifySlowParseDir (const std::chrono::system_clock::time_point& startedAt)
bool notifySlowParseDir (const std::chrono::system_clock::time_point& startedAt)
{
static bool alreadyNotified = false;
static enum
{
Undecided,
Cancel,
Continue
}
decision = Undecided;
if (alreadyNotified) {
return;
if (decision == Cancel) {
return false;
} else if (decision == Continue) {
return true;
}
const auto now = std::chrono::system_clock::now ();
if (now - startedAt < std::chrono::seconds (10)) {
return;
return true;
}
Gtk::MessageDialog dialog (M ("TP_FILMSIMULATION_SLOWPARSEDIR"), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
dialog.run ();
alreadyNotified = true;
Gtk::MessageDialog dialog (M ("TP_FILMSIMULATION_SLOWPARSEDIR"), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
if (dialog.run () == Gtk::RESPONSE_YES) {
decision = Cancel;
return false;
} else {
decision = Continue;
return true;
}
}
}
@@ -227,7 +239,10 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
dirs.push_back (std::move (dir));
notifySlowParseDir (startedAt);
if (!notifySlowParseDir (startedAt)) {
m_model->clear ();
return 0;
}
}
currDirs.clear ();
@@ -278,7 +293,10 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
++fileCount;
notifySlowParseDir (startedAt);
if (!notifySlowParseDir (startedAt)) {
m_model->clear ();
return 0;
}
}
}