strawberry-audio-player-win.../src/core/application.h

135 lines
3.3 KiB
C
Raw Normal View History

2018-02-27 18:06:05 +01:00
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2012, David Sansome <me@davidsansome.com>
2018-12-29 03:25:21 +01:00
* Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
2021-03-20 21:14:47 +01:00
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
2018-02-27 18:06:05 +01:00
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
2018-08-09 18:10:03 +02:00
*
2018-02-27 18:06:05 +01:00
*/
#ifndef APPLICATION_H
#define APPLICATION_H
2018-02-27 18:06:05 +01:00
#include "config.h"
#include <memory>
#include <QObject>
#include <QList>
#include <QString>
2018-02-27 18:06:05 +01:00
#include "settings/settingsdialog.h"
2020-02-08 03:40:30 +01:00
class QThread;
class TaskManager;
2018-02-27 18:06:05 +01:00
class ApplicationImpl;
class TagReaderClient;
class Database;
class DeviceFinders;
2018-02-27 18:06:05 +01:00
class Player;
2018-07-01 22:26:46 +02:00
class SCollection;
class CollectionBackend;
class CollectionModel;
2018-02-27 18:06:05 +01:00
class PlaylistBackend;
class PlaylistManager;
2018-09-20 17:36:23 +02:00
#ifndef Q_OS_WIN
class DeviceManager;
2018-09-20 17:36:23 +02:00
#endif
2018-02-27 18:06:05 +01:00
class CoverProviders;
class AlbumCoverLoader;
class CurrentAlbumCoverLoader;
2020-05-09 01:48:08 +02:00
class CoverProviders;
2018-10-14 00:08:33 +02:00
class LyricsProviders;
2019-04-18 15:03:01 +02:00
class AudioScrobbler;
2020-08-30 18:09:13 +02:00
class LastFMImport;
class InternetServices;
2021-07-11 01:02:53 +02:00
class RadioServices;
2019-04-18 15:03:01 +02:00
#ifdef HAVE_MOODBAR
class MoodbarController;
class MoodbarLoader;
#endif
2018-02-27 18:06:05 +01:00
class Application : public QObject {
Q_OBJECT
public:
explicit Application(QObject *parent = nullptr);
2020-06-15 21:55:05 +02:00
~Application() override;
2018-02-27 18:06:05 +01:00
TagReaderClient *tag_reader_client() const;
Database *database() const;
TaskManager *task_manager() const;
Player *player() const;
DeviceFinders *device_finders() const;
2018-09-20 17:36:23 +02:00
#ifndef Q_OS_WIN
2018-02-27 18:06:05 +01:00
DeviceManager *device_manager() const;
2018-09-20 17:36:23 +02:00
#endif
2018-02-27 18:06:05 +01:00
2018-07-01 22:26:46 +02:00
SCollection *collection() const;
2018-10-14 00:08:33 +02:00
CollectionBackend *collection_backend() const;
CollectionModel *collection_model() const;
2018-07-01 22:26:46 +02:00
2018-02-27 18:06:05 +01:00
PlaylistBackend *playlist_backend() const;
PlaylistManager *playlist_manager() const;
CoverProviders *cover_providers() const;
AlbumCoverLoader *album_cover_loader() const;
CurrentAlbumCoverLoader *current_albumcover_loader() const;
2018-07-01 22:26:46 +02:00
2018-10-14 00:08:33 +02:00
LyricsProviders *lyrics_providers() const;
2018-02-27 18:06:05 +01:00
2019-04-18 15:03:01 +02:00
AudioScrobbler *scrobbler() const;
InternetServices *internet_services() const;
2021-07-11 01:02:53 +02:00
RadioServices *radio_services() const;
2019-04-18 15:03:01 +02:00
#ifdef HAVE_MOODBAR
MoodbarController *moodbar_controller() const;
MoodbarLoader *moodbar_loader() const;
#endif
2021-07-11 01:02:53 +02:00
LastFMImport *lastfm_import() const;
void Exit();
QThread *MoveToNewThread(QObject *object);
2021-06-22 13:41:38 +02:00
static void MoveToThread(QObject *object, QThread *thread);
2018-02-27 18:06:05 +01:00
2020-02-25 01:08:03 +01:00
private slots:
void ExitReceived();
2018-02-27 18:06:05 +01:00
public slots:
void AddError(const QString &message);
void ReloadSettings();
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
2020-02-25 01:08:03 +01:00
signals:
2021-01-26 16:48:04 +01:00
void ErrorAdded(QString message);
2018-02-27 18:06:05 +01:00
void SettingsChanged();
void SettingsDialogRequested(SettingsDialog::Page page);
void ExitFinished();
void ClearPixmapDiskCache();
2018-02-27 18:06:05 +01:00
private:
std::unique_ptr<ApplicationImpl> p_;
QList<QThread*> threads_;
QList<QObject*> wait_for_exit_;
2018-02-27 18:06:05 +01:00
};
#endif // APPLICATION_H