mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Select files to transcode directly from a playlist.
This commit is contained in:
parent
eb20fb5945
commit
9ff9050d9c
@ -220,6 +220,15 @@ void TranscodeDialog::Add() {
|
||||
if (filenames.isEmpty())
|
||||
return;
|
||||
|
||||
SetFilenames(filenames);
|
||||
|
||||
last_add_dir_ = filenames[0];
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_add_dir", last_add_dir_);
|
||||
}
|
||||
|
||||
void TranscodeDialog::SetFilenames(const QStringList &filenames) {
|
||||
foreach (const QString& filename, filenames) {
|
||||
QString name = filename.section('/', -1, -1);
|
||||
QString path = filename.section('/', 0, -2);
|
||||
@ -228,11 +237,6 @@ void TranscodeDialog::Add() {
|
||||
ui_->files, QStringList() << name << path);
|
||||
item->setData(0, Qt::UserRole, filename);
|
||||
}
|
||||
|
||||
last_add_dir_ = filenames[0];
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_add_dir", last_add_dir_);
|
||||
}
|
||||
|
||||
void TranscodeDialog::Remove() {
|
||||
|
@ -353,6 +353,7 @@ MainWindow::MainWindow(Application* app,
|
||||
connect(ui_->action_update_library, SIGNAL(triggered()), app_->library(), SLOT(IncrementalScan()));
|
||||
connect(ui_->action_full_library_scan, SIGNAL(triggered()), app_->library(), SLOT(FullScan()));
|
||||
connect(ui_->action_queue_manager, SIGNAL(triggered()), SLOT(ShowQueueManager()));
|
||||
connect(ui_->action_add_files_to_transcoder, SIGNAL(triggered()), SLOT(AddFilesToTranscoder()));
|
||||
|
||||
background_streams_->AddAction("Rain", ui_->action_rain);
|
||||
background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad);
|
||||
@ -497,6 +498,7 @@ MainWindow::MainWindow(Application* app,
|
||||
playlist_menu_->addAction(ui_->action_renumber_tracks);
|
||||
playlist_menu_->addAction(ui_->action_selection_set_value);
|
||||
playlist_menu_->addAction(ui_->action_auto_complete_tags);
|
||||
playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
|
||||
playlist_menu_->addSeparator();
|
||||
playlist_copy_to_library_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to library..."), this, SLOT(PlaylistCopyToLibrary()));
|
||||
playlist_move_to_library_ = playlist_menu_->addAction(IconLoader::Load("go-jump"), tr("Move to library..."), this, SLOT(PlaylistMoveToLibrary()));
|
||||
@ -1784,6 +1786,28 @@ void MainWindow::PlaylistUndoRedoChanged(QAction *undo, QAction *redo) {
|
||||
playlist_menu_->insertAction(playlist_undoredo_, redo);
|
||||
}
|
||||
|
||||
void MainWindow::AddFilesToTranscoder() {
|
||||
if (!transcode_dialog_) {
|
||||
transcode_dialog_.reset(new TranscodeDialog);
|
||||
}
|
||||
|
||||
QStringList filenames;
|
||||
|
||||
foreach (const QModelIndex& index,
|
||||
ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||
if (index.column() != 0)
|
||||
continue;
|
||||
int row = app_->playlist_manager()->current()->proxy()->mapToSource(index).row();
|
||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(row));
|
||||
Song song = item->Metadata();
|
||||
filenames << song.url().toLocalFile();
|
||||
}
|
||||
|
||||
transcode_dialog_->SetFilenames(filenames);
|
||||
|
||||
ShowTranscodeDialog();
|
||||
}
|
||||
|
||||
void MainWindow::ShowLibraryConfig() {
|
||||
EnsureSettingsDialogCreated();
|
||||
settings_dialog_->OpenAtPage(SettingsDialog::Page_Library);
|
||||
|
@ -158,6 +158,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
void AutoCompleteTags();
|
||||
void AutoCompleteTagsAccepted();
|
||||
void PlaylistUndoRedoChanged(QAction* undo, QAction* redo);
|
||||
void AddFilesToTranscoder();
|
||||
|
||||
void PlaylistCopyToLibrary();
|
||||
void PlaylistMoveToLibrary();
|
||||
|
@ -415,7 +415,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1131</width>
|
||||
<height>23</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_music">
|
||||
@ -859,6 +859,20 @@
|
||||
<string>Remove duplicates from playlist</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_add_files_to_transcoder">
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add file(s) to transcoder</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add file to transcoder</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+T</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
Loading…
x
Reference in New Issue
Block a user