QStringList OverviewPlaylistWidget::LetUserSelectMediaFile(QWidget *pParent, QString pDescription, bool pMultipleFiles) { QStringList tResult; LOGEX(OverviewPlaylistWidget, LOG_VERBOSE, "Current data directory is \"%s\"", CONF.GetDataDirectory().toStdString().c_str()); if (pMultipleFiles) tResult = QFileDialog::getOpenFileNames(pParent, pDescription, CONF.GetDataDirectory(), sLoadMediaFilters, &sAllLoadMediaFilter, CONF_NATIVE_DIALOGS); else { tResult = QStringList(QFileDialog::getOpenFileName(pParent, pDescription, CONF.GetDataDirectory(), sLoadMediaFilters, &sAllLoadMediaFilter, CONF_NATIVE_DIALOGS)); // use the file parser to avoid playlists and resolve them to one single entry if (!tResult.isEmpty()) { Playlist tPlaylist = Parse(tResult.first(), ""); if (tPlaylist.size() > 0) tResult = QStringList(tPlaylist.first().Location); else tResult.clear(); } } if (!tResult.isEmpty()) CONF.SetDataDirectory(tResult.first().left(tResult.first().lastIndexOf('/'))); return tResult; }
QStringList OverviewPlaylistWidget::LetUserSelectAudioFile(QWidget *pParent, QString pDescription, bool pMultipleFiles) { QStringList tResult; if (pMultipleFiles) tResult = QFileDialog::getOpenFileNames(pParent, pDescription, CONF.GetDataDirectory(), sLoadAudioFilters, &sAllLoadAudioFilter, CONF_NATIVE_DIALOGS); else { tResult = QStringList(QFileDialog::getOpenFileName(pParent, pDescription, CONF.GetDataDirectory(), sLoadAudioFilters, &sAllLoadAudioFilter, CONF_NATIVE_DIALOGS)); // use the file parser to avoid playlists and resolve them to one single entry if (!tResult.isEmpty()) { Playlist tPlaylist = Parse(tResult.first(), "", false); if (tPlaylist.size() > 0) tResult = QStringList(tPlaylist.first().Location); else { tResult.clear(); } } } if ((!tResult.isEmpty()) && (tResult.first() != "")) { CONF.SetDataDirectory(tResult.first().left(tResult.first().lastIndexOf('/'))); } return tResult; }