From ac8490b5ee9e8219a663cabdabb772dc9615e68e Mon Sep 17 00:00:00 2001 From: jfmartel Date: Sun, 4 Feb 2024 06:48:18 -0500 Subject: [PATCH] Ajout de la gestion de roulette de volume du clavier --- DisplaySwitch.exe | 0 Sources/AvReceiver/AvReceiver.cpp | 50 +++++++ Sources/AvReceiver/AvReceiver.h | 8 +- Sources/AvReceiver/AvReceiverGui.cpp | 70 ++++++++- Sources/AvReceiver/AvReceiverGui.h | 6 + Sources/AvReceiver/AvReceiverGui.ui | 27 +++- Sources/AvReceiver/VolumeController.cpp | 138 ++++++++++++++++++ Sources/AvReceiver/VolumeController.h | 57 ++++++++ Sources/AvReceiver/VolumeController.h.T22060 | 53 +++++++ Sources/Chalet/ChaletGui.cpp | 40 +++++ Sources/Chalet/ChaletGui.h | 1 + Sources/Chalet/ChaletGui.ui | 100 ++++++++++--- .../LoraModuleInterfaceData.cpp | 21 ++- .../LoraModuleInterfaceData.h | 5 + Sources/ProtocolDefs.h | 2 + Sources/SystemGui.cpp | 9 +- Sources/SystemGui.h | 2 + Sources/SystemTrayManager.cpp | 28 +++- Sources/SystemTrayManager.h | 7 +- Sources/TrayVolumeCtrl.cpp | 89 +++++++++++ Sources/TrayVolumeCtrl.h | 42 ++++++ SystemGui.pro | 12 +- ui_AvReceiverGui.h | 12 +- ui_ChaletGui.h | 86 +++++++---- ui_TrayVolumeCtrl.h | 57 ++++++++ 25 files changed, 854 insertions(+), 68 deletions(-) create mode 100644 DisplaySwitch.exe create mode 100644 Sources/AvReceiver/VolumeController.cpp create mode 100644 Sources/AvReceiver/VolumeController.h create mode 100644 Sources/AvReceiver/VolumeController.h.T22060 create mode 100644 Sources/TrayVolumeCtrl.cpp create mode 100644 Sources/TrayVolumeCtrl.h create mode 100644 ui_TrayVolumeCtrl.h diff --git a/DisplaySwitch.exe b/DisplaySwitch.exe new file mode 100644 index 0000000..e69de29 diff --git a/Sources/AvReceiver/AvReceiver.cpp b/Sources/AvReceiver/AvReceiver.cpp index 8582294..413e406 100644 --- a/Sources/AvReceiver/AvReceiver.cpp +++ b/Sources/AvReceiver/AvReceiver.cpp @@ -11,6 +11,9 @@ CAvReceiver::CAvReceiver(CAvReceiverGui *ReceiverGui) mReceiverPollTimer->setSingleShot(false); mReceiverPollTimer->setInterval(1000); connect(mReceiverPollTimer,SIGNAL(timeout()),this,SLOT(PollTimerExpired())); + + connect(&mVolumeController,&CVolumeController::ExternalVolumeChanged,this,&CAvReceiver::ExternalVolumeChanged); + mTempReceiverVolume = 0; } CAvReceiver::~CAvReceiver() @@ -23,6 +26,7 @@ int CAvReceiver::Start() { mNetworkInterface->ConnectToMasterCtrl(); mReceiverPollTimer->start(); + mVolumeController.Init(this); return RET_OK; } @@ -77,6 +81,7 @@ int CAvReceiver::ReceiverGeneralStatusReceived(QByteArray StatusData) Strm >> mReceiverStatus; Strm >> mZone2Status; mReceiverGui->UpdateReceiverStatus(mReceiverStatus, mZone2Status); + mTempReceiverVolume = mReceiverStatus.mMainVolume; return RET_OK; } int CAvReceiver::SelectScenePressed(char Zone, char Scene) @@ -89,6 +94,7 @@ int CAvReceiver::SelectScenePressed(char Zone, char Scene) int CAvReceiver::MainZoneVolumeChanged(float Value) { +// qDebug("MainZoneVolumeChanged : %f",Value); QByteArray VolumeData; QDataStream Strm(&VolumeData,QIODevice::WriteOnly); Strm << Value; @@ -102,3 +108,47 @@ int CAvReceiver::Zone2VolumeChanged(float Value) Strm << Value; return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,VolumeData); } + +int CAvReceiver::Zone2InputSrcChanged(QString InputSrc) +{ + QByteArray SourceData; + QDataStream Strm(&SourceData,QIODevice::WriteOnly); + Strm << InputSrc; + return mNetworkInterface->SendMasterCtrlCommand(AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST,SourceData); +} + +//We need to implement this in a slot because the Windows API runs in a differen Thread and it crashes the MasterCtrl socket. +void CAvReceiver::ExternalVolumeChanged(float Value) +{ + float ValueInPercent; + float Ret; + if(Value > 0) + { + mTempReceiverVolume += Value; + MainZoneVolumeChanged(mTempReceiverVolume); + Ret = 0.04; + } + else + { + if(mTempReceiverVolume == -80.5) + { + Ret = 0; + } + else + { + mTempReceiverVolume += Value; + if(mTempReceiverVolume == -80.5) + { + MainZoneVolumeChanged(mTempReceiverVolume); + Ret = 0; + } + else + { + MainZoneVolumeChanged(mTempReceiverVolume); + Ret = 0.04; + } + } + } + mVolumeController.SetMasterVolume(Ret); + +} diff --git a/Sources/AvReceiver/AvReceiver.h b/Sources/AvReceiver/AvReceiver.h index 4e8b327..ed0d1f3 100644 --- a/Sources/AvReceiver/AvReceiver.h +++ b/Sources/AvReceiver/AvReceiver.h @@ -3,6 +3,7 @@ #include #include "AvReceiverData.h" +#include "VolumeController.h" class CAvReceiverNetworkCtrlInterface; @@ -23,18 +24,23 @@ public: int SelectScenePressed(char Zone, char Scene); int MainZoneVolumeChanged(float Value); int Zone2VolumeChanged(float Value); + int Zone2InputSrcChanged(QString InputSrc); + + CAvReceiverNetworkCtrlInterface *mNetworkInterface; CAvReceiverGui *mReceiverGui; QTimer *mReceiverPollTimer; + CVolumeController mVolumeController; private: CAvReceiverMainStatus mReceiverStatus; CAvReceiverMainStatus mZone2Status; + float mTempReceiverVolume; public slots: void PollTimerExpired(); - + void ExternalVolumeChanged(float Value); }; #endif // AVRECEIVER_H diff --git a/Sources/AvReceiver/AvReceiverGui.cpp b/Sources/AvReceiver/AvReceiverGui.cpp index 3a2fc1e..7d46c55 100644 --- a/Sources/AvReceiver/AvReceiverGui.cpp +++ b/Sources/AvReceiver/AvReceiverGui.cpp @@ -1,5 +1,6 @@ #include "AvReceiverGui.h" #include "ui_AvReceiverGui.h" +#include "TrayVolumeCtrl.h" #include "AvReceiver.h" @@ -11,8 +12,15 @@ CAvReceiverGui::CAvReceiverGui(QWidget *parent) : mVolumeBarMovementTimer = new QTimer(); mVolumeBarMovementTimer->setInterval(500); mVolumeBarMovementTimer->setSingleShot(true); - connect(mVolumeBarMovementTimer,SIGNAL(timeout()),this,SLOT(VolumeBarMovementTimerExpired())); + mLockZone2VolumeWithZone1 = false; + mTrayVolumeCtrlGuiHandle = 0; + + + ui->mZone2InputComboBx->addItems(QStringList() << "AUDIO1" << "AUDIO2" << "AUDIO3" << "AUDIO4" << "AUDIO5" << "PHONO" << "TUNER" << "SERVER" << "Main Zone Sync"); + ui->mZone2InputComboBx->setEditable(false); + + connect(mVolumeBarMovementTimer,SIGNAL(timeout()),this,SLOT(VolumeBarMovementTimerExpired())); 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))); @@ -21,6 +29,8 @@ CAvReceiverGui::CAvReceiverGui(QWidget *parent) : connect(ui->MainZoneScene4Btn,SIGNAL(clicked(bool)),this,SLOT(MainZoneScene4BtnClicked(bool))); connect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int))); connect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int))); + connect(ui->mZone2InputComboBx,&QComboBox::currentTextChanged,this,&CAvReceiverGui::Zone2InputSelectionChanged); + connect(ui->mZone2SyncVolumeChkBx,&QCheckBox::clicked,this,&CAvReceiverGui::Zone2LockVolumeChanged); } CAvReceiverGui::~CAvReceiverGui() @@ -92,8 +102,12 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiv if(/*ui->mMainZoneVolumeSldBar->isSliderDown() == false && */mVolumeBarMovementTimer->isActive() == false) { - ui->mMainZoneVolumeSldBar->setValue(ConvertVolumeToBarPosition(Status.mMainVolume)); + int SliderValue = ConvertVolumeToBarPosition(Status.mMainVolume); + disconnect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int))); + ui->mMainZoneVolumeSldBar->setValue(SliderValue); + connect(ui->mMainZoneVolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(MainZoneVolumeSetChanged(int))); ui->mMainZoneSliderValueLbl->setText(""); + mTrayVolumeCtrlGuiHandle->SetMainZoneVolume(SliderValue,Status.mMainVolume); } @@ -146,11 +160,16 @@ int CAvReceiverGui::UpdateReceiverStatus(CAvReceiverMainStatus Status, CAvReceiv StatusText += "\n"; ui->mZone2StatusLabel->setText(StatusText); + ui->mZone2InputComboBx->setCurrentText(Zone2Status.mInput); if(/*ui->mZone2VolumeSldBar->isSliderDown() == false && */mVolumeBarMovementTimer->isActive() == false) { - ui->mZone2VolumeSldBar->setValue(ConvertVolumeToBarPosition(Zone2Status.mMainVolume)); + int SliderValue = ConvertVolumeToBarPosition(Zone2Status.mMainVolume); + disconnect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int))); + ui->mZone2VolumeSldBar->setValue(SliderValue); + connect(ui->mZone2VolumeSldBar,SIGNAL(valueChanged(int)),this,SLOT(Zone2VolumeSetChanged(int))); ui->mZone2SliderValueLbl->setText(""); + mTrayVolumeCtrlGuiHandle->SetZone2Volume(SliderValue,Zone2Status.mMainVolume); } return RET_OK; @@ -192,26 +211,63 @@ float CAvReceiverGui::ConvertBarPositionToVolume(int position) void CAvReceiverGui::MainZoneVolumeSetChanged(int value) { - int BarPosition = ui->mMainZoneVolumeSldBar->value(); +// int BarPosition = ui->mMainZoneVolumeSldBar->value(); + int BarPosition = value; float Volume = ConvertBarPositionToVolume(BarPosition); ui->mMainZoneSliderValueLbl->setText(QString("%1").arg(Volume)); mProgramHandle->MainZoneVolumeChanged(Volume); - mVolumeBarMovementTimer->start(); + + + if(mLockZone2VolumeWithZone1 == true) + { + ui->mZone2VolumeSldBar->setValue(BarPosition); + mVolumeBarMovementTimer->start(); + //mProgramHandle->Zone2VolumeChanged(Volume); + } } void CAvReceiverGui::Zone2VolumeSetChanged(int value) { - int BarPosition = ui->mZone2VolumeSldBar->value(); +// int BarPosition = ui->mZone2VolumeSldBar->value(); + int BarPosition = value; float Volume = ConvertBarPositionToVolume(BarPosition); ui->mZone2SliderValueLbl->setText(QString("%1").arg(Volume)); mProgramHandle->Zone2VolumeChanged(Volume); - mVolumeBarMovementTimer->start(); + // mVolumeBarMovementTimer->start(); } void CAvReceiverGui::VolumeBarMovementTimerExpired() { + int BarPosition = ui->mMainZoneVolumeSldBar->value(); + float Volume = ConvertBarPositionToVolume(BarPosition); + mProgramHandle->Zone2VolumeChanged(Volume); +} + +void CAvReceiverGui::Zone2LockVolumeChanged(bool checked) +{ + mLockZone2VolumeWithZone1 = checked; + if(checked) + { + //Set Zone 2 volume to main zone value + int BarPosition = ui->mMainZoneVolumeSldBar->value(); + float Volume = ConvertBarPositionToVolume(BarPosition); + + mProgramHandle->Zone2VolumeChanged(Volume); + + ui->mZone2VolumeSldBar->setEnabled(false); + } + else + { + ui->mZone2VolumeSldBar->setEnabled(true); + } } + +void CAvReceiverGui::Zone2InputSelectionChanged() +{ + QString Src = ui->mZone2InputComboBx->currentText(); + mProgramHandle->Zone2InputSrcChanged(Src); +} diff --git a/Sources/AvReceiver/AvReceiverGui.h b/Sources/AvReceiver/AvReceiverGui.h index 24fba2f..8752edc 100644 --- a/Sources/AvReceiver/AvReceiverGui.h +++ b/Sources/AvReceiver/AvReceiverGui.h @@ -6,6 +6,8 @@ class CAvReceiver; #include "AvReceiverData.h" #include +class CTrayVolumeCtrl; + namespace Ui { class CAvReceiverGui; } @@ -24,6 +26,8 @@ public: int ConvertVolumeToBarPosition(float Volume); float ConvertBarPositionToVolume(int position); QTimer *mVolumeBarMovementTimer; + bool mLockZone2VolumeWithZone1; + CTrayVolumeCtrl *mTrayVolumeCtrlGuiHandle; private: Ui::CAvReceiverGui *ui; @@ -38,6 +42,8 @@ public slots: void MainZoneVolumeSetChanged(int); void Zone2VolumeSetChanged(int); void VolumeBarMovementTimerExpired(); + void Zone2InputSelectionChanged(); + void Zone2LockVolumeChanged(bool checked); }; #endif // AVRECEIVERGUI_H diff --git a/Sources/AvReceiver/AvReceiverGui.ui b/Sources/AvReceiver/AvReceiverGui.ui index 4b1bfc5..268046c 100644 --- a/Sources/AvReceiver/AvReceiverGui.ui +++ b/Sources/AvReceiver/AvReceiverGui.ui @@ -6,8 +6,8 @@ 0 0 - 796 - 447 + 883 + 453 @@ -213,6 +213,29 @@ Qt::AlignCenter + + + + 580 + 180 + 121 + 21 + + + + + + + 590 + 120 + 171 + 17 + + + + Sync volume with Main zone + + diff --git a/Sources/AvReceiver/VolumeController.cpp b/Sources/AvReceiver/VolumeController.cpp new file mode 100644 index 0000000..1fa3401 --- /dev/null +++ b/Sources/AvReceiver/VolumeController.cpp @@ -0,0 +1,138 @@ +#include "VolumeController.h" +#include +#include +#include +#include +#include + +CVolumeController::CVolumeController(QObject *parent) : QObject(parent) +{ + mDeviceEnumerator = NULL; + mAudioDevice = NULL; + mEndpointVolume = 0; + mProgramPtr = 0; + mVolumeControllerActive = false; +} + +CVolumeController::~CVolumeController() +{ + if(mVolumeControllerActive == true) + { + if(mEndpointVolume != NULL) + { + mEndpointVolume->UnregisterControlChangeNotify(this); + mEndpointVolume->Release(); + } + if(mAudioDevice != NULL) + mAudioDevice->Release(); + if(mDeviceEnumerator != NULL) + mDeviceEnumerator->Release(); + + CoUninitialize(); + } +} + +int CVolumeController::Init(CAvReceiver *ProgramPtr) +{ + mProgramPtr = ProgramPtr; + IPropertyStore *pProps = NULL; + IMMDeviceCollection *pCollection = NULL; + + CoInitialize(NULL); + CoCreateGuid(&mMyGUID); + + const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); + const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator); + HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL,CLSCTX_ALL, IID_IMMDeviceEnumerator,(void**)&mDeviceEnumerator); + + hr = mDeviceEnumerator->EnumAudioEndpoints(eRender,DEVICE_STATE_ACTIVE,&pCollection); + unsigned int count; + hr = pCollection->GetCount(&count); + + + // mDeviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &mAudioDevice); // Get the default audio output device + + bool InterfaceFound = false; + for(unsigned int i = 0; i < count; i++) + { + hr = pCollection->Item(i,&mAudioDevice); + mAudioDevice->OpenPropertyStore(STGM_READ,&pProps); + PROPVARIANT DevName; + // Initialize container for property value. + PropVariantInit(&DevName); + hr = pProps->GetValue(PKEY_Device_FriendlyName, &DevName); //Get the friendly name + QString FriendlyName = QString("%1").arg(DevName.pwszVal); + PropVariantClear(&DevName); + qDebug("%s",qPrintable(FriendlyName)); + if(FriendlyName.contains("SPDIF")) + { + //We found our interface. + InterfaceFound = true; + qDebug("Audio interface found... binding callback."); + break; + } + } + if(pProps != NULL) + pProps->Release(); + + if(InterfaceFound == false) + { + qDebug("Audio interface not found"); + if(mAudioDevice != NULL) + mAudioDevice->Release(); + if(mDeviceEnumerator != NULL) + mDeviceEnumerator->Release(); + CoUninitialize(); + return RET_ERROR; + } + + mAudioDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (void**)&mEndpointVolume); // Activate the endpoint volume interface + + mEndpointVolume->RegisterControlChangeNotify(this);// Set up the volume change callback + + + mEndpointVolume->SetMasterVolumeLevelScalar(0.02,&mMyGUID); + mEndpointVolume->GetMasterVolumeLevelScalar(&mMasterVolume); + + return RET_OK; + +} + +int CVolumeController::SetMasterVolume(float Volume) +{ + mEndpointVolume->SetMasterVolumeLevelScalar(Volume,&mMyGUID); + return RET_OK; +} + +STDMETHODIMP CVolumeController:: OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) +{ + if (pNotify) + { + if(pNotify->guidEventContext != mMyGUID) + { +// qDebug("Volume changed. Current %f, Requested: %f",mMasterVolume,pNotify->fMasterVolume); + // float NewVolume; + if(mMasterVolume > pNotify->fMasterVolume) //Volume decrease + { + // qDebug("Volume Decrease"); + emit ExternalVolumeChanged(-EXTERNAL_VOLUME_INCREMENT); + } + else if(mMasterVolume < pNotify->fMasterVolume) //Volume increase + { + // qDebug("Volume increase"); + emit ExternalVolumeChanged(EXTERNAL_VOLUME_INCREMENT); + + } +// qDebug("Setting interface volume to %f",NewVolume); + // mEndpointVolume->SetMasterVolumeLevelScalar(NewVolume,&mMyGUID); + + } + else + { + mEndpointVolume->GetMasterVolumeLevelScalar(&mMasterVolume); + // qDebug("Setting internal master volume: %f",mMasterVolume); + } + } + return RET_OK; +} + diff --git a/Sources/AvReceiver/VolumeController.h b/Sources/AvReceiver/VolumeController.h new file mode 100644 index 0000000..f12c149 --- /dev/null +++ b/Sources/AvReceiver/VolumeController.h @@ -0,0 +1,57 @@ +#ifndef VOLUMECONTROLLER_H +#define VOLUMECONTROLLER_H + +#include "GlobalDefine.h" +#include +#include +#include + +#define EXTERNAL_VOLUME_INCREMENT 1 + +class CAvReceiver; + + +class CVolumeController : public QObject, public IAudioEndpointVolumeCallback +{ + Q_OBJECT +public: + explicit CVolumeController(QObject *parent = 0); + ~CVolumeController(); + int Init(CAvReceiver *ProgramPtr); + bool mVolumeControllerActive; + int SetMasterVolume(float Volume); + + CAvReceiver *mProgramPtr; + +private: + IMMDeviceEnumerator *mDeviceEnumerator ; + IMMDevice *mAudioDevice ; + IAudioEndpointVolume *mEndpointVolume; + GUID mMyGUID; + float mMasterVolume; + // CAudioNotificationCallback *mAudioNotificationObject; + + +public: + STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { + return E_NOINTERFACE; + } + + STDMETHODIMP_(ULONG) AddRef() {return 2;} + STDMETHODIMP_(ULONG) Release() {return 1;} + STDMETHODIMP OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify); + +public: + + +signals: +void ExternalVolumeChanged(float); + + +public slots: +}; + + + + +#endif // VOLUMECONTROLLER_H diff --git a/Sources/AvReceiver/VolumeController.h.T22060 b/Sources/AvReceiver/VolumeController.h.T22060 new file mode 100644 index 0000000..f20c592 --- /dev/null +++ b/Sources/AvReceiver/VolumeController.h.T22060 @@ -0,0 +1,53 @@ +#ifndef VOLUMECONTROLLER_H +#define VOLUMECONTROLLER_H + +#include "GlobalDefine.h" +#include +#include +#include + +class CAvReceiver; + + +class CVolumeController : public QObject, public IAudioEndpointVolumeCallback +{ + Q_OBJECT +public: + explicit CVolumeController(QObject *parent = 0); + ~CVolumeController(); + int Init(); + + CAvReceiver *mProgramPtr; + +private: + IMMDeviceEnumerator *mDeviceEnumerator ; + IMMDevice *mAudioDevice ; + IAudioEndpointVolume *mEndpointVolume; + // CAudioNotificationCallback *mAudioNotificationObject; + + +public: + STDMETHODIMP QueryInterface(REFIID riid, void **ppv) { + return E_NOINTERFACE; + } + + STDMETHODIMP_(ULONG) AddRef() {return 2;} + + STDMETHODIMP_(ULONG) Release() {return 1;} + + STDMETHODIMP OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify); + +public: + + +signals: + + + +public slots: +}; + + + + +#endif // VOLUMECONTROLLER_H diff --git a/Sources/Chalet/ChaletGui.cpp b/Sources/Chalet/ChaletGui.cpp index af4286f..570a270 100644 --- a/Sources/Chalet/ChaletGui.cpp +++ b/Sources/Chalet/ChaletGui.cpp @@ -49,11 +49,14 @@ CChaletGui::CChaletGui(QWidget *parent) : // create graph and assign data to it: mBatteryPlotWidget->addGraph(); + mBatteryPlotWidget->addGraph(mBatteryPlotWidget->xAxis,mBatteryPlotWidget->yAxis2); // give the axes some labels: mBatteryPlotWidget->xAxis->setLabel("time"); mBatteryPlotWidget->yAxis->setLabel("Volts"); + mBatteryPlotWidget->yAxis2->setLabel("RSSI (dBm)"); + mBatteryPlotWidget->yAxis2->setVisible(true); double now = QDateTime::currentDateTime().toSecsSinceEpoch(); QSharedPointer dateTicker(new QCPAxisTickerDateTime); @@ -73,6 +76,14 @@ CChaletGui::CChaletGui(QWidget *parent) : mBatteryPlotWidget->xAxis->setRange(midnight.toSecsSinceEpoch(), eod.toSecsSinceEpoch()); mBatteryPlotWidget->yAxis->setRange(12,15); + mBatteryPlotWidget->yAxis2->setRange(-255,0.0); + QList xAxis, yAxis; + xAxis.append(mBatteryPlotWidget->xAxis); + yAxis.append(mBatteryPlotWidget->yAxis); + yAxis.append(mBatteryPlotWidget->yAxis2); + mBatteryPlotWidget->axisRect()->setRangeDragAxes(xAxis,yAxis); + mBatteryPlotWidget->axisRect()->setRangeZoomAxes(xAxis,yAxis); + mBatteryPlotWidget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); mBatteryPlotWidget->graph(0)->addData(now,13.5); @@ -96,6 +107,8 @@ CChaletGui::CChaletGui(QWidget *parent) : ui->mTotalRxTxRequestsLbl->setText("Chalet Rx req: ??"); ui->mChaletTemperatureLbl->setText("Temperature: -100)"); + ui->mChaletWifiSelectionRadioBtn->setChecked(true); + } CChaletGui::~CChaletGui() @@ -293,6 +306,28 @@ int CChaletGui::UpdateLoraModuleStatus(CLoraModuleInterfaceStatus Status) QString ModuleStatusTxt = QString("Ambient RSSI: %1 [%3dBm]\nLast Rx RSSI: %2 [%4dBm]").arg(Status.mModuleAmbientRSSI).arg(Status.mModuleLastRxRSSI).arg(-1*(255-Status.mModuleAmbientRSSI)).arg(-1*(255-Status.mModuleLastRxRSSI)); ui->mLoraIFModuleStatus->setText(ModuleStatusTxt); + quint32 Add = 0; + + Add += (quint32)(Status.mIPAddress1 & 0x000000FF); + Add <<= 8; + Add += (quint32)(Status.mIPAddress2 & 0x000000FF); + Add <<= 8; + Add += (quint32)(Status.mIPAddress3 & 0x000000FF); + Add <<= 8; + Add += (quint32)(Status.mIPAddress4 & 0x000000FF); + QHostAddress IP = QHostAddress(Add); + + QString IPString = QString("Lora Module IP Address:").append(IP.toString()); + ui->mLoraModuleIPAddressLbl->setText(IPString); + + if(Status.mModuleLastRxRSSI > 10) //filter glitches + { + double CurTime = QDateTime::currentDateTime().toSecsSinceEpoch(); + mBatteryPlotWidget->graph(1)->addData(CurTime,-1*(255-Status.mModuleLastRxRSSI)); + + mBatteryPlotWidget->replot(); + } + return RET_OK; } @@ -507,3 +542,8 @@ void CChaletGui::RebootCPUButtonClicked() ui->mModuleIPAddressLbl->setText("Module IP Address: "); mProgramHandle->RequestWifiStatus(); } + + void CChaletGui::WiFiSettingsSelectionChanged() + { + + } diff --git a/Sources/Chalet/ChaletGui.h b/Sources/Chalet/ChaletGui.h index bb74cf1..931b703 100644 --- a/Sources/Chalet/ChaletGui.h +++ b/Sources/Chalet/ChaletGui.h @@ -60,6 +60,7 @@ public slots: void ResetCommStatsBtnClicked(); void UpdateDeviceWifiStatus(char WifiState, QHostAddress IP); void GetModuleWifiStatusBtnClicked(); + void WiFiSettingsSelectionChanged(); }; diff --git a/Sources/Chalet/ChaletGui.ui b/Sources/Chalet/ChaletGui.ui index 54018d4..ada762d 100644 --- a/Sources/Chalet/ChaletGui.ui +++ b/Sources/Chalet/ChaletGui.ui @@ -282,7 +282,7 @@ 420 - 240 + 260 1021 321 @@ -350,23 +350,23 @@ Temperature: - + - 70 + 60 380 321 - 231 + 251 - WiFi parameters (stored in flash) + Wifi parameters stored in flash 80 - 110 + 150 221 20 @@ -382,7 +382,7 @@ 10 - 110 + 150 71 20 @@ -400,7 +400,7 @@ 10 - 140 + 180 71 20 @@ -418,7 +418,7 @@ 80 - 140 + 180 221 20 @@ -434,7 +434,7 @@ 10 - 50 + 90 71 20 @@ -452,7 +452,7 @@ 80 - 50 + 90 221 20 @@ -468,7 +468,7 @@ 10 - 80 + 120 71 20 @@ -486,7 +486,7 @@ 80 - 80 + 120 221 20 @@ -502,7 +502,7 @@ 20 - 20 + 60 70 17 @@ -515,7 +515,7 @@ 70 - 180 + 220 75 23 @@ -528,7 +528,7 @@ 170 - 180 + 220 75 23 @@ -537,6 +537,38 @@ SET + + + + 40 + 20 + 85 + 20 + + + + Chalet + + + buttonGroup + + + + + + 140 + 20 + 101 + 20 + + + + Lora Module IF + + + buttonGroup + + @@ -770,8 +802,39 @@ Module state: ?? Activity!!! + + + + 170 + 130 + 61 + 20 + + + + GET + + + + + + 240 + 130 + 291 + 16 + + + + + 10 + + + + Module IP Address: + + - groupBox_2 + WifiSettingGroupBox groupBox MainPageLabel mInverterRlyStatusLabel @@ -810,4 +873,7 @@ Module state: ?? + + + diff --git a/Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp b/Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp index d09b071..3a44093 100644 --- a/Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp +++ b/Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp @@ -26,6 +26,13 @@ CLoraModuleInterfaceStatus& CLoraModuleInterfaceStatus::operator = (const CLoraM mModuleAmbientRSSI = rhs.mModuleAmbientRSSI; mModuleLastRxRSSI = rhs.mModuleLastRxRSSI; + mIPAddress1 = rhs.mIPAddress1; + mIPAddress2 = rhs.mIPAddress2; + mIPAddress3 = rhs.mIPAddress3; + mIPAddress4 = rhs.mIPAddress4; + + + return *this; } @@ -45,7 +52,13 @@ QDataStream &operator<<(QDataStream &out, const CLoraModuleInterfaceStatus &sour << source.mModuleLBTEnabled << source.mModuleWORCycle << source.mModuleAmbientRSSI - << source.mModuleLastRxRSSI; + << source.mModuleLastRxRSSI + << source.mIPAddress1 + << source.mIPAddress2 + << source.mIPAddress3 + << source.mIPAddress4; + + return out; } @@ -66,7 +79,11 @@ QDataStream &operator>>(QDataStream &in, CLoraModuleInterfaceStatus &dest) >> dest.mModuleLBTEnabled >> dest.mModuleWORCycle >> dest.mModuleAmbientRSSI - >> dest.mModuleLastRxRSSI; + >> dest.mModuleLastRxRSSI + >> dest.mIPAddress1 + >> dest.mIPAddress2 + >> dest.mIPAddress3 + >> dest.mIPAddress4; return in; diff --git a/Sources/LoRaModuleInterface/LoraModuleInterfaceData.h b/Sources/LoRaModuleInterface/LoraModuleInterfaceData.h index 4770036..5d9c82c 100644 --- a/Sources/LoRaModuleInterface/LoraModuleInterfaceData.h +++ b/Sources/LoRaModuleInterface/LoraModuleInterfaceData.h @@ -95,6 +95,11 @@ public: quint8 mModuleAmbientRSSI; quint8 mModuleLastRxRSSI; + quint8 mIPAddress1; + quint8 mIPAddress2; + quint8 mIPAddress3; + quint8 mIPAddress4; + CLoraModuleInterfaceStatus& operator=(const CLoraModuleInterfaceStatus &rhs); }; diff --git a/Sources/ProtocolDefs.h b/Sources/ProtocolDefs.h index 2c56b17..bc8700a 100644 --- a/Sources/ProtocolDefs.h +++ b/Sources/ProtocolDefs.h @@ -252,6 +252,8 @@ enum AV_RECEIVER_INTERFACE_CMDS AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE, AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST, AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE, + AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST, + AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE, MAX_AV_RECEIVER_INTERFACE_CMD diff --git a/Sources/SystemGui.cpp b/Sources/SystemGui.cpp index 49ebadf..5d63ef5 100644 --- a/Sources/SystemGui.cpp +++ b/Sources/SystemGui.cpp @@ -12,8 +12,10 @@ CSystemGui::CSystemGui(QObject *parent) : QObject(parent) mPICUploader = new CPICUploader(mGui->mPICUploaderGui); mIspindel = new CIspindel(mGui->mIspindelGui); mLoraModuleIF = new CLoraModuleInterface(mGui->mChaletGui); + mTrayVolumeCtrl = new CTrayVolumeCtrl(mGui->mAvReceiverGui); + mGui->mAvReceiverGui->mTrayVolumeCtrlGuiHandle = mTrayVolumeCtrl; - mSysTrayMgr = new CSystemTrayManager(); + mSysTrayMgr = new CSystemTrayManager(mTrayVolumeCtrl); mSysTrayMgr->mProgramHandle=this; mSMSClient->mTrayIconMgr = mSysTrayMgr; @@ -32,6 +34,7 @@ CSystemGui::~CSystemGui() delete mPICUploader; delete mIspindel; delete mLoraModuleIF; + delete mTrayVolumeCtrl; } @@ -44,7 +47,7 @@ void CSystemGui::Start() mChalet->Start(); mPICUploader->Start(); mIspindel->Start(); - mLoraModuleIF->Start(); +// mLoraModuleIF->Start(); } @@ -70,6 +73,8 @@ int CSystemGui::TrayIconLeftClick() if(mGui->isVisible()) { mGui->hide(); + + } else { diff --git a/Sources/SystemGui.h b/Sources/SystemGui.h index e7c2390..c11c14d 100644 --- a/Sources/SystemGui.h +++ b/Sources/SystemGui.h @@ -13,6 +13,7 @@ #include "PICUploader.h" #include "Ispindel.h" #include "LoraModuleInterface.h" +#include "TrayVolumeCtrl.h" class CSystemGui : public QObject @@ -41,6 +42,7 @@ private: CPICUploader *mPICUploader; CIspindel *mIspindel; CLoraModuleInterface *mLoraModuleIF; + CTrayVolumeCtrl *mTrayVolumeCtrl; signals: diff --git a/Sources/SystemTrayManager.cpp b/Sources/SystemTrayManager.cpp index eeacdb1..712b851 100644 --- a/Sources/SystemTrayManager.cpp +++ b/Sources/SystemTrayManager.cpp @@ -2,7 +2,7 @@ #include "SystemGui.h" #include -CSystemTrayManager::CSystemTrayManager() +CSystemTrayManager::CSystemTrayManager(CTrayVolumeCtrl *VolumeCtrlWidget) { mProgramHandle = 0; @@ -13,8 +13,20 @@ CSystemTrayManager::CSystemTrayManager() connect(&mSystemTrayIcon,SIGNAL(messageClicked()),this,SLOT(TrayBaloonMessageClicked())); connect(mTrayMenu,SIGNAL(triggered(QAction*)),this,SLOT(TrayMenuClicked(QAction*))); - mShowSettingsGUIAction = mTrayMenu->addAction("Settings"); + + QWidgetAction *test = new QWidgetAction(0); + test->setDefaultWidget(VolumeCtrlWidget); +// mTrayVolumeAction = new CTrayVolumeMenuAction("Volume"); +// mShowSettingsGUIAction = mTrayMenu->addAction("Settings"); mQuitAction = mTrayMenu->addAction("Quit SMS Client"); + mTrayMenu->addSection("Display"); + mCloneDisplaysAction = mTrayMenu->addAction("Clone"); + mExtendDisplaysAction = mTrayMenu->addAction("Extend"); + mTrayMenu->addSeparator(); + mTrayMenu->addAction(test); + //mTrayMenu->setMinimumWidth(300); + + mSystemTrayIcon.setIcon(QIcon("./Ico/sms.png")); mSystemTrayIcon.setToolTip("SMS Client :)"); mSystemTrayIcon.show(); @@ -44,7 +56,8 @@ void CSystemTrayManager::TrayIconActivated(QSystemTrayIcon::ActivationReason Rea } case QSystemTrayIcon::Context: { - //qDebug("Context"); + // mTrayVolumeCtrl->show(); + qDebug("Context"); break; } case QSystemTrayIcon::DoubleClick: @@ -56,6 +69,7 @@ void CSystemTrayManager::TrayIconActivated(QSystemTrayIcon::ActivationReason Rea //qDebug("Trigger"); //mTrayMenu->popup(QCursor::pos()); //mProgramHandle->RespawnMainWindowRequest(); + // mTrayVolumeCtrl->show(); mProgramHandle->TrayIconLeftClick(); break; } @@ -78,6 +92,14 @@ void CSystemTrayManager::TrayMenuClicked(QAction *Menu) qDebug("Settings"); mProgramHandle->ShowSettingsWindowRequest(); } + else if(Menu == mCloneDisplaysAction) + { + system("C:\\Windows\\System32\\DisplaySwitch.exe /clone"); + } + else if(Menu == mExtendDisplaysAction) + { + system("C:\\Windows\\System32\\DisplaySwitch.exe /extend"); + } } diff --git a/Sources/SystemTrayManager.h b/Sources/SystemTrayManager.h index 940621c..311c45d 100644 --- a/Sources/SystemTrayManager.h +++ b/Sources/SystemTrayManager.h @@ -5,6 +5,8 @@ #include #include #include +#include "TrayVolumeCtrl.h" + class CSystemGui; @@ -12,7 +14,7 @@ class CSystemTrayManager: public QObject { Q_OBJECT public: - CSystemTrayManager(); + CSystemTrayManager(CTrayVolumeCtrl *VolumeCtrlWidget); virtual ~CSystemTrayManager(); CSystemGui *mProgramHandle; int NewSMSMessagesPendingCount(int count); @@ -21,7 +23,8 @@ public: private: QSystemTrayIcon mSystemTrayIcon; QMenu *mTrayMenu; - QAction *mQuitAction, *mShowSettingsGUIAction; + // CTrayVolumeMenuAction *mTrayVolumeAction; + QAction *mQuitAction, *mShowSettingsGUIAction, *mTrayVolumeMenuAction, *mCloneDisplaysAction, *mExtendDisplaysAction; public slots: void TrayIconActivated(QSystemTrayIcon::ActivationReason); diff --git a/Sources/TrayVolumeCtrl.cpp b/Sources/TrayVolumeCtrl.cpp new file mode 100644 index 0000000..9b38c40 --- /dev/null +++ b/Sources/TrayVolumeCtrl.cpp @@ -0,0 +1,89 @@ +#include "TrayVolumeCtrl.h" +#include "AvReceiverGui.h" + + +CTrayVolumeCtrl::CTrayVolumeCtrl(CAvReceiverGui *AvReceiverGuiPtr, QWidget *parent) : + QWidget(parent) +{ + mAvReceiverGuiHandle = AvReceiverGuiPtr; + + mMainZoneSlider = new QSlider(); + mZone2Slider = new QSlider(); + mMainZoneLabel = new QLabel("Main\n0"); + mMainZoneLabel->setAlignment(Qt::AlignCenter); + mZone2Label = new QLabel("Zone 2\n0"); + mZone2Label->setAlignment(Qt::AlignCenter); + mLayout = new QGridLayout(this); + mButton1 = new QPushButton("1"); + mButton2 = new QPushButton("2"); + mButton3 = new QPushButton("3"); + mButton4 = new QPushButton("4"); + + + mLayout->addWidget(mMainZoneLabel,0,0); + mLayout->addWidget(mZone2Label,0,1); + mLayout->addWidget(mMainZoneSlider,1,0,4,1); + mLayout->addWidget(mZone2Slider,1,1,4,1); + mLayout->addWidget(mButton1,1,2); + mLayout->addWidget(mButton2,2,2); + mLayout->addWidget(mButton3,3,2); + mLayout->addWidget(mButton4,4,2); + mButton1->setMaximumWidth(25); + mButton2->setMaximumWidth(25); + mButton3->setMaximumWidth(25); + mButton4->setMaximumWidth(25); + + mMainZoneSlider->setMaximum(182); + mZone2Slider->setMaximum(182); + + + connect(mMainZoneSlider,&QSlider::valueChanged,this,&CTrayVolumeCtrl::MainZoneSliderValueChanged); + connect(mZone2Slider,&QSlider::valueChanged,this,&CTrayVolumeCtrl::Zone2SliderValueChanged); + connect(mButton1,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene1BtnClicked); + connect(mButton2,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene2BtnClicked); + connect(mButton3,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene3BtnClicked); + connect(mButton4,&QPushButton::clicked,mAvReceiverGuiHandle,&CAvReceiverGui::MainZoneScene4BtnClicked); + +} + +CTrayVolumeCtrl::~CTrayVolumeCtrl() +{ + delete mLayout; + delete mMainZoneSlider; + delete mZone2Slider; + delete mZone2Label; + delete mMainZoneLabel; +} + + +void CTrayVolumeCtrl::MainZoneSliderValueChanged() +{ + float SetVolume = mAvReceiverGuiHandle->ConvertBarPositionToVolume(mMainZoneSlider->value()); + mMainZoneLabel->setText(QString("Main\n%1").arg(SetVolume)); + mAvReceiverGuiHandle->MainZoneVolumeSetChanged(mMainZoneSlider->value()); +} + +void CTrayVolumeCtrl::Zone2SliderValueChanged() +{ + float SetVolume = mAvReceiverGuiHandle->ConvertBarPositionToVolume(mZone2Slider->value()); + mZone2Label->setText(QString("Main\n%1").arg(SetVolume)); + mAvReceiverGuiHandle->Zone2VolumeSetChanged(mZone2Slider->value()); +} + +int CTrayVolumeCtrl::SetMainZoneVolume(int SliderValue, float Volume) +{ + mMainZoneSlider->blockSignals(true); + mMainZoneLabel->setText(QString("Main\n%1").arg(Volume)); + mMainZoneSlider->setValue(SliderValue); + mMainZoneSlider->blockSignals(false); + mMainZoneCurVolume = Volume; +} + +int CTrayVolumeCtrl::SetZone2Volume(int SliderValue, float Volume) +{ + mZone2Slider->blockSignals(true); + mZone2Label->setText(QString("Zone 2\n%1").arg(Volume)); + mZone2Slider->setValue(SliderValue); + mZone2Slider->blockSignals(false); + mZone2CurVolume = Volume; +} diff --git a/Sources/TrayVolumeCtrl.h b/Sources/TrayVolumeCtrl.h new file mode 100644 index 0000000..c356c53 --- /dev/null +++ b/Sources/TrayVolumeCtrl.h @@ -0,0 +1,42 @@ +#ifndef TRAYVOLUMECTRL_H +#define TRAYVOLUMECTRL_H + +#include +#include +#include +#include +#include +#include + +class CAvReceiverGui; + +class CTrayVolumeCtrl : public QWidget +{ + Q_OBJECT + +public: + explicit CTrayVolumeCtrl(CAvReceiverGui *AvReceiverGuiPtr,QWidget *parent = 0); + ~CTrayVolumeCtrl(); + //QHBoxLayout *mLayout; + QGridLayout *mLayout; + QSlider *mMainZoneSlider, *mZone2Slider; + QLabel *mMainZoneLabel, *mZone2Label; + QPushButton *mButton1, *mButton2, *mButton3, *mButton4; + CAvReceiverGui *mAvReceiverGuiHandle; + + int SetMainZoneVolume(int SliderValue, float Volume); + int SetZone2Volume(int SliderValue, float Volume); + + float mMainZoneCurVolume, mZone2CurVolume; + + +private: + +public slots: + + void MainZoneSliderValueChanged(); + void Zone2SliderValueChanged(); + +}; + +#endif // TRAYVOLUMECTRL_H diff --git a/SystemGui.pro b/SystemGui.pro index b5e825f..bf2854a 100644 --- a/SystemGui.pro +++ b/SystemGui.pro @@ -80,7 +80,9 @@ SOURCES += \ Sources/Ispindel/IspindelData.cpp \ Sources/LoRaModuleInterface/LoraModuleInterface.cpp \ Sources/LoRaModuleInterface/LoraModuleIFMasterCtrlInterface.cpp \ - Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp + Sources/LoRaModuleInterface/LoraModuleInterfaceData.cpp \ + Sources/TrayVolumeCtrl.cpp \ + Sources/AvReceiver/VolumeController.cpp HEADERS += Sources/AbstractNetworkInterface.h \ Sources/Chalet/CChalet.h \ @@ -131,7 +133,9 @@ HEADERS += Sources/AbstractNetworkInterface.h \ Sources/Ispindel/IspindelData.h \ Sources/LoRaModuleInterface/LoraModuleInterface.h \ Sources/LoRaModuleInterface/LoraModuleIFMasterCtrlInterface.h \ - Sources/LoRaModuleInterface/LoraModuleInterfaceData.h + Sources/LoRaModuleInterface/LoraModuleInterfaceData.h \ + Sources/TrayVolumeCtrl.h \ + Sources/AvReceiver/VolumeController.h FORMS += \ SMSGui.ui \ @@ -142,3 +146,7 @@ FORMS += \ Sources/AvReceiver/AvReceiverGui.ui \ Sources/Tower/TowerLightShowGui.ui \ Sources/Ispindel/IspindelGUI.ui + +#win32: LIBS += -luuid + +win32: LIBS += -lole32 diff --git a/ui_AvReceiverGui.h b/ui_AvReceiverGui.h index 32d024d..1d349fc 100644 --- a/ui_AvReceiverGui.h +++ b/ui_AvReceiverGui.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -37,12 +38,14 @@ public: QSlider *mZone2VolumeSldBar; QLabel *mMainZoneSliderValueLbl; QLabel *mZone2SliderValueLbl; + QComboBox *mZone2InputComboBx; + QCheckBox *mZone2SyncVolumeChkBx; void setupUi(QWidget *CAvReceiverGui) { if (CAvReceiverGui->objectName().isEmpty()) CAvReceiverGui->setObjectName(QString::fromUtf8("CAvReceiverGui")); - CAvReceiverGui->resize(796, 447); + CAvReceiverGui->resize(883, 453); label = new QLabel(CAvReceiverGui); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(230, 30, 201, 16)); @@ -93,6 +96,12 @@ public: mZone2SliderValueLbl->setObjectName(QString::fromUtf8("mZone2SliderValueLbl")); mZone2SliderValueLbl->setGeometry(QRect(490, 100, 51, 16)); mZone2SliderValueLbl->setAlignment(Qt::AlignCenter); + mZone2InputComboBx = new QComboBox(CAvReceiverGui); + mZone2InputComboBx->setObjectName(QString::fromUtf8("mZone2InputComboBx")); + mZone2InputComboBx->setGeometry(QRect(580, 180, 121, 21)); + mZone2SyncVolumeChkBx = new QCheckBox(CAvReceiverGui); + mZone2SyncVolumeChkBx->setObjectName(QString::fromUtf8("mZone2SyncVolumeChkBx")); + mZone2SyncVolumeChkBx->setGeometry(QRect(590, 120, 171, 17)); retranslateUi(CAvReceiverGui); @@ -114,6 +123,7 @@ public: MainZoneScene4Btn->setText(QCoreApplication::translate("CAvReceiverGui", "4", nullptr)); mMainZoneSliderValueLbl->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr)); mZone2SliderValueLbl->setText(QCoreApplication::translate("CAvReceiverGui", "TextLabel", nullptr)); + mZone2SyncVolumeChkBx->setText(QCoreApplication::translate("CAvReceiverGui", "Sync volume with Main zone", nullptr)); } // retranslateUi }; diff --git a/ui_ChaletGui.h b/ui_ChaletGui.h index 26ff60a..41d03d3 100644 --- a/ui_ChaletGui.h +++ b/ui_ChaletGui.h @@ -11,12 +11,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -50,7 +52,7 @@ public: QDateEdit *mLogStartDateEdit; QPushButton *mGetChaletLogButton; QLabel *mChaletTemperatureLbl; - QGroupBox *groupBox_2; + QGroupBox *WifiSettingGroupBox; QLineEdit *mWifiAccessPtNameEditBx; QLabel *mAccessPtNameLabel; QLabel *mAccessPtPassLbl; @@ -62,6 +64,8 @@ public: QCheckBox *mDHCPEnableChkBx; QPushButton *mWiFiGetRemoteSettingsBtn; QPushButton *mWiFiSetRemoteSettingsBtn; + QRadioButton *mChaletWifiSelectionRadioBtn; + QRadioButton *mLoraIFWifiSelectionRadioBtn; QLabel *mSolarPanelCurrentCnvLbl; QLabel *mFirmwareVersionLabel; QPushButton *mGetFirmwareVersionBtn; @@ -79,6 +83,9 @@ public: QLabel *label_3; QLabel *label_4; QLabel *mLoraModuleCommActivityLbl; + QPushButton *mGetLoraWifiStatusBtn; + QLabel *mLoraModuleIPAddressLbl; + QButtonGroup *buttonGroup; void setupUi(QWidget *CChaletGui) { @@ -156,7 +163,7 @@ public: mLostReqPercentLbl->setGeometry(QRect(430, 160, 241, 16)); mPlotWidget = new QWidget(CChaletGui); mPlotWidget->setObjectName(QString::fromUtf8("mPlotWidget")); - mPlotWidget->setGeometry(QRect(420, 240, 1021, 321)); + mPlotWidget->setGeometry(QRect(420, 260, 1021, 321)); mChaletCommActivityLbl = new QLabel(CChaletGui); mChaletCommActivityLbl->setObjectName(QString::fromUtf8("mChaletCommActivityLbl")); mChaletCommActivityLbl->setGeometry(QRect(430, 140, 47, 16)); @@ -172,52 +179,62 @@ public: mChaletTemperatureLbl = new QLabel(CChaletGui); mChaletTemperatureLbl->setObjectName(QString::fromUtf8("mChaletTemperatureLbl")); mChaletTemperatureLbl->setGeometry(QRect(190, 340, 241, 16)); - groupBox_2 = new QGroupBox(CChaletGui); - groupBox_2->setObjectName(QString::fromUtf8("groupBox_2")); - groupBox_2->setGeometry(QRect(70, 380, 321, 231)); - mWifiAccessPtNameEditBx = new QLineEdit(groupBox_2); + WifiSettingGroupBox = new QGroupBox(CChaletGui); + WifiSettingGroupBox->setObjectName(QString::fromUtf8("WifiSettingGroupBox")); + WifiSettingGroupBox->setGeometry(QRect(60, 380, 321, 251)); + mWifiAccessPtNameEditBx = new QLineEdit(WifiSettingGroupBox); mWifiAccessPtNameEditBx->setObjectName(QString::fromUtf8("mWifiAccessPtNameEditBx")); - mWifiAccessPtNameEditBx->setGeometry(QRect(80, 110, 221, 20)); + mWifiAccessPtNameEditBx->setGeometry(QRect(80, 150, 221, 20)); mWifiAccessPtNameEditBx->setAlignment(Qt::AlignCenter); - mAccessPtNameLabel = new QLabel(groupBox_2); + mAccessPtNameLabel = new QLabel(WifiSettingGroupBox); mAccessPtNameLabel->setObjectName(QString::fromUtf8("mAccessPtNameLabel")); - mAccessPtNameLabel->setGeometry(QRect(10, 110, 71, 20)); + mAccessPtNameLabel->setGeometry(QRect(10, 150, 71, 20)); QFont font2; font2.setPointSize(10); mAccessPtNameLabel->setFont(font2); - mAccessPtPassLbl = new QLabel(groupBox_2); + mAccessPtPassLbl = new QLabel(WifiSettingGroupBox); mAccessPtPassLbl->setObjectName(QString::fromUtf8("mAccessPtPassLbl")); - mAccessPtPassLbl->setGeometry(QRect(10, 140, 71, 20)); + mAccessPtPassLbl->setGeometry(QRect(10, 180, 71, 20)); mAccessPtPassLbl->setFont(font2); - mWifiPasswordEditBx = new QLineEdit(groupBox_2); + mWifiPasswordEditBx = new QLineEdit(WifiSettingGroupBox); mWifiPasswordEditBx->setObjectName(QString::fromUtf8("mWifiPasswordEditBx")); - mWifiPasswordEditBx->setGeometry(QRect(80, 140, 221, 20)); + mWifiPasswordEditBx->setGeometry(QRect(80, 180, 221, 20)); mWifiPasswordEditBx->setAlignment(Qt::AlignCenter); - label = new QLabel(groupBox_2); + label = new QLabel(WifiSettingGroupBox); label->setObjectName(QString::fromUtf8("label")); - label->setGeometry(QRect(10, 50, 71, 20)); + label->setGeometry(QRect(10, 90, 71, 20)); label->setFont(font2); - mWiFiIPAddressEditBx = new QLineEdit(groupBox_2); + mWiFiIPAddressEditBx = new QLineEdit(WifiSettingGroupBox); mWiFiIPAddressEditBx->setObjectName(QString::fromUtf8("mWiFiIPAddressEditBx")); - mWiFiIPAddressEditBx->setGeometry(QRect(80, 50, 221, 20)); + mWiFiIPAddressEditBx->setGeometry(QRect(80, 90, 221, 20)); mWiFiIPAddressEditBx->setAlignment(Qt::AlignCenter); - label_2 = new QLabel(groupBox_2); + label_2 = new QLabel(WifiSettingGroupBox); label_2->setObjectName(QString::fromUtf8("label_2")); - label_2->setGeometry(QRect(10, 80, 71, 20)); + label_2->setGeometry(QRect(10, 120, 71, 20)); label_2->setFont(font2); - mWiFiGatewayAddressEditBx = new QLineEdit(groupBox_2); + mWiFiGatewayAddressEditBx = new QLineEdit(WifiSettingGroupBox); mWiFiGatewayAddressEditBx->setObjectName(QString::fromUtf8("mWiFiGatewayAddressEditBx")); - mWiFiGatewayAddressEditBx->setGeometry(QRect(80, 80, 221, 20)); + mWiFiGatewayAddressEditBx->setGeometry(QRect(80, 120, 221, 20)); mWiFiGatewayAddressEditBx->setAlignment(Qt::AlignCenter); - mDHCPEnableChkBx = new QCheckBox(groupBox_2); + mDHCPEnableChkBx = new QCheckBox(WifiSettingGroupBox); mDHCPEnableChkBx->setObjectName(QString::fromUtf8("mDHCPEnableChkBx")); - mDHCPEnableChkBx->setGeometry(QRect(20, 20, 70, 17)); - mWiFiGetRemoteSettingsBtn = new QPushButton(groupBox_2); + mDHCPEnableChkBx->setGeometry(QRect(20, 60, 70, 17)); + mWiFiGetRemoteSettingsBtn = new QPushButton(WifiSettingGroupBox); mWiFiGetRemoteSettingsBtn->setObjectName(QString::fromUtf8("mWiFiGetRemoteSettingsBtn")); - mWiFiGetRemoteSettingsBtn->setGeometry(QRect(70, 180, 75, 23)); - mWiFiSetRemoteSettingsBtn = new QPushButton(groupBox_2); + mWiFiGetRemoteSettingsBtn->setGeometry(QRect(70, 220, 75, 23)); + mWiFiSetRemoteSettingsBtn = new QPushButton(WifiSettingGroupBox); mWiFiSetRemoteSettingsBtn->setObjectName(QString::fromUtf8("mWiFiSetRemoteSettingsBtn")); - mWiFiSetRemoteSettingsBtn->setGeometry(QRect(170, 180, 75, 23)); + mWiFiSetRemoteSettingsBtn->setGeometry(QRect(170, 220, 75, 23)); + mChaletWifiSelectionRadioBtn = new QRadioButton(WifiSettingGroupBox); + buttonGroup = new QButtonGroup(CChaletGui); + buttonGroup->setObjectName(QString::fromUtf8("buttonGroup")); + buttonGroup->addButton(mChaletWifiSelectionRadioBtn); + mChaletWifiSelectionRadioBtn->setObjectName(QString::fromUtf8("mChaletWifiSelectionRadioBtn")); + mChaletWifiSelectionRadioBtn->setGeometry(QRect(40, 20, 85, 20)); + mLoraIFWifiSelectionRadioBtn = new QRadioButton(WifiSettingGroupBox); + buttonGroup->addButton(mLoraIFWifiSelectionRadioBtn); + mLoraIFWifiSelectionRadioBtn->setObjectName(QString::fromUtf8("mLoraIFWifiSelectionRadioBtn")); + mLoraIFWifiSelectionRadioBtn->setGeometry(QRect(140, 20, 101, 20)); mSolarPanelCurrentCnvLbl = new QLabel(CChaletGui); mSolarPanelCurrentCnvLbl->setObjectName(QString::fromUtf8("mSolarPanelCurrentCnvLbl")); mSolarPanelCurrentCnvLbl->setGeometry(QRect(190, 280, 201, 16)); @@ -273,7 +290,14 @@ public: mLoraModuleCommActivityLbl = new QLabel(mLoraIFGroupBox); mLoraModuleCommActivityLbl->setObjectName(QString::fromUtf8("mLoraModuleCommActivityLbl")); mLoraModuleCommActivityLbl->setGeometry(QRect(390, 80, 47, 16)); - groupBox_2->raise(); + mGetLoraWifiStatusBtn = new QPushButton(mLoraIFGroupBox); + mGetLoraWifiStatusBtn->setObjectName(QString::fromUtf8("mGetLoraWifiStatusBtn")); + mGetLoraWifiStatusBtn->setGeometry(QRect(170, 130, 61, 20)); + mLoraModuleIPAddressLbl = new QLabel(mLoraIFGroupBox); + mLoraModuleIPAddressLbl->setObjectName(QString::fromUtf8("mLoraModuleIPAddressLbl")); + mLoraModuleIPAddressLbl->setGeometry(QRect(240, 130, 291, 16)); + mLoraModuleIPAddressLbl->setFont(font2); + WifiSettingGroupBox->raise(); groupBox->raise(); MainPageLabel->raise(); mInverterRlyStatusLabel->raise(); @@ -341,7 +365,7 @@ public: mLasCommRequestReceivedLbl->setText(QCoreApplication::translate("CChaletGui", "Last Request: ", nullptr)); mGetChaletLogButton->setText(QCoreApplication::translate("CChaletGui", "PushButton", nullptr)); mChaletTemperatureLbl->setText(QCoreApplication::translate("CChaletGui", "Temperature:", nullptr)); - groupBox_2->setTitle(QCoreApplication::translate("CChaletGui", "WiFi parameters (stored in flash)", nullptr)); + WifiSettingGroupBox->setTitle(QCoreApplication::translate("CChaletGui", "Wifi parameters stored in flash", nullptr)); mWifiAccessPtNameEditBx->setText(QCoreApplication::translate("CChaletGui", "?", nullptr)); mAccessPtNameLabel->setText(QCoreApplication::translate("CChaletGui", "Access Pt:", nullptr)); mAccessPtPassLbl->setText(QCoreApplication::translate("CChaletGui", "Password:", nullptr)); @@ -353,6 +377,8 @@ public: mDHCPEnableChkBx->setText(QCoreApplication::translate("CChaletGui", "DHCP", nullptr)); mWiFiGetRemoteSettingsBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr)); mWiFiSetRemoteSettingsBtn->setText(QCoreApplication::translate("CChaletGui", "SET", nullptr)); + mChaletWifiSelectionRadioBtn->setText(QCoreApplication::translate("CChaletGui", "Chalet", nullptr)); + mLoraIFWifiSelectionRadioBtn->setText(QCoreApplication::translate("CChaletGui", "Lora Module IF", nullptr)); mSolarPanelCurrentCnvLbl->setText(QCoreApplication::translate("CChaletGui", "Solar Panel Current (A):", nullptr)); mFirmwareVersionLabel->setText(QCoreApplication::translate("CChaletGui", "Firmware Version: ?", nullptr)); mGetFirmwareVersionBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr)); @@ -370,6 +396,8 @@ public: label_3->setText(QCoreApplication::translate("CChaletGui", "Module Channel", nullptr)); label_4->setText(QCoreApplication::translate("CChaletGui", "Module Address", nullptr)); mLoraModuleCommActivityLbl->setText(QCoreApplication::translate("CChaletGui", "Activity!!!", nullptr)); + mGetLoraWifiStatusBtn->setText(QCoreApplication::translate("CChaletGui", "GET", nullptr)); + mLoraModuleIPAddressLbl->setText(QCoreApplication::translate("CChaletGui", "Module IP Address:", nullptr)); } // retranslateUi }; diff --git a/ui_TrayVolumeCtrl.h b/ui_TrayVolumeCtrl.h new file mode 100644 index 0000000..3908d7c --- /dev/null +++ b/ui_TrayVolumeCtrl.h @@ -0,0 +1,57 @@ +/******************************************************************************** +** Form generated from reading UI file 'TrayVolumeCtrl.ui' +** +** Created by: Qt User Interface Compiler version 5.14.2 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_TRAYVOLUMECTRL_H +#define UI_TRAYVOLUMECTRL_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_CTrayVolumeCtrl +{ +public: + QSlider *horizontalSlider; + QSlider *horizontalSlider_2; + + void setupUi(QWidget *CTrayVolumeCtrl) + { + if (CTrayVolumeCtrl->objectName().isEmpty()) + CTrayVolumeCtrl->setObjectName(QString::fromUtf8("CTrayVolumeCtrl")); + CTrayVolumeCtrl->resize(441, 147); + horizontalSlider = new QSlider(CTrayVolumeCtrl); + horizontalSlider->setObjectName(QString::fromUtf8("horizontalSlider")); + horizontalSlider->setGeometry(QRect(70, 40, 160, 16)); + horizontalSlider->setOrientation(Qt::Horizontal); + horizontalSlider_2 = new QSlider(CTrayVolumeCtrl); + horizontalSlider_2->setObjectName(QString::fromUtf8("horizontalSlider_2")); + horizontalSlider_2->setGeometry(QRect(70, 70, 160, 16)); + horizontalSlider_2->setOrientation(Qt::Horizontal); + + retranslateUi(CTrayVolumeCtrl); + + QMetaObject::connectSlotsByName(CTrayVolumeCtrl); + } // setupUi + + void retranslateUi(QWidget *CTrayVolumeCtrl) + { + CTrayVolumeCtrl->setWindowTitle(QCoreApplication::translate("CTrayVolumeCtrl", "Form", nullptr)); + } // retranslateUi + +}; + +namespace Ui { + class CTrayVolumeCtrl: public Ui_CTrayVolumeCtrl {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_TRAYVOLUMECTRL_H