Nouvel ampli
This commit is contained in:
parent
17e753c365
commit
52841786a9
@ -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);
|
||||
|
||||
@ -243,6 +243,12 @@ enum AV_RECEIVER_INTERFACE_CMDS
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE,
|
||||
|
||||
|
||||
MAX_AV_RECEIVER_INTERFACE_CMD
|
||||
|
||||
@ -12,7 +12,10 @@
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QCheckBox>
|
||||
#include <QtWidgets/QGroupBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QSlider>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -25,6 +28,13 @@ public:
|
||||
QCheckBox *mSpkBCheckBox;
|
||||
QCheckBox *mSpkACheckBox;
|
||||
QLabel *mZone2StatusLabel;
|
||||
QGroupBox *MainZoneSceneBox;
|
||||
QPushButton *MainZoneScene1Btn;
|
||||
QPushButton *MainZoneScene2Btn;
|
||||
QPushButton *MainZoneScene3Btn;
|
||||
QPushButton *MainZoneScene4Btn;
|
||||
QSlider *mMainZoneVolumeSldBar;
|
||||
QSlider *mZone2VolumeSldBar;
|
||||
|
||||
void setupUi(QWidget *CAvReceiverGui)
|
||||
{
|
||||
@ -36,16 +46,43 @@ public:
|
||||
label->setGeometry(QRect(230, 30, 201, 16));
|
||||
mRcvrStatusLabel = new QLabel(CAvReceiverGui);
|
||||
mRcvrStatusLabel->setObjectName(QString::fromUtf8("mRcvrStatusLabel"));
|
||||
mRcvrStatusLabel->setGeometry(QRect(50, 130, 181, 231));
|
||||
mRcvrStatusLabel->setGeometry(QRect(50, 130, 181, 181));
|
||||
mSpkBCheckBox = new QCheckBox(CAvReceiverGui);
|
||||
mSpkBCheckBox->setObjectName(QString::fromUtf8("mSpkBCheckBox"));
|
||||
mSpkBCheckBox->setGeometry(QRect(280, 110, 70, 17));
|
||||
mSpkBCheckBox->setGeometry(QRect(350, 110, 70, 17));
|
||||
mSpkACheckBox = new QCheckBox(CAvReceiverGui);
|
||||
mSpkACheckBox->setObjectName(QString::fromUtf8("mSpkACheckBox"));
|
||||
mSpkACheckBox->setGeometry(QRect(50, 110, 70, 17));
|
||||
mZone2StatusLabel = new QLabel(CAvReceiverGui);
|
||||
mZone2StatusLabel->setObjectName(QString::fromUtf8("mZone2StatusLabel"));
|
||||
mZone2StatusLabel->setGeometry(QRect(300, 140, 171, 191));
|
||||
mZone2StatusLabel->setGeometry(QRect(370, 140, 171, 191));
|
||||
MainZoneSceneBox = new QGroupBox(CAvReceiverGui);
|
||||
MainZoneSceneBox->setObjectName(QString::fromUtf8("MainZoneSceneBox"));
|
||||
MainZoneSceneBox->setGeometry(QRect(40, 320, 101, 81));
|
||||
MainZoneScene1Btn = new QPushButton(MainZoneSceneBox);
|
||||
MainZoneScene1Btn->setObjectName(QString::fromUtf8("MainZoneScene1Btn"));
|
||||
MainZoneScene1Btn->setGeometry(QRect(10, 20, 31, 22));
|
||||
MainZoneScene2Btn = new QPushButton(MainZoneSceneBox);
|
||||
MainZoneScene2Btn->setObjectName(QString::fromUtf8("MainZoneScene2Btn"));
|
||||
MainZoneScene2Btn->setGeometry(QRect(50, 20, 31, 22));
|
||||
MainZoneScene3Btn = new QPushButton(MainZoneSceneBox);
|
||||
MainZoneScene3Btn->setObjectName(QString::fromUtf8("MainZoneScene3Btn"));
|
||||
MainZoneScene3Btn->setGeometry(QRect(10, 50, 31, 22));
|
||||
MainZoneScene4Btn = new QPushButton(MainZoneSceneBox);
|
||||
MainZoneScene4Btn->setObjectName(QString::fromUtf8("MainZoneScene4Btn"));
|
||||
MainZoneScene4Btn->setGeometry(QRect(50, 50, 31, 22));
|
||||
mMainZoneVolumeSldBar = new QSlider(CAvReceiverGui);
|
||||
mMainZoneVolumeSldBar->setObjectName(QString::fromUtf8("mMainZoneVolumeSldBar"));
|
||||
mMainZoneVolumeSldBar->setGeometry(QRect(190, 120, 21, 160));
|
||||
mMainZoneVolumeSldBar->setMinimum(0);
|
||||
mMainZoneVolumeSldBar->setMaximum(194);
|
||||
mMainZoneVolumeSldBar->setSingleStep(1);
|
||||
mMainZoneVolumeSldBar->setOrientation(Qt::Vertical);
|
||||
mZone2VolumeSldBar = new QSlider(CAvReceiverGui);
|
||||
mZone2VolumeSldBar->setObjectName(QString::fromUtf8("mZone2VolumeSldBar"));
|
||||
mZone2VolumeSldBar->setGeometry(QRect(500, 110, 16, 160));
|
||||
mZone2VolumeSldBar->setMaximum(182);
|
||||
mZone2VolumeSldBar->setOrientation(Qt::Vertical);
|
||||
|
||||
retranslateUi(CAvReceiverGui);
|
||||
|
||||
@ -60,6 +97,11 @@ public:
|
||||
mSpkBCheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Zone 2", nullptr));
|
||||
mSpkACheckBox->setText(QCoreApplication::translate("CAvReceiverGui", "Main Zone", nullptr));
|
||||
mZone2StatusLabel->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr));
|
||||
MainZoneSceneBox->setTitle(QCoreApplication::translate("CAvReceiverGui", "Scene", nullptr));
|
||||
MainZoneScene1Btn->setText(QCoreApplication::translate("CAvReceiverGui", "1", nullptr));
|
||||
MainZoneScene2Btn->setText(QCoreApplication::translate("CAvReceiverGui", "2", nullptr));
|
||||
MainZoneScene3Btn->setText(QCoreApplication::translate("CAvReceiverGui", "3", nullptr));
|
||||
MainZoneScene4Btn->setText(QCoreApplication::translate("CAvReceiverGui", "4", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user