Sayonara Player
Loading...
Searching...
No Matches
GUI_SpectrogramPainter.h
1/* GUI_SpectrogramPainter.h
2 *
3 * Copyright (C) 2011-2024 Michael Lugmair
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef GUI_SPECTROGRAMPAINTER_H
22#define GUI_SPECTROGRAMPAINTER_H
23
24#include "Gui/Plugins/PlayerPluginBase.h"
25
26#include <QList>
27#include <QWidget>
28
29class PlayManager;
30
31class GUI_SpectrogramPainter :
33{
34 Q_OBJECT
35 PIMPL(GUI_SpectrogramPainter)
36
37public:
38 explicit GUI_SpectrogramPainter(PlayManager* playManager, QWidget* parent = nullptr);
39 ~GUI_SpectrogramPainter() override;
40
41 QString name() const override;
42 QString displayName() const override;
43 bool isUiInitialized() const override;
44
45private slots:
46 void reset();
47 void spectrumChanged(const QList<float>& spectrum, MilliSeconds ms);
48 void finished();
49
50 void playstateChanged(PlayState state);
51 void trackChanged(const MetaData& md);
52
53protected:
54 void retranslate() override;
55 void initUi() override;
56
57 void paintEvent(QPaintEvent* e) override;
58 void mousePressEvent(QMouseEvent* e) override;
59 void mouseMoveEvent(QMouseEvent* e) override;
60
61 void showEvent(QShowEvent* e) override;
62 void closeEvent(QCloseEvent* e) override;
63
64private:
65 void drawBuffer(int percent_step);
66 QString calcTooltip(float yPercent);
67
68 void showFullsize();
69 void positionClicked(QPoint position);
70
71 void startAudioDataProvider(const MetaData& md);
72 void stopAudioDataProvider();
73
74 QSize minimumSizeHint() const override;
75};
76
77#endif // GUI_SPECTROGRAMPAINTER_H
bool isUiInitialized() const override
Check if ui already was initialized.
QString name() const override
must be overwritten
QString displayName() const override
must be overwritten
void initUi() override
GUI will be initialized on first show up. Please use this to make Sayonara starting fast.
Definition MetaData.h:43
Definition PlayManager.h:34
Definition PlayerPluginBase.h:40
Definition EngineUtils.h:33