本文整理汇总了C++中DeviceInfo::ReadMountInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceInfo::ReadMountInfo方法的具体用法?C++ DeviceInfo::ReadMountInfo怎么用?C++ DeviceInfo::ReadMountInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceInfo
的用法示例。
在下文中一共展示了DeviceInfo::ReadMountInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MountAdded
void GioLister::MountAdded(GMount* mount) {
g_object_ref(mount);
DeviceInfo info;
info.ReadVolumeInfo(g_mount_get_volume(mount));
#ifdef HAVE_AUDIOCD
if (info.volume_root_uri.startsWith("cdda"))
// Audio CD devices are already handled by CDDA lister
return;
#endif
info.ReadMountInfo(mount);
info.ReadDriveInfo(g_mount_get_drive(mount));
if (!info.is_suitable())
return;
QString old_id;
{
QMutexLocker l(&mutex_);
// The volume might already exist - either mounted or unmounted.
foreach (const QString& id, devices_.keys()) {
if (devices_[id].volume == info.volume) {
old_id = id;
break;
}
}
if (!old_id.isEmpty() && old_id != info.unique_id()) {
// If the ID has changed (for example, after it's been mounted), we need
// to remove the old device.
devices_.remove(old_id);
emit DeviceRemoved(old_id);
old_id = QString();
}
devices_[info.unique_id()] = info;
}
if (!old_id.isEmpty())
emit DeviceChanged(old_id);
else {
emit DeviceAdded(info.unique_id());
}
}
示例2: VolumeAdded
void GioLister::VolumeAdded(GVolume* volume) {
g_object_ref(volume);
DeviceInfo info;
info.ReadVolumeInfo(volume);
#ifdef HAVE_AUDIOCD
if (info.volume_root_uri.startsWith("cdda"))
// Audio CD devices are already handled by CDDA lister
return;
#endif
info.ReadDriveInfo(g_volume_get_drive(volume));
info.ReadMountInfo(g_volume_get_mount(volume));
if (!info.is_suitable()) return;
{
QMutexLocker l(&mutex_);
devices_[info.unique_id()] = info;
}
emit DeviceAdded(info.unique_id());
}