ukui-search/libsearch/filesystemwatcher/file-system-watcher-private.h

66 lines
1.8 KiB
C
Raw Normal View History

/*
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: iaom <zhangpengfei@kylinos.cn>
*
*/
#ifndef FILESYSTEMWATCHERPRIVATE_H
#define FILESYSTEMWATCHERPRIVATE_H
#endif // FILESYSTEMWATCHERPRIVATE_H
#include "file-system-watcher.h"
#include <QHash>
#include <QByteArray>
#include <QSocketNotifier>
#include <QThreadPool>
2022-10-26 18:01:40 +08:00
#include <QMutex>
namespace UkuiSearch {
class FileSystemWatcherPrivate
{
friend class FileSystemWatcher;
public:
FileSystemWatcherPrivate(FileSystemWatcher *parent);
~FileSystemWatcherPrivate();
2022-10-26 18:01:40 +08:00
void addWatchWithBlackList(const QStringList &pathList, const QStringList &blackList);
QStringList removeWatch(const QString &path);
QString removeWatch(int wd);
2022-10-26 18:01:40 +08:00
void clearAll();
2022-08-05 14:07:24 +08:00
private:
void init();
void addWatch(const QString &path);
FileSystemWatcher::WatchEvents m_watchEvents;
FileSystemWatcher::WatchFlags m_watchFlags;
int m_inotifyFd = -1;
QSocketNotifier* m_notifier = nullptr;
// wd -> url
QHash<int, QString> m_watchPathHash;
QStringList m_watchedRootPaths;
FileSystemWatcher *q = nullptr;
2022-08-05 14:07:24 +08:00
bool m_recursive = true;
QStringList m_failedWatchPaths;
2022-08-05 14:07:24 +08:00
};
}