diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d4c84c52c..889ed0b95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -247,16 +247,6 @@ set(SOURCES globalshortcuts/gnomeglobalshortcutbackend.cpp globalshortcuts/qxtglobalshortcutbackend.cpp globalshortcuts/globalshortcutgrabber.cpp - - device/connecteddevice.cpp - device/devicedatabasebackend.cpp - device/devicelister.cpp - device/devicemanager.cpp - device/deviceproperties.cpp - device/devicestatefiltermodel.cpp - device/deviceview.cpp - device/deviceviewcontainer.cpp - device/filesystemdevice.cpp internet/internetmodel.cpp internet/internetservice.cpp @@ -421,16 +411,6 @@ set(HEADERS globalshortcuts/globalshortcuts.h globalshortcuts/gnomeglobalshortcutbackend.h globalshortcuts/globalshortcutgrabber.h - - device/connecteddevice.h - device/devicedatabasebackend.h - device/devicelister.h - device/devicemanager.h - device/deviceproperties.h - device/devicestatefiltermodel.h - device/deviceviewcontainer.h - device/deviceview.h - device/filesystemdevice.h internet/internetmodel.h internet/internetservice.h @@ -499,9 +479,6 @@ set(UI widgets/osdpretty.ui widgets/fileview.ui widgets/loginstatewidget.ui - - device/deviceproperties.ui - device/deviceviewcontainer.ui globalshortcuts/globalshortcutgrabber.ui @@ -679,6 +656,32 @@ optional_source(HAVE_DBUS core/mpris2.h ) +optional_source(UNIX + SOURCES + device/connecteddevice.cpp + device/devicedatabasebackend.cpp + device/devicelister.cpp + device/devicemanager.cpp + device/devicestatefiltermodel.cpp + device/filesystemdevice.cpp + device/deviceviewcontainer.cpp + device/deviceview.cpp + device/deviceproperties.cpp + HEADERS + device/connecteddevice.h + device/devicedatabasebackend.h + device/devicelister.h + device/devicemanager.h + device/devicestatefiltermodel.h + device/filesystemdevice.h + device/deviceviewcontainer.h + device/deviceview.h + device/deviceproperties.h + UI + device/deviceproperties.ui + device/deviceviewcontainer.ui +) + if(HAVE_DBUS) optional_source(HAVE_DEVICEKIT SOURCES device/devicekitlister.cpp diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index bf8ead77d..3bbdd8947 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -68,8 +68,10 @@ #include "collectionitem.h" #include "collectionmodel.h" #include "collectionview.h" -#include "device/devicemanager.h" -#include "device/devicestatefiltermodel.h" +#ifndef Q_OS_WIN +# include "device/devicemanager.h" +# include "device/devicestatefiltermodel.h" +#endif #include "dialogs/edittagdialog.h" #ifdef HAVE_GSTREAMER #include "dialogs/organisedialog.h" @@ -460,7 +462,9 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { #ifdef HAVE_GSTREAMER context_menu_->addSeparator(); organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise())); +#ifndef Q_OS_WIN copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice())); +#endif //delete_ = context_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), this, SLOT(Delete())); #endif @@ -477,7 +481,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { context_menu_->addMenu(filter_->menu()); -#ifdef HAVE_GSTREAMER +#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN) 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))); #endif @@ -518,7 +522,9 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { // only when no smart playlists selected #ifdef HAVE_GSTREAMER organise_->setVisible(regular_elements_only); +#ifndef Q_OS_WIN copy_to_device_->setVisible(regular_elements_only); +#endif //delete_->setVisible(regular_elements_only); #endif show_in_various_->setVisible(regular_elements_only); @@ -527,7 +533,9 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { // only when all selected items are editable #ifdef HAVE_GSTREAMER organise_->setEnabled(regular_elements == regular_editable); +#ifndef Q_OS_WIN copy_to_device_->setEnabled(regular_elements == regular_editable); +#endif //delete_->setEnabled(regular_elements == regular_editable); #endif @@ -670,7 +678,7 @@ void CollectionView::EditTracks() { #ifdef HAVE_GSTREAMER void CollectionView::CopyToDevice() { - +#ifndef Q_OS_WIN if (!organise_dialog_) organise_dialog_.reset(new OrganiseDialog(app_->task_manager())); @@ -678,7 +686,7 @@ void CollectionView::CopyToDevice() { organise_dialog_->SetCopy(true); organise_dialog_->SetSongs(GetSelectedSongs()); organise_dialog_->show(); - +#endif } #endif diff --git a/src/collection/collectionview.h b/src/collection/collectionview.h index 9ad39e8d7..5d2291309 100644 --- a/src/collection/collectionview.h +++ b/src/collection/collectionview.h @@ -151,7 +151,9 @@ signals: QAction *open_in_new_playlist_; #ifdef HAVE_GSTREAMER QAction *organise_; +#ifndef Q_OS_WIN QAction *copy_to_device_; +#endif #endif QAction *delete_; QAction *edit_track_; diff --git a/src/context/contextalbumsview.cpp b/src/context/contextalbumsview.cpp index fad2349e7..4ba8c7265 100644 --- a/src/context/contextalbumsview.cpp +++ b/src/context/contextalbumsview.cpp @@ -66,9 +66,12 @@ #include "core/utilities.h" #include "collection/collectionbackend.h" #include "collection/collectiondirectorymodel.h" +#include "collection/collectionmodel.h" #include "collection/collectionitem.h" -#include "device/devicemanager.h" -#include "device/devicestatefiltermodel.h" +#ifndef Q_OS_WIN +# include "device/devicemanager.h" +# include "device/devicestatefiltermodel.h" +#endif #include "dialogs/edittagdialog.h" #ifdef HAVE_GSTREAMER #include "dialogs/organisedialog.h" @@ -263,9 +266,6 @@ void ContextAlbumsView::SaveFocus() { } void ContextAlbumsView::SaveContainerPath(const QModelIndex &child) { - - -// return; QModelIndex current = model()->parent(child); QVariant type = model()->data(current, ContextAlbumsModel::Role_Type); @@ -359,7 +359,6 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) { if (!context_menu_) { context_menu_ = new QMenu(this); - //context_menu_->setStyleSheet("background-color: #3DADE8;"); add_to_playlist_ = context_menu_->addAction(IconLoader::Load("media-play"), tr("Append to current playlist"), this, SLOT(AddToPlaylist())); load_ = context_menu_->addAction(IconLoader::Load("media-play"), tr("Replace current playlist"), this, SLOT(Load())); @@ -371,7 +370,9 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) { #ifdef HAVE_GSTREAMER context_menu_->addSeparator(); organise_ = context_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(Organise())); +#ifndef Q_OS_WIN copy_to_device_ = context_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(CopyToDevice())); +#endif #endif context_menu_->addSeparator(); @@ -381,7 +382,7 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) { context_menu_->addSeparator(); -#ifdef HAVE_GSTREAMER +#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN) 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))); #endif @@ -418,13 +419,17 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) { #ifdef HAVE_GSTREAMER organise_->setVisible(regular_elements_only); +#ifndef Q_OS_WIN copy_to_device_->setVisible(regular_elements_only); +#endif #endif // only when all selected items are editable #ifdef HAVE_GSTREAMER organise_->setEnabled(regular_elements == regular_editable); +#ifndef Q_OS_WIN copy_to_device_->setEnabled(regular_elements == regular_editable); +#endif #endif context_menu_->popup(e->globalPos()); @@ -509,7 +514,7 @@ void ContextAlbumsView::EditTracks() { #ifdef HAVE_GSTREAMER void ContextAlbumsView::CopyToDevice() { - +#ifndef Q_OS_WIN if (!organise_dialog_) organise_dialog_.reset(new OrganiseDialog(app_->task_manager())); @@ -517,7 +522,7 @@ void ContextAlbumsView::CopyToDevice() { organise_dialog_->SetCopy(true); organise_dialog_->SetSongs(GetSelectedSongs()); organise_dialog_->show(); - +#endif } #endif diff --git a/src/context/contextalbumsview.h b/src/context/contextalbumsview.h index af25671c4..58fef9619 100644 --- a/src/context/contextalbumsview.h +++ b/src/context/contextalbumsview.h @@ -103,7 +103,9 @@ signals: void OpenInNewPlaylist(); #ifdef HAVE_GSTREAMER void Organise(); +//#ifndef Q_OS_WIN void CopyToDevice(); +//#endif #endif void EditTracks(); void ShowInBrowser(); @@ -124,7 +126,9 @@ signals: QAction *open_in_new_playlist_; #ifdef HAVE_GSTREAMER QAction *organise_; +#ifndef Q_OS_WIN QAction *copy_to_device_; +#endif #endif QAction *delete_; QAction *edit_track_; diff --git a/src/core/application.cpp b/src/core/application.cpp index 4f8086bff..6cd954faa 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -38,7 +38,9 @@ #include "appearance.h" #include "engine/enginedevice.h" -#include "device/devicemanager.h" +#ifndef Q_OS_WIN +# include "device/devicemanager.h" +#endif #include "collection/collection.h" #include "playlist/playlistbackend.h" #include "playlist/playlistmanager.h" @@ -48,7 +50,6 @@ #ifdef HAVE_LIBLASTFM #include "covermanager/lastfmcoverprovider.h" #endif -//#include "covermanager/amazoncoverprovider.h" #include "covermanager/discogscoverprovider.h" #include "covermanager/musicbrainzcoverprovider.h" @@ -81,7 +82,9 @@ class ApplicationImpl { task_manager_([=]() { return new TaskManager(app); }), player_([=]() { return new Player(app, app); }), enginedevice_([=]() { return new EngineDevice(app); }), +#ifndef Q_OS_WIN device_manager_([=]() { return new DeviceManager(app, app); }), +#endif collection_([=]() { return new SCollection(app, app); }), playlist_backend_([=]() { PlaylistBackend *backend = new PlaylistBackend(app, app); @@ -95,7 +98,6 @@ class ApplicationImpl { #ifdef HAVE_LIBLASTFM cover_providers->AddProvider(new LastFmCoverProvider(app)); #endif - //cover_providers->AddProvider(new AmazonCoverProvider(app)); cover_providers->AddProvider(new DiscogsCoverProvider(app)); cover_providers->AddProvider(new MusicbrainzCoverProvider(app)); return cover_providers; @@ -122,7 +124,9 @@ class ApplicationImpl { Lazy task_manager_; Lazy player_; Lazy enginedevice_; +#ifndef Q_OS_WIN Lazy device_manager_; +#endif Lazy collection_; Lazy playlist_backend_; Lazy playlist_manager_; @@ -148,7 +152,9 @@ Application::~Application() { // It's important that the device manager is deleted before the database. // Deleting the database deletes all objects that have been created in its thread, including some device collection backends. +#ifndef Q_OS_WIN p_->device_manager_.reset(); +#endif for (QThread *thread : threads_) { thread->quit(); @@ -198,9 +204,11 @@ CurrentArtLoader *Application::current_art_loader() const { Database *Application::database() const { return p_->database_.get(); } +#ifndef Q_OS_WIN DeviceManager *Application::device_manager() const { return p_->device_manager_.get(); } +#endif SCollection *Application::collection() const { return p_->collection_.get(); } diff --git a/src/core/application.h b/src/core/application.h index b81703035..3c20903d9 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -45,7 +45,9 @@ class CollectionBackend; class CollectionModel; class PlaylistBackend; class PlaylistManager; +#ifndef Q_OS_WIN class DeviceManager; +#endif class CoverProviders; class AlbumCoverLoader; class CurrentArtLoader; @@ -68,7 +70,9 @@ class Application : public QObject { TaskManager *task_manager() const; Player *player() const; EngineDevice *enginedevice() const; +#ifndef Q_OS_WIN DeviceManager *device_manager() const; +#endif SCollection *collection() const; diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 84aa00afa..801df23c3 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -121,10 +121,12 @@ #include "covermanager/albumcoverchoicecontroller.h" #include "covermanager/albumcoverloader.h" #include "covermanager/currentartloader.h" -#include "device/devicemanager.h" -#include "device/devicestatefiltermodel.h" -#include "device/deviceview.h" -#include "device/deviceviewcontainer.h" +#ifndef Q_OS_WIN +# include "device/devicemanager.h" +# include "device/devicestatefiltermodel.h" +# include "device/deviceview.h" +# include "device/deviceviewcontainer.h" +#endif #include "transcoder/transcodedialog.h" #include "settings/behavioursettingspage.h" #include "settings/playbacksettingspage.h" @@ -167,8 +169,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co context_view_(new ContextView(this)), collection_view_(new CollectionViewContainer(this)), file_view_(new FileView(this)), +#ifndef Q_OS_WIN device_view_container_(new DeviceViewContainer(this)), device_view_(device_view_container_->view()), +#endif playlist_list_(new PlaylistListContainer(this)), settings_dialog_(std::bind(&MainWindow::CreateSettingsDialog, this)), cover_manager_([=]() { @@ -246,7 +250,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co ui_->tabs->addTab(collection_view_, IconLoader::Load("vinyl"), tr("Collection")); ui_->tabs->addTab(file_view_, IconLoader::Load("document-open"), tr("Files")); ui_->tabs->addTab(playlist_list_, IconLoader::Load("view-media-playlist"), tr("Playlists")); +#ifndef Q_OS_WIN ui_->tabs->addTab(device_view_, IconLoader::Load("device"), tr("Devices")); +#endif ui_->tabs->addTab(tidal_search_view_, IconLoader::Load("tidal"), tr("Tidal", "Tidal")); //ui_->tabs->AddSpacer(); @@ -284,7 +290,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co collection_view_->view()->setModel(collection_sort_model_); collection_view_->view()->SetApplication(app_); +#ifndef Q_OS_WIN device_view_->SetApplication(app_); +#endif playlist_list_->SetApplication(app_); #ifdef HAVE_GSTREAMER @@ -344,7 +352,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co connect(file_view_, SIGNAL(CopyToCollection(QList)), SLOT(CopyFilesToCollection(QList))); connect(file_view_, SIGNAL(MoveToCollection(QList)), SLOT(MoveFilesToCollection(QList))); connect(file_view_, SIGNAL(EditTags(QList)), SLOT(EditFileTags(QList))); +#ifndef Q_OS_WIN connect(file_view_, SIGNAL(CopyToDevice(QList)), SLOT(CopyFilesToDevice(QList))); +#endif #endif file_view_->SetTaskManager(app_->task_manager()); @@ -469,8 +479,10 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co connect(app_->task_manager(), SIGNAL(PauseCollectionWatchers()), app_->collection(), SLOT(PauseWatcher())); connect(app_->task_manager(), SIGNAL(ResumeCollectionWatchers()), app_->collection(), SLOT(ResumeWatcher())); +#ifndef Q_OS_WIN // Devices connections connect(device_view_, SIGNAL(AddToPlaylistSignal(QMimeData*)), SLOT(AddToPlaylist(QMimeData*))); +#endif // Collection filter widget QActionGroup *collection_view_group = new QActionGroup(this); @@ -529,7 +541,9 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co 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_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_delete_ = playlist_menu_->addAction(IconLoader::Load("edit-delete"), tr("Delete from disk..."), this, SLOT(PlaylistDelete())); playlist_open_in_browser_ = playlist_menu_->addAction(IconLoader::Load("document-open-folder"), tr("Show in file browser..."), this, SLOT(PlaylistOpenInBrowser())); @@ -551,7 +565,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co connect(ui_->playlist, SIGNAL(UndoRedoActionsChanged(QAction*, QAction*)), SLOT(PlaylistUndoRedoChanged(QAction*, QAction*))); -#ifdef HAVE_GSTREAMER +#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN) playlist_copy_to_device_->setDisabled(app_->device_manager()->connected_devices_model()->rowCount() == 0); connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), playlist_copy_to_device_, SLOT(setDisabled(bool))); #endif @@ -1324,7 +1338,9 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex playlist_copy_to_collection_->setVisible(false); playlist_move_to_collection_->setVisible(false); //playlist_organise_->setVisible(false); +#ifndef Q_OS_WIN playlist_copy_to_device_->setVisible(false); +#endif #endif playlist_open_in_browser_->setVisible(false); @@ -1393,7 +1409,7 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex } #endif -#ifdef HAVE_GSTREAMER +#if defined(HAVE_GSTREAMER) && !defined(Q_OS_WIN) playlist_copy_to_device_->setVisible(editable); #endif @@ -1830,6 +1846,7 @@ void MainWindow::MoveFilesToCollection(const QList &urls) { } void MainWindow::CopyFilesToDevice(const QList &urls) { +#ifndef Q_OS_WIN organise_dialog_->SetDestinationModel(app_->device_manager()->connected_devices_model(), true); organise_dialog_->SetCopy(true); if (organise_dialog_->SetUrls(urls)) @@ -1837,6 +1854,7 @@ void MainWindow::CopyFilesToDevice(const QList &urls) { else { QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device")); } +#endif } #endif @@ -1968,15 +1986,14 @@ void MainWindow::PlaylistSkip() { } -#ifdef HAVE_GSTREAMER +#if defined(HAVE_GSTREAMER) void MainWindow::PlaylistCopyToDevice() { - +#if !defined(Q_OS_WIN) QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows(); SongList songs; for (const QModelIndex &proxy_index : proxy_indexes) { QModelIndex index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index); - songs << app_->playlist_manager()->current()->item_at(index.row())->Metadata(); } @@ -1985,9 +2002,9 @@ void MainWindow::PlaylistCopyToDevice() { if (organise_dialog_->SetSongs(songs)) organise_dialog_->show(); else { - 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 } #endif diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index 0430ef95b..29170ac56 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -63,8 +63,10 @@ class ContextView; class CollectionViewContainer; class AlbumCoverChoiceController; class CommandlineOptions; +#ifndef Q_OS_WIN class DeviceView; class DeviceViewContainer; +#endif class EditTagDialog; class Equalizer; class ErrorDialog; @@ -134,7 +136,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void resizeEvent(QResizeEvent *event); void closeEvent(QCloseEvent *event); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN bool winEvent(MSG *message, long *result); #endif @@ -183,7 +185,9 @@ signals: #ifdef HAVE_GSTREAMER void PlaylistCopyToCollection(); void PlaylistMoveToCollection(); +#ifndef Q_OS_WIN_ void PlaylistCopyToDevice(); +#endif void PlaylistOrganiseSelected(bool copy); #endif //void PlaylistDelete(); @@ -202,7 +206,9 @@ signals: #ifdef HAVE_GSTREAMER void CopyFilesToCollection(const QList& urls); void MoveFilesToCollection(const QList& urls); +//#ifndef Q_OS_WIN void CopyFilesToDevice(const QList& urls); +//#endif #endif void EditFileTags(const QList& urls); @@ -308,8 +314,10 @@ signals: ContextView *context_view_; CollectionViewContainer *collection_view_; FileView *file_view_; +#ifndef Q_OS_WIN DeviceViewContainer *device_view_container_; DeviceView *device_view_; +#endif PlaylistListContainer *playlist_list_; Lazy settings_dialog_; @@ -347,7 +355,9 @@ signals: #ifdef HAVE_GSTREAMER QAction *playlist_copy_to_collection_; QAction *playlist_move_to_collection_; +#ifndef Q_OS_WIN QAction *playlist_copy_to_device_; +#endif //QAction *playlist_delete_; #endif QAction *playlist_open_in_browser_;