Only notify the user once if the parseDir method of the film simulation is slow.

This commit is contained in:
Adam Reichold
2016-01-12 17:31:13 +01:00
parent bf2c24a48f
commit 250e06884d
2 changed files with 16 additions and 23 deletions

View File

@@ -1466,6 +1466,7 @@ TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
TP_FILMSIMULATION_LABEL;Film Simulation TP_FILMSIMULATION_LABEL;Film Simulation
TP_FILMSIMULATION_STRENGTH;Strength TP_FILMSIMULATION_STRENGTH;Strength
TP_FILMSIMULATION_ZEROCLUTSFOUND;Set HaldCLUT directory in Preferences TP_FILMSIMULATION_ZEROCLUTSFOUND;Set HaldCLUT directory in Preferences
TP_FILMSIMULATION_SLOWPARSEDIR;The Film Simulation HaldCLUT folder you pointed RawTherapee to is taking too long to load. Reduce the number of files in that folder or point RawTherapee to an empty one instead.\n\nSee Preferences > Image Processing > Film Simulation
TP_FLATFIELD_AUTOSELECT;Auto-selection TP_FLATFIELD_AUTOSELECT;Auto-selection
TP_FLATFIELD_BLURRADIUS;Blur radius TP_FLATFIELD_BLURRADIUS;Blur radius
TP_FLATFIELD_BLURTYPE;Blur type TP_FLATFIELD_BLURTYPE;Blur type

View File

@@ -12,24 +12,23 @@ using namespace rtengine::procparams;
namespace namespace
{ {
bool confirmToContinue (const std::chrono::system_clock::time_point& startedAt, void notifySlowParseDir (const std::chrono::system_clock::time_point& startedAt)
std::chrono::system_clock::time_point& continuedAt)
{ {
const auto now = std::chrono::system_clock::now (); static bool alreadyNotified = false;
const auto searchingFor = std::chrono::duration_cast<std::chrono::seconds> (now-continuedAt);
if (searchingFor >= std::chrono::seconds (5)) { if (alreadyNotified) {
return;
const auto message = Glib::ustring::compose ("Searching CLUT files for %1 seconds now...\nDo you wish to continue?", searchingFor.count ());
Gtk::MessageDialog dialog (message, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true);
if (dialog.run () != Gtk::RESPONSE_YES) {
return false;
}
} }
continuedAt = now; const auto now = std::chrono::system_clock::now ();
return true; if (now - startedAt < std::chrono::seconds (10)) {
return;
}
Gtk::MessageDialog dialog (M ("TP_FILMSIMULATION_SLOWPARSEDIR"), false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
dialog.run ();
alreadyNotified = true;
} }
} }
@@ -192,7 +191,6 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
} }
const auto startedAt = std::chrono::system_clock::now (); const auto startedAt = std::chrono::system_clock::now ();
auto continuedAt = startedAt;
// Build menu of limited directory structure using breadth-first search // Build menu of limited directory structure using breadth-first search
using Dirs = std::vector<std::pair<Glib::ustring, Gtk::TreeModel::Row>>; using Dirs = std::vector<std::pair<Glib::ustring, Gtk::TreeModel::Row>>;
@@ -229,10 +227,7 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
dirs.push_back (std::move (dir)); dirs.push_back (std::move (dir));
if (!confirmToContinue (startedAt, continuedAt)) { notifySlowParseDir (startedAt);
m_model->clear ();
return 0;
}
} }
currDirs.clear (); currDirs.clear ();
@@ -283,10 +278,7 @@ int ClutComboBox::parseDir (const Glib::ustring& path)
++fileCount; ++fileCount;
if (!confirmToContinue (startedAt, continuedAt)) { notifySlowParseDir (startedAt);
m_model->clear ();
return 0;
}
} }
} }