diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-12-13 19:05:21 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-12-13 19:05:21 +0000 |
| commit | 581e201025b971c2a0ca6e1f2748340ab1a0fa68 (patch) | |
| tree | b083f945af0d620c17c5ec51717ff5991e640886 /src/plugins/Ui/qsui/qsuivisualization.h | |
| parent | ecb0df68eca0dd66d9fe56fdf2241ea14ab6afe2 (diff) | |
| download | qmmp-581e201025b971c2a0ca6e1f2748340ab1a0fa68.tar.gz qmmp-581e201025b971c2a0ca6e1f2748340ab1a0fa68.tar.bz2 qmmp-581e201025b971c2a0ca6e1f2748340ab1a0fa68.zip | |
refactoring
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9136 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Ui/qsui/qsuivisualization.h')
| -rw-r--r-- | src/plugins/Ui/qsui/qsuivisualization.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/plugins/Ui/qsui/qsuivisualization.h b/src/plugins/Ui/qsui/qsuivisualization.h new file mode 100644 index 000000000..5d2257131 --- /dev/null +++ b/src/plugins/Ui/qsui/qsuivisualization.h @@ -0,0 +1,125 @@ +/*************************************************************************** + * Copyright (C) 2012-2019 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#ifndef QSUIVISUALIZATION_H +#define QSUIVISUALIZATION_H + +#include <QWidget> +#include <QResizeEvent> +#include <qmmp/visual.h> + +class QTimer; +class QMenu; +class QActionGroup; +class QLabel; +class QPainter; +class QSUiVisualDrawer; + +class QSUIVisualization : public Visual +{ + Q_OBJECT +public: + QSUIVisualization(QWidget *parent = nullptr); + virtual ~QSUIVisualization(); + + void setCover(const QPixmap &pixmap); + void clear(); + void clearCover(); + QSize sizeHint() const override; + +public slots: + void start() override; + void stop() override; + void readSettings(); + +private slots: + void timeout(); + void writeSettings(); + +private: + void paintEvent(QPaintEvent *) override; + void mousePressEvent(QMouseEvent *) override; + void hideEvent(QHideEvent *) override; + void showEvent(QShowEvent *) override; + void resizeEvent(QResizeEvent *) override; + void process(); + void draw(QPainter *p); + void createMenu(); + void updateCover(); + + QPixmap m_cover; + QTimer *m_timer; + double *m_intern_vis_data = nullptr; + double *m_peaks = nullptr; + int *m_x_scale = nullptr; + double m_peaks_falloff; + double m_analyzer_falloff; + bool m_show_peaks; + bool m_show_cover = false; + float m_buffer[QMMP_VISUAL_NODE_SIZE]; + int m_cols = 0, m_rows = 0; + int m_offset = 0; + bool m_update = false; + QLabel *m_pixLabel; + //colors + QColor m_color1; + QColor m_color2; + QColor m_color3; + QColor m_bgColor; + QColor m_peakColor; + QSize m_cell_size; + QMenu *m_menu; + QAction *m_peaksAction; + QAction *m_coverAction; + QActionGroup *m_fpsGroup; + QActionGroup *m_analyzerFalloffGroup; + QActionGroup *m_peaksFalloffGroup; + bool m_running = false; +}; + +class QSUiVisualDrawer +{ +public: + virtual void draw(QPainter *p) = 0; + virtual void readSettings() = 0; +}; + +class QSUiAnalyzer : public QSUiVisualDrawer +{ +public: + void draw(QPainter *p) override; + void readSettings() override; + +private: + int m_cols = 0, m_rows = 0, m_offset = 0; + QColor m_color1; + QColor m_color2; + QColor m_color3; + QColor m_bgColor; + QColor m_peakColor; + QSize m_cell_size; + bool m_show_peaks = false; + double *m_intern_vis_data = nullptr; + double *m_peaks = nullptr; + int *m_x_scale = nullptr; + +}; + + +#endif //QSUIVISUALIZATION_H |
