mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 20:09:50 +01:00
Recognise iPods correctly when using GIO.
This commit is contained in:
parent
2c6791f6d7
commit
eddc47cc64
@ -54,12 +54,6 @@ void DeviceLister::ThreadStarted() {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool IsIpod(const QString& path) {
|
|
||||||
return QFile::exists(path + "/iTunes_Control") ||
|
|
||||||
QFile::exists(path + "/iPod_Control") ||
|
|
||||||
QFile::exists(path + "/iTunes/iTunes_Control");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPOD
|
#ifdef HAVE_LIBGPOD
|
||||||
|
|
||||||
QString GetIpodColour(Itdb_IpodModel model) {
|
QString GetIpodColour(Itdb_IpodModel model) {
|
||||||
@ -164,7 +158,7 @@ QString GetIpodModel(Itdb_IpodModel model) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl DeviceLister::MakeUrlFromLocalPath(const QString& path) {
|
QUrl DeviceLister::MakeUrlFromLocalPath(const QString& path) const {
|
||||||
if (IsIpod(path)) {
|
if (IsIpod(path)) {
|
||||||
QUrl ret;
|
QUrl ret;
|
||||||
ret.setScheme("ipod");
|
ret.setScheme("ipod");
|
||||||
@ -175,6 +169,12 @@ QUrl DeviceLister::MakeUrlFromLocalPath(const QString& path) {
|
|||||||
return QUrl::fromLocalFile(path);
|
return QUrl::fromLocalFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DeviceLister::IsIpod(const QString& path) const {
|
||||||
|
return QFile::exists(path + "/iTunes_Control") ||
|
||||||
|
QFile::exists(path + "/iPod_Control") ||
|
||||||
|
QFile::exists(path + "/iTunes/iTunes_Control");
|
||||||
|
}
|
||||||
|
|
||||||
QStringList DeviceLister::GuessIconForPath(const QString& path) {
|
QStringList DeviceLister::GuessIconForPath(const QString& path) {
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
QUrl MakeUrlFromLocalPath(const QString& path);
|
QUrl MakeUrlFromLocalPath(const QString& path) const;
|
||||||
|
bool IsIpod(const QString& path) const;
|
||||||
|
|
||||||
QStringList GuessIconForPath(const QString& path);
|
QStringList GuessIconForPath(const QString& path);
|
||||||
QStringList GuessIconForModel(const QString& vendor, const QString& model);
|
QStringList GuessIconForModel(const QString& vendor, const QString& model);
|
||||||
|
@ -171,8 +171,18 @@ QList<QUrl> GioLister::MakeDeviceUrls(const QString& id) {
|
|||||||
// gphoto2 gives invalid hostnames with []:, characters in
|
// gphoto2 gives invalid hostnames with []:, characters in
|
||||||
uri.replace(QRegExp("//\\[usb:(\\d+),(\\d+)\\]"), "//usb-\\1-\\2");
|
uri.replace(QRegExp("//\\[usb:(\\d+),(\\d+)\\]"), "//usb-\\1-\\2");
|
||||||
|
|
||||||
|
QUrl url(uri);
|
||||||
|
|
||||||
QList<QUrl> ret;
|
QList<QUrl> ret;
|
||||||
ret << uri;
|
|
||||||
|
// Special case for file:// GIO URIs - we have to check whether they point
|
||||||
|
// to an ipod.
|
||||||
|
if (url.isValid() && url.scheme() == "file") {
|
||||||
|
ret << MakeUrlFromLocalPath(url.path());
|
||||||
|
} else {
|
||||||
|
ret << url;
|
||||||
|
}
|
||||||
|
|
||||||
ret << MakeUrlFromLocalPath(mount_point);
|
ret << MakeUrlFromLocalPath(mount_point);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user