Clementine-audio-player-Mac.../src/visualisations/visualisationcontainer.h

108 lines
2.8 KiB
C
Raw Normal View History

/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
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 <http://www.gnu.org/licenses/>.
*/
#ifndef VISUALISATIONCONTAINER_H
#define VISUALISATIONCONTAINER_H
2010-06-06 20:18:06 +02:00
#include <QBasicTimer>
2020-09-18 16:15:19 +02:00
#include <QGraphicsView>
2010-06-06 20:18:06 +02:00
#include "core/song.h"
class GstEngine;
2010-06-06 20:18:06 +02:00
class ProjectMVisualisation;
class VisualisationOverlay;
2010-06-07 03:55:21 +02:00
class VisualisationSelector;
2010-06-07 00:28:24 +02:00
class QMenu;
class QActionGroup;
2010-06-06 20:18:06 +02:00
class VisualisationContainer : public QGraphicsView {
Q_OBJECT
public:
VisualisationContainer(QWidget* parent = nullptr);
static const int kLowFramerate;
static const int kMediumFramerate;
static const int kHighFramerate;
static const int kSuperHighFramerate;
static const char* kSettingsGroup;
static const int kDefaultWidth;
static const int kDefaultHeight;
2010-06-06 20:18:06 +02:00
static const int kDefaultFps;
static const int kDefaultTextureSize;
void SetEngine(GstEngine* engine);
void SetActions(QAction* previous, QAction* play_pause, QAction* stop,
QAction* next);
2010-06-06 20:18:06 +02:00
public slots:
2010-06-06 20:18:06 +02:00
void SongMetadataChanged(const Song& metadata);
void Stopped();
protected:
// QWidget
void showEvent(QShowEvent* e);
void hideEvent(QHideEvent* e);
void closeEvent(QCloseEvent* e);
void resizeEvent(QResizeEvent* e);
void timerEvent(QTimerEvent* e);
void mouseMoveEvent(QMouseEvent* e);
void enterEvent(QEvent* e);
void leaveEvent(QEvent* e);
void mouseDoubleClickEvent(QMouseEvent* e);
void contextMenuEvent(QContextMenuEvent* event);
void keyReleaseEvent(QKeyEvent* event);
2010-06-06 20:18:06 +02:00
private:
void Init();
2010-06-06 20:18:06 +02:00
void SizeChanged();
2019-11-10 15:16:39 +01:00
void AddFramerateMenuItem(const QString& name, int value, int def,
QActionGroup* group);
void AddQualityMenuItem(const QString& name, int value, int def,
QActionGroup* group);
2010-06-06 20:18:06 +02:00
private slots:
2010-06-06 20:18:06 +02:00
void ChangeOverlayOpacity(qreal value);
2010-06-07 00:28:24 +02:00
void ShowPopupMenu(const QPoint& pos);
void ToggleFullscreen();
void SetFps(int fps);
void SetQuality(int size);
private:
bool initialised_;
GstEngine* engine_;
ProjectMVisualisation* vis_;
2010-06-06 20:18:06 +02:00
VisualisationOverlay* overlay_;
QBasicTimer update_timer_;
2010-06-07 03:55:21 +02:00
VisualisationSelector* selector_;
2010-06-06 20:18:06 +02:00
QGraphicsProxyWidget* overlay_proxy_;
2010-06-07 00:28:24 +02:00
QMenu* menu_;
2010-06-06 20:18:06 +02:00
int fps_;
int size_;
};
#endif // VISUALISATIONCONTAINER_H