Saving a profile only took effect after RT restart (#3869)
This commit is contained in:
@@ -46,7 +46,7 @@ bool ProfileStore::init (bool loadAll)
|
|||||||
|
|
||||||
this->loadAll = loadAll;
|
this->loadAll = loadAll;
|
||||||
|
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED && loadAll) {
|
if ((storeState == STORESTATE_NOTINITIALIZED || storeState == STORESTATE_DIRTY) && loadAll) {
|
||||||
storeState = STORESTATE_BEINGINITIALIZED;
|
storeState = STORESTATE_BEINGINITIALIZED;
|
||||||
_parseProfiles ();
|
_parseProfiles ();
|
||||||
storeState = STORESTATE_INITIALIZED;
|
storeState = STORESTATE_INITIALIZED;
|
||||||
@@ -85,7 +85,7 @@ ProfileStore::~ProfileStore ()
|
|||||||
* This method will scan the directory tree again and update the profile list. When finished,
|
* This method will scan the directory tree again and update the profile list. When finished,
|
||||||
* the listeners will be called in order to update with the new list
|
* the listeners will be called in order to update with the new list
|
||||||
*/
|
*/
|
||||||
void ProfileStore::parseProfiles ()
|
void ProfileStore::parseProfilesOnce ()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (auto listener : listeners) {
|
for (auto listener : listeners) {
|
||||||
@@ -100,6 +100,13 @@ void ProfileStore::parseProfiles ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileStore::parseProfiles ()
|
||||||
|
{
|
||||||
|
|
||||||
|
storeState = STORESTATE_DIRTY;
|
||||||
|
parseProfilesOnce ();
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileStore::_parseProfiles ()
|
void ProfileStore::_parseProfiles ()
|
||||||
{
|
{
|
||||||
// clear loaded profiles
|
// clear loaded profiles
|
||||||
@@ -272,7 +279,7 @@ const ProfileStoreEntry* ProfileStore::findEntryFromFullPathU (Glib::ustring pat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED) {
|
if (storeState == STORESTATE_NOTINITIALIZED) {
|
||||||
parseProfiles();
|
parseProfilesOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path == DEFPROFILE_INTERNAL || path == DEFPROFILE_DYNAMIC) {
|
if (path == DEFPROFILE_INTERNAL || path == DEFPROFILE_DYNAMIC) {
|
||||||
@@ -340,7 +347,7 @@ const PartialProfile* ProfileStore::getProfile (Glib::ustring path)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED) {
|
if (storeState == STORESTATE_NOTINITIALIZED) {
|
||||||
parseProfiles();
|
parseProfilesOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProfileStoreEntry *pse = findEntryFromFullPath (path);
|
const ProfileStoreEntry *pse = findEntryFromFullPath (path);
|
||||||
@@ -356,7 +363,7 @@ const PartialProfile* ProfileStore::getProfile (const ProfileStoreEntry* entry)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED) {
|
if (storeState == STORESTATE_NOTINITIALIZED) {
|
||||||
parseProfiles();
|
parseProfilesOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
MyMutex::MyLock lock (parseMutex);
|
MyMutex::MyLock lock (parseMutex);
|
||||||
@@ -387,7 +394,7 @@ const std::vector<const ProfileStoreEntry*>* ProfileStore::getFileList ()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED) {
|
if (storeState == STORESTATE_NOTINITIALIZED) {
|
||||||
parseProfiles();
|
parseProfilesOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMutex.lock();
|
parseMutex.lock();
|
||||||
@@ -493,7 +500,7 @@ void ProfileStore::dumpFolderList()
|
|||||||
PartialProfile *ProfileStore::loadDynamicProfile (const ImageMetaData *im)
|
PartialProfile *ProfileStore::loadDynamicProfile (const ImageMetaData *im)
|
||||||
{
|
{
|
||||||
if (storeState == STORESTATE_NOTINITIALIZED) {
|
if (storeState == STORESTATE_NOTINITIALIZED) {
|
||||||
parseProfiles();
|
parseProfilesOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
PartialProfile *ret = new PartialProfile (true, true);
|
PartialProfile *ret = new PartialProfile (true, true);
|
||||||
|
@@ -106,6 +106,7 @@ class ProfileStore : public rtengine::NonCopyable, public DynamicProfileRules
|
|||||||
STORESTATE_LIGHTWEIGHT,
|
STORESTATE_LIGHTWEIGHT,
|
||||||
STORESTATE_BEINGINITIALIZED,
|
STORESTATE_BEINGINITIALIZED,
|
||||||
STORESTATE_INITIALIZED,
|
STORESTATE_INITIALIZED,
|
||||||
|
STORESTATE_DIRTY,
|
||||||
STORESTATE_DELETED
|
STORESTATE_DELETED
|
||||||
} StoreState;
|
} StoreState;
|
||||||
|
|
||||||
@@ -153,6 +154,11 @@ private:
|
|||||||
* if false, only one root directory is expected
|
* if false, only one root directory is expected
|
||||||
*/
|
*/
|
||||||
bool parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath, Glib::ustring& currDir, unsigned int parentId, unsigned char level, bool displayLevel0);
|
bool parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath, Glib::ustring& currDir, unsigned int parentId, unsigned char level, bool displayLevel0);
|
||||||
|
/** @brief Will parse the profiles's dir only once. Subsequent call to this function will be ignored unless the profile list has been cleared
|
||||||
|
*/
|
||||||
|
void parseProfilesOnce ();
|
||||||
|
/** @brief Will scan the directory to fill the profile list
|
||||||
|
*/
|
||||||
void _parseProfiles ();
|
void _parseProfiles ();
|
||||||
void clearFileList ();
|
void clearFileList ();
|
||||||
void clearProfileList ();
|
void clearProfileList ();
|
||||||
|
Reference in New Issue
Block a user