try to start the 'load cover' dialog in album cover manager inside the chosen album's folder (Fixes issue #733)
This commit is contained in:
parent
80e8fc8d60
commit
61d5641c35
@ -510,8 +510,11 @@ void AlbumCoverManager::ChooseManualCover() {
|
||||
return;
|
||||
QListWidgetItem* item = context_menu_items_[0];
|
||||
|
||||
QString dir = InitialPathForOpenCoverDialog(item->data(Role_PathAutomatic).toString(),
|
||||
item->data(Role_FirstFilename).toString());
|
||||
|
||||
QString cover = QFileDialog::getOpenFileName(
|
||||
this, tr("Choose manual cover"), item->data(Role_PathAutomatic).toString(),
|
||||
this, tr("Choose manual cover"), dir,
|
||||
tr("Images (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm *.tiff)") + ";;" +
|
||||
tr("All files (*)"));
|
||||
if (cover.isNull())
|
||||
@ -533,6 +536,18 @@ void AlbumCoverManager::ChooseManualCover() {
|
||||
cover_loading_tasks_[id] = item;
|
||||
}
|
||||
|
||||
QString AlbumCoverManager::InitialPathForOpenCoverDialog(const QString& path_automatic, const QString& first_file_name) const {
|
||||
if(!path_automatic.isEmpty() && path_automatic != "embedded") {
|
||||
return path_automatic;
|
||||
} else if (!first_file_name.isEmpty() && first_file_name.contains('/')) {
|
||||
// we get rid of the filename because it's extension is screwing with the dialog's
|
||||
// filters
|
||||
return first_file_name.section('/', 0, -2);
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
void AlbumCoverManager::UnsetCover() {
|
||||
foreach (QListWidgetItem* item, context_menu_items_) {
|
||||
item->setIcon(no_cover_icon_);
|
||||
|
@ -111,6 +111,8 @@ class AlbumCoverManager : public QMainWindow {
|
||||
Hide_WithoutCovers,
|
||||
};
|
||||
|
||||
QString InitialPathForOpenCoverDialog(const QString& path_automatic, const QString& first_file_name) const;
|
||||
|
||||
void CancelRequests();
|
||||
|
||||
void UpdateStatusText();
|
||||
|
Loading…
x
Reference in New Issue
Block a user