dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dopticaldiscinfo.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DOPTICALDISCINFO_H
6#define DOPTICALDISCINFO_H
7
8#include <QObject>
9#include <QString>
10#include <QSharedDataPointer>
11
12#include <DExpected>
13
14#include "dtkburn_global.h"
15#include "dtkburntypes.h"
16
17DBURN_BEGIN_NAMESPACE
18
19class DOpticalDiscInfo;
20namespace DOpticalDiscManager {
21DTK_CORE_NAMESPACE::DExpected<DOpticalDiscInfo *>
22createOpticalDiscInfo(const QString &dev, QObject *parent);
23} // namespace DOpticalDiscManager
24
25class DOpticalDiscInfoPrivate;
26class DOpticalDiscInfo final : public QObject
27{
28 Q_OBJECT
29
30 Q_PROPERTY(bool blank READ blank CONSTANT FINAL)
31 Q_PROPERTY(QString device READ device CONSTANT FINAL)
32 Q_PROPERTY(QString volumeName READ volumeName CONSTANT FINAL)
33 Q_PROPERTY(quint64 usedSize READ usedSize CONSTANT FINAL)
34 Q_PROPERTY(quint64 availableSize READ availableSize CONSTANT FINAL)
35 Q_PROPERTY(quint64 totalSize READ totalSize CONSTANT FINAL)
36 Q_PROPERTY(quint64 dataBlocks READ dataBlocks CONSTANT FINAL)
37 Q_PROPERTY(MediaType mediaType READ mediaType CONSTANT FINAL)
38 Q_PROPERTY(QStringList writeSpeed READ writeSpeed CONSTANT FINAL)
39
40public:
44
45 bool blank() const;
46 QString device() const;
47 QString volumeName() const;
48 quint64 usedSize() const;
49 quint64 availableSize() const;
50 quint64 totalSize() const;
51 quint64 dataBlocks() const;
52 MediaType mediaType() const;
53 QStringList writeSpeed() const;
54
55private:
56 explicit DOpticalDiscInfo(const QString &dev, QObject *parent = nullptr);
57
58 friend DTK_CORE_NAMESPACE::DExpected<DOpticalDiscInfo *>
59 DOpticalDiscManager::createOpticalDiscInfo(const QString &dev, QObject *parent);
60
61private:
62 QSharedDataPointer<DOpticalDiscInfoPrivate> d_ptr;
63};
64
65DBURN_END_NAMESPACE
66
67#endif // DOPTICALDISCINFO_H
用于获取光盘基本属性信息的类, 通常创建改类的对象需要较长时间, 不建议在 GUI 线程中创建
Definition dopticaldiscinfo.h:27
QString volumeName() const
获取光盘的卷标名称
bool blank() const
获取光盘是否为空白盘的状态
QStringList writeSpeed() const
获取光盘的旋转速度
DOpticalDiscInfo(const DOpticalDiscInfo &info)
复制构造函数, 通过 info 构造一个新的 DOpticalDiscInfo 对象
quint64 usedSize() const
获取光盘的已使用空间大小
quint64 dataBlocks() const
获取光盘介质的数据块数量
QString device() const
获取光盘的设备路径
DOpticalDiscInfo & operator=(const DOpticalDiscInfo &info)
赋值操作符, 创建一个和 info 一样的副本对象
quint64 availableSize() const
获取光盘可用的空间大小
MediaType mediaType() const
获取光盘的介质类型
quint64 totalSize() const
获取光盘的空间总容量
DTK_CORE_NAMESPACE::DExpected< DOpticalDiscInfo * > createOpticalDiscInfo(const QString &dev, QObject *parent)
创建一个光盘信息对象,由于光盘的物理特性,调用此接口可能会很慢