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);
}
#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) {

View File

@ -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<TagFetcher> tag_fetcher_;
#endif
std::unique_ptr<TrackSelectionDialog> track_selection_dialog_;
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
PlaylistItemList autocomplete_tag_items_;
#endif
InternetTabsView *tidal_view_;
InternetTabsView *qobuz_view_;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<Task> tasks_pending_;
#ifdef HAVE_GSTREAMER
QMap<QString, Task> tasks_transcoding_;
#endif
int tasks_complete_;
bool started_;

View File

@ -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<EngineBase::OutputDetails>();
@ -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<EngineBase::OutputDetails>();
@ -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;

View File

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

View File

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

View File

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

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*) {}
#else
void OSD::CallFinished() {}
#endif
#endif
void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {

View File

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

View File

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

View File

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