feat: add interface for getting class of volumes and mounts.

This commit is contained in:
Chris Xiong 2019-10-28 17:10:33 +08:00
parent 7ad783765d
commit 2b525c6f3e
5 changed files with 18 additions and 2 deletions

View File

@ -42,6 +42,7 @@ public:
QString name() const; QString name() const;
QString uuid() const; QString uuid() const;
QString mountClass() const;
bool isShadowed() const; bool isShadowed() const;
bool canUnmount() const; bool canUnmount() const;
bool canEject() const; bool canEject() const;

View File

@ -47,6 +47,7 @@ public:
~DGioVolume(); ~DGioVolume();
QString name() const; QString name() const;
QString volumeClass() const;
QString volumeMonitorName() const; QString volumeMonitorName() const;
bool canMount() const; bool canMount() const;
bool canEject() const; bool canEject() const;

View File

@ -130,6 +130,13 @@ QString DGioMount::uuid() const
return d->uuid(); return d->uuid();
} }
QString DGioMount::mountClass() const
{
Q_D(const DGioMount);
return QString(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(d->m_gmmMountPtr->gobj())));
}
/*! /*!
* \brief Determines if mount is shadowed. * \brief Determines if mount is shadowed.
* *

View File

@ -84,6 +84,13 @@ QString DGioVolume::name() const
return d->name(); return d->name();
} }
QString DGioVolume::volumeClass() const
{
Q_D(const DGioVolume);
return QString(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(d->m_gmmVolumePtr->gobj())));
}
QString DGioVolume::volumeMonitorName() const QString DGioVolume::volumeMonitorName() const
{ {
Q_D(const DGioVolume); Q_D(const DGioVolume);

View File

@ -115,7 +115,7 @@ int main(int argc, char * argv[])
QExplicitlySharedDataPointer<DGioFile> f2 = p->getDefaultLocationFile(); QExplicitlySharedDataPointer<DGioFile> f2 = p->getDefaultLocationFile();
qDebug() << f->uri() << f2->uri() << f->path() << f2->path(); qDebug() << f->uri() << f2->uri() << f->path() << f2->path();
qDebug() << f->uri() << f2->uri(); qDebug() << f->uri() << f2->uri();
qDebug() << p->name() << p->uuid() << p->canUnmount() << p->themedIconNames() << p->themedIconNames(); qDebug() << p->name() << p->uuid() << p->mountClass() << p->canUnmount() << p->themedIconNames() << p->themedIconNames();
} }
qDebug() << "--------volumes--------------"; qDebug() << "--------volumes--------------";
@ -123,7 +123,7 @@ int main(int argc, char * argv[])
const QList<QExplicitlySharedDataPointer<DGioVolume> > vols = DGioVolumeManager::getVolumes(); const QList<QExplicitlySharedDataPointer<DGioVolume> > vols = DGioVolumeManager::getVolumes();
for (const QExplicitlySharedDataPointer<DGioVolume> &p : vols) { for (const QExplicitlySharedDataPointer<DGioVolume> &p : vols) {
qDebug() << p->name() << p->volumeMonitorName() qDebug() << p->name() << p->volumeClass() << p->volumeMonitorName()
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_UUID) << p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_UUID)
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_CLASS) << p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_CLASS)
<< p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_LABEL) << p->identifier(DGioVolumeIdentifierType::VOLUME_IDENTIFIER_TYPE_LABEL)