Generate events with specific wxFSW_WARNING_OVERFLOW type if applicable.

This allows the program to distinguish between some other, unspecified,
warnings and this one which can and does happen whenever too many changes
occur too quickly but which has a clearly defined work around: the state kept
inside the program just needs to be refreshed by rescanning the directory anew.

See #12847.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-10-07 09:58:51 +00:00
parent 1fd9d44670
commit d32895c5d8
6 changed files with 130 additions and 28 deletions

View File

@@ -156,11 +156,15 @@ public:
class wxFileSystemWatcherEvent : public wxEvent
{
public:
wxFileSystemWatcherEvent(int changeType = 0, int watchid = wxID_ANY);
wxFileSystemWatcherEvent(int changeType, const wxString& errorMsg,
wxFileSystemWatcherEvent(int changeType = 0,
int watchid = wxID_ANY);
wxFileSystemWatcherEvent(int changeType,
const wxFileName& path, const wxFileName& newPath,
wxFSWWarningType warningType,
const wxString& errorMsg,
int watchid = wxID_ANY);
wxFileSystemWatcherEvent(int changeType,
const wxFileName& path,
const wxFileName& newPath,
int watchid = wxID_ANY);
/**
@@ -192,9 +196,22 @@ public:
/**
Return a description of the warning or error if this is an error event.
This string may be empty if the exact reason for the error or the
warning is not known.
*/
wxString GetErrorDescription() const;
/**
Return the type of the warning if this event is a warning one.
If this is not a warning event, i.e. if GetChangeType() doesn't include
::wxFSW_EVENT_WARNING, returns ::wxFSW_WARNING_NONE.
@since 3.0
*/
wxFSWWarningType GetWarningType() const;
/**
Returns a wxString describing an event, useful for logging, debugging
or testing.
@@ -294,3 +311,35 @@ enum wxFSWFlags
wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR
};
/**
Possible warning types for the warning events generated by
wxFileSystemWatcher.
@since 3.0
*/
enum wxFSWWarningType
{
/**
This is not a warning at all.
*/
wxFSW_WARNING_NONE,
/**
A generic warning.
Further information may be provided in the user-readable message
available from wxFileSystemWatcherEvent::GetErrorDescription()
*/
wxFSW_WARNING_GENERAL,
/**
An overflow event.
This warning indicates that some file system changes were not signaled
by any events, usually because there were too many of them and the
internally used queue has overflown. If such event is received it is
recommended to completely rescan the files or directories being
monitored.
*/
wxFSW_WARNING_OVERFLOW
};