aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpchannelswindow.hpp
blob: 4502b2172ae613b6b2ad7687f2b2be5ea24d4963 (plain) (blame)
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
#ifndef QMPCHANNELSWINDOW_H
#define QMPCHANNELSWINDOW_H

#include <QLabel>
#include <QPushButton>
#include <QDialog>
#include <QComboBox>
#include <QShowEvent>
#include <QCloseEvent>
#include <QMoveEvent>
#include "qmppresetselect.hpp"
#include "qmpchanneleditor.hpp"
#include "../core/qmpmidiplay.hpp"
#include "../core/qmpmidimappers.hpp"

namespace Ui {
	class qmpChannelsWindow;
}

class QDCLabel:public QLabel
{
	Q_OBJECT
	private:
		int id;
	protected:
		void mouseDoubleClickEvent(QMouseEvent *event){event->accept();emit onDoubleClick(id);}
	public:
		QDCLabel(QString s):QLabel(s){id=-1;}
		void setID(int _id){id=_id;}
	signals:
		void onDoubleClick(int id);
};

class QDCPushButton:public QPushButton
{
	Q_OBJECT
	private:
		int id;
	protected:
		void mousePressEvent(QMouseEvent *event){QPushButton::mousePressEvent(event);emit onClick(id);}
	public:
		QDCPushButton(QString s):QPushButton(s){id=-1;}
		void setID(int _id){id=_id;}
	signals:
		void onClick(int id);
};

class QDCComboBox:public QComboBox
{
	Q_OBJECT
	private:
		int id;
	public:
		QDCComboBox():QComboBox(){id=-1;connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(indexChangedSlot(int)));}
		void setID(int _id){id=_id;}
	signals:
		void onChange(int id,int idx);
	public slots:
		void indexChangedSlot(int idx){emit(onChange(id,idx));}
};

class qmpCWNoteOnCB:public QObject,public IMidiCallBack
{
	Q_OBJECT
	public:
		void callBack(void* callerdata,void*)
		{if(((((SEventCallBackData*)callerdata)->type)&0xF0)==0x90)emit onNoteOn();}
	signals:
		void onNoteOn();
};

class qmpChannelsWindow;

class qmpChannelFunc:public qmpFuncBaseIntf
{
	private:
		qmpChannelsWindow *p;
	public:
		qmpChannelFunc(qmpChannelsWindow *par);
		void show();
		void close();
};

class qmpChannelsWindow:public QDialog
{
	Q_OBJECT

	public:
		explicit qmpChannelsWindow(QWidget *parent = 0);
		~qmpChannelsWindow();
		void showEvent(QShowEvent *event);
		void closeEvent(QCloseEvent *event);
		void moveEvent(QMoveEvent *event);
		void resetAcitivity();
	public slots:
		void channelWindowsUpdate();
		void updateChannelActivity();
		void channelMSChanged();
		void showPresetWindow(int chid);
		void showChannelEditorWindow(int chid);
		void changeMidiMapping(int chid,int idx);
		void on_pbUnmute_clicked();
		void on_pbUnsolo_clicked();

	private:
		Ui::qmpChannelsWindow *ui;
		qmpPresetSelector *pselectw;
		qmpChannelEditor *ceditw;
		qmpMidiMapperRtMidi *mapper;
		QPixmap *cha,*chi;
		qmpCWNoteOnCB *cb;
		qmpChannelFunc *chnlf;
		//callback fuse... (avoid black midi blocking the main thread)
		int callbacksc,cbcnt,fused;
};

#endif // QMPCHANNELSWINDOW_H