Merge branch 'dev' into metadata-exiv2

- Rating (#5325) not yet implemented
This commit is contained in:
Flössie
2019-09-24 14:30:54 +02:00
539 changed files with 7707 additions and 5098 deletions

View File

@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#include <cstdio>
#include <cstdlib>
@@ -182,9 +182,9 @@ void Thumbnail::_generateThumbnailImage ()
imgRatio = -1.;
// generate thumbnail image
Glib::ustring ext = getExtension (fname);
const std::string ext = getExtension(fname).lowercase();
if (ext == "") {
if (ext.empty()) {
return;
}
@@ -192,20 +192,20 @@ void Thumbnail::_generateThumbnailImage ()
cfs.exifValid = false;
cfs.timeValid = false;
if (ext.lowercase() == "jpg" || ext.lowercase() == "jpeg") {
if (ext == "jpg" || ext == "jpeg") {
infoFromImage (fname);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal);
if (tpp) {
cfs.format = FT_Jpeg;
}
} else if (ext.lowercase() == "png") {
} else if (ext == "png") {
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal);
if (tpp) {
cfs.format = FT_Png;
}
} else if (ext.lowercase() == "tif" || ext.lowercase() == "tiff") {
} else if (ext == "tif" || ext == "tiff") {
infoFromImage (fname);
tpp = rtengine::Thumbnail::loadFromImage (fname, tw, th, 1, pparams->wb.equal);
@@ -295,9 +295,6 @@ const ProcParams& Thumbnail::getProcParamsU ()
*/
rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool force, bool flaggingMode)
{
static int index = 0; // Will act as unique identifier during the session
// try to load the last saved parameters from the cache or from the paramfile file
ProcParams* ldprof = nullptr;
@@ -306,7 +303,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
const CacheImageData* cfs = getCacheImageData();
Glib::ustring defaultPparamsPath = options.findProfilePath(defProf);
const bool create = (!hasProcParams() || force);
const bool run_cpb = false;
const bool run_cpb = !options.CPBPath.empty() && !defaultPparamsPath.empty() && cfs && cfs->exifValid && create;
const Glib::ustring outFName =
(options.paramsLoadLocation == PLL_Input && options.saveParamsFile) ?
@@ -315,12 +312,12 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
if (!run_cpb) {
if (defProf == DEFPROFILE_DYNAMIC && create && cfs && cfs->exifValid) {
const auto pp_deleter =
[](PartialProfile* pp)
{
pp->deleteInstance();
delete pp;
};
const auto pp_deleter =
[](PartialProfile* pp)
{
pp->deleteInstance();
delete pp;
};
const std::unique_ptr<const rtengine::FramesMetaData> imageMetaData(rtengine::FramesMetaData::fromFile(fname));
const std::unique_ptr<PartialProfile, decltype(pp_deleter)> pp(
imageMetaData
@@ -339,6 +336,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
}
} else {
// First generate the communication file, with general values and EXIF metadata
static int index = 0; // Will act as unique identifier during the session
Glib::ustring tmpFileName( Glib::build_filename(options.cacheBaseDir, Glib::ustring::compose("CPB_temp_%1.txt", index++)) );
CPBDump(tmpFileName, fname, outFName,
@@ -446,6 +444,7 @@ void Thumbnail::clearProcParams (int whoClearedIt)
// and restore rank and inTrash
setRank(rank);
pparamsValid = cfs.rating != rank;
setColorLabel(colorlabel);
setStage(inTrash);
@@ -520,6 +519,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh
|| pparams->filmSimulation != pp.filmSimulation
|| pparams->softlight != pp.softlight
|| pparams->dehaze != pp.dehaze
|| pparams->filmNegative != pp.filmNegative
|| whoChangedIt == FILEBROWSER
|| whoChangedIt == BATCHEDITOR;
@@ -763,7 +763,7 @@ void Thumbnail::generateExifDateTimeStrings ()
exifString = Glib::ustring::compose ("f/%1 %2s %3%4 %5mm", Glib::ustring(rtengine::FramesData::apertureToString(cfs.fnumber)), Glib::ustring(rtengine::FramesData::shutterToString(cfs.shutter)), M("QINFO_ISO"), cfs.iso, Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2), cfs.focalLen));
if (options.fbShowExpComp && cfs.expcomp != "0.00" && cfs.expcomp != "") { // don't show exposure compensation if it is 0.00EV;old cache iles do not have ExpComp, so value will not be displayed.
if (options.fbShowExpComp && cfs.expcomp != "0.00" && !cfs.expcomp.empty()) { // don't show exposure compensation if it is 0.00EV;old cache files do not have ExpComp, so value will not be displayed.
exifString = Glib::ustring::compose ("%1 %2EV", exifString, cfs.expcomp); // append exposure compensation to exifString
}
@@ -860,6 +860,7 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname)
cfs.lens = idata->getLens();
cfs.camMake = idata->getMake();
cfs.camModel = idata->getModel();
cfs.rating = idata->getRating();
if (idata->getOrientation() == "Rotate 90 CW") {
deg = 90;
@@ -1052,15 +1053,20 @@ void Thumbnail::setFileName (const Glib::ustring &fn)
int Thumbnail::getRank () const
{
return pparams->rank;
// prefer the user-set rank over the embedded Rating
// pparams->rank == -1 means that there is no saved rank yet, so we should
// next look for the embedded Rating metadata.
if (pparams->rank != -1) {
return pparams->rank;
} else {
return cfs.rating;
}
}
void Thumbnail::setRank (int rank)
{
if (pparams->rank != rank) {
pparams->rank = rank;
pparamsValid = true;
}
pparams->rank = rank;
pparamsValid = true;
}
int Thumbnail::getColorLabel () const