-
Notifications
You must be signed in to change notification settings - Fork 6
/
guiplayer.h
200 lines (173 loc) · 5.29 KB
/
guiplayer.h
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
Drumstick MIDI File Player Multiplatform Program
Copyright (C) 2006-2024, Pedro Lopez-Cabanillas <[email protected]>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_GUIPLAYER_H
#define INCLUDED_GUIPLAYER_H
#include <QHash>
#include <QList>
#include <QMainWindow>
#include <QObject>
#include <QPointer>
#include <QProgressDialog>
#include <QString>
#include <QThread>
#include <chrono>
#include "channels.h"
#include "connections.h"
#include "helpwindow.h"
#include "lyrics.h"
#include "pianola.h"
#include "playlist.h"
#include "prefsdialog.h"
#include "recentfileshelper.h"
#include "toolbareditdialog.h"
#if defined(Q_OS_WINDOWS)
#include "winsnap.h"
#endif
class MIDIEvent;
namespace drumstick { namespace rt {
class BackendManager;
class MIDIOutput;
}}
namespace Ui {
class GUIPlayerClass;
}
class SequencePlayer;
class About;
class GUIPlayer : public QMainWindow
{
Q_OBJECT
public:
GUIPlayer(QWidget *parent = 0);
~GUIPlayer();
enum PlayerState {
InvalidState,
EmptyState,
PlayingState,
PausedState,
StoppedState
};
Q_ENUM(PlayerState)
enum PlaylistRepetition {
Nothing,
CurrentSong,
WholePlaylist
};
Q_ENUM(PlaylistRepetition)
void appendSMFEvent(MIDIEvent* ev);
void appendWRKEvent(unsigned long ticks, MIDIEvent* ev);
void appendOVEEvent(unsigned long ticks, MIDIEvent* ev);
void updateTimeLabel(std::chrono::milliseconds millis);
void updateTempoLabel(float ftempo);
bool isSupported(QString fileName);
void connectOutput(const QString &driver, const QString &connection);
void openFile(const QString &fileName);
void openFileList(const QStringList &fileNames);
void updateState(PlayerState newState);
void applySettings();
void updNavButtons();
void updatePositionWidgets();
protected:
void dragEnterEvent( QDragEnterEvent* event ) override;
void dropEvent( QDropEvent* event ) override;
void closeEvent( QCloseEvent* event ) override;
bool nativeEvent( const QByteArray &eventType, void *message,
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
long *result
#else
qintptr *result
#endif
) override;
void showEvent(QShowEvent *event) override;
void moveEvent(QMoveEvent *event) override;
public slots:
void about();
void play();
void pause();
void stop();
void open();
void setup();
void preferences();
void tempoReset();
void volumeReset();
void tempoSlider(int value);
void quit();
void volumeSlider(int value);
void pitchShift(int value);
void playerFinished();
void playerStopped();
void playerEcho(std::chrono::milliseconds time, long ticks);
void nextSong();
void prevSong();
void positionSliderPressed();
void positionSliderMoved(int value);
void positionSliderReleased();
void forward();
void backward();
void jump();
void loop();
void progressDialogInit(const QString& type, int max);
void progressDialogUpdate(int pos);
void progressDialogClose();
void slotShowPianola(bool checked);
void slotPianolaClosed();
void slotShowChannels(bool checked);
void slotChannelsClosed();
void slotShowLyrics(bool checked);
void slotLyricsClosed();
void slotShowRhythm(bool checked);
void slotAboutTranslation();
void slotSwitchLanguage(QAction *action);
void slotFileInfo();
void slotPlayList();
void slotEditToolbar();
void slotPlaylistRepeat(QAction *action);
void slotHelp();
void slotOpenWebSite();
void slotVolume(int channel, qreal vol);
void slotMuted(int channel, bool mute);
void slotLocked(int channel, bool lock);
void slotPatch(int channel, int patch);
void slotLoadSongSettings();
void slotSaveSongSettings();
void slotSearch();
private:
void createLanguageMenu();
void retranslateUi();
void connectOutPort();
PlayerState m_state;
PlaylistRepetition m_repeat;
drumstick::rt::BackendManager *m_manager;
drumstick::rt::MIDIOutput *m_midiOut;
SequencePlayer *m_player;
Ui::GUIPlayerClass* m_ui;
QPointer<QProgressDialog> m_pd;
QThread m_playerThread;
QPointer<RecentFilesHelper> m_recentFiles;
QPointer<Connections> m_connections;
QPointer<Pianola> m_pianola;
QPointer<Channels> m_channels;
QPointer<Lyrics> m_lyrics;
QPointer<PrefsDialog> m_preferences;
QPointer<PlayList> m_playList;
QPointer<ToolBarEditDialog> m_toolbarEditor;
QPointer<HelpWindow> m_helpWindow;
QAction *m_currentLang;
bool m_firstShown{true};
int m_newSliderPosition{0};
#if defined(Q_OS_WINDOWS)
WinSnap m_snapper;
#endif
};
#endif // INCLUDED_GUIPLAYER_H