}
void MainWindow::_clear_current_playlist() {
+ CONFIRM_ACTION(this, tr("Clear playlist?"))
Playlist playlist = _library->getCurrentPlaylist();
playlist.clear();
_library->saveCurrentPlaylist(playlist);
void ManageLibraryForm::_delete_selected() {
QList<QString> directories;
QModelIndexList idx = ui->dirView->selectionModel()->selectedIndexes();
+ if (idx.count() == 0) {
+ return;
+ }
+ CONFIRM_ACTION(this, tr("Delete selected directories?"))
foreach (QModelIndex id, idx) {
if (id.column() == 1) {
QString path = id.data().toString();
}
void ManageLibraryForm::_update_selected() {
+ CONFIRM_ACTION(this, tr("Update selected directories? It may takes several minutes"))
QList<QString> directories;
QModelIndexList idx = ui->dirView->selectionModel()->selectedIndexes();
foreach (QModelIndex id, idx) {
}
void ManageLibraryForm::_update_all() {
+ CONFIRM_ACTION(this, tr("Update all library? It may takes a long time"))
_library->updateAll();
refresh();
emit refreshLibrary();
}
void PlayerForm::_delete_track() {
+ CONFIRM_ACTION(this, tr("Delete track?"))
QList<QModelIndex> idx = ui->playlistView->selectionModel()->selectedIndexes();
if (idx.isEmpty())
return;
#include <QList>
#include <QMap>
#include <QUrl>
+#include <QMessageBox>
#include "config.h"
#define _DYNAMIC_PLAYLIST_MAX_COUNT_ 50
#define _APPLICATION_PATH_ "/opt/someplayer"
+#define CONFIRM_ACTION(PARENT, TEXT) \
+ if (QMessageBox::question(PARENT, tr("Confirm action"), \
+ TEXT, QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok) \
+ {return;}
+
#endif