summaryrefslogtreecommitdiffstats
path: root/api/logic/WatchLock.h
blob: 3e08b4137024ff291c00df7e4c47d580b2983e00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#pragma once

#include <QString>
#include <QFileSystemWatcher>

struct WatchLock
{
    WatchLock(QFileSystemWatcher * watcher, const QString& directory)
        : m_watcher(watcher), m_directory(directory)
    {
        m_watcher->removePath(m_directory);
    }
    ~WatchLock()
    {
        m_watcher->addPath(m_directory);
    }
    QFileSystemWatcher * m_watcher;
    QString m_directory;
};