Make AskForScan() per-device rather than per device lister and fix cddadevice to use the url rather than the unique id.
This commit is contained in:
parent
b458c9d24c
commit
50824cafe9
|
@ -53,7 +53,7 @@ void CddaDevice::Init() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_CDDA_BASE_SRC(cdda_)->device = g_strdup (unique_id_.toLocal8Bit().constData());
|
GST_CDDA_BASE_SRC(cdda_)->device = g_strdup (url_.path().toLocal8Bit().constData());
|
||||||
|
|
||||||
// Change the element's state to ready and paused, to be able to query it
|
// Change the element's state to ready and paused, to be able to query it
|
||||||
if (gst_element_set_state(cdda_, GST_STATE_READY) == GST_STATE_CHANGE_FAILURE ||
|
if (gst_element_set_state(cdda_, GST_STATE_READY) == GST_STATE_CHANGE_FAILURE ||
|
||||||
|
@ -88,7 +88,7 @@ void CddaDevice::Init() {
|
||||||
song.set_id(track_number);
|
song.set_id(track_number);
|
||||||
song.set_valid(true);
|
song.set_valid(true);
|
||||||
song.set_filetype(Song::Type_Cdda);
|
song.set_filetype(Song::Type_Cdda);
|
||||||
song.set_url(QUrl(QString("cdda://%1/%2").arg(unique_id()).arg(track_number)));
|
song.set_url(QUrl(QString("cdda://%1/%2").arg(url_.path()).arg(track_number)));
|
||||||
song.set_title(QString("Track %1").arg(track_number));
|
song.set_title(QString("Track %1").arg(track_number));
|
||||||
song.set_track(track_number);
|
song.set_track(track_number);
|
||||||
songs << song;
|
songs << song;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
quint64 DeviceCapacity(const QString& id);
|
quint64 DeviceCapacity(const QString& id);
|
||||||
quint64 DeviceFreeSpace(const QString& id);
|
quint64 DeviceFreeSpace(const QString& id);
|
||||||
QVariantMap DeviceHardwareInfo(const QString& id);
|
QVariantMap DeviceHardwareInfo(const QString& id);
|
||||||
bool AskForScan() { return false; }
|
bool AskForScan(const QString&) const { return false; }
|
||||||
QString MakeFriendlyName(const QString&);
|
QString MakeFriendlyName(const QString&);
|
||||||
QList<QUrl> MakeDeviceUrls(const QString&);
|
QList<QUrl> MakeDeviceUrls(const QString&);
|
||||||
void UnmountDevice(const QString&);
|
void UnmountDevice(const QString&);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
// When connecting to a device for the first time, do we want an user's
|
// When connecting to a device for the first time, do we want an user's
|
||||||
// confirmation for scanning it? (by default yes)
|
// confirmation for scanning it? (by default yes)
|
||||||
virtual bool AskForScan() { return true; }
|
virtual bool AskForScan(const QString&) const { return true; }
|
||||||
|
|
||||||
virtual QString MakeFriendlyName(const QString& id) = 0;
|
virtual QString MakeFriendlyName(const QString& id) = 0;
|
||||||
virtual QList<QUrl> MakeDeviceUrls(const QString& id) = 0;
|
virtual QList<QUrl> MakeDeviceUrls(const QString& id) = 0;
|
||||||
|
|
|
@ -319,7 +319,7 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
|
||||||
if (info.database_id_ == -1 &&
|
if (info.database_id_ == -1 &&
|
||||||
!info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) {
|
!info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) {
|
||||||
|
|
||||||
if (info.BestBackend()->lister_->AskForScan()) {
|
if (info.BestBackend()->lister_->AskForScan(info.BestBackend()->unique_id_)) {
|
||||||
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox(
|
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox(
|
||||||
QMessageBox::Information, tr("Connect device"),
|
QMessageBox::Information, tr("Connect device"),
|
||||||
tr("This is the first time you have connected this device. Clementine will now scan the device to find music files - this may take some time."),
|
tr("This is the first time you have connected this device. Clementine will now scan the device to find music files - this may take some time."),
|
||||||
|
|
|
@ -308,8 +308,9 @@ void DeviceView::DeviceDisconnected(int row) {
|
||||||
|
|
||||||
void DeviceView::Forget() {
|
void DeviceView::Forget() {
|
||||||
QModelIndex device_idx = MapToDevice(menu_index_);
|
QModelIndex device_idx = MapToDevice(menu_index_);
|
||||||
|
QString unique_id = manager_->data(device_idx, DeviceManager::Role_UniqueId).toString();
|
||||||
if (manager_->GetLister(device_idx.row()) &&
|
if (manager_->GetLister(device_idx.row()) &&
|
||||||
manager_->GetLister(device_idx.row())->AskForScan()) {
|
manager_->GetLister(device_idx.row())->AskForScan(unique_id)) {
|
||||||
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox(
|
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox(
|
||||||
QMessageBox::Question, tr("Forget device"),
|
QMessageBox::Question, tr("Forget device"),
|
||||||
tr("Forgetting a device will remove it from this list and Clementine will have to rescan all the songs again next time you connect it."),
|
tr("Forgetting a device will remove it from this list and Clementine will have to rescan all the songs again next time you connect it."),
|
||||||
|
|
|
@ -24,6 +24,7 @@ class MacDeviceLister : public DeviceLister {
|
||||||
virtual quint64 DeviceCapacity(const QString& id);
|
virtual quint64 DeviceCapacity(const QString& id);
|
||||||
virtual quint64 DeviceFreeSpace(const QString& id);
|
virtual quint64 DeviceFreeSpace(const QString& id);
|
||||||
virtual QVariantMap DeviceHardwareInfo(const QString& id);
|
virtual QVariantMap DeviceHardwareInfo(const QString& id);
|
||||||
|
virtual bool AskForScan(const QString& serial) const;
|
||||||
virtual QString MakeFriendlyName(const QString& id);
|
virtual QString MakeFriendlyName(const QString& id);
|
||||||
virtual QList<QUrl> MakeDeviceUrls(const QString& id);
|
virtual QList<QUrl> MakeDeviceUrls(const QString& id);
|
||||||
|
|
||||||
|
|
|
@ -823,6 +823,10 @@ quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial){
|
||||||
|
|
||||||
QVariantMap MacDeviceLister::DeviceHardwareInfo(const QString& serial){return QVariantMap();}
|
QVariantMap MacDeviceLister::DeviceHardwareInfo(const QString& serial){return QVariantMap();}
|
||||||
|
|
||||||
|
bool MacDeviceLister::AskForScan(const QString& serial) const {
|
||||||
|
return !IsCDDevice(serial);
|
||||||
|
}
|
||||||
|
|
||||||
void MacDeviceLister::UnmountDevice(const QString& serial) {
|
void MacDeviceLister::UnmountDevice(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) return;
|
if (IsMTPSerial(serial)) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue