Nouvel ampli
This commit is contained in:
@@ -79,3 +79,26 @@ int CAvReceiver::ReceiverGeneralStatusReceived(QByteArray StatusData)
|
||||
mReceiverGui->UpdateReceiverStatus(mReceiverStatus, mZone2Status);
|
||||
return RET_OK;
|
||||
}
|
||||
int CAvReceiver::SelectScenePressed(char Zone, char Scene)
|
||||
{
|
||||
QByteArray SceneData;
|
||||
SceneData.append(Zone).append(Scene);
|
||||
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST,SceneData);
|
||||
}
|
||||
|
||||
int CAvReceiver::MainZoneVolumeChanged(float Value)
|
||||
{
|
||||
QByteArray VolumeData;
|
||||
QDataStream Strm(&VolumeData,QIODevice::WriteOnly);
|
||||
Strm << Value;
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST,VolumeData);
|
||||
}
|
||||
|
||||
int CAvReceiver::Zone2VolumeChanged(float Value)
|
||||
{
|
||||
QByteArray VolumeData;
|
||||
QDataStream Strm(&VolumeData,QIODevice::WriteOnly);
|
||||
Strm << Value;
|
||||
return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,VolumeData);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public:
|
||||
int Zone2ToggleSwitchPressed(bool state);
|
||||
int MainUnitToggleSwitchPressed(bool state);
|
||||
int ReceiverGeneralStatusReceived(QByteArray StatusData);
|
||||
int SelectScenePressed(char Zone, char Scene);
|
||||
int MainZoneVolumeChanged(float Value);
|
||||
int Zone2VolumeChanged(float Value);
|
||||
|
||||
CAvReceiverNetworkCtrlInterface *mNetworkInterface;
|
||||
CAvReceiverGui *mReceiverGui;
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
#include <QString>
|
||||
#include "GlobalDefine.h"
|
||||
|
||||
#define MAIN_ZONE_MIN_VOLUME (float)-80.5
|
||||
#define MAIN_ZONE_MAX_VOLUME (float)16.5
|
||||
|
||||
enum eAVReceiverZones
|
||||
{
|
||||
AV_RECEIVER_MAIN_ZONE = 1,
|
||||
AV_RECEIVER_ZONE_2,
|
||||
|
||||
AV_RECEIVER_MAX_ZONE
|
||||
};
|
||||
|
||||
class CAvReceiverMainStatus
|
||||
{
|
||||
|
||||
@@ -11,6 +11,12 @@ CAvReceiverGui::CAvReceiverGui(QWidget *parent) :
|
||||
|
||||
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()
|
||||
@@ -79,6 +85,8 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiv
|
||||
|
||||
ui->mRcvrStatusLabel->setText(StatusText);
|
||||
|
||||
if(ui->mMainZoneVolumeSldBar->isSliderDown() == false)
|
||||
ui->mMainZoneVolumeSldBar->setValue(ConvertVolumeToBarPosition(Status.mMainVolume));
|
||||
|
||||
|
||||
|
||||
@@ -131,5 +139,59 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiv
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public:
|
||||
CAvReceiver *mProgramHandle;
|
||||
|
||||
int UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiverMainStatus Zone2Status);
|
||||
int ConvertVolumeToBarPosition(float Volume);
|
||||
float ConvertBarPositionToVolume(int position);
|
||||
|
||||
private:
|
||||
Ui::CAvReceiverGui *ui;
|
||||
@@ -27,6 +29,12 @@ private:
|
||||
public slots:
|
||||
void SpeakerBRadioClicked(bool checked);
|
||||
void SpeakerARadioClicked(bool checked);
|
||||
void MainZoneScene1BtnClicked(bool);
|
||||
void MainZoneScene2BtnClicked(bool);
|
||||
void MainZoneScene3BtnClicked(bool);
|
||||
void MainZoneScene4BtnClicked(bool);
|
||||
void MainZoneVolumeSetChanged();
|
||||
void Zone2VolumeSetChanged();
|
||||
};
|
||||
|
||||
#endif // AVRECEIVERGUI_H
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<x>50</x>
|
||||
<y>130</y>
|
||||
<width>181</width>
|
||||
<height>231</height>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -42,7 +42,7 @@
|
||||
<widget class="QCheckBox" name="mSpkBCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<x>350</x>
|
||||
<y>110</y>
|
||||
<width>70</width>
|
||||
<height>17</height>
|
||||
@@ -68,7 +68,7 @@
|
||||
<widget class="QLabel" name="mZone2StatusLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<x>370</x>
|
||||
<y>140</y>
|
||||
<width>171</width>
|
||||
<height>191</height>
|
||||
@@ -78,6 +78,109 @@
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="MainZoneSceneBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>320</y>
|
||||
<width>101</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Scene</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="MainZoneScene1Btn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="MainZoneScene2Btn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>20</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="MainZoneScene3Btn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="MainZoneScene4Btn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>50</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSlider" name="mMainZoneVolumeSldBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>120</y>
|
||||
<width>21</width>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>194</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="mZone2VolumeSldBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>110</y>
|
||||
<width>16</width>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>182</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -48,10 +48,21 @@ int CAvReceiverNetworkCtrlInterface::DeviceFrameReceived(int TargetDeviceID, int
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST:
|
||||
default:
|
||||
{
|
||||
qDebug("AV Receiver: Invalid Ethernet Msg received: %d",MessageID);
|
||||
|
||||
Reference in New Issue
Block a user