Save recent folders in options file, Issue 2790
This commit is contained in:
@@ -899,6 +899,7 @@ PREFERENCES_LEVAUTDN;Denoising level
|
|||||||
PREFERENCES_LEVDN;Cell size
|
PREFERENCES_LEVDN;Cell size
|
||||||
PREFERENCES_LISS;Auto multi-zone smoothing
|
PREFERENCES_LISS;Auto multi-zone smoothing
|
||||||
PREFERENCES_MAX;Maxi (Tile)
|
PREFERENCES_MAX;Maxi (Tile)
|
||||||
|
PREFERENCES_MAXRECENTFOLDERS;Maximum number of recent folders
|
||||||
PREFERENCES_MED;Medium (Tile/2)
|
PREFERENCES_MED;Medium (Tile/2)
|
||||||
PREFERENCES_MENUGROUPEXTPROGS;Group "Open with"
|
PREFERENCES_MENUGROUPEXTPROGS;Group "Open with"
|
||||||
PREFERENCES_MENUGROUPFILEOPERATIONS;Group "File operations"
|
PREFERENCES_MENUGROUPFILEOPERATIONS;Group "File operations"
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ void Options::setDefaults () {
|
|||||||
lastVibranceCurvesDir = "";
|
lastVibranceCurvesDir = "";
|
||||||
lastProfilingReferenceDir = "";
|
lastProfilingReferenceDir = "";
|
||||||
lastBWCurvesDir = "";
|
lastBWCurvesDir = "";
|
||||||
|
maxRecentFolders = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
Options* Options::copyFrom (Options* other) {
|
Options* Options::copyFrom (Options* other) {
|
||||||
@@ -780,6 +780,9 @@ if (keyFile.has_group ("File Browser")) {
|
|||||||
if (keyFile.has_key ("File Browser", "menuGroupFileOperations")) menuGroupFileOperations = keyFile.get_boolean ("File Browser", "menuGroupFileOperations");
|
if (keyFile.has_key ("File Browser", "menuGroupFileOperations")) menuGroupFileOperations = keyFile.get_boolean ("File Browser", "menuGroupFileOperations");
|
||||||
if (keyFile.has_key ("File Browser", "menuGroupProfileOperations")) menuGroupProfileOperations = keyFile.get_boolean ("File Browser", "menuGroupProfileOperations");
|
if (keyFile.has_key ("File Browser", "menuGroupProfileOperations")) menuGroupProfileOperations = keyFile.get_boolean ("File Browser", "menuGroupProfileOperations");
|
||||||
if (keyFile.has_key ("File Browser", "menuGroupExtProg")) menuGroupExtProg = keyFile.get_boolean ("File Browser", "menuGroupExtProg");
|
if (keyFile.has_key ("File Browser", "menuGroupExtProg")) menuGroupExtProg = keyFile.get_boolean ("File Browser", "menuGroupExtProg");
|
||||||
|
if (keyFile.has_key ("File Browser", "MaxRecentFolders")) maxRecentFolders = keyFile.get_integer ("File Browser", "MaxRecentFolders");
|
||||||
|
recentFolders.reserve(maxRecentFolders+10); // reserve some more than maxRecentFolders, because at runtime it stores more than that
|
||||||
|
if (keyFile.has_key ("File Browser", "RecentFolders")) recentFolders = keyFile.get_string_list ("File Browser", "RecentFolders");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyFile.has_group ("Clipping Indication")) {
|
if (keyFile.has_group ("Clipping Indication")) {
|
||||||
@@ -1081,8 +1084,15 @@ int Options::saveToFile (Glib::ustring fname) {
|
|||||||
keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel);
|
keyFile.set_boolean ("File Browser", "menuGroupLabel", menuGroupLabel);
|
||||||
keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations);
|
keyFile.set_boolean ("File Browser", "menuGroupFileOperations", menuGroupFileOperations);
|
||||||
keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations);
|
keyFile.set_boolean ("File Browser", "menuGroupProfileOperations", menuGroupProfileOperations);
|
||||||
keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg);
|
keyFile.set_boolean ("File Browser", "menuGroupExtProg", menuGroupExtProg);
|
||||||
|
keyFile.set_integer ("File Browser", "MaxRecentFolders", maxRecentFolders);
|
||||||
|
{
|
||||||
|
std::vector<Glib::ustring> temp;
|
||||||
|
temp.reserve(maxRecentFolders);
|
||||||
|
for(unsigned int i=0;i<std::min(recentFolders.size(),maxRecentFolders);i++)
|
||||||
|
temp.push_back(recentFolders[i]);
|
||||||
|
keyFile.set_string_list ("File Browser", "RecentFolders", temp);
|
||||||
|
}
|
||||||
keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold);
|
keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold);
|
||||||
keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold);
|
keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold);
|
||||||
keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped);
|
keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped);
|
||||||
|
|||||||
@@ -283,7 +283,11 @@ class Options {
|
|||||||
Glib::ustring lastColorToningCurvesDir;
|
Glib::ustring lastColorToningCurvesDir;
|
||||||
Glib::ustring lastVibranceCurvesDir;
|
Glib::ustring lastVibranceCurvesDir;
|
||||||
Glib::ustring lastProfilingReferenceDir;
|
Glib::ustring lastProfilingReferenceDir;
|
||||||
Glib::ustring lastBWCurvesDir;
|
Glib::ustring lastBWCurvesDir;
|
||||||
|
|
||||||
|
size_t maxRecentFolders; // max. number of recent folders stored in options file
|
||||||
|
std::vector<Glib::ustring> recentFolders; // List containing all recent folders
|
||||||
|
|
||||||
|
|
||||||
Options ();
|
Options ();
|
||||||
|
|
||||||
|
|||||||
@@ -1116,6 +1116,16 @@ Gtk::Widget* Preferences::getFileBrowserPanel () {
|
|||||||
vbro->pack_start (*filmStripOverlayedFileNames, Gtk::PACK_SHRINK, 0);
|
vbro->pack_start (*filmStripOverlayedFileNames, Gtk::PACK_SHRINK, 0);
|
||||||
vbro->pack_start (*sameThumbSize, Gtk::PACK_SHRINK, 0);
|
vbro->pack_start (*sameThumbSize, Gtk::PACK_SHRINK, 0);
|
||||||
vbro->pack_start (*ckbInternalThumbIfUntouched, Gtk::PACK_SHRINK, 0);
|
vbro->pack_start (*ckbInternalThumbIfUntouched, Gtk::PACK_SHRINK, 0);
|
||||||
|
|
||||||
|
Gtk::HBox* hbrecent = Gtk::manage( new Gtk::HBox () );
|
||||||
|
Gtk::Label* labrecent = Gtk::manage( new Gtk::Label (M("PREFERENCES_MAXRECENTFOLDERS")+":") );
|
||||||
|
maxRecentFolders = Gtk::manage( new Gtk::SpinButton () );
|
||||||
|
hbrecent->pack_start (*labrecent, Gtk::PACK_SHRINK, 4);
|
||||||
|
hbrecent->pack_start (*maxRecentFolders, Gtk::PACK_SHRINK, 4);
|
||||||
|
maxRecentFolders->set_digits (0);
|
||||||
|
maxRecentFolders->set_increments (1, 5);
|
||||||
|
maxRecentFolders->set_range (1, 25);
|
||||||
|
vbro->pack_start (*hbrecent, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
fro->add (*vbro);
|
fro->add (*vbro);
|
||||||
|
|
||||||
@@ -1411,7 +1421,8 @@ void Preferences::storePreferences () {
|
|||||||
moptions.parseExtensions.push_back (c[i][extensionColumns.ext]);
|
moptions.parseExtensions.push_back (c[i][extensionColumns.ext]);
|
||||||
moptions.parseExtensionsEnabled.push_back (c[i][extensionColumns.enabled]);
|
moptions.parseExtensionsEnabled.push_back (c[i][extensionColumns.enabled]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moptions.maxRecentFolders = (int)maxRecentFolders->get_value();
|
||||||
moptions.maxThumbnailHeight = (int)maxThumbSize->get_value ();
|
moptions.maxThumbnailHeight = (int)maxThumbSize->get_value ();
|
||||||
moptions.maxCacheEntries = (int)maxCacheEntries->get_value ();
|
moptions.maxCacheEntries = (int)maxCacheEntries->get_value ();
|
||||||
moptions.overlayedFileNames = overlayedFileNames->get_active ();
|
moptions.overlayedFileNames = overlayedFileNames->get_active ();
|
||||||
@@ -1574,7 +1585,8 @@ void Preferences::fillPreferences () {
|
|||||||
row[extensionColumns.ext] = moptions.parseExtensions[i];
|
row[extensionColumns.ext] = moptions.parseExtensions[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
maxThumbSize->set_value (moptions.maxThumbnailHeight);
|
maxThumbSize->set_value (moptions.maxThumbnailHeight);
|
||||||
|
maxRecentFolders->set_value(moptions.maxRecentFolders);
|
||||||
maxCacheEntries->set_value (moptions.maxCacheEntries);
|
maxCacheEntries->set_value (moptions.maxCacheEntries);
|
||||||
overlayedFileNames->set_active (moptions.overlayedFileNames);
|
overlayedFileNames->set_active (moptions.overlayedFileNames);
|
||||||
filmStripOverlayedFileNames->set_active(moptions.filmStripOverlayedFileNames);
|
filmStripOverlayedFileNames->set_active(moptions.filmStripOverlayedFileNames);
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener {
|
|||||||
Gtk::ColorButton* butNavGuideCol;
|
Gtk::ColorButton* butNavGuideCol;
|
||||||
|
|
||||||
Gtk::SpinButton* maxThumbSize;
|
Gtk::SpinButton* maxThumbSize;
|
||||||
Gtk::SpinButton* maxCacheEntries;
|
Gtk::SpinButton* maxCacheEntries;
|
||||||
|
Gtk::SpinButton* maxRecentFolders;
|
||||||
Gtk::Button* clearThumbnails;
|
Gtk::Button* clearThumbnails;
|
||||||
Gtk::Button* clearProfiles;
|
Gtk::Button* clearProfiles;
|
||||||
Gtk::Button* clearAll;
|
Gtk::Button* clearAll;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "recentbrowser.h"
|
#include "recentbrowser.h"
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
@@ -27,6 +28,9 @@ RecentBrowser::RecentBrowser () : listener (NULL) {
|
|||||||
|
|
||||||
Gtk::Frame* frame = Gtk::manage (new Gtk::Frame (M("MAIN_FRAME_RECENT")));
|
Gtk::Frame* frame = Gtk::manage (new Gtk::Frame (M("MAIN_FRAME_RECENT")));
|
||||||
frame->add (*recentDirs);
|
frame->add (*recentDirs);
|
||||||
|
for(size_t i=0;i<options.recentFolders.size();i++) {
|
||||||
|
recentDirs->append_text (options.recentFolders[i]);
|
||||||
|
}
|
||||||
|
|
||||||
pack_start (*frame, Gtk::PACK_SHRINK, 4);
|
pack_start (*frame, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
@@ -43,6 +47,24 @@ void RecentBrowser::selectionChanged () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile) {
|
void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile) {
|
||||||
|
|
||||||
|
size_t numFolders = options.recentFolders.size();
|
||||||
|
if(numFolders>0) { // search entry and move to top if it exists
|
||||||
|
size_t i;
|
||||||
|
for(i=0;i<numFolders;i++) {
|
||||||
|
if(options.recentFolders[i] == dirname) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i>0) {
|
||||||
|
if(i<numFolders) {
|
||||||
|
options.recentFolders.erase(options.recentFolders.begin()+i);
|
||||||
|
}
|
||||||
|
options.recentFolders.insert(options.recentFolders.begin(),dirname);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.recentFolders.insert(options.recentFolders.begin(),dirname);
|
||||||
|
}
|
||||||
|
|
||||||
conn.block (true);
|
conn.block (true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user