+void MainWindow::playlist_duplicate()
+{
+ QItemSelectionModel *selected = ui->playlist->selectionModel();
+ if (!selected->hasSelection()) {
+ // Should have been grayed out, but OK.
+ return;
+ }
+ QModelIndexList rows = selected->selectedRows();
+ int first = rows.front().row(), last = rows.back().row();
+ playlist_clips->duplicate_clips(first, last);
+ playlist_selection_changed();
+}
+
+void MainWindow::playlist_remove()
+{
+ QItemSelectionModel *selected = ui->playlist->selectionModel();
+ if (!selected->hasSelection()) {
+ // Should have been grayed out, but OK.
+ return;
+ }
+ QModelIndexList rows = selected->selectedRows();
+ int first = rows.front().row(), last = rows.back().row();
+ playlist_clips->erase_clips(first, last);
+
+ // TODO: select the next one in the list?
+
+ playlist_selection_changed();
+}
+
+void MainWindow::playlist_move(int delta)
+{
+ QItemSelectionModel *selected = ui->playlist->selectionModel();
+ if (!selected->hasSelection()) {
+ // Should have been grayed out, but OK.
+ return;
+ }
+
+ QModelIndexList rows = selected->selectedRows();
+ int first = rows.front().row(), last = rows.back().row();
+ if ((delta == -1 && first == 0) ||
+ (delta == 1 && size_t(last) == playlist_clips->size() - 1)) {
+ // Should have been grayed out, but OK.
+ return;
+ }
+
+ playlist_clips->move_clips(first, last, delta);
+ playlist_selection_changed();
+}
+