198 lines
4.8 KiB
C++
198 lines
4.8 KiB
C++
#include "AvReceiverGui.h"
|
|
#include "ui_AvReceiverGui.h"
|
|
|
|
#include "AvReceiver.h"
|
|
|
|
CAvReceiverGui::CAvReceiverGui(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::CAvReceiverGui)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
connect(ui->mSpkBCheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerBRadioClicked(bool)));
|
|
connect(ui->mSpkACheckBox,SIGNAL(clicked(bool)),this,SLOT(SpeakerARadioClicked(bool)));
|
|
connect(ui->MainZoneScene1Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene1BtnClicked(bool)));
|
|
connect(ui->MainZoneScene2Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene2BtnClicked(bool)));
|
|
connect(ui->MainZoneScene3Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene3BtnClicked(bool)));
|
|
connect(ui->MainZoneScene4Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene4BtnClicked(bool)));
|
|
connect(ui->mMainZoneVolumeSldBar,SIGNAL(sliderMoved(int)),this,SLOT(MainZoneVolumeSetChanged()));
|
|
connect(ui->mZone2VolumeSldBar,SIGNAL(sliderMoved(int)),this,SLOT(Zone2VolumeSetChanged()));
|
|
}
|
|
|
|
CAvReceiverGui::~CAvReceiverGui()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void CAvReceiverGui::SpeakerBRadioClicked(bool checked)
|
|
{
|
|
mProgramHandle->Zone2ToggleSwitchPressed(checked);
|
|
}
|
|
|
|
void CAvReceiverGui::SpeakerARadioClicked(bool checked)
|
|
{
|
|
mProgramHandle->MainUnitToggleSwitchPressed(checked);
|
|
}
|
|
|
|
int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status)
|
|
{
|
|
QString StatusText;
|
|
|
|
StatusText.clear();
|
|
StatusText += "Main Receiver Status:\n\n";
|
|
|
|
StatusText += "Power: ";
|
|
if(Status.mMainPwrStatus == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
ui->mSpkACheckBox->setChecked(true);
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
ui->mSpkACheckBox->setChecked(false);
|
|
}
|
|
|
|
StatusText += "Mute: ";
|
|
if(Status.mIsMute == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
}
|
|
|
|
StatusText += "Main sleep: ";
|
|
if(Status.mMainSleepStatus == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
}
|
|
|
|
StatusText += "Volume: ";
|
|
StatusText += QString("%1").arg(Status.mMainVolume);
|
|
StatusText +="\n";
|
|
StatusText += "Input: ";
|
|
StatusText +=Status.mInput;
|
|
StatusText += "\n";
|
|
StatusText += "Program: ";
|
|
StatusText +=Status.mProgram;
|
|
StatusText += "\n";
|
|
|
|
ui->mRcvrStatusLabel->setText(StatusText);
|
|
|
|
if(ui->mMainZoneVolumeSldBar->isSliderDown() == false)
|
|
ui->mMainZoneVolumeSldBar->setValue(ConvertVolumeToBarPosition(Status.mMainVolume));
|
|
|
|
|
|
|
|
|
|
|
|
StatusText = "Zone2 Status\n\n";
|
|
|
|
StatusText += "Power: ";
|
|
if(Zone2Status.mMainPwrStatus == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
ui->mSpkBCheckBox->setChecked(true);
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
ui->mSpkBCheckBox->setChecked(false);
|
|
}
|
|
|
|
StatusText += "Mute: ";
|
|
if(Zone2Status.mIsMute == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
}
|
|
|
|
StatusText += "Main sleep: ";
|
|
if(Zone2Status.mMainSleepStatus == true)
|
|
{
|
|
StatusText += "ON\n";
|
|
|
|
}
|
|
else
|
|
{
|
|
StatusText += "OFF\n";
|
|
}
|
|
|
|
StatusText += "Volume: ";
|
|
StatusText += QString("%1").arg(Zone2Status.mMainVolume);
|
|
StatusText +="\n";
|
|
StatusText += "Input: ";
|
|
StatusText +=Zone2Status.mInput;
|
|
StatusText += "\n";
|
|
StatusText += "Program: ";
|
|
StatusText +=Zone2Status.mProgram;
|
|
StatusText += "\n";
|
|
|
|
ui->mZone2StatusLabel->setText(StatusText);
|
|
|
|
if(ui->mZone2VolumeSldBar->isSliderDown() == false)
|
|
ui->mZone2VolumeSldBar->setValue(ConvertVolumeToBarPosition(Zone2Status.mMainVolume));
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
void CAvReceiverGui::MainZoneScene1BtnClicked(bool)
|
|
{
|
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,1);
|
|
}
|
|
|
|
void CAvReceiverGui::MainZoneScene2BtnClicked(bool)
|
|
{
|
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,2);
|
|
}
|
|
void CAvReceiverGui::MainZoneScene3BtnClicked(bool)
|
|
{
|
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,3);
|
|
}
|
|
void CAvReceiverGui::MainZoneScene4BtnClicked(bool)
|
|
{
|
|
mProgramHandle->SelectScenePressed(AV_RECEIVER_MAIN_ZONE,4);
|
|
}
|
|
|
|
int CAvReceiverGui::ConvertVolumeToBarPosition(float Volume)
|
|
{
|
|
int Pos;
|
|
Pos = (int)((Volume + 80.5) *2);
|
|
return Pos;
|
|
}
|
|
|
|
float CAvReceiverGui::ConvertBarPositionToVolume(int position)
|
|
{
|
|
float Volume;
|
|
Volume = (float)position;
|
|
Volume = ((Volume/2) - 80.5);
|
|
|
|
return Volume;
|
|
}
|
|
|
|
void CAvReceiverGui::MainZoneVolumeSetChanged()
|
|
{
|
|
int BarPosition = ui->mMainZoneVolumeSldBar->value();
|
|
float Volume = ConvertBarPositionToVolume(BarPosition);
|
|
|
|
mProgramHandle->MainZoneVolumeChanged(Volume);
|
|
}
|
|
|
|
void CAvReceiverGui::Zone2VolumeSetChanged()
|
|
{
|
|
int BarPosition = ui->mZone2VolumeSldBar->value();
|
|
float Volume = ConvertBarPositionToVolume(BarPosition);
|
|
|
|
|
|
mProgramHandle->Zone2VolumeChanged(Volume);
|
|
}
|