Fix compile with optional components disabled

This commit is contained in:
Jonas Kvinge
2019-10-03 23:29:52 +02:00
parent f449808ba3
commit 4402a56e94
16 changed files with 67 additions and 41 deletions

View File

@@ -2106,9 +2106,10 @@ void MainWindow::PlaylistUndoRedoChanged(QAction *undo, QAction *redo) {
playlist_menu_->insertAction(playlist_undoredo_, redo); playlist_menu_->insertAction(playlist_undoredo_, redo);
} }
#ifdef HAVE_GSTREAMER
void MainWindow::AddFilesToTranscoder() { void MainWindow::AddFilesToTranscoder() {
#ifdef HAVE_GSTREAMER
QStringList filenames; QStringList filenames;
for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) { for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
@@ -2122,21 +2123,24 @@ void MainWindow::AddFilesToTranscoder() {
transcode_dialog_->SetFilenames(filenames); transcode_dialog_->SetFilenames(filenames);
ShowTranscodeDialog(); ShowTranscodeDialog();
}
#endif #endif
}
void MainWindow::ShowCollectionConfig() { void MainWindow::ShowCollectionConfig() {
//EnsureSettingsDialogCreated();
settings_dialog_->OpenAtPage(SettingsDialog::Page_Collection); settings_dialog_->OpenAtPage(SettingsDialog::Page_Collection);
} }
void MainWindow::TaskCountChanged(int count) { void MainWindow::TaskCountChanged(int count) {
if (count == 0) { if (count == 0) {
ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page); ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page);
} }
else { else {
ui_->status_bar_stack->setCurrentWidget(ui_->multi_loading_indicator); ui_->status_bar_stack->setCurrentWidget(ui_->multi_loading_indicator);
} }
} }
void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) { void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) {
@@ -2339,13 +2343,13 @@ void MainWindow::ShowAboutDialog() {
} }
#ifdef HAVE_GSTREAMER
void MainWindow::ShowTranscodeDialog() { void MainWindow::ShowTranscodeDialog() {
#ifdef HAVE_GSTREAMER
transcode_dialog_->show(); transcode_dialog_->show();
#endif
} }
#endif
void MainWindow::ShowErrorDialog(const QString &message) { void MainWindow::ShowErrorDialog(const QString &message) {
error_dialog_->ShowMessage(message); error_dialog_->ShowMessage(message);
@@ -2421,9 +2425,10 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
} }
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
void MainWindow::AutoCompleteTags() { void MainWindow::AutoCompleteTags() {
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
// Create the tag fetching stuff if it hasn't been already // Create the tag fetching stuff if it hasn't been already
if (!tag_fetcher_) { if (!tag_fetcher_) {
tag_fetcher_.reset(new TagFetcher); tag_fetcher_.reset(new TagFetcher);
@@ -2456,6 +2461,9 @@ void MainWindow::AutoCompleteTags() {
tag_fetcher_->StartFetch(songs); tag_fetcher_->StartFetch(songs);
track_selection_dialog_->show(); track_selection_dialog_->show();
#endif
} }
void MainWindow::AutoCompleteTagsAccepted() { void MainWindow::AutoCompleteTagsAccepted() {
@@ -2466,8 +2474,8 @@ void MainWindow::AutoCompleteTagsAccepted() {
// This is really lame but we don't know what rows have changed // This is really lame but we don't know what rows have changed
ui_->playlist->view()->update(); ui_->playlist->view()->update();
} }
#endif
void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, QString line2) { void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, QString line2) {

View File

@@ -162,14 +162,10 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void RenumberTracks(); void RenumberTracks();
void SelectionSetValue(); void SelectionSetValue();
void EditValue(); void EditValue();
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
void AutoCompleteTags(); void AutoCompleteTags();
void AutoCompleteTagsAccepted(); void AutoCompleteTagsAccepted();
#endif
void PlaylistUndoRedoChanged(QAction *undo, QAction *redo); void PlaylistUndoRedoChanged(QAction *undo, QAction *redo);
#ifdef HAVE_GSTREAMER
void AddFilesToTranscoder(); void AddFilesToTranscoder();
#endif
void PlaylistCopyToCollection(); void PlaylistCopyToCollection();
void PlaylistMoveToCollection(); void PlaylistMoveToCollection();
@@ -225,9 +221,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void ShowCoverManager(); void ShowCoverManager();
void ShowAboutDialog(); void ShowAboutDialog();
#ifdef HAVE_GSTREAMER
void ShowTranscodeDialog(); void ShowTranscodeDialog();
#endif
void ShowErrorDialog(const QString& message); void ShowErrorDialog(const QString& message);
SettingsDialog *CreateSettingsDialog(); SettingsDialog *CreateSettingsDialog();
EditTagDialog *CreateEditTagDialog(); EditTagDialog *CreateEditTagDialog();
@@ -319,9 +313,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
std::unique_ptr<TagFetcher> tag_fetcher_; std::unique_ptr<TagFetcher> tag_fetcher_;
#endif #endif
std::unique_ptr<TrackSelectionDialog> track_selection_dialog_; std::unique_ptr<TrackSelectionDialog> track_selection_dialog_;
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
PlaylistItemList autocomplete_tag_items_; PlaylistItemList autocomplete_tag_items_;
#endif
InternetTabsView *tidal_view_; InternetTabsView *tidal_view_;
InternetTabsView *qobuz_view_; InternetTabsView *qobuz_view_;

View File

@@ -252,6 +252,8 @@ QStringList DeviceLister::GuessIconForPath(const QString &path) {
ret << model_icon.arg(model); ret << model_icon.arg(model);
} }
} }
#else
Q_UNUSED(path)
#endif #endif
return ret; return ret;

View File

@@ -35,7 +35,7 @@
#include "core/song.h" #include "core/song.h"
class MtpConnection : public QObject, public std::enable_shared_from_this<MtpConnection> { class MtpConnection : public QObject, public std::enable_shared_from_this<MtpConnection> {
public: public:
MtpConnection(const QUrl &url); MtpConnection(const QUrl &url);
~MtpConnection(); ~MtpConnection();
@@ -43,7 +43,7 @@ public:
LIBMTP_mtpdevice_t *device() const { return device_; } LIBMTP_mtpdevice_t *device() const { return device_; }
bool GetSupportedFiletypes(QList<Song::FileType> *ret); bool GetSupportedFiletypes(QList<Song::FileType> *ret);
private: private:
Q_DISABLE_COPY(MtpConnection) Q_DISABLE_COPY(MtpConnection)
LIBMTP_mtpdevice_t *device_; LIBMTP_mtpdevice_t *device_;

View File

@@ -841,9 +841,10 @@ void EditTagDialog::ResetPlayCounts() {
UpdateStatisticsTab(*song); UpdateStatisticsTab(*song);
} }
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
void EditTagDialog::FetchTag() { void EditTagDialog::FetchTag() {
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes();
SongList songs; SongList songs;
@@ -864,10 +865,14 @@ void EditTagDialog::FetchTag() {
results_dialog_->show(); results_dialog_->show();
#endif
} }
void EditTagDialog::FetchTagSongChosen(const Song &original_song, const Song &new_metadata) { void EditTagDialog::FetchTagSongChosen(const Song &original_song, const Song &new_metadata) {
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
const QString filename = original_song.url().toLocalFile(); const QString filename = original_song.url().toLocalFile();
// Find the song with this filename // Find the song with this filename
@@ -893,9 +898,13 @@ void EditTagDialog::FetchTagSongChosen(const Song &original_song, const Song &ne
UpdateUI(sel); UpdateUI(sel);
} }
} #else
Q_UNUSED(original_song)
Q_UNUSED(new_metadata)
#endif #endif
}
void EditTagDialog::SongSaveComplete(TagReaderReply *reply, const QString &filename, const Song &song) { void EditTagDialog::SongSaveComplete(TagReaderReply *reply, const QString &filename, const Song &song) {
pending_--; pending_--;

View File

@@ -109,10 +109,8 @@ class EditTagDialog : public QDialog {
void ResetField(); void ResetField();
void ButtonClicked(QAbstractButton *button); void ButtonClicked(QAbstractButton *button);
void ResetPlayCounts(); void ResetPlayCounts();
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
void FetchTag(); void FetchTag();
void FetchTagSongChosen(const Song &original_song, const Song &new_metadata); void FetchTagSongChosen(const Song &original_song, const Song &new_metadata);
#endif
void AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &scaled, const QImage &original); void AlbumCoverLoaded(const quint64 id, const QUrl &cover_url, const QImage &scaled, const QImage &original);

View File

@@ -330,7 +330,6 @@ 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) {
Q_UNUSED(output); Q_UNUSED(output);
@@ -348,7 +347,6 @@ 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) {

View File

@@ -81,9 +81,7 @@ class Organise : public QObject {
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
void LogLine(const QString message); void LogLine(const QString message);
private: private:
@@ -125,14 +123,9 @@ class Organise : public QObject {
int task_count_; int task_count_;
const QString playlist_; const QString playlist_;
#ifdef HAVE_GSTREAMER
QBasicTimer transcode_progress_timer_; QBasicTimer transcode_progress_timer_;
#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_;

View File

@@ -556,11 +556,14 @@ void BackendSettingsPage::SwitchALSADevices(alsa_plugin alsaplugin) {
} }
} }
#endif
void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) { void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) {
Q_UNUSED(checked); Q_UNUSED(checked);
#ifdef HAVE_ALSA
if (!configloaded_ || !EngineInitialised()) return; if (!configloaded_ || !EngineInitialised()) return;
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>(); EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
@@ -582,12 +585,16 @@ void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) {
if (!found) ui_->lineedit_device->setText(device_new); if (!found) ui_->lineedit_device->setText(device_new);
} }
#endif
} }
void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) { void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) {
Q_UNUSED(checked); Q_UNUSED(checked);
#ifdef HAVE_ALSA
if (!configloaded_ || !EngineInitialised()) return; if (!configloaded_ || !EngineInitialised()) return;
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>(); EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
@@ -609,10 +616,10 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) {
if (!found) ui_->lineedit_device->setText(device_new); if (!found) ui_->lineedit_device->setText(device_new);
} }
}
#endif #endif
}
void BackendSettingsPage::FadingOptionsChanged() { void BackendSettingsPage::FadingOptionsChanged() {
if (!configloaded_ || !EngineInitialised()) return; if (!configloaded_ || !EngineInitialised()) return;

View File

@@ -63,10 +63,8 @@ public:
void DeviceStringChanged(); void DeviceStringChanged();
void RgPreampChanged(int value); void RgPreampChanged(int value);
void BufferMinFillChanged(int value); void BufferMinFillChanged(int value);
#ifdef HAVE_ALSA
void radiobutton_alsa_hw_clicked(bool checked); void radiobutton_alsa_hw_clicked(bool checked);
void radiobutton_alsa_plughw_clicked(bool checked); void radiobutton_alsa_plughw_clicked(bool checked);
#endif
void FadingOptionsChanged(); void FadingOptionsChanged();
private: private:

View File

@@ -213,9 +213,10 @@ void FileView::UndoCommand::undo() {
} }
#ifdef HAVE_GSTREAMER
void FileView::Delete(const QStringList &filenames) { void FileView::Delete(const QStringList &filenames) {
#ifdef HAVE_GSTREAMER
if (filenames.isEmpty()) if (filenames.isEmpty())
return; return;
@@ -228,19 +229,28 @@ void FileView::Delete(const QStringList &filenames) {
connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList)));
delete_files->Start(filenames); delete_files->Start(filenames);
#else
Q_UNUSED(filenames)
#endif
} }
void FileView::DeleteFinished(const SongList &songs_with_errors) { void FileView::DeleteFinished(const SongList &songs_with_errors) {
#ifdef HAVE_GSTREAMER
if (songs_with_errors.isEmpty()) return; if (songs_with_errors.isEmpty()) return;
OrganiseErrorDialog *dialog = new OrganiseErrorDialog(this); OrganiseErrorDialog *dialog = new OrganiseErrorDialog(this);
dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors); dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors);
// It deletes itself when the user closes it // It deletes itself when the user closes it
} #else
Q_UNUSED(songs_with_errors)
#endif #endif
}
void FileView::showEvent(QShowEvent *e) { void FileView::showEvent(QShowEvent *e) {
QWidget::showEvent(e); QWidget::showEvent(e);

View File

@@ -79,10 +79,8 @@ class FileView : public QWidget {
void ItemActivated(const QModelIndex &index); void ItemActivated(const QModelIndex &index);
void ItemDoubleClick(const QModelIndex &index); void ItemDoubleClick(const QModelIndex &index);
#ifdef HAVE_GSTREAMER
void Delete(const QStringList &filenames); void Delete(const QStringList &filenames);
void DeleteFinished(const SongList &songs_with_errors); void DeleteFinished(const SongList &songs_with_errors);
#endif
private: private:
void ChangeFilePathWithoutUndo(const QString &new_path); void ChangeFilePathWithoutUndo(const QString &new_path);

View File

@@ -255,8 +255,12 @@ void OSD::ShowMessage(const QString &summary, const QString &message, const QStr
} }
#if !defined(HAVE_X11) && defined(HAVE_DBUS) #if !defined(HAVE_X11)
#if defined(HAVE_DBUS)
void OSD::CallFinished(QDBusPendingCallWatcher*) {} void OSD::CallFinished(QDBusPendingCallWatcher*) {}
#else
void OSD::CallFinished() {}
#endif
#endif #endif
void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) { void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {

View File

@@ -101,8 +101,10 @@ class OSD : public QObject {
QString ReplaceVariable(const QString &variable, const Song &song); QString ReplaceVariable(const QString &variable, const Song &song);
private slots: private slots:
#if defined(HAVE_DBUS) #ifdef HAVE_DBUS
void CallFinished(QDBusPendingCallWatcher *watcher); void CallFinished(QDBusPendingCallWatcher *watcher);
#else
void CallFinished();
#endif #endif
void AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image); void AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image);

View File

@@ -157,6 +157,10 @@ void OSD::ShowMessageNative(const QString &summary, const QString &message, cons
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*))); connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*)));
#else // HAVE_DBUS #else // HAVE_DBUS
Q_UNUSED(summary)
Q_UNUSED(message)
Q_UNUSED(icon)
Q_UNUSED(image)
qLog(Warning) << "not implemented"; qLog(Warning) << "not implemented";
#endif // HAVE_DBUS #endif // HAVE_DBUS
@@ -179,5 +183,6 @@ void OSD::CallFinished(QDBusPendingCallWatcher *watcher) {
last_notification_time_ = QDateTime::currentDateTime(); last_notification_time_ = QDateTime::currentDateTime();
} }
} }
#else
void OSD::CallFinished() {}
#endif #endif

View File

@@ -80,6 +80,8 @@ TrackSlider::~TrackSlider() {
void TrackSlider::SetApplication(Application* app) { void TrackSlider::SetApplication(Application* app) {
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR
if (!moodbar_style_) moodbar_style_ = new MoodbarProxyStyle(app, ui_->slider); if (!moodbar_style_) moodbar_style_ = new MoodbarProxyStyle(app, ui_->slider);
#else
Q_UNUSED(app);
#endif #endif
} }