Enable organise without gstreamer
This commit is contained in:
@@ -273,6 +273,11 @@ set(SOURCES
|
|||||||
scrobbler/librefmscrobbler.cpp
|
scrobbler/librefmscrobbler.cpp
|
||||||
scrobbler/listenbrainzscrobbler.cpp
|
scrobbler/listenbrainzscrobbler.cpp
|
||||||
|
|
||||||
|
organise/organise.cpp
|
||||||
|
organise/organiseformat.cpp
|
||||||
|
organise/organisedialog.cpp
|
||||||
|
organise/organiseerrordialog.cpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
@@ -439,6 +444,10 @@ set(HEADERS
|
|||||||
scrobbler/librefmscrobbler.h
|
scrobbler/librefmscrobbler.h
|
||||||
scrobbler/listenbrainzscrobbler.h
|
scrobbler/listenbrainzscrobbler.h
|
||||||
|
|
||||||
|
organise/organise.h
|
||||||
|
organise/organisedialog.h
|
||||||
|
organise/organiseerrordialog.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(UI
|
set(UI
|
||||||
@@ -492,6 +501,9 @@ set(UI
|
|||||||
|
|
||||||
internet/internetsearchview.ui
|
internet/internetsearchview.ui
|
||||||
|
|
||||||
|
organise/organisedialog.ui
|
||||||
|
organise/organiseerrordialog.ui
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RESOURCES ../data/data.qrc ../data/icons.qrc)
|
set(RESOURCES ../data/data.qrc ../data/icons.qrc)
|
||||||
@@ -765,13 +777,9 @@ optional_source(HAVE_LIBPULSE
|
|||||||
engine/pulsedevicefinder.cpp
|
engine/pulsedevicefinder.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# MusicBrainz, Organise and transcode require GStreamer
|
# MusicBrainz and transcoder require GStreamer
|
||||||
optional_source(HAVE_GSTREAMER
|
optional_source(HAVE_GSTREAMER
|
||||||
SOURCES
|
SOURCES
|
||||||
organise/organise.cpp
|
|
||||||
organise/organiseformat.cpp
|
|
||||||
organise/organisedialog.cpp
|
|
||||||
organise/organiseerrordialog.cpp
|
|
||||||
transcoder/transcoder.cpp
|
transcoder/transcoder.cpp
|
||||||
transcoder/transcodedialog.cpp
|
transcoder/transcodedialog.cpp
|
||||||
transcoder/transcoderoptionsdialog.cpp
|
transcoder/transcoderoptionsdialog.cpp
|
||||||
@@ -785,17 +793,12 @@ SOURCES
|
|||||||
transcoder/transcoderoptionsmp3.cpp
|
transcoder/transcoderoptionsmp3.cpp
|
||||||
settings/transcodersettingspage.cpp
|
settings/transcodersettingspage.cpp
|
||||||
HEADERS
|
HEADERS
|
||||||
organise/organise.h
|
|
||||||
organise/organisedialog.h
|
|
||||||
organise/organiseerrordialog.h
|
|
||||||
transcoder/transcoder.h
|
transcoder/transcoder.h
|
||||||
transcoder/transcodedialog.h
|
transcoder/transcodedialog.h
|
||||||
transcoder/transcoderoptionsdialog.h
|
transcoder/transcoderoptionsdialog.h
|
||||||
transcoder/transcoderoptionsmp3.h
|
transcoder/transcoderoptionsmp3.h
|
||||||
settings/transcodersettingspage.h
|
settings/transcodersettingspage.h
|
||||||
UI
|
UI
|
||||||
organise/organisedialog.ui
|
|
||||||
organise/organiseerrordialog.ui
|
|
||||||
transcoder/transcodedialog.ui
|
transcoder/transcodedialog.ui
|
||||||
transcoder/transcodelogdialog.ui
|
transcoder/transcodelogdialog.ui
|
||||||
transcoder/transcoderoptionsaac.ui
|
transcoder/transcoderoptionsaac.ui
|
||||||
|
|||||||
@@ -73,9 +73,7 @@
|
|||||||
# include "device/devicestatefiltermodel.h"
|
# include "device/devicestatefiltermodel.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dialogs/edittagdialog.h"
|
#include "dialogs/edittagdialog.h"
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
#include "organise/organisedialog.h"
|
#include "organise/organisedialog.h"
|
||||||
#endif
|
|
||||||
#include "settings/collectionsettingspage.h"
|
#include "settings/collectionsettingspage.h"
|
||||||
|
|
||||||
CollectionItemDelegate::CollectionItemDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
CollectionItemDelegate::CollectionItemDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||||
@@ -460,14 +458,12 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue track"), this, SLOT(AddToPlaylistEnqueue()));
|
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue track"), this, SLOT(AddToPlaylistEnqueue()));
|
||||||
add_to_playlist_enqueue_next_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue to play next"), this, SLOT(AddToPlaylistEnqueueNext()));
|
add_to_playlist_enqueue_next_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue to play next"), this, SLOT(AddToPlaylistEnqueueNext()));
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise()));
|
organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise()));
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice()));
|
copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice()));
|
||||||
#endif
|
#endif
|
||||||
//delete_ = context_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), this, SLOT(Delete()));
|
//delete_ = context_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), this, SLOT(Delete()));
|
||||||
#endif
|
|
||||||
|
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
edit_track_ = context_menu_->addAction(IconLoader::Load("edit-rename"), tr("Edit track information..."), this, SLOT(EditTracks()));
|
edit_track_ = context_menu_->addAction(IconLoader::Load("edit-rename"), tr("Edit track information..."), this, SLOT(EditTracks()));
|
||||||
@@ -482,7 +478,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
|
|
||||||
context_menu_->addMenu(filter_->menu());
|
context_menu_->addMenu(filter_->menu());
|
||||||
|
|
||||||
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0);
|
copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0);
|
||||||
connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), copy_to_device_, SLOT(setDisabled(bool)));
|
connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), copy_to_device_, SLOT(setDisabled(bool)));
|
||||||
#endif
|
#endif
|
||||||
@@ -520,25 +516,20 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
edit_track_->setVisible(regular_editable <= 1);
|
edit_track_->setVisible(regular_editable <= 1);
|
||||||
edit_track_->setEnabled(regular_editable == 1);
|
edit_track_->setEnabled(regular_editable == 1);
|
||||||
|
|
||||||
// only when no smart playlists selected
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_->setVisible(regular_elements_only);
|
organise_->setVisible(regular_elements_only);
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setVisible(regular_elements_only);
|
copy_to_device_->setVisible(regular_elements_only);
|
||||||
#endif
|
#endif
|
||||||
//delete_->setVisible(regular_elements_only);
|
//delete_->setVisible(regular_elements_only);
|
||||||
#endif
|
|
||||||
show_in_various_->setVisible(regular_elements_only);
|
show_in_various_->setVisible(regular_elements_only);
|
||||||
no_show_in_various_->setVisible(regular_elements_only);
|
no_show_in_various_->setVisible(regular_elements_only);
|
||||||
|
|
||||||
// only when all selected items are editable
|
// only when all selected items are editable
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_->setEnabled(regular_elements == regular_editable);
|
organise_->setEnabled(regular_elements == regular_editable);
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setEnabled(regular_elements == regular_editable);
|
copy_to_device_->setEnabled(regular_elements == regular_editable);
|
||||||
#endif
|
#endif
|
||||||
//delete_->setEnabled(regular_elements == regular_editable);
|
//delete_->setEnabled(regular_elements == regular_editable);
|
||||||
#endif
|
|
||||||
|
|
||||||
context_menu_->popup(e->globalPos());
|
context_menu_->popup(e->globalPos());
|
||||||
|
|
||||||
@@ -661,7 +652,6 @@ SongList CollectionView::GetSelectedSongs() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void CollectionView::Organise() {
|
void CollectionView::Organise() {
|
||||||
|
|
||||||
if (!organise_dialog_)
|
if (!organise_dialog_)
|
||||||
@@ -675,7 +665,6 @@ void CollectionView::Organise() {
|
|||||||
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void CollectionView::EditTracks() {
|
void CollectionView::EditTracks() {
|
||||||
|
|
||||||
@@ -687,7 +676,6 @@ void CollectionView::EditTracks() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void CollectionView::CopyToDevice() {
|
void CollectionView::CopyToDevice() {
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
if (!organise_dialog_)
|
if (!organise_dialog_)
|
||||||
@@ -699,7 +687,6 @@ void CollectionView::CopyToDevice() {
|
|||||||
organise_dialog_->show();
|
organise_dialog_->show();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void CollectionView::FilterReturnPressed() {
|
void CollectionView::FilterReturnPressed() {
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ class QPaintEvent;
|
|||||||
class Application;
|
class Application;
|
||||||
class CollectionFilterWidget;
|
class CollectionFilterWidget;
|
||||||
class EditTagDialog;
|
class EditTagDialog;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
class OrganiseDialog;
|
class OrganiseDialog;
|
||||||
#endif
|
|
||||||
|
|
||||||
class CollectionItemDelegate : public QStyledItemDelegate {
|
class CollectionItemDelegate : public QStyledItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -119,10 +117,8 @@ signals:
|
|||||||
void AddToPlaylistEnqueue();
|
void AddToPlaylistEnqueue();
|
||||||
void AddToPlaylistEnqueueNext();
|
void AddToPlaylistEnqueueNext();
|
||||||
void OpenInNewPlaylist();
|
void OpenInNewPlaylist();
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void Organise();
|
void Organise();
|
||||||
void CopyToDevice();
|
void CopyToDevice();
|
||||||
#endif
|
|
||||||
void EditTracks();
|
void EditTracks();
|
||||||
void ShowInBrowser();
|
void ShowInBrowser();
|
||||||
void ShowInVarious();
|
void ShowInVarious();
|
||||||
@@ -151,11 +147,9 @@ signals:
|
|||||||
QAction *add_to_playlist_enqueue_;
|
QAction *add_to_playlist_enqueue_;
|
||||||
QAction *add_to_playlist_enqueue_next_;
|
QAction *add_to_playlist_enqueue_next_;
|
||||||
QAction *open_in_new_playlist_;
|
QAction *open_in_new_playlist_;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
QAction *organise_;
|
QAction *organise_;
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
QAction *copy_to_device_;
|
QAction *copy_to_device_;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
QAction *delete_;
|
QAction *delete_;
|
||||||
QAction *edit_track_;
|
QAction *edit_track_;
|
||||||
@@ -164,9 +158,7 @@ signals:
|
|||||||
QAction *show_in_various_;
|
QAction *show_in_various_;
|
||||||
QAction *no_show_in_various_;
|
QAction *no_show_in_various_;
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
||||||
#endif
|
|
||||||
std::unique_ptr<EditTagDialog> edit_tag_dialog_;
|
std::unique_ptr<EditTagDialog> edit_tag_dialog_;
|
||||||
|
|
||||||
bool is_in_keyboard_search_;
|
bool is_in_keyboard_search_;
|
||||||
|
|||||||
@@ -73,9 +73,7 @@
|
|||||||
# include "device/devicestatefiltermodel.h"
|
# include "device/devicestatefiltermodel.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dialogs/edittagdialog.h"
|
#include "dialogs/edittagdialog.h"
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
#include "organise/organisedialog.h"
|
#include "organise/organisedialog.h"
|
||||||
#endif
|
|
||||||
#include "settings/collectionsettingspage.h"
|
#include "settings/collectionsettingspage.h"
|
||||||
|
|
||||||
#include "contextview.h"
|
#include "contextview.h"
|
||||||
@@ -367,12 +365,10 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue track"), this, SLOT(AddToPlaylistEnqueue()));
|
add_to_playlist_enqueue_ = context_menu_->addAction(IconLoader::Load("go-next"), tr("Queue track"), this, SLOT(AddToPlaylistEnqueue()));
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise()));
|
organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise()));
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice()));
|
copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice()));
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
@@ -382,7 +378,7 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
|
|
||||||
context_menu_->addSeparator();
|
context_menu_->addSeparator();
|
||||||
|
|
||||||
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0);
|
copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0);
|
||||||
connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), copy_to_device_, SLOT(setDisabled(bool)));
|
connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), copy_to_device_, SLOT(setDisabled(bool)));
|
||||||
#endif
|
#endif
|
||||||
@@ -405,9 +401,7 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
|
|
||||||
// TODO: check if custom plugin actions should be enabled / visible
|
// TODO: check if custom plugin actions should be enabled / visible
|
||||||
const int songs_selected = regular_elements;
|
const int songs_selected = regular_elements;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
const bool regular_elements_only = songs_selected == regular_elements && regular_elements > 0;
|
const bool regular_elements_only = songs_selected == regular_elements && regular_elements > 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
// in all modes
|
// in all modes
|
||||||
load_->setEnabled(songs_selected);
|
load_->setEnabled(songs_selected);
|
||||||
@@ -419,19 +413,15 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
edit_track_->setVisible(regular_editable <= 1);
|
edit_track_->setVisible(regular_editable <= 1);
|
||||||
edit_track_->setEnabled(regular_editable == 1);
|
edit_track_->setEnabled(regular_editable == 1);
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_->setVisible(regular_elements_only);
|
organise_->setVisible(regular_elements_only);
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setVisible(regular_elements_only);
|
copy_to_device_->setVisible(regular_elements_only);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// only when all selected items are editable
|
// only when all selected items are editable
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_->setEnabled(regular_elements == regular_editable);
|
organise_->setEnabled(regular_elements == regular_editable);
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
copy_to_device_->setEnabled(regular_elements == regular_editable);
|
copy_to_device_->setEnabled(regular_elements == regular_editable);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
context_menu_->popup(e->globalPos());
|
context_menu_->popup(e->globalPos());
|
||||||
@@ -488,7 +478,6 @@ SongList ContextAlbumsView::GetSelectedSongs() const {
|
|||||||
return model_->GetChildSongs(selected_indexes);
|
return model_->GetChildSongs(selected_indexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void ContextAlbumsView::Organise() {
|
void ContextAlbumsView::Organise() {
|
||||||
|
|
||||||
if (!organise_dialog_)
|
if (!organise_dialog_)
|
||||||
@@ -502,7 +491,6 @@ void ContextAlbumsView::Organise() {
|
|||||||
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void ContextAlbumsView::EditTracks() {
|
void ContextAlbumsView::EditTracks() {
|
||||||
|
|
||||||
@@ -514,7 +502,6 @@ void ContextAlbumsView::EditTracks() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void ContextAlbumsView::CopyToDevice() {
|
void ContextAlbumsView::CopyToDevice() {
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
if (!organise_dialog_)
|
if (!organise_dialog_)
|
||||||
@@ -526,7 +513,6 @@ void ContextAlbumsView::CopyToDevice() {
|
|||||||
organise_dialog_->show();
|
organise_dialog_->show();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void ContextAlbumsView::ShowInBrowser() {
|
void ContextAlbumsView::ShowInBrowser() {
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,7 @@
|
|||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
class EditTagDialog;
|
class EditTagDialog;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
class OrganiseDialog;
|
class OrganiseDialog;
|
||||||
#endif
|
|
||||||
class ContextAlbumsModel;
|
class ContextAlbumsModel;
|
||||||
|
|
||||||
class ContextItemDelegate : public QStyledItemDelegate {
|
class ContextItemDelegate : public QStyledItemDelegate {
|
||||||
@@ -101,12 +99,8 @@ signals:
|
|||||||
void AddToPlaylist();
|
void AddToPlaylist();
|
||||||
void AddToPlaylistEnqueue();
|
void AddToPlaylistEnqueue();
|
||||||
void OpenInNewPlaylist();
|
void OpenInNewPlaylist();
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void Organise();
|
void Organise();
|
||||||
//#ifndef Q_OS_WIN
|
|
||||||
void CopyToDevice();
|
void CopyToDevice();
|
||||||
//#endif
|
|
||||||
#endif
|
|
||||||
void EditTracks();
|
void EditTracks();
|
||||||
void ShowInBrowser();
|
void ShowInBrowser();
|
||||||
|
|
||||||
@@ -124,20 +118,16 @@ signals:
|
|||||||
QAction *add_to_playlist_;
|
QAction *add_to_playlist_;
|
||||||
QAction *add_to_playlist_enqueue_;
|
QAction *add_to_playlist_enqueue_;
|
||||||
QAction *open_in_new_playlist_;
|
QAction *open_in_new_playlist_;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
QAction *organise_;
|
QAction *organise_;
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
QAction *copy_to_device_;
|
QAction *copy_to_device_;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
QAction *delete_;
|
QAction *delete_;
|
||||||
QAction *edit_track_;
|
QAction *edit_track_;
|
||||||
QAction *edit_tracks_;
|
QAction *edit_tracks_;
|
||||||
QAction *show_in_browser_;
|
QAction *show_in_browser_;
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
||||||
#endif
|
|
||||||
std::unique_ptr<EditTagDialog> edit_tag_dialog_;
|
std::unique_ptr<EditTagDialog> edit_tag_dialog_;
|
||||||
|
|
||||||
bool is_in_keyboard_search_;
|
bool is_in_keyboard_search_;
|
||||||
|
|||||||
@@ -84,9 +84,7 @@
|
|||||||
#include "dialogs/console.h"
|
#include "dialogs/console.h"
|
||||||
#include "dialogs/trackselectiondialog.h"
|
#include "dialogs/trackselectiondialog.h"
|
||||||
#include "dialogs/edittagdialog.h"
|
#include "dialogs/edittagdialog.h"
|
||||||
#ifdef HAVE_GSTREAMER
|
#include "organise/organisedialog.h"
|
||||||
# include "organise/organisedialog.h"
|
|
||||||
#endif
|
|
||||||
#include "widgets/fancytabwidget.h"
|
#include "widgets/fancytabwidget.h"
|
||||||
#include "widgets/playingwidget.h"
|
#include "widgets/playingwidget.h"
|
||||||
#include "widgets/sliderwidget.h"
|
#include "widgets/sliderwidget.h"
|
||||||
@@ -201,13 +199,11 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
|
|
||||||
//organise_dialog_(new OrganiseDialog(app_->task_manager())),
|
//organise_dialog_(new OrganiseDialog(app_->task_manager())),
|
||||||
equalizer_(new Equalizer),
|
equalizer_(new Equalizer),
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_dialog_([=]() {
|
organise_dialog_([=]() {
|
||||||
OrganiseDialog *dialog = new OrganiseDialog(app->task_manager());
|
OrganiseDialog *dialog = new OrganiseDialog(app->task_manager());
|
||||||
dialog->SetDestinationModel(app->collection()->model()->directory_model());
|
dialog->SetDestinationModel(app->collection()->model()->directory_model());
|
||||||
return dialog;
|
return dialog;
|
||||||
}),
|
}),
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STREAM_TIDAL
|
#ifdef HAVE_STREAM_TIDAL
|
||||||
tidal_search_view_(new InternetSearchView(app_, app_->tidal_search(), TidalSettingsPage::kSettingsGroup, SettingsDialog::Page_Tidal, this)),
|
tidal_search_view_(new InternetSearchView(app_, app_->tidal_search(), TidalSettingsPage::kSettingsGroup, SettingsDialog::Page_Tidal, this)),
|
||||||
#endif
|
#endif
|
||||||
@@ -315,9 +311,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
#endif
|
#endif
|
||||||
playlist_list_->SetApplication(app_);
|
playlist_list_->SetApplication(app_);
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_dialog_->SetDestinationModel(app_->collection()->model()->directory_model());
|
organise_dialog_->SetDestinationModel(app_->collection()->model()->directory_model());
|
||||||
#endif
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
qLog(Debug) << "Creating UI";
|
qLog(Debug) << "Creating UI";
|
||||||
@@ -364,7 +358,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
ui_->action_update_collection->setIcon(IconLoader::Load("view-refresh"));
|
ui_->action_update_collection->setIcon(IconLoader::Load("view-refresh"));
|
||||||
ui_->action_full_collection_scan->setIcon(IconLoader::Load("view-refresh"));
|
ui_->action_full_collection_scan->setIcon(IconLoader::Load("view-refresh"));
|
||||||
ui_->action_settings->setIcon(IconLoader::Load("configure"));
|
ui_->action_settings->setIcon(IconLoader::Load("configure"));
|
||||||
|
|
||||||
// Scrobble
|
// Scrobble
|
||||||
|
|
||||||
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble-disabled", 22));
|
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble-disabled", 22));
|
||||||
@@ -412,11 +406,19 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
|
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
|
||||||
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
|
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
|
||||||
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
|
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
|
||||||
|
#if defined(HAVE_GSTREAMER)
|
||||||
connect(ui_->action_transcoder, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
|
connect(ui_->action_transcoder, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
|
||||||
|
#else
|
||||||
|
ui_->action_transcoder->setDisabled(true);
|
||||||
|
#endif
|
||||||
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
|
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
|
||||||
connect(ui_->action_update_collection, SIGNAL(triggered()), app_->collection(), SLOT(IncrementalScan()));
|
connect(ui_->action_update_collection, SIGNAL(triggered()), app_->collection(), SLOT(IncrementalScan()));
|
||||||
connect(ui_->action_full_collection_scan, SIGNAL(triggered()), app_->collection(), SLOT(FullScan()));
|
connect(ui_->action_full_collection_scan, SIGNAL(triggered()), app_->collection(), SLOT(FullScan()));
|
||||||
|
#if defined(HAVE_GSTREAMER)
|
||||||
connect(ui_->action_add_files_to_transcoder, SIGNAL(triggered()), SLOT(AddFilesToTranscoder()));
|
connect(ui_->action_add_files_to_transcoder, SIGNAL(triggered()), SLOT(AddFilesToTranscoder()));
|
||||||
|
#else
|
||||||
|
ui_->action_add_files_to_transcoder->setDisabled(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(ui_->action_toggle_scrobbling, SIGNAL(triggered()), app_->scrobbler(), SLOT(ToggleScrobbling()));
|
connect(ui_->action_toggle_scrobbling, SIGNAL(triggered()), app_->scrobbler(), SLOT(ToggleScrobbling()));
|
||||||
connect(app_->scrobbler(), SIGNAL(ErrorMessage(QString)), SLOT(ShowErrorDialog(QString)));
|
connect(app_->scrobbler(), SIGNAL(ErrorMessage(QString)), SLOT(ShowErrorDialog(QString)));
|
||||||
@@ -571,16 +573,16 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||||||
playlist_menu_->addAction(ui_->action_renumber_tracks);
|
playlist_menu_->addAction(ui_->action_renumber_tracks);
|
||||||
playlist_menu_->addAction(ui_->action_selection_set_value);
|
playlist_menu_->addAction(ui_->action_selection_set_value);
|
||||||
playlist_menu_->addAction(ui_->action_auto_complete_tags);
|
playlist_menu_->addAction(ui_->action_auto_complete_tags);
|
||||||
playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
|
|
||||||
playlist_menu_->addSeparator();
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
|
playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
|
||||||
|
#endif
|
||||||
|
playlist_menu_->addSeparator();
|
||||||
|
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
||||||
|
playlist_copy_to_device_ = playlist_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice()));
|
||||||
|
#endif
|
||||||
playlist_copy_to_collection_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(PlaylistCopyToCollection()));
|
playlist_copy_to_collection_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(PlaylistCopyToCollection()));
|
||||||
playlist_move_to_collection_ = playlist_menu_->addAction(IconLoader::Load("go-jump"), tr("Move to collection..."), this, SLOT(PlaylistMoveToCollection()));
|
playlist_move_to_collection_ = playlist_menu_->addAction(IconLoader::Load("go-jump"), tr("Move to collection..."), this, SLOT(PlaylistMoveToCollection()));
|
||||||
playlist_organise_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(PlaylistMoveToCollection()));
|
playlist_organise_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(PlaylistMoveToCollection()));
|
||||||
#ifndef Q_OS_WIN
|
|
||||||
playlist_copy_to_device_ = playlist_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice()));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
playlist_open_in_browser_ = playlist_menu_->addAction(IconLoader::Load("document-open-folder"), tr("Show in file browser..."), this, SLOT(PlaylistOpenInBrowser()));
|
playlist_open_in_browser_ = playlist_menu_->addAction(IconLoader::Load("document-open-folder"), tr("Show in file browser..."), this, SLOT(PlaylistOpenInBrowser()));
|
||||||
playlist_open_in_browser_->setVisible(false);
|
playlist_open_in_browser_->setVisible(false);
|
||||||
playlist_show_in_collection_ = playlist_menu_->addAction(IconLoader::Load("edit-find"), tr("Show in collection..."), this, SLOT(ShowInCollection()));
|
playlist_show_in_collection_ = playlist_menu_->addAction(IconLoader::Load("edit-find"), tr("Show in collection..."), this, SLOT(ShowInCollection()));
|
||||||
@@ -1428,14 +1430,12 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
|
|||||||
ui_->action_remove_from_playlist->setEnabled(!selection.isEmpty());
|
ui_->action_remove_from_playlist->setEnabled(!selection.isEmpty());
|
||||||
|
|
||||||
playlist_show_in_collection_->setVisible(false);
|
playlist_show_in_collection_->setVisible(false);
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
playlist_copy_to_collection_->setVisible(false);
|
playlist_copy_to_collection_->setVisible(false);
|
||||||
playlist_move_to_collection_->setVisible(false);
|
playlist_move_to_collection_->setVisible(false);
|
||||||
playlist_organise_->setVisible(false);
|
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
||||||
#ifndef Q_OS_WIN
|
|
||||||
playlist_copy_to_device_->setVisible(false);
|
playlist_copy_to_device_->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
playlist_organise_->setVisible(false);
|
||||||
playlist_open_in_browser_->setVisible(false);
|
playlist_open_in_browser_->setVisible(false);
|
||||||
|
|
||||||
if (selected < 1) {
|
if (selected < 1) {
|
||||||
@@ -1495,18 +1495,14 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
|
|||||||
// Is it a collection item?
|
// Is it a collection item?
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (item->IsLocalCollectionItem() && item->Metadata().id() != -1) {
|
if (item->IsLocalCollectionItem() && item->Metadata().id() != -1) {
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
playlist_organise_->setVisible(editable);
|
playlist_organise_->setVisible(editable);
|
||||||
#endif
|
|
||||||
playlist_show_in_collection_->setVisible(editable);
|
playlist_show_in_collection_->setVisible(editable);
|
||||||
playlist_open_in_browser_->setVisible(true);
|
playlist_open_in_browser_->setVisible(true);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
else {
|
else {
|
||||||
playlist_copy_to_collection_->setVisible(editable);
|
playlist_copy_to_collection_->setVisible(editable);
|
||||||
playlist_move_to_collection_->setVisible(editable);
|
playlist_move_to_collection_->setVisible(editable);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
||||||
playlist_copy_to_device_->setVisible(editable);
|
playlist_copy_to_device_->setVisible(editable);
|
||||||
@@ -1941,7 +1937,6 @@ void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) {
|
|||||||
ui_->status_bar->show();
|
ui_->status_bar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void MainWindow::CopyFilesToCollection(const QList<QUrl> &urls) {
|
void MainWindow::CopyFilesToCollection(const QList<QUrl> &urls) {
|
||||||
organise_dialog_->SetDestinationModel(app_->collection_model()->directory_model());
|
organise_dialog_->SetDestinationModel(app_->collection_model()->directory_model());
|
||||||
organise_dialog_->SetUrls(urls);
|
organise_dialog_->SetUrls(urls);
|
||||||
@@ -1957,7 +1952,7 @@ void MainWindow::MoveFilesToCollection(const QList<QUrl> &urls) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CopyFilesToDevice(const QList<QUrl> &urls) {
|
void MainWindow::CopyFilesToDevice(const QList<QUrl> &urls) {
|
||||||
#ifndef Q_OS_WIN
|
#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN)
|
||||||
organise_dialog_->SetDestinationModel(app_->device_manager()->connected_devices_model(), true);
|
organise_dialog_->SetDestinationModel(app_->device_manager()->connected_devices_model(), true);
|
||||||
organise_dialog_->SetCopy(true);
|
organise_dialog_->SetCopy(true);
|
||||||
if (organise_dialog_->SetUrls(urls))
|
if (organise_dialog_->SetUrls(urls))
|
||||||
@@ -1967,10 +1962,8 @@ void MainWindow::CopyFilesToDevice(const QList<QUrl> &urls) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MainWindow::EditFileTags(const QList<QUrl> &urls) {
|
void MainWindow::EditFileTags(const QList<QUrl> &urls) {
|
||||||
//EnsureEditTagDialogCreated();
|
|
||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
for (const QUrl &url : urls) {
|
for (const QUrl &url : urls) {
|
||||||
@@ -1985,7 +1978,6 @@ void MainWindow::EditFileTags(const QList<QUrl> &urls) {
|
|||||||
edit_tag_dialog_->show();
|
edit_tag_dialog_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void MainWindow::PlaylistCopyToCollection() {
|
void MainWindow::PlaylistCopyToCollection() {
|
||||||
PlaylistOrganiseSelected(true);
|
PlaylistOrganiseSelected(true);
|
||||||
}
|
}
|
||||||
@@ -2009,7 +2001,6 @@ void MainWindow::PlaylistOrganiseSelected(bool copy) {
|
|||||||
organise_dialog_->SetCopy(copy);
|
organise_dialog_->SetCopy(copy);
|
||||||
organise_dialog_->show();
|
organise_dialog_->show();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MainWindow::PlaylistOpenInBrowser() {
|
void MainWindow::PlaylistOpenInBrowser() {
|
||||||
|
|
||||||
@@ -2055,9 +2046,8 @@ void MainWindow::PlaylistSkip() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_GSTREAMER)
|
|
||||||
void MainWindow::PlaylistCopyToDevice() {
|
void MainWindow::PlaylistCopyToDevice() {
|
||||||
#if !defined(Q_OS_WIN)
|
#ifndef Q_OS_WIN
|
||||||
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
||||||
SongList songs;
|
SongList songs;
|
||||||
|
|
||||||
@@ -2075,7 +2065,6 @@ void MainWindow::PlaylistCopyToDevice() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MainWindow::ChangeCollectionQueryMode(QAction *action) {
|
void MainWindow::ChangeCollectionQueryMode(QAction *action) {
|
||||||
if (action == collection_show_duplicates_) {
|
if (action == collection_show_duplicates_) {
|
||||||
|
|||||||
@@ -186,14 +186,10 @@ signals:
|
|||||||
void AddFilesToTranscoder();
|
void AddFilesToTranscoder();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void PlaylistCopyToCollection();
|
void PlaylistCopyToCollection();
|
||||||
void PlaylistMoveToCollection();
|
void PlaylistMoveToCollection();
|
||||||
#ifndef Q_OS_WIN_
|
|
||||||
void PlaylistCopyToDevice();
|
void PlaylistCopyToDevice();
|
||||||
#endif
|
|
||||||
void PlaylistOrganiseSelected(bool copy);
|
void PlaylistOrganiseSelected(bool copy);
|
||||||
#endif
|
|
||||||
void PlaylistOpenInBrowser();
|
void PlaylistOpenInBrowser();
|
||||||
void ShowInCollection();
|
void ShowInCollection();
|
||||||
|
|
||||||
@@ -206,11 +202,9 @@ signals:
|
|||||||
void SongChanged(const Song& song);
|
void SongChanged(const Song& song);
|
||||||
void VolumeChanged(int volume);
|
void VolumeChanged(int volume);
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void CopyFilesToCollection(const QList<QUrl>& urls);
|
void CopyFilesToCollection(const QList<QUrl>& urls);
|
||||||
void MoveFilesToCollection(const QList<QUrl>& urls);
|
void MoveFilesToCollection(const QList<QUrl>& urls);
|
||||||
void CopyFilesToDevice(const QList<QUrl>& urls);
|
void CopyFilesToDevice(const QList<QUrl>& urls);
|
||||||
#endif
|
|
||||||
void EditFileTags(const QList<QUrl>& urls);
|
void EditFileTags(const QList<QUrl>& urls);
|
||||||
|
|
||||||
void AddToPlaylist(QMimeData *data);
|
void AddToPlaylist(QMimeData *data);
|
||||||
@@ -327,9 +321,7 @@ signals:
|
|||||||
Lazy<TranscodeDialog> transcode_dialog_;
|
Lazy<TranscodeDialog> transcode_dialog_;
|
||||||
#endif
|
#endif
|
||||||
Lazy<ErrorDialog> error_dialog_;
|
Lazy<ErrorDialog> error_dialog_;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
Lazy<OrganiseDialog> organise_dialog_;
|
Lazy<OrganiseDialog> organise_dialog_;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
||||||
std::unique_ptr<TagFetcher> tag_fetcher_;
|
std::unique_ptr<TagFetcher> tag_fetcher_;
|
||||||
@@ -352,12 +344,10 @@ signals:
|
|||||||
QAction *playlist_undoredo_;
|
QAction *playlist_undoredo_;
|
||||||
QAction *playlist_organise_;
|
QAction *playlist_organise_;
|
||||||
QAction *playlist_show_in_collection_;
|
QAction *playlist_show_in_collection_;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
QAction *playlist_copy_to_collection_;
|
QAction *playlist_copy_to_collection_;
|
||||||
QAction *playlist_move_to_collection_;
|
QAction *playlist_move_to_collection_;
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
QAction *playlist_copy_to_device_;
|
QAction *playlist_copy_to_device_;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
QAction *playlist_open_in_browser_;
|
QAction *playlist_open_in_browser_;
|
||||||
QAction *playlist_queue_;
|
QAction *playlist_queue_;
|
||||||
|
|||||||
@@ -210,10 +210,8 @@ void DeviceView::SetApplication(Application *app) {
|
|||||||
|
|
||||||
properties_dialog_->SetDeviceManager(app_->device_manager());
|
properties_dialog_->SetDeviceManager(app_->device_manager());
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_dialog_.reset(new OrganiseDialog(app_->task_manager()));
|
organise_dialog_.reset(new OrganiseDialog(app_->task_manager()));
|
||||||
organise_dialog_->SetDestinationModel(app_->collection_model()->directory_model());
|
organise_dialog_->SetDestinationModel(app_->collection_model()->directory_model());
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,9 +233,7 @@ void DeviceView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
open_in_new_playlist_ = collection_menu_->addAction(IconLoader::Load("document-new"), tr("Open in new playlist"), this, SLOT(OpenInNewPlaylist()));
|
open_in_new_playlist_ = collection_menu_->addAction(IconLoader::Load("document-new"), tr("Open in new playlist"), this, SLOT(OpenInNewPlaylist()));
|
||||||
|
|
||||||
collection_menu_->addSeparator();
|
collection_menu_->addSeparator();
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
organise_action_ = collection_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(Organise()));
|
organise_action_ = collection_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(Organise()));
|
||||||
#endif
|
|
||||||
delete_action_ = collection_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from device..."), this, SLOT(Delete()));
|
delete_action_ = collection_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from device..."), this, SLOT(Delete()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +405,6 @@ void DeviceView::OpenInNewPlaylist() {
|
|||||||
emit AddToPlaylistSignal(data);
|
emit AddToPlaylistSignal(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void DeviceView::Delete() {
|
void DeviceView::Delete() {
|
||||||
|
|
||||||
if (selectedIndexes().isEmpty()) return;
|
if (selectedIndexes().isEmpty()) return;
|
||||||
@@ -444,14 +439,12 @@ void DeviceView::Organise() {
|
|||||||
organise_dialog_->show();
|
organise_dialog_->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void DeviceView::Unmount() {
|
void DeviceView::Unmount() {
|
||||||
QModelIndex device_idx = MapToDevice(menu_index_);
|
QModelIndex device_idx = MapToDevice(menu_index_);
|
||||||
app_->device_manager()->Unmount(device_idx.row());
|
app_->device_manager()->Unmount(device_idx.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void DeviceView::DeleteFinished(const SongList &songs_with_errors) {
|
void DeviceView::DeleteFinished(const SongList &songs_with_errors) {
|
||||||
|
|
||||||
if (songs_with_errors.isEmpty()) return;
|
if (songs_with_errors.isEmpty()) return;
|
||||||
@@ -461,7 +454,6 @@ void DeviceView::DeleteFinished(const SongList &songs_with_errors) {
|
|||||||
// It deletes itself when the user closes it
|
// It deletes itself when the user closes it
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool DeviceView::CanRecursivelyExpand(const QModelIndex &index) const {
|
bool DeviceView::CanRecursivelyExpand(const QModelIndex &index) const {
|
||||||
// Never expand devices
|
// Never expand devices
|
||||||
|
|||||||
@@ -85,17 +85,13 @@ class DeviceView : public AutoExpandingTreeView {
|
|||||||
void Load();
|
void Load();
|
||||||
void AddToPlaylist();
|
void AddToPlaylist();
|
||||||
void OpenInNewPlaylist();
|
void OpenInNewPlaylist();
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void Organise();
|
void Organise();
|
||||||
void Delete();
|
void Delete();
|
||||||
#endif
|
|
||||||
|
|
||||||
void DeviceConnected(int row);
|
void DeviceConnected(int row);
|
||||||
void DeviceDisconnected(int row);
|
void DeviceDisconnected(int row);
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
void DeleteFinished(const SongList &songs_with_errors);
|
void DeleteFinished(const SongList &songs_with_errors);
|
||||||
#endif
|
|
||||||
|
|
||||||
// AutoExpandingTreeView
|
// AutoExpandingTreeView
|
||||||
bool CanRecursivelyExpand(const QModelIndex &index) const;
|
bool CanRecursivelyExpand(const QModelIndex &index) const;
|
||||||
@@ -112,9 +108,7 @@ class DeviceView : public AutoExpandingTreeView {
|
|||||||
QSortFilterProxyModel *sort_model_;
|
QSortFilterProxyModel *sort_model_;
|
||||||
|
|
||||||
std::unique_ptr<DeviceProperties> properties_dialog_;
|
std::unique_ptr<DeviceProperties> properties_dialog_;
|
||||||
#ifdef HAVE_GSTREAMER
|
|
||||||
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
||||||
#endif
|
|
||||||
|
|
||||||
QMenu *device_menu_;
|
QMenu *device_menu_;
|
||||||
QAction *eject_action_;
|
QAction *eject_action_;
|
||||||
|
|||||||
@@ -35,19 +35,25 @@
|
|||||||
#include "core/taskmanager.h"
|
#include "core/taskmanager.h"
|
||||||
#include "core/musicstorage.h"
|
#include "core/musicstorage.h"
|
||||||
#include "organise.h"
|
#include "organise.h"
|
||||||
#include "transcoder/transcoder.h"
|
#ifdef HAVE_GSTREAMER
|
||||||
|
# include "transcoder/transcoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class OrganiseFormat;
|
class OrganiseFormat;
|
||||||
|
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
const int Organise::kBatchSize = 10;
|
const int Organise::kBatchSize = 10;
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
const int Organise::kTranscodeProgressInterval = 500;
|
const int Organise::kTranscodeProgressInterval = 500;
|
||||||
|
#endif
|
||||||
|
|
||||||
Organise::Organise(TaskManager *task_manager, std::shared_ptr<MusicStorage> destination, const OrganiseFormat &format, bool copy, bool overwrite, bool mark_as_listened, const NewSongInfoList &songs_info, bool eject_after)
|
Organise::Organise(TaskManager *task_manager, std::shared_ptr<MusicStorage> destination, const OrganiseFormat &format, bool copy, bool overwrite, bool mark_as_listened, const NewSongInfoList &songs_info, bool eject_after)
|
||||||
: thread_(nullptr),
|
: thread_(nullptr),
|
||||||
task_manager_(task_manager),
|
task_manager_(task_manager),
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
transcoder_(new Transcoder(this)),
|
transcoder_(new Transcoder(this)),
|
||||||
|
#endif
|
||||||
destination_(destination),
|
destination_(destination),
|
||||||
format_(format),
|
format_(format),
|
||||||
copy_(copy),
|
copy_(copy),
|
||||||
@@ -55,7 +61,9 @@ Organise::Organise(TaskManager *task_manager, std::shared_ptr<MusicStorage> dest
|
|||||||
mark_as_listened_(mark_as_listened),
|
mark_as_listened_(mark_as_listened),
|
||||||
eject_after_(eject_after),
|
eject_after_(eject_after),
|
||||||
task_count_(songs_info.count()),
|
task_count_(songs_info.count()),
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
transcode_suffix_(1),
|
transcode_suffix_(1),
|
||||||
|
#endif
|
||||||
tasks_complete_(0),
|
tasks_complete_(0),
|
||||||
started_(false),
|
started_(false),
|
||||||
task_id_(0),
|
task_id_(0),
|
||||||
@@ -78,7 +86,9 @@ void Organise::Start() {
|
|||||||
|
|
||||||
thread_ = new QThread;
|
thread_ = new QThread;
|
||||||
connect(thread_, SIGNAL(started()), SLOT(ProcessSomeFiles()));
|
connect(thread_, SIGNAL(started()), SLOT(ProcessSomeFiles()));
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
connect(transcoder_, SIGNAL(JobComplete(QString, QString, bool)), SLOT(FileTranscoded(QString, QString, bool)));
|
connect(transcoder_, SIGNAL(JobComplete(QString, QString, bool)), SLOT(FileTranscoded(QString, QString, bool)));
|
||||||
|
#endif
|
||||||
|
|
||||||
moveToThread(thread_);
|
moveToThread(thread_);
|
||||||
thread_->start();
|
thread_->start();
|
||||||
@@ -87,7 +97,9 @@ void Organise::Start() {
|
|||||||
void Organise::ProcessSomeFiles() {
|
void Organise::ProcessSomeFiles() {
|
||||||
|
|
||||||
if (!started_) {
|
if (!started_) {
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
transcode_temp_name_.open();
|
transcode_temp_name_.open();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!destination_->StartCopy(&supported_filetypes_)) {
|
if (!destination_->StartCopy(&supported_filetypes_)) {
|
||||||
// Failed to start - mark everything as failed :(
|
// Failed to start - mark everything as failed :(
|
||||||
@@ -99,12 +111,14 @@ void Organise::ProcessSomeFiles() {
|
|||||||
|
|
||||||
// None left?
|
// None left?
|
||||||
if (tasks_pending_.isEmpty()) {
|
if (tasks_pending_.isEmpty()) {
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
if (!tasks_transcoding_.isEmpty()) {
|
if (!tasks_transcoding_.isEmpty()) {
|
||||||
// Just wait - FileTranscoded will start us off again in a little while
|
// Just wait - FileTranscoded will start us off again in a little while
|
||||||
qLog(Debug) << "Waiting for transcoding jobs";
|
qLog(Debug) << "Waiting for transcoding jobs";
|
||||||
transcode_progress_timer_.start(kTranscodeProgressInterval, this);
|
transcode_progress_timer_.start(kTranscodeProgressInterval, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
UpdateProgress();
|
UpdateProgress();
|
||||||
|
|
||||||
@@ -137,6 +151,7 @@ void Organise::ProcessSomeFiles() {
|
|||||||
Song song = task.song_info_.song_;
|
Song song = task.song_info_.song_;
|
||||||
if (!song.is_valid()) continue;
|
if (!song.is_valid()) continue;
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
// Maybe this file is one that's been transcoded already?
|
// Maybe this file is one that's been transcoded already?
|
||||||
if (!task.transcoded_filename_.isEmpty()) {
|
if (!task.transcoded_filename_.isEmpty()) {
|
||||||
qLog(Debug) << "This file has already been transcoded";
|
qLog(Debug) << "This file has already been transcoded";
|
||||||
@@ -174,6 +189,7 @@ void Organise::ProcessSomeFiles() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
MusicStorage::CopyJob job;
|
MusicStorage::CopyJob job;
|
||||||
job.source_ = task.transcoded_filename_.isEmpty() ? task.song_info_.song_.url().toLocalFile() : task.transcoded_filename_;
|
job.source_ = task.transcoded_filename_.isEmpty() ? task.song_info_.song_.url().toLocalFile() : task.transcoded_filename_;
|
||||||
@@ -204,6 +220,7 @@ void Organise::ProcessSomeFiles() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
Song::FileType Organise::CheckTranscode(Song::FileType original_type) const {
|
Song::FileType Organise::CheckTranscode(Song::FileType original_type) const {
|
||||||
|
|
||||||
if (original_type == Song::FileType_Stream) return Song::FileType_Unknown;
|
if (original_type == Song::FileType_Stream) return Song::FileType_Unknown;
|
||||||
@@ -230,6 +247,7 @@ Song::FileType Organise::CheckTranscode(Song::FileType original_type) const {
|
|||||||
return Song::FileType_Unknown;
|
return Song::FileType_Unknown;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Organise::SetSongProgress(float progress, bool transcoded) {
|
void Organise::SetSongProgress(float progress, bool transcoded) {
|
||||||
|
|
||||||
@@ -243,12 +261,14 @@ void Organise::UpdateProgress() {
|
|||||||
|
|
||||||
const int total = task_count_ * 100;
|
const int total = task_count_ * 100;
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
// Update transcoding progress
|
// Update transcoding progress
|
||||||
QMap<QString, float> transcode_progress = transcoder_->GetProgress();
|
QMap<QString, float> transcode_progress = transcoder_->GetProgress();
|
||||||
for (const QString &filename : transcode_progress.keys()) {
|
for (const QString &filename : transcode_progress.keys()) {
|
||||||
if (!tasks_transcoding_.contains(filename)) continue;
|
if (!tasks_transcoding_.contains(filename)) continue;
|
||||||
tasks_transcoding_[filename].transcode_progress_ = transcode_progress[filename];
|
tasks_transcoding_[filename].transcode_progress_ = transcode_progress[filename];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Count the progress of all tasks that are in the queue.
|
// Count the progress of all tasks that are in the queue.
|
||||||
// Files that need transcoding total 50 for the transcode and 50 for the copy, files that only need to be copied total 100.
|
// Files that need transcoding total 50 for the transcode and 50 for the copy, files that only need to be copied total 100.
|
||||||
@@ -257,9 +277,11 @@ void Organise::UpdateProgress() {
|
|||||||
for (const Task &task : tasks_pending_) {
|
for (const Task &task : tasks_pending_) {
|
||||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
for (const Task &task : tasks_transcoding_.values()) {
|
for (const Task &task : tasks_transcoding_.values()) {
|
||||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Add the progress of the track that's currently copying
|
// Add the progress of the track that's currently copying
|
||||||
progress += current_copy_progress_;
|
progress += current_copy_progress_;
|
||||||
@@ -268,6 +290,7 @@ void Organise::UpdateProgress() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
void Organise::FileTranscoded(const QString &input, const QString &output, bool success) {
|
void Organise::FileTranscoded(const QString &input, const QString &output, bool success) {
|
||||||
|
|
||||||
qLog(Info) << "File finished" << input << success;
|
qLog(Info) << "File finished" << input << success;
|
||||||
@@ -283,14 +306,17 @@ void Organise::FileTranscoded(const QString &input, const QString &output, bool
|
|||||||
QTimer::singleShot(0, this, SLOT(ProcessSomeFiles()));
|
QTimer::singleShot(0, this, SLOT(ProcessSomeFiles()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Organise::timerEvent(QTimerEvent *e) {
|
void Organise::timerEvent(QTimerEvent *e) {
|
||||||
|
|
||||||
QObject::timerEvent(e);
|
QObject::timerEvent(e);
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
if (e->timerId() == transcode_progress_timer_.timerId()) {
|
if (e->timerId() == transcode_progress_timer_.timerId()) {
|
||||||
UpdateProgress();
|
UpdateProgress();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ class QTimerEvent;
|
|||||||
|
|
||||||
class MusicStorage;
|
class MusicStorage;
|
||||||
class TaskManager;
|
class TaskManager;
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
class Transcoder;
|
class Transcoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
class Organise : public QObject {
|
class Organise : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -60,7 +62,9 @@ class Organise : public QObject {
|
|||||||
Organise(TaskManager *task_manager, std::shared_ptr<MusicStorage> destination, const OrganiseFormat &format, bool copy, bool overwrite, bool mark_as_listened, const NewSongInfoList &songs, bool eject_after);
|
Organise(TaskManager *task_manager, std::shared_ptr<MusicStorage> destination, const OrganiseFormat &format, bool copy, bool overwrite, bool mark_as_listened, const NewSongInfoList &songs, bool eject_after);
|
||||||
|
|
||||||
static const int kBatchSize;
|
static const int kBatchSize;
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
static const int kTranscodeProgressInterval;
|
static const int kTranscodeProgressInterval;
|
||||||
|
#endif
|
||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
@@ -73,19 +77,25 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ProcessSomeFiles();
|
void ProcessSomeFiles();
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
void FileTranscoded(const QString &input, const QString &output, bool success);
|
void FileTranscoded(const QString &input, const QString &output, bool success);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetSongProgress(float progress, bool transcoded = false);
|
void SetSongProgress(float progress, bool transcoded = false);
|
||||||
void UpdateProgress();
|
void UpdateProgress();
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
Song::FileType CheckTranscode(Song::FileType original_type) const;
|
Song::FileType CheckTranscode(Song::FileType original_type) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Task {
|
struct Task {
|
||||||
explicit Task(const NewSongInfo &song_info = NewSongInfo()) : song_info_(song_info), transcode_progress_(0.0) {}
|
explicit Task(const NewSongInfo &song_info = NewSongInfo()) :
|
||||||
|
song_info_(song_info),
|
||||||
|
transcode_progress_(0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
NewSongInfo song_info_;
|
NewSongInfo song_info_;
|
||||||
|
|
||||||
float transcode_progress_;
|
float transcode_progress_;
|
||||||
QString transcoded_filename_;
|
QString transcoded_filename_;
|
||||||
QString new_extension_;
|
QString new_extension_;
|
||||||
@@ -95,7 +105,9 @@ signals:
|
|||||||
QThread *thread_;
|
QThread *thread_;
|
||||||
QThread *original_thread_;
|
QThread *original_thread_;
|
||||||
TaskManager *task_manager_;
|
TaskManager *task_manager_;
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
Transcoder *transcoder_;
|
Transcoder *transcoder_;
|
||||||
|
#endif
|
||||||
std::shared_ptr<MusicStorage> destination_;
|
std::shared_ptr<MusicStorage> destination_;
|
||||||
QList<Song::FileType> supported_filetypes_;
|
QList<Song::FileType> supported_filetypes_;
|
||||||
|
|
||||||
@@ -106,12 +118,16 @@ signals:
|
|||||||
const bool eject_after_;
|
const bool eject_after_;
|
||||||
int task_count_;
|
int task_count_;
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
QBasicTimer transcode_progress_timer_;
|
QBasicTimer transcode_progress_timer_;
|
||||||
QTemporaryFile transcode_temp_name_;
|
QTemporaryFile transcode_temp_name_;
|
||||||
int transcode_suffix_;
|
int transcode_suffix_;
|
||||||
|
#endif
|
||||||
|
|
||||||
QList<Task> tasks_pending_;
|
QList<Task> tasks_pending_;
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
QMap<QString, Task> tasks_transcoding_;
|
QMap<QString, Task> tasks_transcoding_;
|
||||||
|
#endif
|
||||||
int tasks_complete_;
|
int tasks_complete_;
|
||||||
|
|
||||||
bool started_;
|
bool started_;
|
||||||
|
|||||||
Reference in New Issue
Block a user