diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index c7054bbca..86ce333a1 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -2106,9 +2106,10 @@ void MainWindow::PlaylistUndoRedoChanged(QAction *undo, QAction *redo) { playlist_menu_->insertAction(playlist_undoredo_, redo); } -#ifdef HAVE_GSTREAMER void MainWindow::AddFilesToTranscoder() { +#ifdef HAVE_GSTREAMER + QStringList filenames; for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) { @@ -2122,21 +2123,24 @@ void MainWindow::AddFilesToTranscoder() { transcode_dialog_->SetFilenames(filenames); ShowTranscodeDialog(); -} + #endif +} + void MainWindow::ShowCollectionConfig() { - //EnsureSettingsDialogCreated(); settings_dialog_->OpenAtPage(SettingsDialog::Page_Collection); } void MainWindow::TaskCountChanged(int count) { + if (count == 0) { ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page); } else { ui_->status_bar_stack->setCurrentWidget(ui_->multi_loading_indicator); } + } void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) { @@ -2339,13 +2343,13 @@ void MainWindow::ShowAboutDialog() { } -#ifdef HAVE_GSTREAMER void MainWindow::ShowTranscodeDialog() { +#ifdef HAVE_GSTREAMER transcode_dialog_->show(); +#endif } -#endif void MainWindow::ShowErrorDialog(const QString &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() { +#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) + // Create the tag fetching stuff if it hasn't been already if (!tag_fetcher_) { tag_fetcher_.reset(new TagFetcher); @@ -2456,6 +2461,9 @@ void MainWindow::AutoCompleteTags() { tag_fetcher_->StartFetch(songs); track_selection_dialog_->show(); + +#endif + } void MainWindow::AutoCompleteTagsAccepted() { @@ -2466,8 +2474,8 @@ void MainWindow::AutoCompleteTagsAccepted() { // This is really lame but we don't know what rows have changed ui_->playlist->view()->update(); + } -#endif void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, QString line2) { diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index f6f22efdd..5abd905a1 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -162,14 +162,10 @@ class MainWindow : public QMainWindow, public PlatformInterface { void RenumberTracks(); void SelectionSetValue(); void EditValue(); -#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) void AutoCompleteTags(); void AutoCompleteTagsAccepted(); -#endif void PlaylistUndoRedoChanged(QAction *undo, QAction *redo); -#ifdef HAVE_GSTREAMER void AddFilesToTranscoder(); -#endif void PlaylistCopyToCollection(); void PlaylistMoveToCollection(); @@ -225,9 +221,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void ShowCoverManager(); void ShowAboutDialog(); -#ifdef HAVE_GSTREAMER void ShowTranscodeDialog(); -#endif void ShowErrorDialog(const QString& message); SettingsDialog *CreateSettingsDialog(); EditTagDialog *CreateEditTagDialog(); @@ -319,9 +313,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { std::unique_ptr tag_fetcher_; #endif std::unique_ptr track_selection_dialog_; -#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) PlaylistItemList autocomplete_tag_items_; -#endif InternetTabsView *tidal_view_; InternetTabsView *qobuz_view_; diff --git a/src/device/devicelister.cpp b/src/device/devicelister.cpp index 7bd2ba9c1..85ff6fb58 100644 --- a/src/device/devicelister.cpp +++ b/src/device/devicelister.cpp @@ -252,6 +252,8 @@ QStringList DeviceLister::GuessIconForPath(const QString &path) { ret << model_icon.arg(model); } } +#else + Q_UNUSED(path) #endif return ret; diff --git a/src/device/mtpconnection.h b/src/device/mtpconnection.h index f578d2321..1fe0738f4 100644 --- a/src/device/mtpconnection.h +++ b/src/device/mtpconnection.h @@ -35,7 +35,7 @@ #include "core/song.h" class MtpConnection : public QObject, public std::enable_shared_from_this { -public: + public: MtpConnection(const QUrl &url); ~MtpConnection(); @@ -43,7 +43,7 @@ public: LIBMTP_mtpdevice_t *device() const { return device_; } bool GetSupportedFiletypes(QList *ret); -private: + private: Q_DISABLE_COPY(MtpConnection) LIBMTP_mtpdevice_t *device_; diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp index 03e9ff161..7837cf0a9 100644 --- a/src/dialogs/edittagdialog.cpp +++ b/src/dialogs/edittagdialog.cpp @@ -841,9 +841,10 @@ void EditTagDialog::ResetPlayCounts() { UpdateStatisticsTab(*song); } -#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) void EditTagDialog::FetchTag() { +#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) + const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); SongList songs; @@ -864,10 +865,14 @@ void EditTagDialog::FetchTag() { results_dialog_->show(); +#endif + } 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(); // Find the song with this filename @@ -893,9 +898,13 @@ void EditTagDialog::FetchTagSongChosen(const Song &original_song, const Song &ne UpdateUI(sel); } -} +#else + Q_UNUSED(original_song) + Q_UNUSED(new_metadata) #endif +} + void EditTagDialog::SongSaveComplete(TagReaderReply *reply, const QString &filename, const Song &song) { pending_--; diff --git a/src/dialogs/edittagdialog.h b/src/dialogs/edittagdialog.h index bbe136747..0a8e8e394 100644 --- a/src/dialogs/edittagdialog.h +++ b/src/dialogs/edittagdialog.h @@ -109,10 +109,8 @@ class EditTagDialog : public QDialog { void ResetField(); void ButtonClicked(QAbstractButton *button); void ResetPlayCounts(); -#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT) void FetchTag(); 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); diff --git a/src/organise/organise.cpp b/src/organise/organise.cpp index ae452dcfd..7532556e5 100644 --- a/src/organise/organise.cpp +++ b/src/organise/organise.cpp @@ -330,7 +330,6 @@ void Organise::UpdateProgress() { } -#ifdef HAVE_GSTREAMER void Organise::FileTranscoded(const QString &input, const QString &output, bool success) { Q_UNUSED(output); @@ -348,7 +347,6 @@ void Organise::FileTranscoded(const QString &input, const QString &output, bool QTimer::singleShot(0, this, SLOT(ProcessSomeFiles())); } -#endif void Organise::timerEvent(QTimerEvent *e) { diff --git a/src/organise/organise.h b/src/organise/organise.h index 620a11c60..d0689db97 100644 --- a/src/organise/organise.h +++ b/src/organise/organise.h @@ -81,9 +81,7 @@ class Organise : public QObject { private slots: void ProcessSomeFiles(); -#ifdef HAVE_GSTREAMER void FileTranscoded(const QString &input, const QString &output, bool success); -#endif void LogLine(const QString message); private: @@ -125,14 +123,9 @@ class Organise : public QObject { int task_count_; const QString playlist_; -#ifdef HAVE_GSTREAMER QBasicTimer transcode_progress_timer_; -#endif - QList tasks_pending_; -#ifdef HAVE_GSTREAMER QMap tasks_transcoding_; -#endif int tasks_complete_; bool started_; diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index 5f560ebdd..164ff090b 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -556,11 +556,14 @@ void BackendSettingsPage::SwitchALSADevices(alsa_plugin alsaplugin) { } } +#endif void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) { Q_UNUSED(checked); +#ifdef HAVE_ALSA + if (!configloaded_ || !EngineInitialised()) return; EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value(); @@ -582,12 +585,16 @@ void BackendSettingsPage::radiobutton_alsa_hw_clicked(bool checked) { if (!found) ui_->lineedit_device->setText(device_new); } +#endif + } void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) { Q_UNUSED(checked); +#ifdef HAVE_ALSA + if (!configloaded_ || !EngineInitialised()) return; EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value(); @@ -609,10 +616,10 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(bool checked) { if (!found) ui_->lineedit_device->setText(device_new); } -} - #endif +} + void BackendSettingsPage::FadingOptionsChanged() { if (!configloaded_ || !EngineInitialised()) return; diff --git a/src/settings/backendsettingspage.h b/src/settings/backendsettingspage.h index af39c88ef..3fe058ad3 100644 --- a/src/settings/backendsettingspage.h +++ b/src/settings/backendsettingspage.h @@ -63,10 +63,8 @@ public: void DeviceStringChanged(); void RgPreampChanged(int value); void BufferMinFillChanged(int value); -#ifdef HAVE_ALSA void radiobutton_alsa_hw_clicked(bool checked); void radiobutton_alsa_plughw_clicked(bool checked); -#endif void FadingOptionsChanged(); private: diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index b62361cfa..38c638106 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -213,9 +213,10 @@ void FileView::UndoCommand::undo() { } -#ifdef HAVE_GSTREAMER void FileView::Delete(const QStringList &filenames) { +#ifdef HAVE_GSTREAMER + if (filenames.isEmpty()) return; @@ -228,19 +229,28 @@ void FileView::Delete(const QStringList &filenames) { connect(delete_files, SIGNAL(Finished(SongList)), SLOT(DeleteFinished(SongList))); delete_files->Start(filenames); +#else + Q_UNUSED(filenames) +#endif + } void FileView::DeleteFinished(const SongList &songs_with_errors) { +#ifdef HAVE_GSTREAMER + if (songs_with_errors.isEmpty()) return; OrganiseErrorDialog *dialog = new OrganiseErrorDialog(this); dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors); // It deletes itself when the user closes it -} +#else + Q_UNUSED(songs_with_errors) #endif +} + void FileView::showEvent(QShowEvent *e) { QWidget::showEvent(e); diff --git a/src/widgets/fileview.h b/src/widgets/fileview.h index 7dcf954d6..089c2bf46 100644 --- a/src/widgets/fileview.h +++ b/src/widgets/fileview.h @@ -79,10 +79,8 @@ class FileView : public QWidget { void ItemActivated(const QModelIndex &index); void ItemDoubleClick(const QModelIndex &index); -#ifdef HAVE_GSTREAMER void Delete(const QStringList &filenames); void DeleteFinished(const SongList &songs_with_errors); -#endif private: void ChangeFilePathWithoutUndo(const QString &new_path); diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index f35faf42d..dfcc562bc 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -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*) {} +#else +void OSD::CallFinished() {} +#endif #endif void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) { diff --git a/src/widgets/osd.h b/src/widgets/osd.h index fcbfcf119..5c55bf311 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -101,8 +101,10 @@ class OSD : public QObject { QString ReplaceVariable(const QString &variable, const Song &song); private slots: -#if defined(HAVE_DBUS) +#ifdef HAVE_DBUS void CallFinished(QDBusPendingCallWatcher *watcher); +#else + void CallFinished(); #endif void AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image); diff --git a/src/widgets/osd_x11.cpp b/src/widgets/osd_x11.cpp index cb1e81dc2..95c5896e3 100644 --- a/src/widgets/osd_x11.cpp +++ b/src/widgets/osd_x11.cpp @@ -157,6 +157,10 @@ void OSD::ShowMessageNative(const QString &summary, const QString &message, cons QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*))); #else // HAVE_DBUS + Q_UNUSED(summary) + Q_UNUSED(message) + Q_UNUSED(icon) + Q_UNUSED(image) qLog(Warning) << "not implemented"; #endif // HAVE_DBUS @@ -179,5 +183,6 @@ void OSD::CallFinished(QDBusPendingCallWatcher *watcher) { last_notification_time_ = QDateTime::currentDateTime(); } } +#else +void OSD::CallFinished() {} #endif - diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index 61bf3d984..af3849733 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -80,6 +80,8 @@ TrackSlider::~TrackSlider() { void TrackSlider::SetApplication(Application* app) { #ifdef HAVE_MOODBAR if (!moodbar_style_) moodbar_style_ = new MoodbarProxyStyle(app, ui_->slider); +#else + Q_UNUSED(app); #endif }