Beaucoup de dev... début de LoraModuleInterface

This commit is contained in:
2022-12-11 13:17:19 -05:00
parent 3f28be7793
commit 49cd147334
27 changed files with 686 additions and 95 deletions
+38
View File
@@ -0,0 +1,38 @@
#include "LoraSettingsGui.h"
#include "ui_LoraSettingsGui.h"
#include "ProgramSettings.h"
CLoraSettingsGui::CLoraSettingsGui(QWidget *parent) :
QWidget(parent),
ui(new Ui::CLoraSettingsGui)
{
ui->setupUi(this);
}
CLoraSettingsGui::~CLoraSettingsGui()
{
delete ui;
}
CLoraSettingsGui::SetSettings(CSettings *settings)
{
ui->mLoraAddressSpinBx->setValue(settings->mChaletLoraAddress);
ui->mComportComboBox->setCurrentText(settings->mChaletComPort);
return RET_OK;
}
quint16 CLoraSettingsGui::GetChaletLoraAddress()
{
quint16 Add = ui->mLoraAddressSpinBx->value();
return Add;
}
quint8 CLoraSettingsGui::GetChaletLoraChannel()
{
return 4;
}
QString CLoraSettingsGui::GetChaletLoraComPort()
{
return ui->mComportComboBox->currentText();
}
+28
View File
@@ -0,0 +1,28 @@
#ifndef LORASETTINGSGUI_H
#define LORASETTINGSGUI_H
#include <QWidget>
class CSettings;
namespace Ui {
class CLoraSettingsGui;
}
class CLoraSettingsGui : public QWidget
{
Q_OBJECT
public:
explicit CLoraSettingsGui(QWidget *parent = 0);
~CLoraSettingsGui();
int SetSettings(CSettings* settings);
QString GetChaletLoraComPort();
quint8 GetChaletLoraChannel();
quint16 GetChaletLoraAddress();
private:
Ui::CLoraSettingsGui *ui;
};
#endif // LORASETTINGSGUI_H
+195
View File
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CLoraSettingsGui</class>
<widget class="QWidget" name="CLoraSettingsGui">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>553</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>151</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Lora Settings</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>221</width>
<height>191</height>
</rect>
</property>
<property name="title">
<string>Chalet</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Lora Address:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Lora Channel:</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
<widget class="QSpinBox" name="mLoraAddressSpinBx">
<property name="geometry">
<rect>
<x>90</x>
<y>40</y>
<width>71</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>6</number>
</property>
</widget>
<widget class="QComboBox" name="mComportComboBox">
<property name="geometry">
<rect>
<x>80</x>
<y>80</y>
<width>69</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>COM1</string>
</property>
</item>
<item>
<property name="text">
<string>COM2</string>
</property>
</item>
<item>
<property name="text">
<string>COM3</string>
</property>
</item>
<item>
<property name="text">
<string>COM4</string>
</property>
</item>
<item>
<property name="text">
<string>COM5</string>
</property>
</item>
<item>
<property name="text">
<string>COM6</string>
</property>
</item>
<item>
<property name="text">
<string>COM7</string>
</property>
</item>
<item>
<property name="text">
<string>COM8</string>
</property>
</item>
<item>
<property name="text">
<string>COM9</string>
</property>
</item>
<item>
<property name="text">
<string>COM10</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Com Port:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Chalet = 7
Chaloupe = 8</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+16
View File
@@ -14,10 +14,13 @@ CSettingsWindow::CSettingsWindow()
QVBoxLayout *MainLayout = new QVBoxLayout;
QWidget *mPagesContainer = new QWidget(this);
mLoraSettingsPage = new CLoraSettingsGui(mPagesContainer);
mOptionsTabBar = new QTabBar();
mOptionsTabBar->addTab("SMS");
mOptionsTabBar->addTab("Network");
mOptionsTabBar->addTab("Contacts");
mOptionsTabBar->addTab("Lora");
mOptionsTabBar->resize(this->geometry().width(),mOptionsTabBar->height());
MainLayout->addWidget(mOptionsTabBar);
@@ -160,14 +163,22 @@ void CSettingsWindow::TabBarClicked(int TabIndex)
{
mSMSPage->hide();
mContactsPage->hide();
mLoraSettingsPage->hide();
}
else if(TabIndex == 2)//Contacts
{
mSMSPage->hide();
mLoraSettingsPage->hide();
mContactsPage->show();
}
else if(TabIndex == 3) //Lora
{
mSMSPage->hide();
mContactsPage->hide();
mLoraSettingsPage->show();
}
}
void CSettingsWindow::RetreiveDIDButtonClicked(bool checked)
@@ -207,6 +218,8 @@ unsigned int CSettingsWindow::SetSettingsData(CSettings *SettingsData)
mDIDSelectionDropList->clear();
mDIDSelectionDropList->addItem(SettingsData->mVoipMSSettings.mDefaultDID);
mVoipMSCalendar->setSelectedDate(SettingsData->mVoipMSSettings.mStartDate);
mLoraSettingsPage->SetSettings(SettingsData);
return RET_OK;
}
@@ -219,6 +232,9 @@ void CSettingsWindow::DoneButtonClicked(bool checked)
Settings->mVoipMSSettings.mPassword = mVoipMSPassword->text();
Settings->mVoipMSSettings.mStartDate = mVoipMSCalendar->selectedDate();
Settings->mVoipMSSettings.mUsername = mVoipMSUsername->text();
Settings->mChaletComPort = mLoraSettingsPage->GetChaletLoraComPort();
Settings->mChaletLoraAddress = mLoraSettingsPage->GetChaletLoraAddress();
Settings->mChaletLoraChannel = mLoraSettingsPage->GetChaletLoraChannel();
mProgramHandle->SaveSettings(Settings);
mProgramHandle->SettingsWindowClosed();
+2
View File
@@ -11,6 +11,7 @@
#include "ProgramSettings.h"
#include "QTableWidget"
#include <QLabel>
#include "LoraSettingsGui.h"
class CMasterCtrl;
@@ -28,6 +29,7 @@ public:
QWidget *mSMSPage;
QWidget *mContactsPage;
QTabBar *mOptionsTabBar;
CLoraSettingsGui *mLoraSettingsPage;
//SMS Page
QLineEdit *mVoipMSUsername;