Example #1
0
DeviceManagerUnix::DeviceManagerUnix(QObject *parent)
    : DeviceManager(parent)
{
    qDBusRegisterMetaType<QVariantMapMap>();
    qDBusRegisterMetaType<DBusManagedObjects>();
    qDBusRegisterMetaType<ByteArrayList>();
    //qDBusRegisterMetaType<ByteArray>();

    // Check for presence of udisks2
    auto system = QDBusConnection::systemBus();
    serviceConnected = system.isConnected()
            && system.interface()->isServiceRegistered(DBUS_SERVICE_NAME);
    if (!serviceConnected)
        return;

    // Listen to interface changes
    system.connect(DBUS_SERVICE_NAME, DBUS_OBJECT_ROOT,
                   DBUS_IFACE_MANAGER, DBUS_IFACE_ADDED,
                   this, SLOT(dbus_interfaceAdded(QDBusObjectPath,QMap<QString,QVariant>)));
    system.connect(DBUS_SERVICE_NAME, DBUS_OBJECT_ROOT,
                   DBUS_IFACE_MANAGER, DBUS_IFACE_REMOVED,
                   this, SLOT(dbus_interfaceRemoved(QDBusObjectPath,QStringList)));

    // Populate our data fields
    foreach (QString drive, drives()) {
        addDrive(drive);
    }
Example #2
0
void djvSystemTest::run(int & argc, char ** argv)
{
    DJV_DEBUG("djvSystemTest::run");
    
    QCoreApplication app(argc, argv);
    
    searchPath();
    drives();
}
 std::vector<DocumentBrowser::Drive*> DocumentBrowser::getDrives() const
 {
     std::vector<DocumentBrowser::Drive*> drives(m_drives.size());
     for(auto& drive_pair : m_drives)
     {
         drives.emplace_back(drive_pair.second.get());
     }
     
     return drives;
 }
 foreach( FmDlgCloseUnit* unit, mDlgCloseUnitList ) {
     QString drives( unit->associatedDrives() );
     for( int i = 0; i < drives.length(); i++ ) {
         QString drive( drives[i] + QString( ":/" ) );
         if( !FmUtils::isDriveAvailable( drive ) ) {
             FM_LOG( " close Dialog start " );
             unit->dialog()->close();
             FM_LOG( " close Dialog end " );
         }
     }
 }