added option 'InspectorDelay' to delay generation of inspector previews

This commit is contained in:
Alberto Griggio
2018-02-09 22:20:55 +01:00
parent d17bb0cfe6
commit 91f14e0146
4 changed files with 31 additions and 1 deletions

View File

@@ -210,6 +210,23 @@ void Inspector::switchImage (const Glib::ustring &fullPath)
return;
}
if (delayconn.connected()) {
delayconn.disconnect();
}
next_image_path = fullPath;
if (!options.inspectorDelay) {
doSwitchImage();
} else {
delayconn = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Inspector::doSwitchImage), options.inspectorDelay);
}
}
bool Inspector::doSwitchImage()
{
Glib::ustring fullPath = next_image_path;
// we first check the size of the list, it may have been changed in Preference
if (images.size() > size_t(options.maxInspectorBuffers)) {
// deleting the last entries
@@ -225,7 +242,6 @@ void Inspector::switchImage (const Glib::ustring &fullPath)
if (fullPath.empty()) {
currImage = nullptr;
queue_draw();
return;
} else {
bool found = false;
@@ -264,6 +280,8 @@ void Inspector::switchImage (const Glib::ustring &fullPath)
}
}
}
return true;
}
void Inspector::deleteBuffers ()

View File

@@ -48,9 +48,14 @@ private:
double zoom;
bool active;
sigc::connection delayconn;
Glib::ustring next_image_path;
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
void deleteBuffers();
bool doSwitchImage();
public:
Inspector();
~Inspector();

View File

@@ -426,6 +426,7 @@ void Options::setDefaults ()
#endif
filledProfile = false;
maxInspectorBuffers = 2; // a rather conservative value for low specced systems...
inspectorDelay = 0;
serializeTiffRead = true;
FileBrowserToolbarSingleRow = false;
@@ -1056,6 +1057,10 @@ void Options::readFromFile (Glib::ustring fname)
maxInspectorBuffers = keyFile.get_integer ("Performance", "MaxInspectorBuffers");
}
if (keyFile.has_key ("Performance", "InspectorDelay")) {
inspectorDelay = keyFile.get_integer("Performance", "InspectorDelay");
}
if (keyFile.has_key ("Performance", "PreviewDemosaicFromSidecar")) {
prevdemo = (prevdemo_t)keyFile.get_integer ("Performance", "PreviewDemosaicFromSidecar");
}
@@ -1847,6 +1852,7 @@ void Options::saveToFile (Glib::ustring fname)
keyFile.set_integer ("Performance", "SIMPLNRAUT", rtSettings.leveldnautsimpl);
keyFile.set_integer ("Performance", "ClutCacheSize", clutCacheSize);
keyFile.set_integer ("Performance", "MaxInspectorBuffers", maxInspectorBuffers);
keyFile.set_integer ("Performance", "InspectorDelay", inspectorDelay);
keyFile.set_integer ("Performance", "PreviewDemosaicFromSidecar", prevdemo);
keyFile.set_boolean ("Performance", "Daubechies", rtSettings.daubech);
keyFile.set_boolean ("Performance", "SerializeTiffRead", serializeTiffRead);

View File

@@ -275,6 +275,7 @@ public:
Glib::ustring clutsDir;
int rgbDenoiseThreadLimit; // maximum number of threads for the denoising tool ; 0 = use the maximum available
int maxInspectorBuffers; // maximum number of buffers (i.e. images) for the Inspector feature
int inspectorDelay;
int clutCacheSize;
bool filledProfile; // Used as reminder for the ProfilePanel "mode"
prevdemo_t prevdemo; // Demosaicing method used for the <100% preview