organise: Update the song preview when the selected destination's data changes
This will cause the file exensions to change when transcode options are changed.
This commit is contained in:
parent
4dd3233976
commit
c299c198de
@ -113,6 +113,13 @@ void OrganiseDialog::SetDestinationModel(QAbstractItemModel* model,
|
||||
ui_->destination->setModel(model);
|
||||
|
||||
ui_->eject_after->setVisible(devices);
|
||||
|
||||
// In case this is called more than once, disconnect old model.
|
||||
if (model_connection_) disconnect(model_connection_);
|
||||
// If a device changes, transcoding options may have changed.
|
||||
model_connection_ =
|
||||
connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
|
||||
SLOT(DestDataChanged(QModelIndex, QModelIndex)));
|
||||
}
|
||||
|
||||
bool OrganiseDialog::SetSongs(const SongList& songs) {
|
||||
@ -306,6 +313,16 @@ void OrganiseDialog::UpdatePreviews() {
|
||||
}
|
||||
}
|
||||
|
||||
void OrganiseDialog::DestDataChanged(const QModelIndex& begin,
|
||||
const QModelIndex& end) {
|
||||
const QModelIndex destination =
|
||||
ui_->destination->model()->index(ui_->destination->currentIndex(), 0);
|
||||
if (QItemSelection(begin, end).contains(destination)) {
|
||||
qLog(Debug) << "Destination data changed";
|
||||
UpdatePreviews();
|
||||
}
|
||||
}
|
||||
|
||||
QSize OrganiseDialog::sizeHint() const { return QSize(650, 0); }
|
||||
|
||||
void OrganiseDialog::Reset() {
|
||||
|
@ -80,6 +80,8 @@ signals:
|
||||
void InsertTag(const QString& tag);
|
||||
void UpdatePreviews();
|
||||
|
||||
void DestDataChanged(const QModelIndex& begin, const QModelIndex& end);
|
||||
|
||||
void OrganiseFinished(const QStringList& files_with_errors);
|
||||
|
||||
private:
|
||||
@ -93,6 +95,8 @@ signals:
|
||||
TaskManager* task_manager_;
|
||||
LibraryBackend* backend_;
|
||||
|
||||
QMetaObject::Connection model_connection_;
|
||||
|
||||
OrganiseFormat format_;
|
||||
|
||||
QFuture<SongList> songs_future_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user