]> cloud.milkyroute.net Git - dolphin.git/blob - src/statusbar/mountpointobservercache.h
SVN_SILENT made messages (.desktop file) - always resolve ours
[dolphin.git] / src / statusbar / mountpointobservercache.h
1 /*
2 * SPDX-FileCopyrightText: 2014 Frank Reininghaus <frank78ac@googlemail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef MOUNTPOINTOBSERVERCACHE_H
8 #define MOUNTPOINTOBSERVERCACHE_H
9
10 #include <QHash>
11 #include <QObject>
12
13 class MountPointObserver;
14 class QTimer;
15
16 class MountPointObserverCache : public QObject
17 {
18 Q_OBJECT
19
20 MountPointObserverCache();
21 ~MountPointObserverCache() override;
22
23 public:
24 static MountPointObserverCache *instance();
25
26 /**
27 * Returns a MountPointObserver for the given \a url. A new observer is created if necessary.
28 */
29 MountPointObserver *observerForUrl(const QUrl &url);
30
31 private Q_SLOTS:
32 /**
33 * Removes the given \a observer from the cache.
34 */
35 void slotObserverDestroyed(QObject *observer);
36
37 private:
38 QHash<QUrl, MountPointObserver *> m_observerForMountPoint;
39 QHash<QObject *, QUrl> m_mountPointForObserver;
40 QTimer *m_updateTimer;
41
42 friend class MountPointObserverCacheSingleton;
43 };
44
45 #endif