/* This file is part of Clementine. Copyright 2010, David Sansome Clementine 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. Clementine 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 Clementine. If not, see . */ #ifndef PROJECTMVISUALISATION_H #define PROJECTMVISUALISATION_H #include #include #include #include #include "engines/bufferconsumer.h" class projectM; class ProjectMPresetModel; class VisualisationContainer; class QTemporaryFile; class ProjectMVisualisation : public QGraphicsScene, public BufferConsumer { Q_OBJECT public: ProjectMVisualisation(VisualisationContainer* container); ~ProjectMVisualisation(); enum Mode { Random = 0, FromList = 1, }; QString preset_url() const; ProjectMPresetModel* preset_model() const { return preset_model_; } Mode mode() const { return mode_; } int duration() const { return duration_; } // BufferConsumer void ConsumeBuffer(GstBuffer* buffer, int); public slots: void SetTextureSize(int size); void SetDuration(int seconds); void SetSelected(const QStringList& paths, bool selected); void ClearSelected(); void SetImmediatePreset(const QString& path); void SetMode(Mode mode); void Lock(bool lock); protected: // QGraphicsScene void drawBackground(QPainter* painter, const QRectF& rect); private slots: void SceneRectChanged(const QRectF& rect); private: void InitProjectM(); void Load(); void Save(); int IndexOfPreset(const QString& path) const; private: std::unique_ptr projectm_; ProjectMPresetModel* preset_model_; Mode mode_; int duration_; std::unique_ptr temporary_font_; std::vector default_rating_list_; int texture_size_; // As of version 5.6, Qt supports automatic scaling for high-DPI displays. We // need to know the pixel ratio so that we can convert coordinates for // projectM. // https://doc.qt.io/qt-5/highdpi.html qreal pixel_ratio_; VisualisationContainer* container_; }; #endif // PROJECTMVISUALISATION_H