fs-watcher uses its own database
add test for fs-watcher
Change-Id: Iac54e5d5c748f80099ef798a6515993ab432c725
diff --git a/gui/fs-watcher.h b/gui/fs-watcher.h
index f10850c..e3c9305 100644
--- a/gui/fs-watcher.h
+++ b/gui/fs-watcher.h
@@ -25,9 +25,9 @@
#include <vector>
#include <QFileSystemWatcher>
#include <boost/filesystem.hpp>
+#include <sqlite3.h>
#include "scheduler.h"
-#include "file-state.h"
class FsWatcher : public QObject
{
@@ -39,7 +39,6 @@
// constructor
FsWatcher (QString dirPath,
LocalFile_Change_Callback onChange, LocalFile_Change_Callback onDelete,
- FileState *fileState,
QObject* parent = 0);
// destructor
@@ -61,10 +60,25 @@
// handle callback from the watcher
// scan directory and notify callback about any file changes
void
- ScanDirectory_NotifyUpdates_Execute (QString dirPath, bool notifyCallbacks);
+ ScanDirectory_NotifyUpdates_Execute (QString dirPath);
void
- ScanDirectory_NotifyRemovals_Execute (QString dirPath, bool removeIncomplete);
+ ScanDirectory_NotifyRemovals_Execute (QString dirPath);
+
+ void
+ initFileStateDb();
+
+ bool
+ fileExists(const boost::filesystem::path &filename);
+
+ void
+ addFile(const boost::filesystem::path &filename);
+
+ void
+ deleteFile(const boost::filesystem::path &filename);
+
+ void
+ getFilesInDir(const boost::filesystem::path &dir, std::vector<std::string> &files);
private:
QFileSystemWatcher* m_watcher; // filesystem watcher
@@ -75,7 +89,7 @@
LocalFile_Change_Callback m_onChange;
LocalFile_Change_Callback m_onDelete;
- FileState *m_fileState;
+ sqlite3 *m_db;
};
#endif // FILESYSTEMWATCHER_H