diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d4606d4c..d3bb4c233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set(DEBIAN_PACKAGE_DESCRIPTION "Qt Client for MPD") set(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_PACKAGE_VERSION_MAJOR "2") set(CPACK_PACKAGE_VERSION_MINOR "2") -set(CPACK_PACKAGE_VERSION_PATCH "50") +set(CPACK_PACKAGE_VERSION_PATCH "51") set(CPACK_PACKAGE_VERSION_SPIN "") # Use ".$number" - e.g. ".1" set(CPACK_PACKAGE_CONTACT "Craig Drummond ") set(CANTATA_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") @@ -305,7 +305,7 @@ include_directories(${CMAKE_SOURCE_DIR}/3rdparty ${CMAKE_SOURCE_DIR} ${CMAKE_BIN set(CANTATA_SRCS ${CANTATA_SRCS} gui/settings.cpp gui/application.cpp gui/initialsettingswizard.cpp gui/mainwindow.cpp gui/preferencesdialog.cpp gui/customactionssettings.cpp - gui/filesettings.cpp gui/interfacesettings.cpp gui/playbacksettings.cpp gui/serversettings.cpp gui/librarypage.cpp gui/customactions.cpp + gui/interfacesettings.cpp gui/playbacksettings.cpp gui/serversettings.cpp gui/librarypage.cpp gui/customactions.cpp gui/folderpage.cpp gui/trayitem.cpp gui/cachesettings.cpp gui/coverdialog.cpp gui/searchpage.cpp gui/stdactions.cpp gui/main.cpp gui/covers.cpp gui/currentcover.cpp gui/mpdbrowsepage.cpp gui/localfolderpage.cpp devices/deviceoptions.cpp @@ -376,8 +376,7 @@ set(CANTATA_MOC_HDRS ${CANTATA_MOC_HDRS} playlists/smartplaylistspage.h scrobbling/scrobbler.h scrobbling/scrobblingsettings.h scrobbling/scrobblingstatus.h scrobbling/scrobblinglove.h) set(CANTATA_UIS ${CANTATA_UIS} - gui/initialsettingswizard.ui gui/mainwindow.ui - gui/filesettings.ui gui/interfacesettings.ui gui/playbacksettings.ui gui/serversettings.ui gui/coverdialog.ui + gui/initialsettingswizard.ui gui/mainwindow.ui gui/interfacesettings.ui gui/playbacksettings.ui gui/serversettings.ui gui/coverdialog.ui context/togglelist.ui context/othersettings.ui streams/digitallyimportedsettings.ui streams/streamssettings.ui playlists/playlistrule.ui playlists/playlistrules.ui diff --git a/ChangeLog b/ChangeLog index 6a17b09a4..f0700070d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,9 @@ 50. Center images and headers in context view. 51. Add option to make album cover in context view fill the album details width. +52. Cleanup some settings. No longer offer to save lyrics, artist images, and + backdrops in MPD folder, just save in cache dir. Move cover filename + setting into interface settings - in a new 'Covers' tab. 2.2.0 ----- diff --git a/context/contextwidget.cpp b/context/contextwidget.cpp index f90ae784f..6240953f9 100644 --- a/context/contextwidget.cpp +++ b/context/contextwidget.cpp @@ -911,41 +911,12 @@ void ContextWidget::downloadResponse() } if (!img.isNull()) { - bool saved=false; - - if (Settings::self()->storeBackdropsInMpdDir() && !currentSong.isVariousArtists() && - !currentSong.isNonMPD() && MPDConnection::self()->getDetails().dirReadable) { - QString mpdDir=MPDConnection::self()->getDetails().dir; - QString songDir=Utils::getDir(currentSong.file); - if (!mpdDir.isEmpty() && 2==songDir.split(Utils::constDirSep, QString::SkipEmptyParts).count()) { - QDir d(mpdDir+songDir); - d.cdUp(); - QString fileName=Utils::fixPath(d.absolutePath())+constBackdropFileName+".jpg"; - QFile f(fileName); - if (f.open(QIODevice::WriteOnly)) { - f.write(data); - f.close(); - DBUG << "Saved backdrop to" << fileName << "for artist" << currentArtist << ", current song" << currentSong.file; - saved=true; - } - } else { - DBUG << "Not saving to mpd folder, mpd dir:" << mpdDir - << "num parts:" << songDir.split(Utils::constDirSep, QString::SkipEmptyParts).count(); - } - } else { - DBUG << "Not saving to mpd folder - set to save in mpd?" << Settings::self()->storeBackdropsInMpdDir() - << "isVa:" << currentSong.isVariousArtists() << "isNonMPD:" << currentSong.isNonMPD() - << "mpd readable:" << MPDConnection::self()->getDetails().dirReadable; - } - - if (!saved) { - QString cacheName=cacheFileName(currentArtist, true); - QFile f(cacheName); - if (f.open(QIODevice::WriteOnly)) { - DBUG << "Saved backdrop to (cache)" << cacheName << "for artist" << currentArtist << ", current song" << currentSong.file; - f.write(data); - f.close(); - } + QString cacheName=cacheFileName(currentArtist, true); + QFile f(cacheName); + if (f.open(QIODevice::WriteOnly)) { + DBUG << "Saved backdrop to (cache)" << cacheName << "for artist" << currentArtist << ", current song" << currentSong.file; + f.write(data); + f.close(); } } updateImage(img); diff --git a/context/songview.cpp b/context/songview.cpp index 11f5bde06..473e25355 100644 --- a/context/songview.cpp +++ b/context/songview.cpp @@ -703,9 +703,7 @@ void SongView::abort() text->setText(QString()); // Set lyrics file anyway - so that editing is enabled! - lyricsFile=Settings::self()->storeLyricsInMpdDir() && !currentSong.isNonMPD() - ? mpdLyricsFilePath(currentSong) - : lyricsCacheFileName(currentSong); + lyricsFile=lyricsCacheFileName(currentSong); setMode(Mode_Display); } cancelJobAction->setEnabled(false); @@ -808,10 +806,7 @@ void SongView::lyricsReady(int id, QString lyrics) } else { text->setText(fixNewLines(plain)); lyricsFile=QString(); - if (! ( Settings::self()->storeLyricsInMpdDir() && !currentSong.isNonMPD() && - saveFile(mpdLyricsFilePath(currentSong))) ) { - saveFile(lyricsCacheFileName(currentSong, true)); - } + saveFile(lyricsCacheFileName(currentSong, true)); setMode(Mode_Display); } } @@ -853,9 +848,7 @@ void SongView::getLyrics() text->setText(QString()); currentProvider=-1; // Set lyrics file anyway - so that editing is enabled! - lyricsFile=Settings::self()->storeLyricsInMpdDir() && !currentSong.isNonMPD() - ? mpdLyricsFilePath(currentSong) - : lyricsCacheFileName(currentSong); + lyricsFile=lyricsCacheFileName(currentSong); setMode(Mode_Display); } } diff --git a/devices/extractjob.cpp b/devices/extractjob.cpp index 712ecd3ae..f1d6a62d1 100644 --- a/devices/extractjob.cpp +++ b/devices/extractjob.cpp @@ -153,11 +153,7 @@ void ExtractJob::run() Tags::update(destFile, Song(), song, 3); if (!stopRequested && !coverFile.isEmpty()) { - QString mpdCover=MPDConnection::self()->getDetails().coverName; - if (mpdCover.isEmpty()) { - mpdCover=Covers::constFileName; - } - copiedCover=Covers::copyImage(Utils::getDir(coverFile), Utils::getDir(destFile), Utils::getFile(coverFile), mpdCover+coverFile.mid(coverFile.length()-4), 0); + copiedCover=Covers::copyImage(Utils::getDir(coverFile), Utils::getDir(destFile), Utils::getFile(coverFile), Covers::albumFileName(song)+coverFile.mid(coverFile.length()-4), 0); } emit result(Device::Ok); diff --git a/devices/mtpdevice.cpp b/devices/mtpdevice.cpp index 25753b880..8206be214 100644 --- a/devices/mtpdevice.cpp +++ b/devices/mtpdevice.cpp @@ -965,11 +965,7 @@ void MtpConnection::getSong(const Song &song, const QString &dest, bool fixVa, b File cover=getCoverDetils(song); if (0!=cover.id) { - QString mpdCover=MPDConnection::self()->getDetails().coverName; - if (mpdCover.isEmpty()) { - mpdCover="cover"; - } - QString fileName=QString(destDir+mpdCover+(cover.name.endsWith(".jpg", Qt::CaseInsensitive) ? ".jpg" : ".png")); + QString fileName=QString(destDir+Covers::albumFileName(song)+(cover.name.endsWith(".jpg", Qt::CaseInsensitive) ? ".jpg" : ".png")); QByteArray fileNameUtf8=fileName.toUtf8(); copiedCover=0==LIBMTP_Get_File_To_File(device, cover.id, fileNameUtf8.constData(), 0, 0); if (copiedCover) { diff --git a/gui/coverdialog.cpp b/gui/coverdialog.cpp index 48ee6efc4..cb9f7730a 100644 --- a/gui/coverdialog.cpp +++ b/gui/coverdialog.cpp @@ -1216,7 +1216,7 @@ bool CoverDialog::saveCover(const QString &src, const QImage &img) QString destName; QString mpdDir; QString dirName; - bool saveInMpd=Settings::self()->storeCoversInMpdDir(); + bool saveInMpd=!isArtist && Settings::self()->storeCoversInMpdDir(); if (saveInMpd) { bool haveAbsPath=filePath.startsWith('/'); @@ -1232,7 +1232,7 @@ bool CoverDialog::saveCover(const QString &src, const QImage &img) if (saveInMpd && !mpdDir.isEmpty() && dirName.startsWith(mpdDir) && 2==dirName.mid(mpdDir.length()).split('/', QString::SkipEmptyParts).count()) { QDir d(dirName); d.cdUp(); - destName=d.absolutePath()+'/'+Covers::artistFileName(song)+src.mid(src.length()-4); + destName=d.absolutePath()+'/'+Covers::constArtistImage+src.mid(src.length()-4); } else { destName=Utils::cacheDir(Covers::constCoverDir, true)+Covers::encodeName(song.albumArtist())+src.mid(src.length()-4); } diff --git a/gui/covers.cpp b/gui/covers.cpp index 1d417dc51..087beb8a7 100644 --- a/gui/covers.cpp +++ b/gui/covers.cpp @@ -369,9 +369,10 @@ QString Covers::encodeName(QString name) return name; } +static QString albumCoverName; QString Covers::albumFileName(const Song &song) { - QString coverName=MPDConnection::self()->getDetails().coverName; + QString coverName=albumCoverName; if (coverName.isEmpty()) { coverName=Covers::constFileName; } @@ -384,30 +385,6 @@ QString Covers::albumFileName(const Song &song) return coverName; } -QString Covers::artistFileName(const Song &song) -{ - QString coverName=MPDConnection::self()->getDetails().coverName; - if (coverName.contains(QLatin1Char('%'))) { - QString rv=encodeName(song.isVariousArtists() ? song.basicArtist() : song.albumArtist()); - if (!rv.isEmpty()) { - return rv; - } - } - return constArtistImage; -} - -QString Covers::composerFileName(const Song &song) -{ - QString coverName=MPDConnection::self()->getDetails().coverName; - if (coverName.contains(QLatin1Char('%'))) { - QString rv=encodeName(song.composer()); - if (!rv.isEmpty()) { - return rv; - } - } - return constComposerImage; -} - QString Covers::fixArtist(const QString &artist) { if (artist.isEmpty()) { @@ -616,9 +593,9 @@ bool CoverDownloader::downloadViaHttp(Job &job, JobType type) { QUrl u; QString coverName=job.song.isArtistImageRequest() - ? Covers::artistFileName(job.song) + ? Covers::constArtistImage : job.song.isComposerImageRequest() - ? Covers::composerFileName(job.song) + ? Covers::constComposerImage : Covers::albumFileName(job.song); coverName+=constExtensions[JobHttpJpg==type ? 0 : 1]; QString dir=Utils::getDir(job.filePath); @@ -873,19 +850,20 @@ QString CoverDownloader::saveImg(const Job &job, const QImage &img, const QByteA } if (job.song.isArtistImageRequest() || job.song.isComposerImageRequest()) { - if (saveInMpdDir && !job.song.isNonMPD() && canSaveTo(job.dir)) { - QString mpdDir=MPDConnection::self()->getDetails().dir; - if (!mpdDir.isEmpty() && job.dir.startsWith(mpdDir) && 2==job.dir.mid(mpdDir.length()).split(Utils::constDirSep, QString::SkipEmptyParts).count()) { - QDir d(job.dir); - d.cdUp(); - savedName=save(mimeType, extension, d.absolutePath()+Utils::constDirSep+ - (job.song.isArtistImageRequest() ? Covers::artistFileName(job.song) : Covers::composerFileName(job.song)), img, raw); - if (!savedName.isEmpty()) { - DBUG << job.song.file << savedName; - return savedName; - } - } - } + // (As of 2.3.0) No longer save artist images into MPD dir +// if (saveInMpdDir && !job.song.isNonMPD() && canSaveTo(job.dir)) { +// QString mpdDir=MPDConnection::self()->getDetails().dir; +// if (!mpdDir.isEmpty() && job.dir.startsWith(mpdDir) && 2==job.dir.mid(mpdDir.length()).split(Utils::constDirSep, QString::SkipEmptyParts).count()) { +// QDir d(job.dir); +// d.cdUp(); +// savedName=save(mimeType, extension, d.absolutePath()+Utils::constDirSep+ +// (job.song.isArtistImageRequest() ? Covers::artistFileName(job.song) : Covers::composerFileName(job.song)), img, raw); +// if (!savedName.isEmpty()) { +// DBUG << job.song.file << savedName; +// return savedName; +// } +// } +// } QString dir = Utils::cacheDir(Covers::constCoverDir, true); if (!dir.isEmpty()) { @@ -1082,6 +1060,10 @@ void Covers::readConfig() { saveInMpdDir=Settings::self()->storeCoversInMpdDir(); fetchCovers=Settings::self()->fetchCovers(); + albumCoverName=Settings::self()->coverFilename(); + if (!albumCoverName.isEmpty()) { + albumCoverName=constFileName; + } } void Covers::stop() @@ -1524,12 +1506,10 @@ Covers::Image Covers::locateImage(const Song &song) QStringList coverFileNames; if (song.isArtistImageRequest()) { - QString artistFile=artistFileName(song); QString basicArtist=song.basicArtist(); - coverFileNames=QStringList() << basicArtist+".jpg" << basicArtist+".png" << artistFile+".jpg" << artistFile+".png"; + coverFileNames=QStringList() << basicArtist+".jpg" << basicArtist+".png" << constArtistImage+".jpg" << constArtistImage+".png"; } else if (song.isComposerImageRequest()) { - QString composerFile=composerFileName(song); - coverFileNames=QStringList() << composerFile+".jpg" << composerFile+".png"; + coverFileNames=QStringList() << constComposerImage+".jpg" << constComposerImage+".png"; } else { QString mpdCover=albumFileName(song); if (!mpdCover.isEmpty()) { diff --git a/gui/covers.h b/gui/covers.h index e13ca0b35..1baecdf32 100644 --- a/gui/covers.h +++ b/gui/covers.h @@ -204,8 +204,6 @@ public: static const QStringList &standardNames(); static QString encodeName(QString name); static QString albumFileName(const Song &song); - static QString artistFileName(const Song &song); - static QString composerFileName(const Song &song); static QString fixArtist(const QString &artist); static bool isJpg(const QByteArray &data); static bool isPng(const QByteArray &data); diff --git a/gui/filesettings.cpp b/gui/filesettings.cpp deleted file mode 100644 index 2a5bca1a8..000000000 --- a/gui/filesettings.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2011-2018 Craig Drummond - * - * ---- - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "filesettings.h" -#include "settings.h" - -FileSettings::FileSettings(QWidget *p) - : QWidget(p) -{ - setupUi(this); - - #ifdef Q_OS_MAC - expandingSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed); - #endif -} - -void FileSettings::load() -{ - storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); - storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); - storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir()); -} - -void FileSettings::save() -{ - Settings::self()->saveStoreCoversInMpdDir(storeCoversInMpdDir->isChecked()); - Settings::self()->saveStoreLyricsInMpdDir(storeLyricsInMpdDir->isChecked()); - Settings::self()->saveStoreBackdropsInMpdDir(storeBackdropsInMpdDir->isChecked()); -} - diff --git a/gui/filesettings.h b/gui/filesettings.h deleted file mode 100644 index b631be917..000000000 --- a/gui/filesettings.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Cantata - * - * Copyright (c) 2011-2018 Craig Drummond - * - * ---- - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef FILESETTINGS_H -#define FILESETTINGS_H - -#include "ui_filesettings.h" - -class FileSettings : public QWidget, private Ui::FileSettings -{ -public: - FileSettings(QWidget *p); - ~FileSettings() override { } - - void load(); - void save(); -}; - -#endif diff --git a/gui/filesettings.ui b/gui/filesettings.ui deleted file mode 100644 index edd3fb549..000000000 --- a/gui/filesettings.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - FileSettings - - - - 0 - 0 - 1413 - 462 - - - - - QFormLayout::ExpandingFieldsGrow - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Save downloaded covers, artist, and composer images, in music folder - - - - - - - Save downloaded lyrics in music folder - - - - - - - Save downloaded backdrops in music folder - - - - - - - If you elect to have Cantata store covers, lyrics, or backdrops, within the music folder, and you do not have write access to this folder, then Cantata will revert to saving the files in your personal cache folder. - - - - - - - Cantata can only save backdrops, artist, and composer images within the music folder hierarchy if this is 2 levels deep. i.e. 'Artist/Album/Tracks'. - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - NoteLabel - QLabel -
widgets/notelabel.h
-
-
- - -
diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp index b919c11ff..8c407c2f9 100644 --- a/gui/initialsettingswizard.cpp +++ b/gui/initialsettingswizard.cpp @@ -41,7 +41,7 @@ enum Pages { PAGE_INTRO, PAGE_CONNECTION, - PAGE_FILES, + PAGE_COVERS, PAGE_END }; @@ -73,12 +73,9 @@ InitialSettingsWizard::InitialSettingsWizard(QWidget *p) groupWarningIcon->setVisible(showGroupWarning); int iconSize=Icon::dlgIconSize(); groupWarningIcon->setPixmap(Icon("dialog-warning").pixmap(iconSize, iconSize)); - storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); - storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); - storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir()); introPage->setBackground(Icons::self()->appIcon); connectionPage->setBackground(Icons::self()->audioFileIcon); - filesPage->setBackground(Icons::self()->filesIcon); + //coversPage->setBackground(Icons::self()->filesIcon); finishedPage->setBackground(Icon("dialog-ok")); #ifdef ENABLE_SIMPLE_MPD_SUPPORT @@ -200,18 +197,18 @@ void InitialSettingsWizard::pageChanged(int p) controlNextButton(); return; } - if (PAGE_FILES==p) { - if (dir->text().trimmed().startsWith(QLatin1String("http:/"))) { - storeCoversInMpdDir->setChecked(false); - storeLyricsInMpdDir->setChecked(false); - storeBackdropsInMpdDir->setChecked(false); - httpNote->setVisible(true); - } else { - storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); - storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); - storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir()); - httpNote->setVisible(false); - } + if (PAGE_COVERS==p) { +// if (dir->text().trimmed().startsWith(QLatin1String("http:/"))) { +// storeCoversInMpdDir->setChecked(false); +// storeLyricsInMpdDir->setChecked(false); +// storeBackdropsInMpdDir->setChecked(false); +// httpNote->setVisible(true); +// } else { +// storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); +// storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); +// storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir()); +// httpNote->setVisible(false); +// } } button(NextButton)->setEnabled(PAGE_END!=p); } @@ -242,8 +239,6 @@ void InitialSettingsWizard::controlNextButton() void InitialSettingsWizard::accept() { Settings::self()->saveConnectionDetails(getDetails()); - Settings::self()->saveStoreCoversInMpdDir(storeCoversInMpdDir->isChecked()); - Settings::self()->saveStoreLyricsInMpdDir(storeLyricsInMpdDir->isChecked()); #ifdef ENABLE_SIMPLE_MPD_SUPPORT if (basic->isChecked()) { diff --git a/gui/interfacesettings.cpp b/gui/interfacesettings.cpp index bfddeab7e..9da66f2a6 100644 --- a/gui/interfacesettings.cpp +++ b/gui/interfacesettings.cpp @@ -105,6 +105,24 @@ static inline QString getStrValue(QComboBox *box) static const char * constValueProperty="value"; static const char * constSep=","; +class CoverNameValidator : public QValidator +{ + public: + + CoverNameValidator(QObject *parent) : QValidator(parent) { } + + State validate(QString &input, int &) const override + { + for (int i=0; isetToolTip(coverFilename->toolTip()); + coverFilename->setValidator(new CoverNameValidator(this)); + #ifdef ENABLE_DEVICES_SUPPORT + coverNameNoteLabel->setText(tr("If no setting is specified for 'Filename', then Cantata will use a default of " + "cover. This filename is used when downloading covers, or when adding " + " music to your library from devices.")); + #else + coverNameNoteLabel->setText(tr("If no setting is specified for 'Filename', then Cantata will use a default of " + "cover. This filename is used when downloading covers.")); + #endif setMinimumSize(750, 650); } @@ -251,6 +279,8 @@ void InterfaceSettings::load() systemTrayPopup->setChecked(Settings::self()->showPopups()); } fetchCovers->setChecked(Settings::self()->fetchCovers()); + saveCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); + coverFilename->setText(Settings::self()->coverFilename()); QStringList hiddenPages=Settings::self()->hiddenPages(); for (int i=0; icount(); ++i) { @@ -327,6 +357,8 @@ void InterfaceSettings::save() Settings::self()->saveStartupState(Settings::SS_Previous); } Settings::self()->saveFetchCovers(fetchCovers->isChecked()); + Settings::self()->saveStoreCoversInMpdDir(saveCoversInMpdDir->isChecked()); + Settings::self()->saveCoverFilename(coverFilename->text().trimmed()); if (loaded && lang) { Settings::self()->saveLang(lang->itemData(lang->currentIndex()).toString()); } @@ -551,3 +583,8 @@ void InterfaceSettings::systemTrayPopupToggled() systemTrayCheckBox->setChecked(true); } } + +void InterfaceSettings::saveCoversInMpdDirToggled() +{ + saveCoversInMpdDirLabel->setOn(saveCoversInMpdDir->isChecked() && saveCoversInMpdDir->isChecked()!=Settings::self()->storeCoversInMpdDir()); +} diff --git a/gui/interfacesettings.h b/gui/interfacesettings.h index 7c963338b..eb3259d43 100644 --- a/gui/interfacesettings.h +++ b/gui/interfacesettings.h @@ -59,6 +59,7 @@ private Q_SLOTS: void enablePlayQueueBackgroundOptions(); void systemTrayCheckBoxToggled(); void systemTrayPopupToggled(); + void saveCoversInMpdDirToggled(); private: bool loaded; diff --git a/gui/interfacesettings.ui b/gui/interfacesettings.ui index 21c29bcc9..9911489bf 100644 --- a/gui/interfacesettings.ui +++ b/gui/interfacesettings.ui @@ -618,6 +618,74 @@ + + + Covers + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + Fetch missing covers + + + + + + + Save downloaded covers into Music folder + + + + + + + Filename: + + + coverFilename + + + + + + + <p>Filename (without extension) to save downloaded covers as.<br/>If left blank 'cover' will be used.<br/><br/><i>%artist% will be replaced with album artist of the current song, and %album% will be replaced with the album name.</i></p> + + + + + + + + + If you enable 'Save downloaded covers into Music folder' you may need to clear the cache of any previous covers to force downloading of new covers. See 'Cache' settings page for further details. + + + + + + + + + + Qt::Vertical + + + + 16 + 16 + + + + + + General @@ -629,34 +697,27 @@ QFormLayout::ExpandingFieldsGrow - - - Fetch missing covers from Last.fm - - - - Show delete action in context menus - + Enforce single-click activation of items - + Show song information tooltips - + Language: @@ -666,10 +727,10 @@ - + - + Style: @@ -679,7 +740,7 @@ - + diff --git a/gui/preferencesdialog.cpp b/gui/preferencesdialog.cpp index 7ed14629c..c83b05498 100644 --- a/gui/preferencesdialog.cpp +++ b/gui/preferencesdialog.cpp @@ -27,7 +27,6 @@ #include "interfacesettings.h" #include "serversettings.h" #include "playbacksettings.h" -#include "filesettings.h" #include "context/contextsettings.h" #include "cachesettings.h" #include "customactionssettings.h" @@ -57,7 +56,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) iCount++; server = new ServerSettings(this); playback = new PlaybackSettings(this); - files = new FileSettings(this); interface = new InterfaceSettings(this); context = new ContextSettings(this); cache = new CacheSettings(this); @@ -65,14 +63,14 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) custom = new CustomActionsSettings(this); server->load(); playback->load(); - files->load(); + //cover->load(); interface->load(); context->load(); scrobbling->load(); custom->load(); addPage(QLatin1String("collection"), server, tr("Collection"), Icon("audio-x-generic"), tr("Collection Settings")); addPage(QLatin1String("playback"), playback, tr("Playback"), Icons::self()->speakerIcon, tr("Playback Settings")); - addPage(QLatin1String("files"), files, tr("Downloaded Files"), Icons::self()->filesIcon, tr("Downloaded Files Settings")); + //addPage(QLatin1String("cover"), files, tr("Covers"), Icons::self()->filesIcon, tr("Album Cover Settings")); addPage(QLatin1String("interface"), interface, tr("Interface"), Icon("preferences-other"), tr("Interface Settings")); addPage(QLatin1String("info"), context, tr("Info"), Icons::self()->contextIcon, tr("Info View Settings")); addPage(QLatin1String("scrobbling"), scrobbling, tr("Scrobbling"), Icons::self()->lastFmIcon, tr("Scrobbling Settings")); @@ -126,7 +124,6 @@ void PreferencesDialog::writeSettings() // *Must* save server settings first, so that MPD settings go to the correct instance! server->save(); playback->save(); - files->save(); interface->save(); #ifdef ENABLE_PROXY_CONFIG proxy->save(); diff --git a/gui/preferencesdialog.h b/gui/preferencesdialog.h index dcf25bea3..10ed82097 100644 --- a/gui/preferencesdialog.h +++ b/gui/preferencesdialog.h @@ -31,7 +31,6 @@ class ProxySettings; class ShortcutsSettingsPage; class ServerSettings; class PlaybackSettings; -class FileSettings; class InterfaceSettings; class ContextSettings; struct MPDConnectionDetails; @@ -72,7 +71,6 @@ Q_SIGNALS: private: ServerSettings *server; PlaybackSettings *playback; - FileSettings *files; InterfaceSettings *interface; ContextSettings *context; #ifdef ENABLE_PROXY_CONFIG diff --git a/gui/serversettings.cpp b/gui/serversettings.cpp index 98276e0c3..48aa98bf1 100644 --- a/gui/serversettings.cpp +++ b/gui/serversettings.cpp @@ -46,23 +46,7 @@ w->deleteLater(); \ w=0; -class CoverNameValidator : public QValidator -{ - public: - CoverNameValidator(QObject *parent) : QValidator(parent) { } - - State validate(QString &input, int &) const override - { - for (int i=0; isetText(tr("Host:")); #endif - basicCoverName->setToolTip(coverName->toolTip()); - basicCoverNameLabel->setToolTip(coverName->toolTip()); - coverNameLabel->setToolTip(coverName->toolTip()); - coverName->setValidator(new CoverNameValidator(this)); - basicCoverName->setValidator(new CoverNameValidator(this)); + #ifdef ENABLE_SIMPLE_MPD_SUPPORT name->setValidator(new CollectionNameValidator(this)); #endif @@ -194,7 +174,7 @@ void ServerSettings::save() existingInConfig.removeAt(i); found=true; if (c.details.hostname!=e.hostname || c.details.port!=e.port || c.details.password!=e.password || - c.details.dir!=e.dir || c.details.coverName!=e.coverName + c.details.dir!=e.dir #ifdef ENABLE_HTTP_STREAM_PLAYBACK || c.details.streamUrl!=e.streamUrl #endif @@ -402,7 +382,6 @@ void ServerSettings::setDetails(const MPDConnectionDetails &details) #ifdef ENABLE_SIMPLE_MPD_SUPPORT if (details.name==MPDUser::constName) { basicDir->setText(Utils::convertPathForDisplay(details.dir)); - basicCoverName->setText(details.coverName); stackedWidget->setCurrentIndex(1); } else { #endif @@ -411,7 +390,6 @@ void ServerSettings::setDetails(const MPDConnectionDetails &details) port->setValue(details.port); password->setText(details.password); dir->setText(Utils::convertPathForDisplay(details.dir)); - coverName->setText(details.coverName); #ifdef ENABLE_HTTP_STREAM_PLAYBACK streamUrl->setText(details.streamUrl); #endif @@ -439,7 +417,6 @@ MPDConnectionDetails ServerSettings::getDetails() const details.port=port->value(); details.password=password->text(); details.dir=Utils::convertPathFromDisplay(dir->text()); - details.coverName=coverName->text().trimmed(); #ifdef ENABLE_HTTP_STREAM_PLAYBACK details.streamUrl=streamUrl->text().trimmed(); #endif @@ -452,7 +429,6 @@ MPDConnectionDetails ServerSettings::getDetails() const else { details=MPDUser::self()->details(true); details.dir=Utils::convertPathFromDisplay(basicDir->text()); - details.coverName=basicCoverName->text().trimmed(); MPDUser::self()->setMusicFolder(details.dir); } #endif diff --git a/gui/serversettings.ui b/gui/serversettings.ui index 0d8de5144..753f8fa85 100644 --- a/gui/serversettings.ui +++ b/gui/serversettings.ui @@ -134,23 +134,6 @@ - - - Cover filename: - - - coverName - - - - - - - <p>Filename (without extension) to save downloaded covers as.<br/>If left blank 'cover' will be used.<br/><br/><i>%artist% will be replaced with album artist of the current song, and %album% will be replaced with the album name.</i></p> - - - - HTTP stream URL: @@ -160,10 +143,10 @@ - + - + Local file playback: @@ -173,7 +156,7 @@ - + Use a simple in-built HTTP server to allow MPD to playback files dropped onto the playqueue. @@ -183,7 +166,7 @@ - + Auto update: @@ -193,7 +176,7 @@ - + <p>Select this option if your MPD server detects modifications (e.g. newly added files) automatically. If so there is no need for Cantata to send update commands for certain actions.</p> @@ -213,27 +196,20 @@ - - - If no setting is specified for 'Cover filename', then Cantata will use a default of <code>cover</code> - - - - 'HTTP Stream URL' is only of use if you have MPD configured to output to a HTTP stream, and you wish Cantata to be able to play that stream. - + MPD usually only plays songs from within your collection. Newer MPD's (from v0.19 onwards) can also playback other files if you are connected to a local MPD server (e.g. address is '127.0.0.1' or 'localhost') For this to work, the MPD server needs read-access to wherever the files are located. If you are using an older MPD, a non-local MPD, or your local files are not accessible to other users, then you may elect to use the simple HTTP server that is supplied with Cantata. This server will only allow access to files in the playqueue, and only whilst Cantata is running. - + Qt::Vertical @@ -284,19 +260,6 @@ - - - - Cover filename: - - - basicCoverName - - - - - - @@ -306,14 +269,7 @@ - - - - If no setting is specified for 'Cover filename', then Cantata will use a default of <code>cover</code> - - - - + Qt::Vertical diff --git a/gui/settings.cpp b/gui/settings.cpp index 76961bdee..3b7664093 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -166,7 +166,6 @@ MPDConnectionDetails Settings::connectionDetails(const QString &name) details.port=grp.get("port", name.isEmpty() ? mpdDefaults.port : 6600); details.dir=grp.getDirPath("dir", name.isEmpty() ? mpdDefaults.dir : "/var/lib/mpd/music"); details.password=grp.get("passwd", name.isEmpty() ? mpdDefaults.passwd : QString()); - details.coverName=grp.get("coverName", QString()); #ifdef ENABLE_HTTP_STREAM_PLAYBACK details.streamUrl=grp.get("streamUrl", QString()); #endif @@ -180,7 +179,6 @@ MPDConnectionDetails Settings::connectionDetails(const QString &name) details.port=mpdDefaults.port; details.dir=mpdDefaults.dir; details.password=mpdDefaults.passwd; - details.coverName=QString(); #ifdef ENABLE_HTTP_STREAM_PLAYBACK details.streamUrl=QString(); #endif @@ -273,27 +271,29 @@ bool Settings::stopOnExit() bool Settings::storeCoversInMpdDir() { - return cfg.get("storeCoversInMpdDir", true); + return cfg.get("storeCoversInMpdDir", false); } -bool Settings::storeLyricsInMpdDir() +QString Settings::coverFilename() { - return cfg.get("storeLyricsInMpdDir", true); -} - -bool Settings::storeStreamsInMpdDir() -{ - #ifdef Q_OS_WIN - bool def=false; - #else - bool def=version()>=CANTATA_MAKE_VERSION(0, 9, 50); - #endif - return cfg.get("storeStreamsInMpdDir", def); -} - -bool Settings::storeBackdropsInMpdDir() -{ - return cfg.get("storeBackdropsInMpdDir", false); + QString name=cfg.get("coverFilename", QString()); + // name is empty, so for old configs try to get from MPD settings + if (name.isEmpty() && version() connections; + for (const QString &grp: groups) { + if (cfg.hasGroup(grp) && grp.startsWith("Connection")) { + Configuration cfg(grp); + name=cfg.get("coverName", QString()); + if (!name.isEmpty()) { + // Use 1st non-empty + saveCoverFilename(name); + return name; + } + } + } + } + return name; } int Settings::sidebar() @@ -714,7 +714,6 @@ void Settings::saveConnectionDetails(const MPDConnectionDetails &v) grp.set("port", (int)v.port); grp.setDirPath("dir", v.dir); grp.set("passwd", v.password); - grp.set("coverName", v.coverName); #ifdef ENABLE_HTTP_STREAM_PLAYBACK grp.set("streamUrl", v.streamUrl); #endif @@ -794,14 +793,9 @@ void Settings::saveStoreCoversInMpdDir(bool v) cfg.set("storeCoversInMpdDir", v); } -void Settings::saveStoreLyricsInMpdDir(bool v) +void Settings::saveCoverFilename(const QString &v) { - cfg.set("storeLyricsInMpdDir", v); -} - -void Settings::saveStoreBackdropsInMpdDir(bool v) -{ - cfg.set("storeBackdropsInMpdDir", v); + cfg.set("coverFilename", v); } void Settings::saveSidebar(int v) diff --git a/gui/settings.h b/gui/settings.h index 7f8b4b774..c9ee9ab06 100644 --- a/gui/settings.h +++ b/gui/settings.h @@ -60,9 +60,7 @@ public: bool showPopups(); bool stopOnExit(); bool storeCoversInMpdDir(); - bool storeLyricsInMpdDir(); - bool storeStreamsInMpdDir(); - bool storeBackdropsInMpdDir(); + QString coverFilename(); int sidebar(); QSet composerGenres(); QSet singleTracksFolders(); @@ -164,8 +162,7 @@ public: void saveMinimiseOnClose(bool v); void saveShowPopups(bool v); void saveStoreCoversInMpdDir(bool v); - void saveStoreLyricsInMpdDir(bool v); - void saveStoreBackdropsInMpdDir(bool v); + void saveCoverFilename(const QString &v); void saveLibraryArtistImage(bool v); void saveSidebar(int v); void saveComposerGenres(const QSet &v); diff --git a/icons/theme/CMakeLists.txt b/icons/theme/CMakeLists.txt index 7b603c5f6..63777cadc 100644 --- a/icons/theme/CMakeLists.txt +++ b/icons/theme/CMakeLists.txt @@ -1,7 +1,6 @@ set(ICON_FILES svg/audio-x-generic.svg svg/information.svg -svg/folder-downloads.svg svg/folder-temp.svg svg/fork.svg svg/inode-directory.svg diff --git a/icons/theme/svg/folder-downloads.svg b/icons/theme/svg/folder-downloads.svg deleted file mode 100644 index 5bda3cac7..000000000 --- a/icons/theme/svg/folder-downloads.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/models/streamsmodel.cpp b/models/streamsmodel.cpp index f59edfc38..17509f18a 100644 --- a/models/streamsmodel.cpp +++ b/models/streamsmodel.cpp @@ -1241,8 +1241,6 @@ void StreamsModel::favouriteStreams(const QList &streams) } } - importOldFavourites(); - if (CategoryItem::Fetched!=favourites->state) { favourites->state=CategoryItem::Fetched; emit dataChanged(idx, idx); @@ -1733,24 +1731,6 @@ StreamsModel::Item * StreamsModel::parseSomaFmEntry(QXmlStreamReader &doc, Categ return name.isEmpty() || url.isEmpty() ? nullptr : new Item(url, name, parent); } -void StreamsModel::importOldFavourites() -{ - if (!favourites->importedOld) { - if (Settings::self()->version()storeStreamsInMpdDir() - ? MPDConnection::self()->getDetails().dir : Utils::dataDir(QString(), false); - - if (!prevFile.isEmpty()) { - prevFile+="streams.xml.gz"; - if (QFile::exists(prevFile)) { - importIntoFavourites(prevFile); - } - } - } - favourites->importedOld=true; - } -} - void StreamsModel::loadInstalledProviders() { QSet added; diff --git a/models/streamsmodel.h b/models/streamsmodel.h index 831e3556b..211bd42da 100644 --- a/models/streamsmodel.h +++ b/models/streamsmodel.h @@ -311,7 +311,6 @@ private Q_SLOTS: private: bool loadCache(CategoryItem *cat); Item * toItem(const QModelIndex &index) const { return index.isValid() ? static_cast(index.internalPointer()) : root; } - void importOldFavourites(); void loadInstalledProviders(); private: diff --git a/mpd-interface/mpdconnection.h b/mpd-interface/mpdconnection.h index 00a3e246d..1b4d7b4b7 100644 --- a/mpd-interface/mpdconnection.h +++ b/mpd-interface/mpdconnection.h @@ -157,7 +157,6 @@ struct MPDConnectionDetails { QString password; QString dir; bool dirReadable; - QString coverName; #ifdef ENABLE_HTTP_STREAM_PLAYBACK QString streamUrl; #endif diff --git a/mpd-interface/mpduser.cpp b/mpd-interface/mpduser.cpp index 13277497f..da606af3b 100644 --- a/mpd-interface/mpduser.cpp +++ b/mpd-interface/mpduser.cpp @@ -246,7 +246,6 @@ void MPDUser::init(bool create) { if (create || det.dir.isEmpty() || det.hostname.isEmpty() || pidFileName.isEmpty()) { // Read coverFileName from Cantata settings... - det.coverName=Settings::self()->connectionDetails(constName).coverName; det.dirReadable=false; // Read music folder and socket from MPD conf file... diff --git a/tags/trackorganiser.cpp b/tags/trackorganiser.cpp index 1334d79ca..fe2374b79 100644 --- a/tags/trackorganiser.cpp +++ b/tags/trackorganiser.cpp @@ -387,8 +387,10 @@ void TrackOrganiser::renameFile() if (sArtistDir.exists() && dArtistDir.exists() && sArtistDir.absolutePath()!=sDir.absolutePath() && sArtistDir.absolutePath()!=dArtistDir.absolutePath()) { QStringList artistImages; QFileInfoList entries=sArtistDir.entryInfoList(QDir::Files|QDir::Dirs|QDir::NoDotAndDotDot); - QString artistImage=Covers::artistFileName(s); - QSet acceptable=QSet() << artistImage+QLatin1String(".jpg") << artistImage+QLatin1String(".png") + QSet acceptable=QSet() << Covers::constArtistImage+QLatin1String(".jpg") + << Covers::constArtistImage+QLatin1String(".png") + << Covers::constComposerImage+QLatin1String(".jpg") + << Covers::constComposerImage+QLatin1String(".png") << ContextWidget::constBackdropFileName+QLatin1String(".jpg") << ContextWidget::constBackdropFileName+QLatin1String(".png"); diff --git a/widgets/icons.cpp b/widgets/icons.cpp index 4c0daef7e..f7358a2a4 100644 --- a/widgets/icons.cpp +++ b/widgets/icons.cpp @@ -64,7 +64,6 @@ Icons::Icons() speakerIcon=Icon(QStringList() << "speaker" << "audio-speakers" << "gnome-volume-control"); repeatIcon=MonoIcon::icon(FontAwesome::refresh, stdColor); shuffleIcon=MonoIcon::icon(FontAwesome::random, stdColor); - filesIcon=Icon(QStringList() << "folder-downloads" << "folder-download" << "folder" << "go-down"); albumIconSmall.addFile(":album32.svg"); albumIconLarge.addFile(":album.svg"); albumMonoIcon=MonoIcon::icon(":mono-album.svg", stdColor); diff --git a/widgets/icons.h b/widgets/icons.h index 90199baf2..4892a5e73 100644 --- a/widgets/icons.h +++ b/widgets/icons.h @@ -52,7 +52,6 @@ public: Icon streamIcon; Icon speakerIcon; Icon menuIcon; - Icon filesIcon; Icon playqueueIcon; Icon libraryIcon; diff --git a/windows/cantata.nsi.cmake b/windows/cantata.nsi.cmake index d76f11276..b4b63ac4f 100644 --- a/windows/cantata.nsi.cmake +++ b/windows/cantata.nsi.cmake @@ -159,7 +159,6 @@ section "install" file "icons\cantata\16\cantata.png" setOutPath $INSTDIR\icons\cantata\svg file "icons\cantata\svg\audio-x-generic.svg" - file "icons\cantata\svg\folder-downloads.svg" file "icons\cantata\svg\folder-temp.svg" file "icons\cantata\svg\fork.svg" file "icons\cantata\svg\information.svg"