| 825 | } |
| 826 | |
| 827 | void PlaylistTreeWidget::savePlaylistToFile() |
| 828 | { |
| 829 | // ask user for file location |
| 830 | QSettings settings; |
| 831 | |
| 832 | QString filename = QFileDialog::getSaveFileName(this, |
| 833 | tr("Save Playlist"), |
| 834 | settings.value("LastPlaylistPath").toString(), |
| 835 | tr("Playlist Files (*.yuvplaylist)")); |
| 836 | if (filename.isEmpty()) |
| 837 | return; |
| 838 | if (!filename.endsWith(".yuvplaylist", Qt::CaseInsensitive)) |
| 839 | filename += ".yuvplaylist"; |
| 840 | |
| 841 | // remember this directory for next time |
| 842 | QDir dirName(filename.section('/', 0, -2)); |
| 843 | settings.setValue("LastPlaylistPath", dirName.path()); |
| 844 | |
| 845 | // Write the XML structure to file |
| 846 | QFile file(filename); |
| 847 | file.open(QIODevice::WriteOnly | QIODevice::Text); |
| 848 | QTextStream outStream(&file); |
| 849 | outStream << getPlaylistString(dirName); |
| 850 | file.close(); |
| 851 | |
| 852 | // We saved the playlist |
| 853 | isSaved = true; |
| 854 | } |
| 855 | |
| 856 | bool PlaylistTreeWidget::loadPlaylistFile(const QString &filePath) |
| 857 | { |
no test coverage detected