Don't compile devices on windows

This commit is contained in:
Jonas Kvinge 2018-09-20 17:36:23 +02:00
parent 246f82bfad
commit 97ec12b5b3
9 changed files with 113 additions and 52 deletions

View File

@ -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

View File

@ -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

View File

@ -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_;

View File

@ -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

View File

@ -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_;

View File

@ -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<TaskManager> task_manager_;
Lazy<Player> player_;
Lazy<EngineDevice> enginedevice_;
#ifndef Q_OS_WIN
Lazy<DeviceManager> device_manager_;
#endif
Lazy<SCollection> collection_;
Lazy<PlaylistBackend> playlist_backend_;
Lazy<PlaylistManager> 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(); }

View File

@ -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;

View File

@ -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<QUrl>)), SLOT(CopyFilesToCollection(QList<QUrl>)));
connect(file_view_, SIGNAL(MoveToCollection(QList<QUrl>)), SLOT(MoveFilesToCollection(QList<QUrl>)));
connect(file_view_, SIGNAL(EditTags(QList<QUrl>)), SLOT(EditFileTags(QList<QUrl>)));
#ifndef Q_OS_WIN
connect(file_view_, SIGNAL(CopyToDevice(QList<QUrl>)), SLOT(CopyFilesToDevice(QList<QUrl>)));
#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<QUrl> &urls) {
}
void MainWindow::CopyFilesToDevice(const QList<QUrl> &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<QUrl> &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

View File

@ -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<QUrl>& urls);
void MoveFilesToCollection(const QList<QUrl>& urls);
//#ifndef Q_OS_WIN
void CopyFilesToDevice(const QList<QUrl>& urls);
//#endif
#endif
void EditFileTags(const QList<QUrl>& 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<SettingsDialog> 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_;