1 |
schoenebeck |
1698 |
// qsamplerDeviceStatusForm.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
Copyright (C) 2008, Christian Schoenebeck |
5 |
capela |
2459 |
Copyright (C) 2010-2013, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
schoenebeck |
1698 |
|
7 |
|
|
This program is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU General Public License |
9 |
|
|
as published by the Free Software Foundation; either version 2 |
10 |
|
|
of the License, or (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 |
capela |
2459 |
You should have received a copy of the GNU General Public License along |
18 |
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
schoenebeck |
1698 |
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef __qsamplerDeviceStatusForm_h |
24 |
|
|
#define __qsamplerDeviceStatusForm_h |
25 |
|
|
|
26 |
|
|
#include "qsamplerDevice.h" |
27 |
|
|
|
28 |
|
|
#include <QMainWindow> |
29 |
|
|
#include <QAction> |
30 |
|
|
#include <QCloseEvent> |
31 |
|
|
#include <QLabel> |
32 |
|
|
#include <QTimer> |
33 |
capela |
2038 |
|
34 |
schoenebeck |
1698 |
#include <map> |
35 |
|
|
|
36 |
capela |
2038 |
|
37 |
schoenebeck |
1698 |
namespace QSampler { |
38 |
|
|
|
39 |
capela |
2038 |
class MidiActivityLED : public QLabel |
40 |
|
|
{ |
41 |
schoenebeck |
1698 |
Q_OBJECT |
42 |
capela |
2038 |
|
43 |
schoenebeck |
1698 |
public: |
44 |
|
|
|
45 |
capela |
2038 |
MidiActivityLED(QString sText = QString(), QWidget *pParent = 0); |
46 |
|
|
~MidiActivityLED(); |
47 |
|
|
|
48 |
|
|
void midiActivityLedOn(); |
49 |
|
|
|
50 |
schoenebeck |
1698 |
protected slots: |
51 |
|
|
|
52 |
capela |
2038 |
void midiActivityLedOff(); |
53 |
|
|
|
54 |
schoenebeck |
1698 |
private: |
55 |
capela |
2038 |
|
56 |
|
|
QTimer m_timer; |
57 |
|
|
|
58 |
|
|
// MIDI activity pixmap common resources. |
59 |
|
|
static int g_iMidiActivityRefCount; |
60 |
|
|
static QPixmap *g_pMidiActivityLedOn; |
61 |
|
|
static QPixmap *g_pMidiActivityLedOff; |
62 |
schoenebeck |
1698 |
}; |
63 |
|
|
|
64 |
capela |
2038 |
|
65 |
|
|
class DeviceStatusForm : public QWidget |
66 |
|
|
{ |
67 |
schoenebeck |
1698 |
Q_OBJECT |
68 |
capela |
2038 |
|
69 |
schoenebeck |
1698 |
public: |
70 |
capela |
2038 |
|
71 |
|
|
DeviceStatusForm(int DeviceID, |
72 |
|
|
QWidget* pParent = NULL, Qt::WindowFlags wflags = 0); |
73 |
schoenebeck |
1698 |
~DeviceStatusForm(); |
74 |
capela |
2038 |
|
75 |
|
|
QAction *visibleAction(); |
76 |
|
|
|
77 |
schoenebeck |
1698 |
void midiArrived(int iPort); |
78 |
|
|
|
79 |
capela |
2038 |
static DeviceStatusForm *getInstance(int iDeviceID); |
80 |
|
|
static const std::map<int, DeviceStatusForm *>& getInstances(); |
81 |
|
|
|
82 |
schoenebeck |
1698 |
static void onDevicesChanged(); |
83 |
schoenebeck |
1699 |
static void onDeviceChanged(int iDeviceID); |
84 |
capela |
2038 |
|
85 |
schoenebeck |
1699 |
static void deleteAllInstances(); |
86 |
schoenebeck |
1698 |
|
87 |
|
|
protected: |
88 |
capela |
2038 |
|
89 |
|
|
void closeEvent(QCloseEvent *pCloseEvent); |
90 |
schoenebeck |
1699 |
void updateGUIPorts(); |
91 |
schoenebeck |
1698 |
|
92 |
|
|
private: |
93 |
|
|
|
94 |
capela |
2038 |
int m_DeviceID; |
95 |
|
|
Device *m_pDevice; |
96 |
|
|
QAction *m_pVisibleAction; |
97 |
|
|
|
98 |
|
|
std::vector<MidiActivityLED *> m_midiActivityLEDs; |
99 |
|
|
|
100 |
|
|
static std::map<int, DeviceStatusForm*> g_instances; |
101 |
schoenebeck |
1698 |
}; |
102 |
|
|
|
103 |
|
|
} // namespace QSampler |
104 |
|
|
|
105 |
capela |
2038 |
|
106 |
schoenebeck |
1698 |
#endif // __qsamplerDeviceStatusForm_h |
107 |
|
|
|
108 |
|
|
// end of qsamplerDeviceStatusForm.h |