PP3 sidecar files were triggering unwanted monitoring event (there was still some remaining even with Oduis' fix from issue #597). They are now filtered out : only files that have one of the retained (and then displayed) extensions are taken into account.
Works for both Windows and Linux (i don't know if MacOS version's is listening the directories). Note that contrary to the Branch3 version of the patch, the pp3 files are updated too when ranking the thumbs because this information is now part of the pp3 file.
This commit is contained in:
@@ -274,7 +274,11 @@ void ProcParams::setDefaults () {
|
||||
ppVersion = PPVERSION;
|
||||
}
|
||||
|
||||
int ProcParams::save (Glib::ustring fname) const {
|
||||
int ProcParams::save (Glib::ustring fname, Glib::ustring fname2) const {
|
||||
|
||||
if (!fname.length() && !fname2.length())
|
||||
return 0;
|
||||
|
||||
SafeKeyFile keyFile;
|
||||
|
||||
keyFile.set_string ("Version", "AppVersion", APPVERSION);
|
||||
@@ -531,16 +535,30 @@ int ProcParams::save (Glib::ustring fname) const {
|
||||
keyFile.set_string_list ("IPTC", iptc[i].field, values);
|
||||
}
|
||||
|
||||
FILE *f = safe_g_fopen (fname, "wt");
|
||||
Glib::ustring sPParams = keyFile.to_data();
|
||||
|
||||
int error1, error2;
|
||||
error1 = write (fname , sPParams);
|
||||
error2 = write (fname2, sPParams);
|
||||
return error1 & error2;
|
||||
}
|
||||
|
||||
int ProcParams::write (Glib::ustring &fname, Glib::ustring &content) const {
|
||||
|
||||
int error = 0;
|
||||
if (fname.length()) {
|
||||
FILE *f;
|
||||
f = safe_g_fopen (fname, "wt");
|
||||
|
||||
if (f==NULL)
|
||||
return 1;
|
||||
error = 1;
|
||||
else {
|
||||
fprintf (f, "%s", keyFile.to_data().c_str());
|
||||
fprintf (f, "%s", content.c_str());
|
||||
fclose (f);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int ProcParams::load (Glib::ustring fname) {
|
||||
|
||||
|
@@ -496,11 +496,13 @@ class ProcParams {
|
||||
*/
|
||||
void setDefaults ();
|
||||
/**
|
||||
* Saves the parameters to a file.
|
||||
* @param fname the name of the file
|
||||
* @return Error code (=0 if no error)
|
||||
* Saves the parameters to possibly two files. This is a performance improvement if a function has to
|
||||
* save the same file in two different location, i.e. the cache and the image's directory
|
||||
* @param fname the name of the first file (can be an empty string)
|
||||
* @param fname2 the name of the second file (can be an empty string) (optional)
|
||||
* @return Error code (=0 if all supplied filenames where created correctly)
|
||||
*/
|
||||
int save (Glib::ustring fname) const;
|
||||
int save (Glib::ustring fname, Glib::ustring fname2 = "") const;
|
||||
/**
|
||||
* Loads the parameters from a file.
|
||||
* @param fname the name of the file
|
||||
@@ -518,6 +520,15 @@ class ProcParams {
|
||||
|
||||
bool operator== (const ProcParams& other);
|
||||
bool operator!= (const ProcParams& other);
|
||||
|
||||
private:
|
||||
/** Write the ProcParams's text in the file of the given name.
|
||||
* @param fname the name of the file
|
||||
* @param content the text to write
|
||||
* @return Error code (=0 if no error)
|
||||
* */
|
||||
int write (Glib::ustring &fname, Glib::ustring &content) const;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -106,14 +106,46 @@ void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<FileMTimeIn
|
||||
}
|
||||
}
|
||||
|
||||
void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &names, const Glib::ustring &directory)
|
||||
/*
|
||||
* safe_build_file_list can now filter out at the source all files that doesn't have the extensions specified (if provided)
|
||||
*/
|
||||
void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &names, const Glib::ustring &directory, const std::vector<Glib::ustring> *extensions)
|
||||
{
|
||||
Glib::RefPtr<Gio::FileEnumerator> dirList;
|
||||
|
||||
if (dir) {
|
||||
if (!extensions) {
|
||||
SAFE_ENUMERATOR_CODE_START
|
||||
names.push_back (Glib::build_filename (directory, info->get_name()));
|
||||
SAFE_ENUMERATOR_CODE_END;
|
||||
}
|
||||
else {
|
||||
// convert extensions to lowercase in a new vector list
|
||||
std::vector<Glib::ustring> lcExtensions;
|
||||
for (unsigned int i=0; i<extensions->size(); i++)
|
||||
lcExtensions.push_back ((*extensions)[i].lowercase());
|
||||
|
||||
SAFE_ENUMERATOR_CODE_START
|
||||
// convert the current filename to lowercase in a new ustring
|
||||
Glib::ustring fname = Glib::ustring(info->get_name()).lowercase();
|
||||
|
||||
int pos = fname.find_last_of('.');
|
||||
if (pos > -1 && pos < (fname.length()-1)) {
|
||||
// there is an extension to the filename
|
||||
|
||||
Glib::ustring lcFileExt = fname.substr(pos+1).lowercase();
|
||||
|
||||
// look out if it has one of the retained extensions
|
||||
for (unsigned int i=0; i<lcExtensions.size(); i++) {
|
||||
if (lcFileExt == lcExtensions[i]) {
|
||||
names.push_back (Glib::build_filename (directory, info->get_name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
SAFE_ENUMERATOR_CODE_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class FileMTimeInfo {
|
||||
|
||||
Glib::RefPtr<Gio::FileInfo> safe_query_file_info (Glib::RefPtr<Gio::File> &file);
|
||||
void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<FileMTimeInfo> &flist);
|
||||
void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &names, const Glib::ustring &directory = "");
|
||||
void safe_build_file_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &names, const Glib::ustring &directory = "", const std::vector<Glib::ustring> *extensions=NULL);
|
||||
void safe_build_subdir_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ustring> &subDirs, bool add_hidden);
|
||||
|
||||
bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8);
|
||||
|
@@ -471,9 +471,7 @@ void EditorPanel::saveProfile () {
|
||||
ProcParams params;
|
||||
ipc->getParams (¶ms);
|
||||
|
||||
if (options.saveParamsFile)
|
||||
params.save (openThm->getFileName() + paramFileExtension);
|
||||
if (options.saveParamsCache)
|
||||
// Will call updateCache, which will update both the cached and sidecar files if necessary
|
||||
openThm->setProcParams (params, EDITOR);
|
||||
}
|
||||
}
|
||||
|
@@ -832,7 +832,7 @@ void FileBrowser::toTrashRequested (std::vector<FileBrowserEntry*> tbe) {
|
||||
tbe[i]->getThumbButtonSet()->setRank (tbe[i]->thumbnail->getRank());
|
||||
tbe[i]->getThumbButtonSet()->setColorLabel (tbe[i]->thumbnail->getColorLabel());
|
||||
tbe[i]->getThumbButtonSet()->setInTrash (true);
|
||||
tbe[i]->thumbnail->updateCache(); // needed to save the rank to disk
|
||||
tbe[i]->thumbnail->updateCache (); // needed to save the colorlabel to disk in the procparam file(s) and the cache image data file
|
||||
}
|
||||
}
|
||||
trash_changed().emit();
|
||||
@@ -851,7 +851,7 @@ void FileBrowser::fromTrashRequested (std::vector<FileBrowserEntry*> tbe) {
|
||||
tbe[i]->getThumbButtonSet()->setRank (tbe[i]->thumbnail->getRank());
|
||||
tbe[i]->getThumbButtonSet()->setColorLabel (tbe[i]->thumbnail->getColorLabel());
|
||||
tbe[i]->getThumbButtonSet()->setInTrash (false);
|
||||
tbe[i]->thumbnail->updateCache(); // needed to save the rank to disk
|
||||
tbe[i]->thumbnail->updateCache (); // needed to save the colorlabel to disk in the procparam file(s) and the cache image data file
|
||||
}
|
||||
}
|
||||
trash_changed().emit();
|
||||
@@ -868,7 +868,7 @@ void FileBrowser::rankingRequested (std::vector<FileBrowserEntry*> tbe, int rank
|
||||
tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER);
|
||||
|
||||
tbe[i]->thumbnail->setRank (rank);
|
||||
tbe[i]->thumbnail->updateCache(); // needed to save the rank to disk
|
||||
tbe[i]->thumbnail->updateCache (); // needed to save the colorlabel to disk in the procparam file(s) and the cache image data file
|
||||
//TODO? - should update pparams instead?
|
||||
|
||||
if (tbe[i]->getThumbButtonSet())
|
||||
@@ -887,7 +887,7 @@ void FileBrowser::colorlabelRequested (std::vector<FileBrowserEntry*> tbe, int c
|
||||
tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER);
|
||||
|
||||
tbe[i]->thumbnail->setColorLabel (colorlabel);
|
||||
tbe[i]->thumbnail->updateCache(); // needed to save the colorlabel to disk
|
||||
tbe[i]->thumbnail->updateCache(); // needed to save the colorlabel to disk in the procparam file(s) and the cache image data file
|
||||
//TODO? - should update pparams instead?
|
||||
if (tbe[i]->getThumbButtonSet())
|
||||
tbe[i]->getThumbButtonSet()->setColorLabel (tbe[i]->thumbnail->getColorLabel());
|
||||
|
@@ -46,6 +46,9 @@ struct FileBrowserIdleHelper {
|
||||
int pending;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class handling actions common to all thumbnails of the file browser
|
||||
*/
|
||||
class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
|
||||
|
||||
typedef sigc::signal<void> type_trash_changed;
|
||||
|
@@ -464,7 +464,7 @@ std::vector<Glib::ustring> FileCatalog::getFileList () {
|
||||
|
||||
std::vector<Glib::ustring> names;
|
||||
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path (selectedDirectory);
|
||||
safe_build_file_list (dir, names, selectedDirectory);
|
||||
safe_build_file_list (dir, names, selectedDirectory, &(options.parsedExtensions));
|
||||
return names;
|
||||
}
|
||||
|
||||
@@ -666,8 +666,9 @@ void FileCatalog::_openImage (std::vector<Thumbnail*> tmb) {
|
||||
bool continueToLoad=true;
|
||||
for (size_t i=0; i< tmb.size() && continueToLoad; i++) {
|
||||
if (editedFiles.find (tmb[i]->getFileName())==editedFiles.end()){
|
||||
listener->fileSelected (tmb[i]);
|
||||
if( !options.tabbedUI )
|
||||
// Open the image here, and stop if in Single Editor mode, or if an image couldn't
|
||||
// be opened, would it be because the file doesn't exist or because of lack of RAM
|
||||
if( !(listener->fileSelected (tmb[i])) && !options.tabbedUI )
|
||||
continueToLoad = false;
|
||||
}
|
||||
tmb[i]->decreaseRef ();
|
||||
@@ -1276,10 +1277,12 @@ int winDirChangedUITread (void* cat) {
|
||||
void FileCatalog::winDirChanged () {
|
||||
g_idle_add(winDirChangedUITread, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal) {
|
||||
|
||||
if (options.has_retained_extention(file->get_parse_name())) {
|
||||
if (!internal)
|
||||
gdk_threads_enter();
|
||||
|
||||
@@ -1289,6 +1292,9 @@ void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Gli
|
||||
if (!internal)
|
||||
gdk_threads_leave();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void FileCatalog::checkAndAddFile (Glib::RefPtr<Gio::File> file) {
|
||||
|
||||
|
@@ -49,6 +49,12 @@ class DirEntry {
|
||||
}
|
||||
};
|
||||
class FilePanel;
|
||||
/*
|
||||
* Class:
|
||||
* - handling the list of file (add/remove them)
|
||||
* - handling the thumbnail toolbar,
|
||||
* - monitoring the directory (for any change)
|
||||
*/
|
||||
class FileCatalog : public Gtk::VBox,
|
||||
public DirSelectionListener,
|
||||
public PreviewLoaderListener,
|
||||
@@ -59,6 +65,7 @@ class FileCatalog : public Gtk::VBox,
|
||||
#endif
|
||||
{
|
||||
|
||||
private:
|
||||
FilePanel* filepanel;
|
||||
Gtk::HBox* hBox;
|
||||
Glib::ustring selectedDirectory;
|
||||
@@ -127,22 +134,20 @@ class FileCatalog : public Gtk::VBox,
|
||||
|
||||
FilterPanel* filterPanel;
|
||||
|
||||
Glib::RefPtr<Gio::FileMonitor> dirMonitor;
|
||||
|
||||
int previewsToLoad;
|
||||
int previewsLoaded;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
WinDirMonitor* wdMonitor;
|
||||
public:
|
||||
void winDirChanged ();
|
||||
private:
|
||||
#endif
|
||||
std::vector<Glib::ustring> fileNameList;
|
||||
std::set<Glib::ustring> editedFiles;
|
||||
guint modifierKey; // any modifiers held when rank button was pressed
|
||||
|
||||
#ifndef _WIN32
|
||||
Glib::RefPtr<Gio::FileMonitor> dirMonitor;
|
||||
#else
|
||||
WinDirMonitor* wdMonitor;
|
||||
#endif
|
||||
|
||||
void addAndOpenFile (const Glib::ustring& fname);
|
||||
void checkAndAddFile (Glib::RefPtr<Gio::File> info);
|
||||
std::vector<Glib::ustring> getFileList ();
|
||||
@@ -203,7 +208,6 @@ class FileCatalog : public Gtk::VBox,
|
||||
void runFilterDialog ();
|
||||
|
||||
void on_realize();
|
||||
void on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal);
|
||||
void reparseDirectory ();
|
||||
void _openImage (std::vector<Thumbnail*> tmb);
|
||||
|
||||
@@ -226,6 +230,13 @@ class FileCatalog : public Gtk::VBox,
|
||||
|
||||
bool CheckSidePanelsVisibility();
|
||||
void toggleSidePanels();
|
||||
|
||||
#ifndef _WIN32
|
||||
void on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal);
|
||||
#else
|
||||
void winDirChanged ();
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <multilangmgr.h>
|
||||
#include <safekeyfile.h>
|
||||
#include <addsetids.h>
|
||||
#include <guiutils.h>
|
||||
#include <safegtk.h>
|
||||
#include "version.h"
|
||||
|
||||
@@ -121,6 +122,7 @@ void Options::setDefaults () {
|
||||
//crvOpen.clear ();
|
||||
parseExtensions.clear ();
|
||||
parseExtensionsEnabled.clear ();
|
||||
parsedExtensions.clear ();
|
||||
renameUseTemplates = false;
|
||||
renameTemplates.clear ();
|
||||
thumbnailZoomRatios.clear ();
|
||||
@@ -227,6 +229,12 @@ Options* Options::copyFrom (Options* other) {
|
||||
return this;
|
||||
}
|
||||
|
||||
void Options::filterOutParsedExtensions () {
|
||||
parsedExtensions.clear();
|
||||
for (unsigned int i=0; i<parseExtensions.size(); i++)
|
||||
if (parseExtensionsEnabled[i]) parsedExtensions.push_back(parseExtensions[i].lowercase());
|
||||
}
|
||||
|
||||
int Options::readFromFile (Glib::ustring fname) {
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
@@ -400,6 +408,8 @@ if (keyFile.has_group ("Sounds")) {
|
||||
if (keyFile.has_key ("Sounds", "LngEditProcDoneSecs")) sndLngEditProcDoneSecs = keyFile.get_double ("Sounds", "LngEditProcDoneSecs");
|
||||
}
|
||||
|
||||
filterOutParsedExtensions ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -676,6 +686,29 @@ void Options::save () {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* return true if fname ends with one of the retained image file extensions
|
||||
*/
|
||||
bool Options::has_retained_extention (Glib::ustring fname) {
|
||||
|
||||
Glib::ustring ext = getExtension(fname).lowercase();
|
||||
|
||||
if (ext.length()) {
|
||||
// there is an extension to the filename
|
||||
|
||||
// look out if it has one of the retained extensions
|
||||
for (unsigned int i=0; i<parsedExtensions.size(); i++) {
|
||||
if (ext == parsedExtensions[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* return true if ext is an enabled extension
|
||||
*/
|
||||
bool Options::is_extention_enabled (Glib::ustring ext) {
|
||||
for (int j=0; j<(int)parseExtensions.size(); j++)
|
||||
if (parseExtensions[j].casefold() == ext.casefold())
|
||||
|
@@ -119,8 +119,9 @@ class Options {
|
||||
ThFileType thumbnailFormat;
|
||||
int thumbInterp; // 0: nearest, 1: bilinear
|
||||
bool liveThumbnails;
|
||||
std::vector<Glib::ustring> parseExtensions;
|
||||
std::vector<int> parseExtensionsEnabled;
|
||||
std::vector<Glib::ustring> parseExtensions; // List containing all extensions type
|
||||
std::vector<int> parseExtensionsEnabled; // List of bool to retain extension or not
|
||||
std::vector<Glib::ustring> parsedExtensions; // List containing all retained extensions (lowercase)
|
||||
std::vector<int> tpOpen;
|
||||
//std::vector<int> crvOpen;
|
||||
std::vector<int> baBehav;
|
||||
@@ -158,12 +159,14 @@ class Options {
|
||||
Options ();
|
||||
|
||||
Options* copyFrom (Options* other);
|
||||
void filterOutParsedExtensions ();
|
||||
void setDefaults ();
|
||||
int readFromFile (Glib::ustring fname);
|
||||
int saveToFile (Glib::ustring fname);
|
||||
static void load ();
|
||||
static void save ();
|
||||
|
||||
bool has_retained_extention (Glib::ustring fname);
|
||||
bool is_extention_enabled(Glib::ustring ext);
|
||||
};
|
||||
|
||||
|
@@ -1197,6 +1197,7 @@ void Preferences::okPressed () {
|
||||
storePreferences ();
|
||||
workflowUpdate();
|
||||
options.copyFrom (&moptions);
|
||||
options.filterOutParsedExtensions();
|
||||
Options::save ();
|
||||
hide ();
|
||||
}
|
||||
|
@@ -23,6 +23,9 @@
|
||||
#include <thumbbrowserentrybase.h>
|
||||
#include <set>
|
||||
|
||||
/*
|
||||
* Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space
|
||||
*/
|
||||
class ThumbBrowserBase : public Gtk::VBox {
|
||||
|
||||
class Internal : public Gtk::DrawingArea {
|
||||
|
@@ -618,15 +618,15 @@ void Thumbnail::saveThumbnail ()
|
||||
_saveThumbnail();
|
||||
}
|
||||
|
||||
void Thumbnail::updateCache () {
|
||||
void Thumbnail::updateCache (bool updatePParams, bool updateCacheImageData) {
|
||||
|
||||
if (pparamsValid) {
|
||||
if (options.saveParamsCache)
|
||||
pparams.save (getCacheFileName ("profiles")+paramFileExtension);
|
||||
if (options.saveParamsFile)
|
||||
// pparams.save (removeExtension(fname) + paramFileExtension);
|
||||
pparams.save (fname + paramFileExtension);
|
||||
if (updatePParams && pparamsValid) {
|
||||
pparams.save (
|
||||
options.saveParamsCache ? getCacheFileName ("profiles")+paramFileExtension : "",
|
||||
options.saveParamsFile ? fname + paramFileExtension : ""
|
||||
);
|
||||
}
|
||||
if (updateCacheImageData)
|
||||
cfs.save (getCacheFileName ("data")+".txt");
|
||||
}
|
||||
|
||||
|
@@ -135,7 +135,7 @@ class Thumbnail {
|
||||
void increaseRef ();
|
||||
void decreaseRef ();
|
||||
|
||||
void updateCache ();
|
||||
void updateCache (bool updatePParams = true, bool updateCacheImageData = true);
|
||||
void saveThumbnail ();
|
||||
|
||||
bool openDefaultViewer(int destination);
|
||||
|
@@ -17,18 +17,86 @@
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <windirmonitor.h>
|
||||
#include <options.h>
|
||||
|
||||
static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nBytes, LPOVERLAPPED lpOverlapped) {
|
||||
|
||||
DWORD dwOffset = 0;
|
||||
FILE_NOTIFY_INFORMATION* pInfo = NULL;
|
||||
|
||||
WinDirMonitor::MonitorData* monData = (WinDirMonitor::MonitorData*)lpOverlapped;
|
||||
if (!nBytes) {
|
||||
delete monData;
|
||||
return;
|
||||
}
|
||||
|
||||
bool notify = false;
|
||||
// Analysis of the modifications
|
||||
do {
|
||||
Glib::ustring fname = "";
|
||||
Glib::ustring action = "";
|
||||
int strLen = 0;
|
||||
|
||||
// Get a pointer to the first change record...
|
||||
pInfo = (FILE_NOTIFY_INFORMATION*) &monData->file_notify_buffer[dwOffset];
|
||||
|
||||
char fnameC[(MAX_PATH+1)*2] = {0};
|
||||
strLen = WideCharToMultiByte(CP_UTF8,0,pInfo->FileName,pInfo->FileNameLength/sizeof(WCHAR),fnameC,sizeof(fnameC),0,0);
|
||||
fnameC[strLen] = 0;
|
||||
fname = fnameC;
|
||||
|
||||
if (options.has_retained_extention(fname))
|
||||
{
|
||||
switch (pInfo->Action)
|
||||
{
|
||||
case (FILE_ACTION_ADDED):
|
||||
action = "FILE_ACTION_ADDED";
|
||||
break;
|
||||
case (FILE_ACTION_REMOVED):
|
||||
action = "FILE_ACTION_REMOVED";
|
||||
break;
|
||||
case (FILE_ACTION_MODIFIED):
|
||||
action = "FILE_ACTION_MODIFIED";
|
||||
break;
|
||||
case (FILE_ACTION_RENAMED_OLD_NAME):
|
||||
action = "FILE_ACTION_RENAMED_OLD_NAME";
|
||||
break;
|
||||
case (FILE_ACTION_RENAMED_NEW_NAME):
|
||||
action = "FILE_ACTION_RENAMED_NEW_NAME";
|
||||
break;
|
||||
case (FILE_ACTION_REMOVED_BY_DELETE):
|
||||
action = "FILE_ACTION_REMOVED_BY_DELETE";
|
||||
/* break;
|
||||
case (FILE_ACTION_ADDED_STREAM):
|
||||
action = "FILE_ACTION_ADDED_STREAM";
|
||||
break;
|
||||
case (FILE_ACTION_REMOVED_STREAM):
|
||||
action = "FILE_ACTION_REMOVED_STREAM";
|
||||
break;
|
||||
case (FILE_ACTION_MODIFIED_STREAM):
|
||||
action = "FILE_ACTION_MODIFIED_STREAM";
|
||||
break;
|
||||
case (FILE_ACTION_ID_NOT_TUNNELLED):
|
||||
action = "FILE_ACTION_ID_NOT_TUNNELLED";
|
||||
break;
|
||||
case (FILE_ACTION_TUNNELLED_ID_COLLISION):
|
||||
action = "FILE_ACTION_TUNNELLED_ID_COLLISION";*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
notify = true;
|
||||
}
|
||||
|
||||
// More than one change may happen at the same time. Load the next change and continue...
|
||||
dwOffset += pInfo->NextEntryOffset;
|
||||
}
|
||||
while (pInfo->NextEntryOffset != 0);
|
||||
|
||||
// ReadDirectoryChangesW sometimes emits multiple events per change (one for each change type)
|
||||
// To make sure it's not flooding update, this gets filtered.
|
||||
time_t curTime= ::time(NULL);
|
||||
if (monData->listener && ::difftime(curTime, monData->lastTimeUpdateDir)>1.0) {
|
||||
if (notify && monData->listener && ::difftime(curTime, monData->lastTimeUpdateDir)>1.0) {
|
||||
printf("----- Appel de WinDirChanged -----\n");
|
||||
monData->listener->winDirChanged ();
|
||||
monData->lastTimeUpdateDir = curTime;
|
||||
}
|
||||
|
Reference in New Issue
Block a user