aboutsummaryrefslogtreecommitdiff
path: root/qmpchannelswindow.cpp
blob: 6aca878c46bc3419697cffbfa2ff9a2e4fa382a1 (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
#include <QCheckBox>
#include <QPushButton>
#include <QComboBox>
#include <QLabel>
#include "qmpchannelswindow.hpp"
#include "ui_qmpchannelswindow.h"
#include "qmpmainwindow.hpp"

qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::qmpchannelswindow)
{
	ui->setupUi(this);
	connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
	for(int i=0;i<16;++i)
	{
		ui->twChannels->setCellWidget(i,0,new QCheckBox(""));
		connect(ui->twChannels->cellWidget(i,0),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
		ui->twChannels->setCellWidget(i,1,new QCheckBox(""));
		connect(ui->twChannels->cellWidget(i,1),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
		ui->twChannels->setCellWidget(i,2,new QComboBox());
		QComboBox *cb=(QComboBox*)ui->twChannels->cellWidget(i,2);
		//stub
		cb->addItem("Internal fluidsynth");
		ui->twChannels->setCellWidget(i,3,new QLabel(""));
		ui->twChannels->setCellWidget(i,4,new QPushButton("..."));
	}
	ui->twChannels->setColumnWidth(0,32);
	ui->twChannels->setColumnWidth(1,32);
	ui->twChannels->setColumnWidth(2,192);
	ui->twChannels->setColumnWidth(3,192);
	ui->twChannels->setColumnWidth(4,32);
}

void qmpchannelswindow::closeEvent(QCloseEvent *event)
{
	setVisible(false);
	emit dialogClosing();
	event->accept();
}

void qmpchannelswindow::channelWindowsUpdate()
{
	for(int i=0;i<16;++i)
	{
		char data[128],nm[24];
		int b,p;
		((qmpMainWindow*)this->parent())->getPlayer()->getChannelPreset(i,&b,&p,nm);
		sprintf(data,"%d:%d %s",b,p,nm);
		((QLabel*)ui->twChannels->cellWidget(i,3))->setText(data);
	}
}

void qmpchannelswindow::channelMSChanged()
{
	for(int i=0;i<16;++i)
	{
		QCheckBox *m,*s;
		m=(QCheckBox*)ui->twChannels->cellWidget(i,0);
		s=(QCheckBox*)ui->twChannels->cellWidget(i,1);
		if(m->isChecked()&&s->isChecked())s->setChecked(false);
		((qmpMainWindow*)this->parent())->getPlayer()->setMute(i,m->isChecked());
		((qmpMainWindow*)this->parent())->getPlayer()->setSolo(i,s->isChecked());
	}
}

qmpchannelswindow::~qmpchannelswindow()
{
	delete ui;
}

void qmpchannelswindow::on_pbUnmute_clicked()
{
	for(int i=0;i<16;++i)
	{
		((QCheckBox*)ui->twChannels->cellWidget(i,0))->setChecked(false);
		((qmpMainWindow*)this->parent())->getPlayer()->setMute(i,false);
	}
}

void qmpchannelswindow::on_pbUnsolo_clicked()
{
	for(int i=0;i<16;++i)
	{
		((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false);
		((qmpMainWindow*)this->parent())->getPlayer()->setSolo(i,false);
	}
}