source: trunk/qt/WatchDir.h @ 14539

Last change on this file since 14539 was 14539, checked in by mikedld, 6 years ago

Unify/prettify Qt client headers style

  • Property svn:keywords set to Date Rev Author Id
File size: 988 bytes
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: WatchDir.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_WATCH_DIR_H
11#define QTR_WATCH_DIR_H
12
13#include <QObject>
14#include <QSet>
15#include <QString>
16
17class QFileSystemWatcher;
18
19class TorrentModel;
20
21class WatchDir: public QObject
22{
23    Q_OBJECT
24
25  public:
26    WatchDir (const TorrentModel&);
27    virtual ~WatchDir ();
28
29    void setPath (const QString& path, bool isEnabled);
30
31  signals:
32    void torrentFileAdded (const QString& filename);
33
34  private:
35    enum
36    {
37      OK,
38      DUPLICATE,
39      ERROR
40    };
41
42  private:
43    int metainfoTest (const QString& filename) const;
44
45  private slots:
46    void watcherActivated (const QString& path);
47    void onTimeout ();
48
49    void rescanAllWatchedDirectories ();
50
51  private:
52    const TorrentModel& myModel;
53
54    QSet<QString> myWatchDirFiles;
55    QFileSystemWatcher * myWatcher;
56};
57
58#endif // QTR_WATCH_DIR_H
Note: See TracBrowser for help on using the repository browser.