code style cleanups (after floessie's feedback)

This commit is contained in:
Alberto Griggio
2017-03-06 09:00:13 +01:00
parent f7f4575c54
commit a1a042e9ea
3 changed files with 28 additions and 20 deletions

View File

@@ -20,13 +20,14 @@
#include "options.h" #include "options.h"
#include "toolpanel.h" #include "toolpanel.h"
#include "guiutils.h" #include "guiutils.h"
#include "dynamicprofile.h"
ProfileStore profileStore; ProfileStore profileStore;
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
ProfileStore::ProfileStore () : parseMutex(nullptr), storeState(STORESTATE_NOTINITIALIZED), internalDefaultProfile(nullptr), internalDefaultEntry(nullptr), internalDynamicEntry(nullptr) ProfileStore::ProfileStore () : parseMutex(nullptr), storeState(STORESTATE_NOTINITIALIZED), internalDefaultProfile(nullptr), internalDefaultEntry(nullptr), internalDynamicEntry(nullptr), dynamicRules(new std::vector<DynamicProfileRule>())
{ {
internalDefaultProfile = new AutoPartialProfile(); internalDefaultProfile = new AutoPartialProfile();
internalDefaultProfile->set(true); internalDefaultProfile->set(true);
@@ -42,7 +43,7 @@ bool ProfileStore::init ()
storeState = STORESTATE_BEINGINITIALIZED; storeState = STORESTATE_BEINGINITIALIZED;
parseMutex = new MyMutex(); parseMutex = new MyMutex();
_parseProfiles (); _parseProfiles ();
loadDynamicProfileRules(dynamicRules); loadDynamicProfileRules(*dynamicRules);
storeState = STORESTATE_INITIALIZED; storeState = STORESTATE_INITIALIZED;
} }
@@ -506,6 +507,20 @@ void ProfileStore::dumpFolderList()
printf("\n"); printf("\n");
} }
const std::vector<DynamicProfileRule> &ProfileStore::getDynamicProfileRules() const
{
return *dynamicRules;
}
void ProfileStore::setDynamicProfileRules(const std::vector<DynamicProfileRule> &r)
{
*dynamicRules = r;
}
ProfileStoreEntry::ProfileStoreEntry() : label(""), type(PSET_FOLDER), parentFolderId(0), folderId(0) {} ProfileStoreEntry::ProfileStoreEntry() : label(""), type(PSET_FOLDER), parentFolderId(0), folderId(0) {}
ProfileStoreEntry::ProfileStoreEntry(Glib::ustring label, PSEType type, unsigned short parentFolder, unsigned short folder) : label(label), type(type), parentFolderId(parentFolder), folderId(folder) {} ProfileStoreEntry::ProfileStoreEntry(Glib::ustring label, PSEType type, unsigned short parentFolder, unsigned short folder) : label(label), type(type), parentFolderId(parentFolder), folderId(folder) {}

View File

@@ -29,9 +29,11 @@
#include "threadutils.h" #include "threadutils.h"
#include "paramsedited.h" #include "paramsedited.h"
#include "guiutils.h" #include "guiutils.h"
#include "dynamicprofile.h"
// forward decl
class DynamicProfileRule;
/** @brief This will implement callback functions for the ProfileStore /** @brief This will implement callback functions for the ProfileStore
* *
*/ */
@@ -163,7 +165,7 @@ private:
std::list<ProfileStoreListener*> listeners; std::list<ProfileStoreListener*> listeners;
/** cache for dynamic profile rules */ /** cache for dynamic profile rules */
std::vector<DynamicProfileRule> dynamicRules; std::unique_ptr<std::vector<DynamicProfileRule>> dynamicRules;
/** @brief Method to recursively parse a profile folder with a level depth arbitrarily limited to 3 /** @brief Method to recursively parse a profile folder with a level depth arbitrarily limited to 3
* *
@@ -208,15 +210,8 @@ public:
return internalDynamicEntry; return internalDynamicEntry;
} }
const std::vector<DynamicProfileRule> &getDynamicProfileRules() const const std::vector<DynamicProfileRule> &getDynamicProfileRules() const;
{ void setDynamicProfileRules(const std::vector<DynamicProfileRule> &r);
return dynamicRules;
}
void setDynamicProfileRules(const std::vector<DynamicProfileRule> &r)
{
dynamicRules = r;
}
void addListener(ProfileStoreListener *listener); void addListener(ProfileStoreListener *listener);
void removeListener(ProfileStoreListener *listener); void removeListener(ProfileStoreListener *listener);

View File

@@ -217,14 +217,12 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
const CacheImageData* cfs = getCacheImageData(); const CacheImageData* cfs = getCacheImageData();
Glib::ustring defaultPparamsPath = options.findProfilePath(defProf); Glib::ustring defaultPparamsPath = options.findProfilePath(defProf);
bool create = (!hasProcParams() || forceCPB); const bool create = (!hasProcParams() || forceCPB);
Glib::ustring outFName; const Glib::ustring outFName =
if (options.paramsLoadLocation == PLL_Input) { (options.paramsLoadLocation == PLL_Input) ?
outFName = fname + paramFileExtension; fname + paramFileExtension :
} else { getCacheFileName("profiles", paramFileExtension);
outFName = getCacheFileName("profiles", paramFileExtension);
}
if (defProf == DEFPROFILE_DYNAMIC && create && cfs && cfs->exifValid) { if (defProf == DEFPROFILE_DYNAMIC && create && cfs && cfs->exifValid) {
rtengine::ImageMetaData* imageMetaData; rtengine::ImageMetaData* imageMetaData;