Clean up merge
This commit is contained in:
parent
9fcf45dca5
commit
4223f114cb
@ -21,6 +21,9 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "dcp.h"
|
||||
@ -2182,8 +2185,7 @@ void DCPStore::init(const Glib::ustring& rt_profile_dir, bool loadAll)
|
||||
&& lastdot <= sname.size() - 4
|
||||
&& !sname.casefold().compare(lastdot, 4, ".dcp")
|
||||
) {
|
||||
const Glib::ustring cam_short_name = sname.substr(0, lastdot).uppercase();
|
||||
file_std_profiles[cam_short_name] = fname; // They will be loaded and cached on demand
|
||||
file_std_profiles[sname.substr(0, lastdot).casefold_collate_key()] = fname; // They will be loaded and cached on demand
|
||||
}
|
||||
} else {
|
||||
// Directory
|
||||
@ -2194,11 +2196,10 @@ void DCPStore::init(const Glib::ustring& rt_profile_dir, bool loadAll)
|
||||
|
||||
for (const auto& alias : getAliases(rt_profile_dir)) {
|
||||
const Glib::ustring alias_name = Glib::ustring(alias.first).uppercase();
|
||||
const Glib::ustring real_name = Glib::ustring(alias.second).uppercase();
|
||||
const std::map<Glib::ustring, Glib::ustring>::const_iterator real = file_std_profiles.find(real_name);
|
||||
const std::map<std::string, Glib::ustring>::const_iterator real = file_std_profiles.find(Glib::ustring(alias.second).casefold_collate_key());
|
||||
|
||||
if (real != file_std_profiles.end()) {
|
||||
file_std_profiles[alias_name] = real->second;
|
||||
file_std_profiles[alias_name.casefold_collate_key()] = real->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2220,19 +2221,19 @@ bool DCPStore::isValidDCPFileName(const Glib::ustring& filename) const
|
||||
|
||||
DCPProfile* DCPStore::getProfile(const Glib::ustring& filename) const
|
||||
{
|
||||
const auto key = filename.casefold_collate_key();
|
||||
MyMutex::MyLock lock(mutex);
|
||||
const std::map<std::string, DCPProfile*>::const_iterator iter = profile_cache.find(key);
|
||||
|
||||
const std::map<Glib::ustring, DCPProfile*>::iterator r = profile_cache.find(filename);
|
||||
|
||||
if (r != profile_cache.end()) {
|
||||
return r->second;
|
||||
if (iter != profile_cache.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
DCPProfile* const res = new DCPProfile(filename);
|
||||
|
||||
if (res->isValid()) {
|
||||
// Add profile
|
||||
profile_cache[filename] = res;
|
||||
profile_cache[key] = res;
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("DCP profile '%s' loaded from disk\n", filename.c_str());
|
||||
}
|
||||
@ -2245,13 +2246,9 @@ DCPProfile* DCPStore::getProfile(const Glib::ustring& filename) const
|
||||
|
||||
DCPProfile* DCPStore::getStdProfile(const Glib::ustring& requested_cam_short_name) const
|
||||
{
|
||||
const Glib::ustring name = requested_cam_short_name.uppercase();
|
||||
|
||||
// Warning: do NOT use map.find(), since it does not seem to work reliably here
|
||||
for (const auto& file_std_profile : file_std_profiles) {
|
||||
if (file_std_profile.first == name) {
|
||||
return getProfile(file_std_profile.second);
|
||||
}
|
||||
const std::map<std::string, Glib::ustring>::const_iterator iter = file_std_profiles.find(requested_cam_short_name.casefold_collate_key());
|
||||
if (iter != file_std_profiles.end()) {
|
||||
return getProfile(iter->second);
|
||||
}
|
||||
|
||||
// profile not found, looking if we're in loadAll=false mode
|
||||
|
@ -170,10 +170,10 @@ private:
|
||||
std::vector<Glib::ustring> profileDir;
|
||||
|
||||
// these contain standard profiles from RT. keys are all in uppercase, file path is value
|
||||
std::map<Glib::ustring, Glib::ustring> file_std_profiles;
|
||||
std::map<std::string, Glib::ustring> file_std_profiles;
|
||||
|
||||
// Maps file name to profile as cache
|
||||
mutable std::map<Glib::ustring, DCPProfile*> profile_cache;
|
||||
mutable std::map<std::string, DCPProfile*> profile_cache;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "imagedata.h"
|
||||
#include "imagesource.h"
|
||||
#include "procparams.h"
|
||||
#include "rt_math.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -35,6 +34,20 @@
|
||||
|
||||
using namespace rtengine;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
const std::string& validateUft8(const std::string& str, const std::string& on_error = "???")
|
||||
{
|
||||
if (Glib::ustring(str).validate()) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return on_error;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
extern const Settings *settings;
|
||||
@ -59,15 +72,6 @@ Exiv2::Image::AutoPtr open_exiv2(const Glib::ustring& fname)
|
||||
|
||||
} // namespace rtengine
|
||||
|
||||
const std::string& validateUft8(const std::string& str, const std::string& on_error = "???")
|
||||
{
|
||||
if (Glib::ustring(str).validate()) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return on_error;
|
||||
}
|
||||
|
||||
FramesMetaData* FramesMetaData::fromFile(const Glib::ustring& fname)
|
||||
{
|
||||
return new FramesData(fname);
|
||||
@ -644,7 +648,7 @@ std::string FramesMetaData::expcompToString(double expcomp, bool maskZeroexpcomp
|
||||
|
||||
double FramesMetaData::shutterFromString(std::string s)
|
||||
{
|
||||
const std::string::size_type i = s.find_first_of ('/');
|
||||
const std::string::size_type i = s.find_first_of('/');
|
||||
|
||||
if (i == std::string::npos) {
|
||||
return std::atof(s.c_str());
|
||||
|
@ -21,18 +21,24 @@
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include "rawimage.h"
|
||||
#include "rtengine.h"
|
||||
#include "imageio.h"
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
class ustring;
|
||||
|
||||
}
|
||||
|
||||
namespace rtengine
|
||||
{
|
||||
|
||||
Exiv2::Image::AutoPtr open_exiv2(const Glib::ustring &fname); // TODO: Global function?
|
||||
|
||||
class FramesData :
|
||||
class FramesData final :
|
||||
public FramesMetaData
|
||||
{
|
||||
private:
|
||||
@ -56,7 +62,7 @@ private:
|
||||
bool isHDR;
|
||||
|
||||
public:
|
||||
FramesData(const Glib::ustring& fname);
|
||||
explicit FramesData(const Glib::ustring& fname);
|
||||
|
||||
void setDCRawFrameCount(unsigned int frameCount);
|
||||
unsigned int getFrameCount() const override;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <libiptcdata/iptc-jpeg.h>
|
||||
#include <memory>
|
||||
#include "rt_math.h"
|
||||
#include "procparams.h"
|
||||
|
@ -5589,7 +5589,7 @@ double ImProcFunctions::getAutoDistor(const Glib::ustring &fname, int thumb_size
|
||||
int w_thumb = -1, h_thumb = thumb_size;
|
||||
|
||||
eSensorType sensorType = rtengine::ST_NONE;
|
||||
Thumbnail* thumb = rtengine::Thumbnail::loadQuickFromRaw (fname, sensorType, w_thumb, h_thumb, 1, FALSE);
|
||||
Thumbnail* thumb = rtengine::Thumbnail::loadQuickFromRaw(fname, sensorType, w_thumb, h_thumb, 1, FALSE);
|
||||
|
||||
if (!thumb) {
|
||||
return 0.0;
|
||||
|
@ -1733,17 +1733,12 @@ private:
|
||||
MetadataInfo info(imgsrc->getFileName());
|
||||
switch (params.metadata.mode) {
|
||||
case MetaDataParams::TUNNEL:
|
||||
// Sending back the whole first root, which won't necessarily be the selected frame number
|
||||
// and may contain subframe depending on initial raw's hierarchy
|
||||
// readyImg->setMetadata (ii->getMetaData()->getRootExifData ());
|
||||
readyImg->setMetadata(std::move(info));
|
||||
break;
|
||||
case MetaDataParams::EDIT:
|
||||
info.setExif(params.exif);
|
||||
info.setIptc(params.iptc);
|
||||
readyImg->setMetadata(std::move(info));
|
||||
// ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy
|
||||
// readyImg->setMetadata (ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc);
|
||||
break;
|
||||
default: // case MetaDataParams::STRIP
|
||||
// nothing to do
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "paramsedited.h"
|
||||
#include "ppversion.h"
|
||||
#include "procparamchangers.h"
|
||||
#include "profilestorecombobox.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "cacheimagedata.h"
|
||||
#include "threadutils.h"
|
||||
#include "thumbnaillistener.h"
|
||||
#include "../rtengine/procparams.h"
|
||||
|
||||
namespace rtengine
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user