Clear from cache - for selected thumbnails (issue 386)
This commit is contained in:
parent
93fa7e25ae
commit
3711a6df5e
@ -55,6 +55,9 @@ FILEBROWSER_AUTODARKFRAME;Auto dark frame
|
|||||||
FILEBROWSER_AUTOFLATFIELD;Auto flat field
|
FILEBROWSER_AUTOFLATFIELD;Auto flat field
|
||||||
FILEBROWSER_BROWSEPATHBUTTONHINT;Click to browse to the chosen path
|
FILEBROWSER_BROWSEPATHBUTTONHINT;Click to browse to the chosen path
|
||||||
FILEBROWSER_BROWSEPATHHINT;Type path to browse (<b>Ctrl-o</b> set focus,<b>Ctrl-Enter</b> to browse in File Browser)
|
FILEBROWSER_BROWSEPATHHINT;Type path to browse (<b>Ctrl-o</b> set focus,<b>Ctrl-Enter</b> to browse in File Browser)
|
||||||
|
FILEBROWSER_CACHE;Cache
|
||||||
|
FILEBROWSER_CACHECLEARFROMPARTIAL;Clear from cache - partial
|
||||||
|
FILEBROWSER_CACHECLEARFROMFULL;Clear from cache - full
|
||||||
FILEBROWSER_CLEARPROFILE;Clear profile
|
FILEBROWSER_CLEARPROFILE;Clear profile
|
||||||
FILEBROWSER_COPYPROFILE;Copy profile
|
FILEBROWSER_COPYPROFILE;Copy profile
|
||||||
FILEBROWSER_CURRENT_NAME;Current name:
|
FILEBROWSER_CURRENT_NAME;Current name:
|
||||||
|
@ -152,6 +152,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
|
|||||||
if (r==openEntries.end() && md5!="") {
|
if (r==openEntries.end() && md5!="") {
|
||||||
safe_g_remove (getCacheFileName ("data", fname, md5) + ".txt");
|
safe_g_remove (getCacheFileName ("data", fname, md5) + ".txt");
|
||||||
safe_g_remove (getCacheFileName ("profiles", fname, md5) + paramFileExtension);
|
safe_g_remove (getCacheFileName ("profiles", fname, md5) + paramFileExtension);
|
||||||
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust16");
|
||||||
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust");
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust");
|
||||||
safe_g_remove (getCacheFileName ("images", fname, md5) + ".jpg");
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".jpg");
|
||||||
safe_g_remove (getCacheFileName ("aehistograms", fname, md5));
|
safe_g_remove (getCacheFileName ("aehistograms", fname, md5));
|
||||||
@ -163,6 +164,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
|
|||||||
if (md5!="") {
|
if (md5!="") {
|
||||||
safe_g_remove (getCacheFileName ("data", fname, md5) + ".txt");
|
safe_g_remove (getCacheFileName ("data", fname, md5) + ".txt");
|
||||||
safe_g_remove (getCacheFileName ("profiles", fname, md5) + paramFileExtension);
|
safe_g_remove (getCacheFileName ("profiles", fname, md5) + paramFileExtension);
|
||||||
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust16");
|
||||||
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust");
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust");
|
||||||
safe_g_remove (getCacheFileName ("images", fname, md5) + ".jpg");
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".jpg");
|
||||||
safe_g_remove (getCacheFileName ("aehistograms", fname, md5));
|
safe_g_remove (getCacheFileName ("aehistograms", fname, md5));
|
||||||
@ -171,6 +173,20 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CacheManager::clearFromCache (const Glib::ustring& fname, bool leavenotrace) {
|
||||||
|
std::string md5 = getMD5 (fname);
|
||||||
|
if (md5!="") {
|
||||||
|
if (leavenotrace){
|
||||||
|
safe_g_remove (getCacheFileName ("data", fname, md5) + ".txt");
|
||||||
|
safe_g_remove (getCacheFileName ("profiles", fname, md5) + paramFileExtension);
|
||||||
|
}
|
||||||
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust16");
|
||||||
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".cust");
|
||||||
|
safe_g_remove (getCacheFileName ("images", fname, md5) + ".jpg");
|
||||||
|
safe_g_remove (getCacheFileName ("aehistograms", fname, md5));
|
||||||
|
safe_g_remove (getCacheFileName ("embprofiles", fname, md5) + ".icc");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CacheManager::renameEntry (const std::string& oldfilename, const std::string& oldmd5, const std::string& newfilename) {
|
void CacheManager::renameEntry (const std::string& oldfilename, const std::string& oldmd5, const std::string& newfilename) {
|
||||||
|
|
||||||
@ -179,6 +195,7 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin
|
|||||||
std::string newmd5 = getMD5 (newfilename);
|
std::string newmd5 = getMD5 (newfilename);
|
||||||
|
|
||||||
safe_g_rename (getCacheFileName ("profiles", oldfilename, oldmd5) + paramFileExtension, (getCacheFileName ("profiles", newfilename, newmd5) + paramFileExtension).c_str());
|
safe_g_rename (getCacheFileName ("profiles", oldfilename, oldmd5) + paramFileExtension, (getCacheFileName ("profiles", newfilename, newmd5) + paramFileExtension).c_str());
|
||||||
|
safe_g_rename (getCacheFileName ("images", oldfilename, oldmd5) + ".cust16", getCacheFileName ("images", newfilename, newmd5) + ".cust16");
|
||||||
safe_g_rename (getCacheFileName ("images", oldfilename, oldmd5) + ".cust", getCacheFileName ("images", newfilename, newmd5) + ".cust");
|
safe_g_rename (getCacheFileName ("images", oldfilename, oldmd5) + ".cust", getCacheFileName ("images", newfilename, newmd5) + ".cust");
|
||||||
safe_g_rename (getCacheFileName ("images", oldfilename, oldmd5) + ".jpg", getCacheFileName ("images", newfilename, newmd5) + ".jpg");
|
safe_g_rename (getCacheFileName ("images", oldfilename, oldmd5) + ".jpg", getCacheFileName ("images", newfilename, newmd5) + ".jpg");
|
||||||
safe_g_rename (getCacheFileName ("aehistograms", oldfilename, oldmd5), getCacheFileName ("aehistograms", newfilename, newmd5));
|
safe_g_rename (getCacheFileName ("aehistograms", oldfilename, oldmd5), getCacheFileName ("aehistograms", newfilename, newmd5));
|
||||||
@ -291,6 +308,7 @@ void CacheManager::applyCacheSizeLimitation () {
|
|||||||
std::sort (flist.begin(), flist.end());
|
std::sort (flist.begin(), flist.end());
|
||||||
while (flist.size() > options.maxCacheEntries) {
|
while (flist.size() > options.maxCacheEntries) {
|
||||||
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "data"), flist.front().fname) + ".txt");
|
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "data"), flist.front().fname) + ".txt");
|
||||||
|
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".cust16");
|
||||||
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".cust");
|
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".cust");
|
||||||
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".jpg");
|
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".jpg");
|
||||||
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "aehistograms"), flist.front().fname));
|
safe_g_remove (Glib::build_filename (Glib::build_filename (baseDir, "aehistograms"), flist.front().fname));
|
||||||
|
@ -59,6 +59,7 @@ class CacheManager {
|
|||||||
void clearAll ();
|
void clearAll ();
|
||||||
void clearThumbImages ();
|
void clearThumbImages ();
|
||||||
void clearProfiles ();
|
void clearProfiles ();
|
||||||
|
void clearFromCache(const Glib::ustring& fname, bool leavenotrace);
|
||||||
|
|
||||||
void applyCacheSizeLimitation ();
|
void applyCacheSizeLimitation ();
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||||
* Copyright (c) 2011 Oliver Duis <www.oliverduis.de>
|
* Copyright (c) 2011 Oliver Duis <www.oliverduis.de>
|
||||||
|
* Copyright (c) 2011 Michael Ezra <www.michaelezra.com>
|
||||||
*
|
*
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,6 +76,8 @@ FileBrowser::FileBrowser ()
|
|||||||
pmenu->attach (*(partpasteprof = new Gtk::MenuItem (M("FILEBROWSER_PARTIALPASTEPROFILE"))), 0, 1, p, p+1); p++;
|
pmenu->attach (*(partpasteprof = new Gtk::MenuItem (M("FILEBROWSER_PARTIALPASTEPROFILE"))), 0, 1, p, p+1); p++;
|
||||||
pmenu->attach (*(applyprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE"))), 0, 1, p, p+1); p++;
|
pmenu->attach (*(applyprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE"))), 0, 1, p, p+1); p++;
|
||||||
pmenu->attach (*(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p+1); p++;
|
pmenu->attach (*(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p+1); p++;
|
||||||
|
pmenu->attach (*(cachemenu = new Gtk::MenuItem (M("FILEBROWSER_CACHE"))), 0, 1, p, p+1); p++;
|
||||||
|
|
||||||
pmenu->show_all ();
|
pmenu->show_all ();
|
||||||
|
|
||||||
pmaccelgroup = Gtk::AccelGroup::create ();
|
pmaccelgroup = Gtk::AccelGroup::create ();
|
||||||
@ -109,7 +112,8 @@ FileBrowser::FileBrowser ()
|
|||||||
pasteprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), pasteprof));
|
pasteprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), pasteprof));
|
||||||
partpasteprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), partpasteprof));
|
partpasteprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), partpasteprof));
|
||||||
applyprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), applyprof));
|
applyprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), applyprof));
|
||||||
clearprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearprof));
|
clearprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearprof));
|
||||||
|
cachemenu->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), cachemenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
|
void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
|
||||||
@ -143,6 +147,16 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
|
|||||||
}
|
}
|
||||||
applyprof->set_submenu (*applmenu);
|
applyprof->set_submenu (*applmenu);
|
||||||
|
|
||||||
|
// build cache sub menu
|
||||||
|
p = 0;
|
||||||
|
Gtk::Menu* cachesubmenu = Gtk::manage (new Gtk::Menu ());
|
||||||
|
cachesubmenu->attach (*(clearFromCache = new Gtk::MenuItem (M("FILEBROWSER_CACHECLEARFROMPARTIAL"))), 0, 1, p, p+1); p++;
|
||||||
|
cachesubmenu->attach (*(clearFromCacheFull = new Gtk::MenuItem (M("FILEBROWSER_CACHECLEARFROMFULL"))), 0, 1, p, p+1); p++;
|
||||||
|
clearFromCache->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearFromCache));
|
||||||
|
clearFromCacheFull->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearFromCacheFull));
|
||||||
|
cachesubmenu->show_all ();
|
||||||
|
cachemenu->set_submenu (*cachesubmenu);
|
||||||
|
|
||||||
pmenu->popup (3, this->eventTime);
|
pmenu->popup (3, this->eventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,6 +416,16 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) {
|
|||||||
mselected[i]->thumbnail->clearProcParams (FILEBROWSER);
|
mselected[i]->thumbnail->clearProcParams (FILEBROWSER);
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
else if (m==clearFromCache) {
|
||||||
|
for (int i=0; i<mselected.size(); i++)
|
||||||
|
tbl->clearFromCacheRequested (mselected, false);
|
||||||
|
//queue_draw ();
|
||||||
|
}
|
||||||
|
else if (m==clearFromCacheFull) {
|
||||||
|
for (int i=0; i<mselected.size(); i++)
|
||||||
|
tbl->clearFromCacheRequested (mselected, true);
|
||||||
|
//queue_draw ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::copyProfile () {
|
void FileBrowser::copyProfile () {
|
||||||
|
@ -36,6 +36,7 @@ class FileBrowserListener {
|
|||||||
virtual void renameRequested (std::vector<FileBrowserEntry*> tbe) {}
|
virtual void renameRequested (std::vector<FileBrowserEntry*> tbe) {}
|
||||||
virtual void deleteRequested (std::vector<FileBrowserEntry*> tbe, bool inclBatchProcessed) {}
|
virtual void deleteRequested (std::vector<FileBrowserEntry*> tbe, bool inclBatchProcessed) {}
|
||||||
virtual void selectionChanged (std::vector<Thumbnail*> tbe) {}
|
virtual void selectionChanged (std::vector<Thumbnail*> tbe) {}
|
||||||
|
virtual void clearFromCacheRequested(std::vector<FileBrowserEntry*> tbe, bool leavenotrace) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileBrowserIdleHelper {
|
struct FileBrowserIdleHelper {
|
||||||
@ -70,6 +71,9 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
|
|||||||
Gtk::MenuItem* partpasteprof;
|
Gtk::MenuItem* partpasteprof;
|
||||||
Gtk::MenuItem* applyprof;
|
Gtk::MenuItem* applyprof;
|
||||||
Gtk::MenuItem* clearprof;
|
Gtk::MenuItem* clearprof;
|
||||||
|
Gtk::MenuItem* cachemenu;
|
||||||
|
Gtk::MenuItem* clearFromCache;
|
||||||
|
Gtk::MenuItem* clearFromCacheFull;
|
||||||
Gtk::Menu* pmenu;
|
Gtk::Menu* pmenu;
|
||||||
Gtk::Menu* profmenu;
|
Gtk::Menu* profmenu;
|
||||||
Glib::RefPtr<Gtk::AccelGroup> pmaccelgroup;
|
Glib::RefPtr<Gtk::AccelGroup> pmaccelgroup;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* This file is part of RawTherapee.
|
* This file is part of RawTherapee.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||||
|
* Copyright (c) 2011 Michael Ezra <www.michaelezra.com>
|
||||||
*
|
*
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -657,6 +658,18 @@ void FileCatalog::renameRequested (std::vector<FileBrowserEntry*> tbe) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileCatalog::clearFromCacheRequested (std::vector<FileBrowserEntry*> tbe, bool leavenotrace) {
|
||||||
|
|
||||||
|
if (tbe.size()==0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<tbe.size(); i++) {
|
||||||
|
Glib::ustring fname = tbe[i]->filename;
|
||||||
|
// remove from cache
|
||||||
|
cacheMgr->clearFromCache (fname,leavenotrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FileCatalog::categoryButtonToggled (Gtk::ToggleButton* b) {
|
void FileCatalog::categoryButtonToggled (Gtk::ToggleButton* b) {
|
||||||
|
|
||||||
//was control key pressed
|
//was control key pressed
|
||||||
|
@ -164,6 +164,7 @@ class FileCatalog : public Gtk::VBox,
|
|||||||
void deleteRequested (std::vector<FileBrowserEntry*> tbe, bool inclBatchProcessed);
|
void deleteRequested (std::vector<FileBrowserEntry*> tbe, bool inclBatchProcessed);
|
||||||
void developRequested (std::vector<FileBrowserEntry*> tbe);
|
void developRequested (std::vector<FileBrowserEntry*> tbe);
|
||||||
void renameRequested (std::vector<FileBrowserEntry*> tbe);
|
void renameRequested (std::vector<FileBrowserEntry*> tbe);
|
||||||
|
void clearFromCacheRequested(std::vector<FileBrowserEntry*> tbe, bool leavenotrace);
|
||||||
void selectionChanged (std::vector<Thumbnail*> tbe);
|
void selectionChanged (std::vector<Thumbnail*> tbe);
|
||||||
void emptyTrash ();
|
void emptyTrash ();
|
||||||
bool trashIsEmpty ();
|
bool trashIsEmpty ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user