Browse Source

update

master
zhaohe 1 year ago
parent
commit
03f392ae3f
  1. 2
      libxsync
  2. 54
      mainwindow.cpp
  3. 15
      mainwindow.h
  4. 324
      mainwindow.ui

2
libxsync

@ -1 +1 @@
Subproject commit 8d566302ea775dfe97f7f86b136cfbbe2888041f
Subproject commit 3eeca6b41c8b0c85f4bdf1c682037a50f4ae6d3a

54
mainwindow.cpp

@ -475,10 +475,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
XsyncInit(XSyncUdpFactoryImpl::Ins());
xsync_config_t config = {0};
XsyncIns()->initialize(&config);
XsyncIns()->registerOnConnectStateChangeCallback([this](string targetIp, bool state) {
XsyncIns()->registerOnConnectStateChangeCallback([this](bool state, string targetIp) {
ZLOGI(TAG, "targetIp:%s,state:%d", targetIp.c_str(), state);
if (state) {
emit doinui_signal(QFunction([this, targetIp]() { ui->IpInput->setText(QString::fromStdString(targetIp)); }));
string sn;
XsyncIns()->readSn(sn);
emit doinui_signal(QFunction([this, targetIp, sn]() {
ui->IpInput->setText(QString::fromStdString(targetIp));
ui->snDisplay->setText(QString::fromStdString(sn));
}));
} else {
emit doinui_signal(QFunction([this, targetIp]() { ui->IpInput->setText(QString::fromStdString("disconnect")); }));
}
@ -559,13 +564,6 @@ void MainWindow::mainWindowsRun() { //
} \
}
void MainWindow::on_GenNewMac_clicked() { DO_XSYNC_FUNC(XsyncIns()->generatorNewMac()); }
void MainWindow::on_FactoryReset_clicked() { DO_XSYNC_FUNC(XsyncIns()->factoryReset()); }
void MainWindow::on_Reboot_clicked() { DO_XSYNC_FUNC(XsyncIns()->reboot()); }
void MainWindow::on_ChangeNetCfg_clicked() { //
// DO_XSYNC_FUNC(XsyncIns()->changeNetworkConfig(ui->ChangeNetCfg_ip->text().toStdString(), ui->ChangeNetCfg_mask->text().toStdString(), ui->ChangeNetCfg_gateway->text().toStdString()));
}
void MainWindow::on_TimecodePage_Read_clicked() {
TimecodeFormat_t InternalTimecode_Format;
XsyncTimecode_t InternalTimecode_Code;
@ -622,9 +620,6 @@ void MainWindow::on_tabWidget_currentChanged(int index) {
on_RecordSigGen_Read_clicked();
}
void MainWindow::on_TTLInputModule_Index_currentIndexChanged(int index) {}
void MainWindow::on_TTLOutputMoudle_ID_currentIndexChanged(int index) {}
void MainWindow::on_TTLPage_Read_clicked() {
{
float freq1 = 0;
@ -904,3 +899,38 @@ void MainWindow::on_RecordSigGen_Write_clicked() {
}
void MainWindow::on_RecordSigGenerator_manualStart_clicked() { DO_XSYNC_FUNC(XsyncIns()->RecordSigGenerator_manualStart()); }
void MainWindow::on_RecordSigGenerator_manualStop_clicked() { DO_XSYNC_FUNC(XsyncIns()->RecordSigGenerator_manualStop()); }
void MainWindow::on_NetworkConfig_read_clicked() {
// DO_XSYNC_FUNC(XsyncIns()->changeNetworkConfig(ui->ChangeNetCfg_ip->text().toStdString(), ui->ChangeNetCfg_mask->text().toStdString(), ui->ChangeNetCfg_gateway->text().toStdString()));
string ip;
string mask;
string gateway;
NetworkMode_t mode;
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getIp(ip));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getMask(mask));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_getGateway(gateway));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfig_getMode(mode));
ui->NetworkConfigStaticIpMode_Ip->setText(QString::fromStdString(ip));
ui->NetworkConfigStaticIpMode_Mask->setText(QString::fromStdString(mask));
ui->NetworkConfigStaticIpMode_Gateway->setText(QString::fromStdString(gateway));
ui->NetworkConfig_Mode->setText(QString::fromStdString(QString::number(mode).toStdString()));
}
void MainWindow::on_NetworkConfig_storage_clicked() {
string ip = ui->NetworkConfigStaticIpMode_Ip->text().toStdString();
string mask = ui->NetworkConfigStaticIpMode_Mask->text().toStdString();
string gateway = ui->NetworkConfigStaticIpMode_Gateway->text().toStdString();
NetworkMode_t mode = (NetworkMode_t)ui->NetworkConfig_Mode->text().toUInt();
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setIp(ip));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setMask(mask));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfigStaticIpMode_setGateway(gateway));
DO_XSYNC_FUNC(XsyncIns()->NetworkConfig_setMode(mode));
DO_XSYNC_FUNC(XsyncIns()->storageConfig());
}
void MainWindow::on_GenNewMac_clicked() { DO_XSYNC_FUNC(XsyncIns()->generatorNewMac()); }
void MainWindow::on_FactoryReset_clicked() { DO_XSYNC_FUNC(XsyncIns()->factoryReset()); }
void MainWindow::on_Reboot_clicked() { DO_XSYNC_FUNC(XsyncIns()->reboot()); }

15
mainwindow.h

@ -88,11 +88,6 @@ class MainWindow : public QMainWindow {
void on_ClearLogButton_clicked();
void on_Connect2XsyncButton_clicked();
void on_GenNewMac_clicked();
void on_FactoryReset_clicked();
void on_Reboot_clicked();
void on_ChangeNetCfg_clicked();
void updateUI_timeCodeInfo_slot(QString);
void updateUI_cameraSyncInfo_slot(QString);
void updateUI_reg_slot(int32_t regadd, uint32_t regval);
@ -107,9 +102,6 @@ class MainWindow : public QMainWindow {
void on_tabWidget_currentChanged(int index);
void on_TTLInputModule_Index_currentIndexChanged(int index);
void on_TTLOutputMoudle_ID_currentIndexChanged(int index);
void on_TTLPage_Read_clicked();
void on_TTLPage_Write_clicked();
@ -120,12 +112,17 @@ class MainWindow : public QMainWindow {
void on_SysClockPage_Read_clicked();
void on_SysClockPage_Wirte_clicked();
void on_RecordSigGen_Read_clicked();
void on_RecordSigGen_Write_clicked();
void on_RecordSigGenerator_manualStart_clicked();
void on_RecordSigGenerator_manualStop_clicked();
void on_NetworkConfig_read_clicked();
void on_NetworkConfig_storage_clicked();
void on_GenNewMac_clicked();
void on_FactoryReset_clicked();
void on_Reboot_clicked();
signals:
void append_log_signal(QString str);
void updateUI_timeCodeInfo_signal(QString);

324
mainwindow.ui

@ -72,6 +72,35 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_63">
<property name="text">
<string>SN</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="snDisplay">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -175,7 +204,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>4</number>
<number>6</number>
</property>
<widget class="QWidget" name="tab_8">
<attribute name="title">
@ -2480,13 +2509,13 @@
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>IP配置</string>
<string>设备基础操作</string>
</attribute>
<widget class="QPushButton" name="GenNewMac">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<x>600</x>
<y>30</y>
<width>101</width>
<height>31</height>
</rect>
@ -2495,110 +2524,201 @@
<string>GenNewMac</string>
</property>
</widget>
<widget class="QPushButton" name="FactoryReset">
<widget class="QGroupBox" name="groupBox_21">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>FactoryReset</string>
</property>
</widget>
<widget class="QPushButton" name="Reboot">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Reboot</string>
</property>
</widget>
<widget class="QPushButton" name="ChangeNetCfg">
<property name="geometry">
<rect>
<x>20</x>
<y>140</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>ChangeNetCfg</string>
</property>
</widget>
<widget class="QLineEdit" name="ChangeNetCfg_ip">
<property name="geometry">
<rect>
<x>130</x>
<y>140</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>192.168.8.10</string>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="ChangeNetCfg_mask">
<property name="geometry">
<rect>
<x>250</x>
<y>140</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>255.255.255.0</string>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="ChangeNetCfg_gateway">
<property name="geometry">
<rect>
<x>370</x>
<y>140</y>
<width>111</width>
<height>31</height>
<y>20</y>
<width>441</width>
<height>311</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>192.168.8.1</string>
</property>
<property name="readOnly">
<bool>false</bool>
<property name="title">
<string>配置</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="NetworkConfig_storage">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>保存配置</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="NetworkConfigStaticIpMode_Ip">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QPushButton" name="FactoryReset">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>恢复出厂设置</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_60">
<property name="text">
<string>静态IP-网关</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="NetworkConfig_read">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>读取配置</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="NetworkConfigStaticIpMode_Gateway">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="Reboot">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>重启设备</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_61">
<property name="text">
<string>静态IP-子网掩码</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_59">
<property name="text">
<string>静态IP-IP</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="NetworkConfigStaticIpMode_Mask">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_62">
<property name="text">
<string>网络配置模式(0:static,1:dhcp)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="NetworkConfig_Mode">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>

Loading…
Cancel
Save