2010-06-06 16:06:23 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-06-06 16:06:23 +02:00
|
|
|
|
|
|
|
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"
|
2010-06-06 16:06:23 +02:00
|
|
|
|
|
|
|
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-06 16:06:23 +02:00
|
|
|
|
2010-06-07 00:28:24 +02:00
|
|
|
class QMenu;
|
|
|
|
class QActionGroup;
|
|
|
|
|
2010-06-06 20:18:06 +02:00
|
|
|
class VisualisationContainer : public QGraphicsView {
|
2010-06-06 16:06:23 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2014-02-10 16:03:54 +01:00
|
|
|
VisualisationContainer(QWidget* parent = nullptr);
|
2010-06-06 16:06:23 +02:00
|
|
|
|
2012-03-22 20:02:12 +01:00
|
|
|
static const int kLowFramerate;
|
|
|
|
static const int kMediumFramerate;
|
|
|
|
static const int kHighFramerate;
|
|
|
|
static const int kSuperHighFramerate;
|
|
|
|
|
2010-06-06 20:17:41 +02:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
static const int kDefaultWidth;
|
|
|
|
static const int kDefaultHeight;
|
2010-06-06 20:18:06 +02:00
|
|
|
static const int kDefaultFps;
|
2010-06-07 01:05:11 +02:00
|
|
|
static const int kDefaultTextureSize;
|
2010-06-06 20:17:41 +02:00
|
|
|
|
2010-06-06 16:06:23 +02:00
|
|
|
void SetEngine(GstEngine* engine);
|
2014-02-07 16:34:20 +01:00
|
|
|
void SetActions(QAction* previous, QAction* play_pause, QAction* stop,
|
|
|
|
QAction* next);
|
2010-06-06 20:18:06 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public slots:
|
2010-06-06 20:18:06 +02:00
|
|
|
void SongMetadataChanged(const Song& metadata);
|
|
|
|
void Stopped();
|
2010-06-06 16:06:23 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
protected:
|
2010-06-06 16:06:23 +02:00
|
|
|
// QWidget
|
2010-06-06 20:29:13 +02:00
|
|
|
void showEvent(QShowEvent* e);
|
|
|
|
void hideEvent(QHideEvent* e);
|
2020-05-09 07:36:19 +02:00
|
|
|
void closeEvent(QCloseEvent* e);
|
2010-06-06 20:29:13 +02:00
|
|
|
void resizeEvent(QResizeEvent* e);
|
|
|
|
void timerEvent(QTimerEvent* e);
|
|
|
|
void mouseMoveEvent(QMouseEvent* e);
|
|
|
|
void enterEvent(QEvent* e);
|
|
|
|
void leaveEvent(QEvent* e);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* e);
|
2014-02-07 16:34:20 +01:00
|
|
|
void contextMenuEvent(QContextMenuEvent* event);
|
|
|
|
void keyReleaseEvent(QKeyEvent* event);
|
2010-06-06 20:18:06 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-07-10 17:48:46 +02:00
|
|
|
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
|
|
|
|
2014-02-07 16:34:20 +01: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);
|
2010-06-07 01:05:11 +02:00
|
|
|
void SetQuality(int size);
|
2010-06-06 16:06:23 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2010-07-10 17:48:46 +02:00
|
|
|
bool initialised_;
|
|
|
|
|
2010-06-06 16:06:23 +02:00
|
|
|
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_;
|
2010-06-07 01:05:11 +02:00
|
|
|
int size_;
|
2010-06-06 16:06:23 +02:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // VISUALISATIONCONTAINER_H
|