本文整理汇总了C++中solid::Device::udi方法的典型用法代码示例。如果您正苦于以下问题:C++ Device::udi方法的具体用法?C++ Device::udi怎么用?C++ Device::udi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solid::Device
的用法示例。
在下文中一共展示了Device::udi方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canHandle
bool SmbDeviceHandlerFactory::canHandle( const Solid::Device &device ) const
{
const Solid::NetworkShare *share = device.as<Solid::NetworkShare>();
if( !share )
{
debug() << __PRETTY_FUNCTION__ << device.udi() << "has no NetworkShare interface";
return false;
}
if( share->type() != Solid::NetworkShare::Cifs )
{
debug() << __PRETTY_FUNCTION__ << device.udi() << "has type" << share->type()
<< "but smbfs/cifs type is" << Solid::NetworkShare::Cifs;
return false;
}
const Solid::StorageAccess *access = device.as<Solid::StorageAccess>();
if( !access )
{
debug() << __PRETTY_FUNCTION__ << device.udi() << "has no StorageAccess interface";
return false;
}
if( !access->isAccessible() || access->filePath().isEmpty() )
{
debug() << __PRETTY_FUNCTION__ << device.udi() << "is not accessible"
<< "or has empty mount-point";
return false;
}
return true;
}
示例2: main
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
KComponentData data("tutorial5");
//get a Network Device
QList<Solid::Device> netlist = Solid::Device::listFromType(Solid::DeviceInterface::NetworkInterface, QString());
//check to see if no network devices were found
if(netlist.empty())
{
kDebug() << "No network devices found!";
return 0;
}
Solid::Device device = netlist[0];
Solid::NetworkInterface *netdev = device.as<Solid::NetworkInterface>();
//keep the program from crashing in the event that there's a bug in solid
if(!netdev)
{
kDebug() << "Device could not be converted. There is a bug.";
return 0;
}
kDebug() << "The iface of " << device.udi() << " is " << netdev->ifaceName();
return 0;
}
示例3: data
QVariant SoundCardModel::data(const QModelIndex &index, int role) const
{
// Sanity check
if (!index.isValid())
return QVariant();
// Check if role is supported
if (role != Qt::DisplayRole && role != Qt::DecorationRole)
return QVariant();
Solid::Device device = m_list.at(index.row());
Solid::AudioInterface *audio = device.as<Solid::AudioInterface>();
if (audio->deviceType() == Solid::AudioInterface::AudioOutput) {
qDebug() << device.udi() << device.product() << device.parentUdi();
switch (role) {
case Qt::DisplayRole:
return audio->name();
case Qt::DecorationRole:
switch (audio->soundcardType()) {
case Solid::AudioInterface::Headset:
return QIcon::fromTheme("audio-headset");
default:
return QIcon::fromTheme("audio-card");
}
}
}
return QVariant();
}
示例4: SolDevice
SolStorageDevice::SolStorageDevice(QTreeWidgetItem *parent, const Solid::Device &device, const storageChildren &c) :
SolDevice(parent, device)
{
deviceTypeHolder = Solid::DeviceInterface::StorageDrive;
setDefaultDeviceText();
if(c == CREATECHILDREN)
{
createDeviceChildren<SolVolumeDevice>(this,device.udi(),Solid::DeviceInterface::StorageVolume);
}
}
示例5: opticalParent
Solid::Device MenuDiskItem::opticalParent() const
{
Solid::Device it = mDevice;
//search for parent drive
for ( ; !it.udi().isEmpty(); it = it.parent())
{
if (it.is<Solid::OpticalDrive>())
break;
}
return it;
}
示例6: hasRemovableParent
// Paulo: I'm not sure what this is for
static bool hasRemovableParent(Solid::Device device)
{
// qDebug() << "acess:" << device.udi();
for ( ; !device.udi().isEmpty(); device = device.parent())
{
Solid::StorageDrive* drive = device.as<Solid::StorageDrive>();
if (drive && drive->isRemovable())
{
// qDebug() << "removable parent drive:" << device.udi();
return true;
}
}
return false;
}
示例7: lookup
AudioCdDevice::AudioCdDevice(MusicModel *m, Solid::Device &dev)
: Device(m, dev, false, true)
#ifdef CDDB_FOUND
, cddb(0)
#endif
#ifdef MUSICBRAINZ5_FOUND
, mb(0)
#endif
, year(0)
, disc(0)
, time(0xFFFFFFFF)
, lookupInProcess(false)
, autoPlay(false)
{
icn=Icon("media-optical");
drive=dev.parent().as<Solid::OpticalDrive>();
Solid::Block *block=dev.as<Solid::Block>();
if (block) {
device=block->device();
} else { // With UDisks2 we cannot get block from device :-(
QStringList parts=dev.udi().split("/", QString::SkipEmptyParts);
if (!parts.isEmpty()) {
parts=parts.last().split(":");
if (!parts.isEmpty()) {
device="/dev/"+parts.first();
}
}
}
if (!device.isEmpty()) {
static bool registeredTypes=false;
if (!registeredTypes) {
qRegisterMetaType<CdAlbum >("CdAlbum");
qRegisterMetaType<QList<CdAlbum> >("QList<CdAlbum>");
registeredTypes=true;
}
devPath=Song::constCddaProtocol+device+QChar('/');
#if defined CDDB_FOUND && defined MUSICBRAINZ5_FOUND
connectService(Settings::self()->useCddb());
#else
connectService(true);
#endif
detailsString=i18n("Reading disc");
setStatusMessage(detailsString);
lookupInProcess=true;
connect(Covers::self(), SIGNAL(cover(const Song &, const QImage &, const QString &)),
this, SLOT(setCover(const Song &, const QImage &, const QString &)));
emit lookup(Settings::self()->cdAuto());
}
}
示例8: deviceLessThan
bool deviceLessThan(const Solid::Device &a, const Solid::Device &b) {
return a.udi() < b.udi();
}