Remove hard-wired ".pp2" strings to make transition to ".pp3" easier

This commit is contained in:
gabor 2010-05-20 17:37:32 +02:00
parent c5a72d2d84
commit c427279ce3
10 changed files with 36 additions and 34 deletions

View File

@ -204,7 +204,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
err = img->saveAsJPEG (fname, saveFormat.jpegQuality); err = img->saveAsJPEG (fname, saveFormat.jpegQuality);
img->free (); img->free ();
if (!err && saveFormat.saveParams) if (!err && saveFormat.saveParams)
processing->params.save (removeExtension(fname) + ".pp2"); processing->params.save (removeExtension(fname) + paramFileExtension);
if (processing->thumbnail) { if (processing->thumbnail) {
processing->thumbnail->imageDeveloped (); processing->thumbnail->imageDeveloped ();
processing->thumbnail->imageRemovedFromQueue (); processing->thumbnail->imageRemovedFromQueue ();

View File

@ -103,7 +103,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
r = openEntries.find (fname); r = openEntries.find (fname);
if (r==openEntries.end() && md5!="") { if (r==openEntries.end() && md5!="") {
::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str()); ::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str());
::g_remove ((getCacheFileName ("profiles", fname, md5) + ".pp2").c_str()); ::g_remove ((getCacheFileName ("profiles", fname, md5) + paramFileExtension).c_str());
::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str()); ::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str());
::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str()); ::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str());
::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str()); ::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str());
@ -114,7 +114,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
std::string md5 = getMD5 (fname); std::string md5 = getMD5 (fname);
if (md5!="") { if (md5!="") {
::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str()); ::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str());
::g_remove ((getCacheFileName ("profiles", fname, md5) + ".pp2").c_str()); ::g_remove ((getCacheFileName ("profiles", fname, md5) + paramFileExtension).c_str());
::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str()); ::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str());
::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str()); ::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str());
::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str()); ::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str());
@ -128,7 +128,7 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin
std::string newmd5 = getMD5 (newfilename); std::string newmd5 = getMD5 (newfilename);
::g_rename ((getCacheFileName ("profiles", oldfilename, oldmd5) + ".pp2").c_str(), (getCacheFileName ("profiles", newfilename, newmd5) + ".pp2").c_str()); ::g_rename ((getCacheFileName ("profiles", oldfilename, oldmd5) + paramFileExtension).c_str(), (getCacheFileName ("profiles", newfilename, newmd5) + paramFileExtension).c_str());
::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".cust").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".cust").c_str()); ::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".cust").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".cust").c_str());
::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".jpg").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".jpg").c_str()); ::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".jpg").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".jpg").c_str());
::g_rename ((getCacheFileName ("aehistograms", oldfilename, oldmd5)).c_str(), (getCacheFileName ("aehistograms", newfilename, newmd5)).c_str()); ::g_rename ((getCacheFileName ("aehistograms", oldfilename, oldmd5)).c_str(), (getCacheFileName ("aehistograms", newfilename, newmd5)).c_str());
@ -245,7 +245,7 @@ void CacheManager::applyCacheSizeLimitation () {
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".jpg").c_str()); ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".jpg").c_str());
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "aehistograms"), flist.front().fname)).c_str()); ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "aehistograms"), flist.front().fname)).c_str());
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "embprofiles"), flist.front().fname) + ".icc").c_str()); ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "embprofiles"), flist.front().fname) + ".icc").c_str());
// ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "profiles"), flist.front().fname) + ".pp2").c_str()); // ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "profiles"), flist.front().fname) + paramFileExtension).c_str());
flist.erase (flist.begin()); flist.erase (flist.begin());
} }
} }

View File

@ -275,7 +275,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
navigator->previewWindow->setPreviewHandler (previewHandler); navigator->previewWindow->setPreviewHandler (previewHandler);
navigator->previewWindow->setImageArea (iarea->imageArea); navigator->previewWindow->setImageArea (iarea->imageArea);
// try to load the last saved parameters from the cache or from the pp2 file // try to load the last saved parameters from the cache or from the paramfile file
ProcParams* ldprof = NULL; ProcParams* ldprof = NULL;
if (openThm->hasProcParams()) { if (openThm->hasProcParams()) {
ldprof = new ProcParams (); ldprof = new ProcParams ();
@ -315,7 +315,7 @@ void EditorPanel::saveProfile () {
ipc->getParams (&params); ipc->getParams (&params);
if (options.saveParamsFile) if (options.saveParamsFile)
params.save (openThm->getFileName() + ".pp2"); params.save (openThm->getFileName() + paramFileExtension);
if (openThm && options.saveParamsCache) if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR); openThm->setProcParams (params, EDITOR);
} }
@ -570,7 +570,7 @@ bool EditorPanel::idle_imageSaved(ProgressConnector<int> *pc,rtengine::IImage16*
if (sf.saveParams) { if (sf.saveParams) {
rtengine::procparams::ProcParams pparams; rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams); ipc->getParams (&pparams);
pparams.save (removeExtension (fname) + ".out.pp2"); pparams.save (removeExtension (fname) + ".out" + paramFileExtension);
} }
}else{ }else{
Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": Error during image saving\n</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": Error during image saving\n</b>";

View File

@ -468,9 +468,9 @@ void FileCatalog::deleteRequested (std::vector<FileBrowserEntry*> tbe) {
cacheMgr.deleteEntry (fname); cacheMgr.deleteEntry (fname);
// delete from file system // delete from file system
::g_remove (fname.c_str()); ::g_remove (fname.c_str());
// delete .pp2 if found // delete paramfile if found
::g_remove (Glib::ustring(fname+".pp2").c_str()); ::g_remove (Glib::ustring(fname+paramFileExtension).c_str());
::g_remove (Glib::ustring(removeExtension(fname)+".pp2").c_str()); ::g_remove (Glib::ustring(removeExtension(fname)+paramFileExtension).c_str());
// delete .thm file // delete .thm file
::g_remove (Glib::ustring(removeExtension(fname)+".thm").c_str()); ::g_remove (Glib::ustring(removeExtension(fname)+".thm").c_str());
::g_remove (Glib::ustring(removeExtension(fname)+".THM").c_str()); ::g_remove (Glib::ustring(removeExtension(fname)+".THM").c_str());

View File

@ -26,7 +26,8 @@
#include <addsetids.h> #include <addsetids.h>
Options options; Options options;
Glib::ustring versionString = "v3.0 alpha 1"; Glib::ustring versionString = "v3.0 alpha 1";
Glib::ustring paramFileExtension = ".pp2";
Options::Options () { Options::Options () {

View File

@ -140,5 +140,6 @@ extern Options options;
extern Glib::ustring argv0; extern Glib::ustring argv0;
extern Glib::ustring argv1; extern Glib::ustring argv1;
extern Glib::ustring versionString; extern Glib::ustring versionString;
extern Glib::ustring paramFileExtension;
#endif #endif

View File

@ -293,8 +293,8 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
std::vector<Glib::ustring> pnames; std::vector<Glib::ustring> pnames;
if (options.multiUser) if (options.multiUser)
parseDir (Options::rtdir + "/" + options.profilePath, pnames, ".pp2"); parseDir (Options::rtdir + "/" + options.profilePath, pnames, paramFileExtension);
parseDir (argv0 + "/" + options.profilePath, pnames, ".pp2"); parseDir (argv0 + "/" + options.profilePath, pnames, paramFileExtension);
for (int i=0; i<pnames.size(); i++) { for (int i=0; i<pnames.size(); i++) {
rprofiles->append_text (pnames[i]); rprofiles->append_text (pnames[i]);
iprofiles->append_text (pnames[i]); iprofiles->append_text (pnames[i]);

View File

@ -126,7 +126,7 @@ void ProfilePanel::save_clicked () {
Gtk::FileFilter filter_pp; Gtk::FileFilter filter_pp;
filter_pp.set_name(M("PROFILEPANEL_FILEDLGFILTERPP")); filter_pp.set_name(M("PROFILEPANEL_FILEDLGFILTERPP"));
filter_pp.add_pattern("*.pp2"); filter_pp.add_pattern("*"+paramFileExtension);
dialog.add_filter(filter_pp); dialog.add_filter(filter_pp);
Gtk::FileFilter filter_any; Gtk::FileFilter filter_any;
@ -156,7 +156,7 @@ void ProfilePanel::save_clicked () {
hasext = false; hasext = false;
if (!hasext) if (!hasext)
fname = fname + ".pp2"; fname = fname + paramFileExtension;
if (Glib::file_test (fname, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (fname, Glib::FILE_TEST_EXISTS)) {
Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": " + M("MAIN_MSG_ALREADYEXISTS") + "\n" + M("MAIN_MSG_QOVERWRITE") + "</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": " + M("MAIN_MSG_ALREADYEXISTS") + "\n" + M("MAIN_MSG_QOVERWRITE") + "</b>";
@ -215,7 +215,7 @@ void ProfilePanel::load_clicked () {
Gtk::FileFilter filter_pp; Gtk::FileFilter filter_pp;
filter_pp.set_name(M("PROFILEPANEL_FILEDLGFILTERPP")); filter_pp.set_name(M("PROFILEPANEL_FILEDLGFILTERPP"));
filter_pp.add_pattern("*.pp2"); filter_pp.add_pattern("*"+paramFileExtension);
dialog.add_filter(filter_pp); dialog.add_filter(filter_pp);
Gtk::FileFilter filter_any; Gtk::FileFilter filter_any;

View File

@ -63,7 +63,7 @@ void ProfileStore::parseDir (const Glib::ustring& pdir) {
// ignore directories // ignore directories
if (!Glib::file_test (fname, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (fname, Glib::FILE_TEST_IS_DIR)) {
int lastdot = sname.find_last_of ('.'); int lastdot = sname.find_last_of ('.');
if (lastdot!=Glib::ustring::npos && lastdot<=sname.size()-4 && !sname.casefold().compare (lastdot, 4, ".pp2")) { if (lastdot!=Glib::ustring::npos && lastdot<=sname.size()-4 && !sname.casefold().compare (lastdot, 4, paramFileExtension)) {
printf ("Processing file %s...\n", fname.c_str()); printf ("Processing file %s...\n", fname.c_str());
Glib::ustring name = sname.substr(0,lastdot); Glib::ustring name = sname.substr(0,lastdot);
if (pparams.find(name)!=pparams.end()) { if (pparams.find(name)!=pparams.end()) {

View File

@ -145,18 +145,18 @@ void Thumbnail::loadProcParams () {
pparamsValid = false; pparamsValid = false;
if (options.paramsLoadLocation==PLL_Input) { if (options.paramsLoadLocation==PLL_Input) {
// try to load it from pp2 file next to the image file // try to load it from params file next to the image file
int ppres = pparams.load (fname + ".pp2"); int ppres = pparams.load (fname + paramFileExtension);
pparamsValid = !ppres && pparams.version>=220; pparamsValid = !ppres && pparams.version>=220;
if (!pparamsValid) if (!pparamsValid)
pparamsValid = !pparams.load (getCacheFileName ("profiles")+".pp2"); pparamsValid = !pparams.load (getCacheFileName ("profiles")+paramFileExtension);
} }
else { else {
// try to load it from cache // try to load it from cache
pparamsValid = !pparams.load (getCacheFileName ("profiles")+".pp2"); pparamsValid = !pparams.load (getCacheFileName ("profiles")+paramFileExtension);
// if no success, load it from pp2 file next to the image file // if no success, load it from params file next to the image file
if (!pparamsValid) { if (!pparamsValid) {
int ppres = pparams.load (fname + ".pp2"); int ppres = pparams.load (fname + paramFileExtension);
pparamsValid = !ppres && pparams.version>=220; pparamsValid = !ppres && pparams.version>=220;
} }
} }
@ -167,16 +167,16 @@ void Thumbnail::clearProcParams (int whoClearedIt) {
cfs.recentlySaved = false; cfs.recentlySaved = false;
pparamsValid = false; pparamsValid = false;
needsReProcessing = true; needsReProcessing = true;
// remove pp2 file from cache // remove param file from cache
Glib::ustring fname_ = getCacheFileName ("profiles")+".pp2"; Glib::ustring fname_ = getCacheFileName ("profiles")+paramFileExtension;
if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS)) if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS))
::g_remove (fname_.c_str()); ::g_remove (fname_.c_str());
// remove pp2 file located next to the file // remove param file located next to the file
// fname_ = removeExtension(fname) + ".pp2"; // fname_ = removeExtension(fname) + paramFileExtension;
fname_ = fname + ".pp2"; fname_ = fname + paramFileExtension;
if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS)) if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS))
::g_remove (fname_.c_str()); ::g_remove (fname_.c_str());
fname_ = removeExtension(fname) + ".pp2"; fname_ = removeExtension(fname) + paramFileExtension;
if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS)) if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS))
::g_remove (fname_.c_str()); ::g_remove (fname_.c_str());
@ -213,7 +213,7 @@ void Thumbnail::imageDeveloped () {
cfs.recentlySaved = true; cfs.recentlySaved = true;
cfs.save (getCacheFileName ("data")+".txt"); cfs.save (getCacheFileName ("data")+".txt");
pparams.save (getCacheFileName ("profiles")+".pp2"); pparams.save (getCacheFileName ("profiles")+paramFileExtension);
} }
void Thumbnail::imageEnqueued () { void Thumbnail::imageEnqueued () {
@ -410,10 +410,10 @@ void Thumbnail::updateCache () {
if (pparamsValid) { if (pparamsValid) {
if (options.saveParamsCache) if (options.saveParamsCache)
pparams.save (getCacheFileName ("profiles")+".pp2"); pparams.save (getCacheFileName ("profiles")+paramFileExtension);
if (options.saveParamsFile) if (options.saveParamsFile)
// pparams.save (removeExtension(fname) + ".pp2"); // pparams.save (removeExtension(fname) + paramFileExtension);
pparams.save (fname + ".pp2"); pparams.save (fname + paramFileExtension);
} }
cfs.save (getCacheFileName ("data")+".txt"); cfs.save (getCacheFileName ("data")+".txt");
} }