summaryrefslogtreecommitdiff
path: root/src/common-lib/filesystemmountwatcher.h
blob: b574363ec76c7adef08ba011b75e306d62044aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#pragma once

#include <QtCore/QObject>
#include <QtCore/QMultiMap>
#include <QtAppManCommon/global.h>

QT_BEGIN_NAMESPACE_AM

class FileSystemMountWatcherPrivate;

class FileSystemMountWatcher : public QObject
{
    Q_OBJECT

public:
    FileSystemMountWatcher(QObject *parent = nullptr);
    ~FileSystemMountWatcher();

    static QMultiMap<QString, QString> currentMountPoints();

    void addMountPoint(const QString &directory);
    void removeMountPoint(const QString &directory);

    // Auto-test API, only functional on Linux. Needs to be called before constructor:
    static bool setMountTabFileForTesting(const QString &mtabFile);

Q_SIGNALS:
    void mountChanged(const QString &mountPoint, const QString &device);

private:
    static FileSystemMountWatcherPrivate *d;
};

QT_END_NAMESPACE_AM