Commit d7f6b0d0 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

IDeviceLister: Add an isDeviceKnown method

parent 32fb81e0
......@@ -44,6 +44,14 @@ public:
* @param uuid The device UUID
*/
virtual void onDeviceUnplugged( const std::string& uuid ) = 0;
/**
* @brief isDeviceKnown Returns true is the provided device is already known to the media library
*
* @note This doesn't reflect the plugged/unplugged state of the device. This is merely an
* indication that the device has been seen at least once by the media library
* @param uuid The device UUID
*/
virtual bool isDeviceKnown( const std::string& uuid ) const = 0;
};
class IDeviceLister
......
......@@ -886,4 +886,9 @@ void MediaLibrary::onDeviceUnplugged( const std::string& uuid )
}
}
bool MediaLibrary::isDeviceKnown( const std::string& uuid ) const
{
return Device::fromUuid( this, uuid ) != nullptr;
}
}
......@@ -165,6 +165,7 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
private:
virtual bool onDevicePlugged( const std::string& uuid, const std::string& mountpoint ) override;
virtual void onDeviceUnplugged(const std::string& uuid) override;
virtual bool isDeviceKnown( const std::string& uuid ) const override;
protected:
std::unique_ptr<SqliteConnection> m_dbConnection;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment