1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
#pragma once
#include <QEvent>
#include <QHideEvent>
#include <QShowEvent>
#include "library/dlgcoverartfullsize.h"
#include "mixer/basetrackplayer.h"
#include "preferences/usersettings.h"
#include "skin/legacy/skincontext.h"
#include "track/track_decl.h"
#include "vinylcontrol/vinylsignalquality.h"
#include "widget/trackdroptarget.h"
#include "widget/wbasewidget.h"
#include "widget/wcoverartmenu.h"
#include "widget/wglwidget.h"
#include "widget/wwidget.h"
class ConfigKey;
class ControlProxy;
class VisualPlayPosition;
class VinylControlManager;
class VSyncThread;
class WSpinnyBase : public WGLWidget,
public WBaseWidget,
public VinylSignalQualityListener,
public TrackDropTarget {
Q_OBJECT
public:
WSpinnyBase(QWidget* parent,
const QString& group,
UserSettingsPointer pConfig,
VinylControlManager* pVCMan,
BaseTrackPlayer* pPlayer);
~WSpinnyBase() override;
void onVinylSignalQualityUpdate(const VinylSignalQualityReport& report) override;
void setup(const QDomNode& node,
const SkinContext& context,
const ConfigKey& showCoverConfigKey);
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
public slots:
void slotLoadTrack(TrackPointer);
void slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack);
void updateVinylControlSpeed(double rpm);
void updateVinylControlEnabled(double enabled);
void updateVinylControlSignalEnabled(double enabled);
void updateSlipEnabled(double enabled);
void render(VSyncThread* vSyncThread);
void swap();
protected slots:
void slotCoverFound(
const QObject* pRequestor,
const CoverInfo& coverInfo,
const QPixmap& pixmap,
mixxx::cache_key_t requestedCacheKey,
bool coverInfoUpdated);
void slotCoverInfoSelected(const CoverInfoRelative& coverInfo);
void slotReloadCoverArt();
void slotTrackCoverArtUpdated();
signals:
void trackDropped(const QString& filename, const QString& group) override;
void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override;
protected:
// QWidget:
void paintEvent(QPaintEvent* /*unused*/) override;
void mouseMoveEvent(QMouseEvent* e) override;
void mousePressEvent(QMouseEvent* e) override;
void mouseReleaseEvent(QMouseEvent* e) override;
void resizeEvent(QResizeEvent* /*unused*/) override;
void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
bool event(QEvent* pEvent) override;
// TrackDropTarget:
bool handleDragAndDropEventFromWindow(QEvent* ev) override;
double calculateAngle(double playpos);
int calculateFullRotations(double playpos);
double calculatePositionFromAngle(double angle);
QPixmap scaledCoverArt(const QPixmap& normal);
void setLoadedCover(const QPixmap& pixmap);
private:
virtual void draw() = 0;
virtual void coverChanged() = 0;
const QString m_group;
UserSettingsPointer m_pConfig;
protected:
std::shared_ptr<QImage> m_pBgImage;
std::shared_ptr<QImage> m_pMaskImage;
std::shared_ptr<QImage> m_pFgImage;
QImage m_fgImageScaled;
std::shared_ptr<QImage> m_pGhostImage;
QImage m_ghostImageScaled;
ControlProxy* m_pPlayPos;
QSharedPointer<VisualPlayPosition> m_pVisualPlayPos;
ControlProxy* m_pTrackSamples;
ControlProxy* m_pTrackSampleRate;
ControlProxy* m_pScratchToggle;
ControlProxy* m_pScratchPos;
ControlProxy* m_pVinylControlSpeedType;
ControlProxy* m_pVinylControlEnabled;
ControlProxy* m_pSignalEnabled;
ControlProxy* m_pSlipEnabled;
ControlProxy* m_pShowCoverProxy;
TrackPointer m_loadedTrack;
QPixmap m_loadedCover;
QPixmap m_loadedCoverScaled;
CoverInfo m_lastRequestedCover;
bool m_bShowCover;
VinylControlManager* m_pVCManager;
double m_dInitialPos;
int m_iVinylInput;
bool m_bVinylActive;
bool m_bSignalActive;
QImage m_qImage;
int m_iVinylScopeSize;
float m_fAngle; // Degrees
double m_dAngleCurrentPlaypos;
double m_dAngleLastPlaypos;
float m_fGhostAngle;
double m_dGhostAngleCurrentPlaypos;
double m_dGhostAngleLastPlaypos;
int m_iStartMouseX;
int m_iStartMouseY;
int m_iFullRotations;
double m_dPrevTheta;
// Speed of the vinyl rotation.
double m_dRotationsPerSecond;
bool m_bClampFailedWarning;
bool m_bGhostPlayback;
BaseTrackPlayer* m_pPlayer;
WCoverArtMenu* m_pCoverMenu;
DlgCoverArtFullSize* m_pDlgCoverArt;
};
|