--- REMOVE FILE ---
| 857 | |
| 858 | // --- REMOVE FILE --- |
| 859 | void MainWindow::removeFile() { |
| 860 | // Remove currently selected filename(s) from the playlist. |
| 861 | QListWidgetItem* item = ui->mediaListWidget->currentItem(); |
| 862 | ui->mediaListWidget->removeItemWidget(item); |
| 863 | delete item; |
| 864 | |
| 865 | // TODO: Remove stored file path. |
| 866 | // FIXME: Clear and rewrite the file contents for now. |
| 867 | QFile playlist; |
| 868 | playlist.setFileName(appDataLocation + "/filepaths.conf"); |
| 869 | playlist.open(QIODevice::ReadWrite | QIODevice::Truncate); |
| 870 | |
| 871 | int size = ui->mediaListWidget->count(); |
| 872 | QTextStream textStream(&playlist); |
| 873 | textStream.setCodec("UTF-8"); |
| 874 | for (int i = 0; i < size; ++i) { |
| 875 | QListWidgetItem* item = ui->mediaListWidget->item(i); |
| 876 | QString filename = item->data(Qt::UserRole).toString(); |
| 877 | textStream << filename << "\n"; |
| 878 | } |
| 879 | |
| 880 | playlist.close(); |
| 881 | } |
| 882 | |
| 883 | |
| 884 | // --- REMOTE IS CONNECTED --- |