Qt: fix playlist title when adding a folder with one item

This commit is contained in:
Brad Parker 2018-08-31 09:16:45 -04:00
parent faaf84aef3
commit 230787808c
3 changed files with 10 additions and 1 deletions

View File

@ -306,11 +306,14 @@ void MainWindow::addFilesToPlaylist(QStringList files)
fileInfo = fileName;
if (files.count() == 1 && list.count() == 1 && i == 0)
/* Make sure we're looking at a user-specified field and not just "<multiple>"
* in case it was a folder with one file in it */
if (files.count() == 1 && list.count() == 1 && i == 0 && playlistDialog->nameFieldEnabled())
{
fileBaseNameArray = selectedName.toUtf8();
pathArray = QDir::toNativeSeparators(selectedPath).toUtf8();
}
/* Otherwise just use the file name itself (minus extension) for the playlist entry title */
else
{
fileBaseNameArray = fileInfo.completeBaseName().toUtf8();

View File

@ -182,6 +182,11 @@ void PlaylistEntryDialog::loadPlaylistOptions()
}
}
bool PlaylistEntryDialog::nameFieldEnabled()
{
return m_nameLineEdit->isEnabled();
}
void PlaylistEntryDialog::setEntryValues(const QHash<QString, QString> &contentHash)
{
QString db;

View File

@ -20,6 +20,7 @@ public:
const QString getSelectedPath();
const QStringList getSelectedExtensions();
bool filterInArchive();
bool nameFieldEnabled();
void setEntryValues(const QHash<QString, QString> &contentHash);
public slots:
bool showDialog(const QHash<QString, QString> &hash = QHash<QString, QString>());