1
/* BEGIN_COMMON_COPYRIGHT_HEADER
4
* LXQt - The Lightweight Desktop Environment
7
* Copyright: 2012 Razor team
10
* Alexander Sokoloff <sokoloff.a@gmail.com>
12
* This program or library is free software; you can redistribute it
13
* and/or modify it under the terms of the GNU Lesser General Public
14
* License as published by the Free Software Foundation; either
15
* version 2.1 of the License, or (at your option) any later version.
17
* This library is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* Lesser General Public License for more details.
22
* You should have received a copy of the GNU Lesser General
23
* Public License along with this library; if not, write to the
24
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25
* Boston, MA 02110-1301 USA
27
* END_COMMON_COPYRIGHT_HEADER */
30
#ifndef LXQTMOUNT_LXQTMOUNT_H
31
#define LXQTMOUNT_LXQTMOUNT_H
33
#include <QtCore/QObject>
34
#include <QtCore/QList>
38
#ifdef COMPILE_LIBLXQT_MOUNT
39
#define LIBLXQT_MOUNT_API Q_DECL_EXPORT
41
#define LIBLXQT_MOUNT_API Q_DECL_IMPORT
44
#define BOOL_SETTER(MEMBER) { bool res=(value != MEMBER); MEMBER = value; return res; }
49
class LIBLXQT_MOUNT_API MountDevice: public QObject
61
virtual bool mount() = 0;
62
virtual bool unmount() = 0;
63
virtual bool eject() = 0;
65
QString devFile() const { return mDevFile; }
66
QString label() const { return mLabel; }
67
QString vendor() const { return mVendor; }
68
QString model() const { return mModel; }
69
QString fileSystem() const { return mFileSystem; }
70
QString mountPath() const { return mMountPath; }
71
QString iconName() const { return mIconName; }
74
qulonglong size() const { return mSize; }
75
MediaType mediaType() const { return mMediaType; }
77
bool isValid() const { return mIsValid; }
78
bool isExternal() const { return mIsExternal; }
79
bool isMounted() const { return mIsMounted; }
80
bool isEjectable() const { return mIsEjectable; }
82
static QString sizeToString(qulonglong size);
85
void error(const QString &msg);
90
explicit MountDevice();
92
bool setDevFile(const QString &value) BOOL_SETTER(mDevFile)
93
bool setLabel(const QString &value) BOOL_SETTER(mLabel)
94
bool setVendor(const QString &value) BOOL_SETTER(mVendor)
95
bool setModel(const QString &value) BOOL_SETTER(mModel)
96
bool setFileSystem(const QString &value) BOOL_SETTER(mFileSystem)
97
bool setMountPath(const QString &value) BOOL_SETTER(mMountPath)
98
bool setIconName(const QString &value) BOOL_SETTER(mIconName)
100
bool setSize(qulonglong value) BOOL_SETTER(mSize)
101
bool setMediaType(MediaType value) BOOL_SETTER(mMediaType)
103
bool setIsValid(bool value) BOOL_SETTER(mIsValid)
104
bool setIsExternal(bool value) BOOL_SETTER(mIsExternal)
105
bool setIsMounted(bool value) BOOL_SETTER(mIsMounted)
106
bool setIsEjectable(bool value) BOOL_SETTER(mIsEjectable)
117
MediaType mMediaType;
124
Q_DISABLE_COPY(MountDevice)
129
typedef QList<MountDevice*> MountDeviceList;
134
class LIBLXQT_MOUNT_API MountManager : public QObject
138
explicit MountManager(QObject *parent = 0);
139
virtual ~MountManager();
141
const MountDeviceList devices() const;
147
void deviceAdded(LxQt::MountDevice *device);
148
void deviceRemoved(LxQt::MountDevice *device);
149
void deviceChanged(LxQt::MountDevice *device);
152
MountProvider *mProvider;
158
LIBLXQT_MOUNT_API QDebug operator<<(QDebug dbg, const LxQt::MountDevice& device);
159
LIBLXQT_MOUNT_API QDebug operator<<(QDebug dbg, const LxQt::MountDevice* const device);
161
#endif // LXQTMOUNT_LXQTMOUNT_H