Revert "Integrate server setup into new settings pages"

This reverts commit e1cdcad65b.
merge-requests/9/head
Roeland Jansen 2022-01-12 19:18:50 +01:00
rodzic 54d08c5b8a
commit d1d0194600
7 zmienionych plików z 276 dodań i 565 usunięć

Wyświetl plik

@ -19,6 +19,7 @@
#include <QDebug>
#include <udpserversetup.h>
#include "packettypes.h"
#include "rigidentities.h"
#include "audiohandler.h"
@ -33,28 +34,6 @@ struct SEQBUFENTRY {
quint8 retransmitCount;
};
struct SERVERUSER {
QString username;
QString password;
quint8 userType;
};
struct SERVERCONFIG {
bool enabled;
bool lan;
quint16 controlPort;
quint16 civPort;
quint16 audioPort;
int audioOutput;
int audioInput;
quint8 resampleQuality;
quint32 baudRate;
QList <SERVERUSER> users;
};
class udpServer : public QObject
{
Q_OBJECT

127
udpserversetup.cpp 100644
Wyświetl plik

@ -0,0 +1,127 @@
#include "udpserversetup.h"
#include "ui_udpserversetup.h"
#include "logcategories.h"
extern void passcode(QString in,QByteArray& out);
udpServerSetup::udpServerSetup(QWidget* parent) :
QDialog(parent),
ui(new Ui::udpServerSetup)
{
ui->setupUi(this);
addUserLine("", "", 0); // Create a blank row if we never receive config.
// Get any stored config information from the main form.
SERVERCONFIG config;
emit serverConfig(config,false); // Just send blank server config.
}
udpServerSetup::~udpServerSetup()
{
delete ui;
}
// Slot to receive config.
void udpServerSetup::receiveServerConfig(SERVERCONFIG conf)
{
qInfo() << "Getting server config";
ui->enableCheckbox->setChecked(conf.enabled);
ui->controlPortText->setText(QString::number(conf.controlPort));
ui->civPortText->setText(QString::number(conf.civPort));
ui->audioPortText->setText(QString::number(conf.audioPort));
int row = 0;
for (int i = 0; i < ui->usersTable->rowCount(); i++)
{
ui->usersTable->removeRow(i);
}
foreach (SERVERUSER user, conf.users)
{
if (user.username != "" && user.password != "")
{
addUserLine(user.username, user.password, user.userType);
row++;
}
}
if (row == 0) {
addUserLine("", "", 0);
}
}
void udpServerSetup::accept()
{
qInfo() << "Server config stored";
SERVERCONFIG config;
config.enabled = ui->enableCheckbox->isChecked();
config.controlPort = ui->controlPortText->text().toInt();
config.civPort = ui->civPortText->text().toInt();
config.audioPort = ui->audioPortText->text().toInt();
config.users.clear();
for (int row = 0; row < ui->usersTable->model()->rowCount(); row++)
{
if (ui->usersTable->item(row, 0) != NULL)
{
SERVERUSER user;
user.username = ui->usersTable->item(row, 0)->text();
QLineEdit* password = (QLineEdit*)ui->usersTable->cellWidget(row, 1);
user.password = password->text();
QComboBox* comboBox = (QComboBox*)ui->usersTable->cellWidget(row, 2);
user.userType = comboBox->currentIndex();
config.users.append(user);
}
else {
ui->usersTable->removeRow(row);
}
}
emit serverConfig(config,true);
this->hide();
}
void udpServerSetup::on_usersTable_cellClicked(int row, int col)
{
qInfo() << "Clicked on " << row << "," << col;
if (row == ui->usersTable->model()->rowCount() - 1 && ui->usersTable->item(row, 0) != NULL) {
addUserLine("", "", 0);
}
}
void udpServerSetup::onPasswordChanged()
{
int row = sender()->property("row").toInt();
QLineEdit* password = (QLineEdit*)ui->usersTable->cellWidget(row, 1);
QByteArray pass;
passcode(password->text(), pass);
password->setText(pass);
qInfo() << "password row" << row << "changed";
}
void udpServerSetup::addUserLine(const QString& user, const QString& pass, const int& type)
{
ui->usersTable->insertRow(ui->usersTable->rowCount());
ui->usersTable->setItem(ui->usersTable->rowCount() - 1, 0, new QTableWidgetItem(user));
ui->usersTable->setItem(ui->usersTable->rowCount() - 1, 1, new QTableWidgetItem());
ui->usersTable->setItem(ui->usersTable->rowCount() - 1, 2, new QTableWidgetItem());
QLineEdit* password = new QLineEdit();
password->setProperty("row", (int)ui->usersTable->rowCount() - 1);
password->setEchoMode(QLineEdit::PasswordEchoOnEdit);
password->setText(pass);
connect(password, SIGNAL(editingFinished()), this, SLOT(onPasswordChanged()));
ui->usersTable->setCellWidget(ui->usersTable->rowCount() - 1, 1, password);
QComboBox* comboBox = new QComboBox();
comboBox->insertItems(0, { "Full User","Full with no TX","Monitor only" });
comboBox->setCurrentIndex(type);
ui->usersTable->setCellWidget(ui->usersTable->rowCount() - 1, 2, comboBox);
}

60
udpserversetup.h 100644
Wyświetl plik

@ -0,0 +1,60 @@
#ifndef UDPSERVERSETUP_H
#define UDPSERVERSETUP_H
#include <QDialog>
#include <QComboBox>
#include <QList>
#include <QDebug>
struct SERVERUSER {
QString username;
QString password;
quint8 userType;
};
struct SERVERCONFIG {
bool enabled;
bool lan;
quint16 controlPort;
quint16 civPort;
quint16 audioPort;
int audioOutput;
int audioInput;
quint8 resampleQuality;
quint32 baudRate;
QList <SERVERUSER> users;
};
namespace Ui {
class udpServerSetup;
}
class udpServerSetup : public QDialog
{
Q_OBJECT
public:
explicit udpServerSetup(QWidget* parent = 0);
~udpServerSetup();
private slots:
void on_usersTable_cellClicked(int row, int col);
void onPasswordChanged();
public slots:
void receiveServerConfig(SERVERCONFIG conf);
signals:
void serverConfig(SERVERCONFIG conf, bool store);
private:
Ui::udpServerSetup* ui;
void accept();
QList<QComboBox*> userTypes;
void addUserLine(const QString &user, const QString &pass, const int &type);
};
#endif // UDPSERVER_H

Wyświetl plik

@ -27,8 +27,12 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
rpt = new repeaterSetup();
sat = new satelliteSetup();
trxadj = new transceiverAdjustments();
srv = new udpServerSetup();
abtBox = new aboutbox();
connect(this, SIGNAL(sendServerConfig(SERVERCONFIG)), srv, SLOT(receiveServerConfig(SERVERCONFIG)));
connect(srv, SIGNAL(serverConfig(SERVERCONFIG, bool)), this, SLOT(serverConfigRequested(SERVERCONFIG, bool)));
qRegisterMetaType<udpPreferences>(); // Needs to be registered early.
qRegisterMetaType<rigCapabilities>();
qRegisterMetaType<duplexMode>();
@ -952,11 +956,10 @@ void wfmain::setServerToPrefs()
{
// Start server if enabled in config
ui->serverSetupGroup->setEnabled(serverConfig.enabled);
if (serverConfig.enabled) {
serverConfig.lan = prefs.enableLAN;
udp = new udpServer(serverConfig,serverTxSetup,serverRxSetup);
udp = new udpServer(serverConfig,rxSetup,txSetup);
serverThread = new QThread(this);
@ -1058,12 +1061,10 @@ void wfmain::setAudioDevicesUI()
if (info.outputChannels > 0) {
qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name);
ui->audioOutputCombo->addItem(QString::fromStdString(info.name), i);
ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name), i);
}
if (info.inputChannels > 0) {
qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name);
ui->audioInputCombo->addItem(QString::fromStdString(info.name), i);
ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name), i);
}
}
@ -1094,13 +1095,11 @@ void wfmain::setAudioDevicesUI()
if (info->maxInputChannels > 0) {
qInfo(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << info->name;
ui->audioInputCombo->addItem(info->name, i);
ui->serverRXAudioInputCombo->addItem(info->name, i);
}
if (info->maxOutputChannels > 0) {
qInfo(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << info->name;
ui->audioOutputCombo->addItem(info->name, i);
ui->serverTXAudioOutputCombo->addItem(info->name, i);
}
}
}
#else
@ -1109,19 +1108,15 @@ void wfmain::setAudioDevicesUI()
const auto audioOutputs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
for (const QAudioDeviceInfo& deviceInfo : audioOutputs) {
ui->audioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
}
const auto audioInputs = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for (const QAudioDeviceInfo& deviceInfo : audioInputs) {
ui->audioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
}
// Set these to default audio devices initially.
rxSetup.port = QAudioDeviceInfo::defaultOutputDevice();
txSetup.port = QAudioDeviceInfo::defaultInputDevice();
serverRxSetup.port = QAudioDeviceInfo::defaultOutputDevice();
serverTxSetup.port = QAudioDeviceInfo::defaultInputDevice();
#endif
}
@ -1349,7 +1344,7 @@ void wfmain::loadSettings()
prefs.drawPeaks = settings->value("DrawPeaks", defPrefs.drawPeaks).toBool();
prefs.wfAntiAlias = settings->value("WFAntiAlias", defPrefs.wfAntiAlias).toBool();
prefs.wfInterpolate = settings->value("WFInterpolate", defPrefs.wfInterpolate).toBool();
prefs.wflength = (unsigned int)settings->value("WFLength", defPrefs.wflength).toInt();
prefs.wflength = (unsigned int) settings->value("WFLength", defPrefs.wflength).toInt();
prefs.stylesheetPath = settings->value("StylesheetPath", defPrefs.stylesheetPath).toString();
ui->splitter->restoreState(settings->value("splitter").toByteArray());
@ -1397,16 +1392,15 @@ void wfmain::loadSettings()
// Radio and Comms: C-IV addr, port to use
settings->beginGroup("Radio");
prefs.radioCIVAddr = (unsigned char)settings->value("RigCIVuInt", defPrefs.radioCIVAddr).toInt();
if (prefs.radioCIVAddr != 0)
prefs.radioCIVAddr = (unsigned char) settings->value("RigCIVuInt", defPrefs.radioCIVAddr).toInt();
if(prefs.radioCIVAddr!=0)
{
ui->rigCIVManualAddrChk->setChecked(true);
ui->rigCIVaddrHexLine->blockSignals(true);
ui->rigCIVaddrHexLine->setText(QString("%1").arg(prefs.radioCIVAddr, 2, 16));
ui->rigCIVaddrHexLine->setEnabled(true);
ui->rigCIVaddrHexLine->blockSignals(false);
}
else {
} else {
ui->rigCIVManualAddrChk->setChecked(false);
ui->rigCIVaddrHexLine->setEnabled(false);
}
@ -1419,9 +1413,9 @@ void wfmain::loadSettings()
ui->serialDeviceListCombo->setCurrentIndex(serialIndex);
}
prefs.serialPortBaud = (quint32)settings->value("SerialPortBaud", defPrefs.serialPortBaud).toInt();
prefs.serialPortBaud = (quint32) settings->value("SerialPortBaud", defPrefs.serialPortBaud).toInt();
ui->baudRateCombo->blockSignals(true);
ui->baudRateCombo->setCurrentIndex(ui->baudRateCombo->findData(prefs.serialPortBaud));
ui->baudRateCombo->setCurrentIndex( ui->baudRateCombo->findData(prefs.serialPortBaud) );
ui->baudRateCombo->blockSignals(false);
if (prefs.serialPortBaud > 0)
@ -1437,10 +1431,10 @@ void wfmain::loadSettings()
else
{
ui->vspCombo->addItem(prefs.virtualSerialPort);
ui->vspCombo->setCurrentIndex(ui->vspCombo->count() - 1);
ui->vspCombo->setCurrentIndex(ui->vspCombo->count()-1);
}
prefs.localAFgain = (unsigned char)settings->value("localAFgain", defPrefs.localAFgain).toUInt();
prefs.localAFgain = (unsigned char) settings->value("localAFgain", defPrefs.localAFgain).toUInt();
rxSetup.localAFgain = prefs.localAFgain;
settings->endGroup();
@ -1454,14 +1448,15 @@ void wfmain::loadSettings()
settings->beginGroup("LAN");
prefs.enableLAN = settings->value("EnableLAN", defPrefs.enableLAN).toBool();
if (prefs.enableLAN)
if(prefs.enableLAN)
{
ui->baudRateCombo->setEnabled(false);
ui->serialDeviceListCombo->setEnabled(false);
}
else {
//ui->udpServerSetupBtn->setEnabled(false);
} else {
ui->baudRateCombo->setEnabled(true);
ui->serialDeviceListCombo->setEnabled(true);
//ui->udpServerSetupBtn->setEnabled(true);
}
ui->lanEnableBtn->setChecked(prefs.enableLAN);
@ -1477,15 +1472,15 @@ void wfmain::loadSettings()
udpPrefs.ipAddress = settings->value("IPAddress", udpDefPrefs.ipAddress).toString();
ui->ipAddressTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->ipAddressTxt->setText(udpPrefs.ipAddress);
udpPrefs.controlLANPort = settings->value("ControlLANPort", udpDefPrefs.controlLANPort).toInt();
ui->controlPortTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->controlPortTxt->setText(QString("%1").arg(udpPrefs.controlLANPort));
udpPrefs.username = settings->value("Username", udpDefPrefs.username).toString();
ui->usernameTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->usernameTxt->setText(QString("%1").arg(udpPrefs.username));
udpPrefs.password = settings->value("Password", udpDefPrefs.password).toString();
ui->passwordTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->passwordTxt->setText(QString("%1").arg(udpPrefs.password));
@ -1601,72 +1596,6 @@ void wfmain::loadSettings()
serverConfig.users.append(user);
}
ui->serverEnableCheckbox->setChecked(serverConfig.enabled);
ui->serverControlPortText->setText(QString::number(serverConfig.controlPort));
ui->serverCivPortText->setText(QString::number(serverConfig.civPort));
ui->serverAudioPortText->setText(QString::number(serverConfig.audioPort));
serverRxSetup.isinput = true;
serverTxSetup.isinput = false;
ui->serverRXAudioInputCombo->blockSignals(true);
serverRxSetup.name = settings->value("ServerAudioInput", "").toString();
qInfo(logGui()) << "Got Server Audio Input: " << serverRxSetup.name;
int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverRxSetup.name);
if (serverAudioInputIndex != -1) {
ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex);
#if defined(RTAUDIO)
serverRxSetup.port = ui->serverRXAudioInputCombo->itemData(serverAudioInputIndex).toInt();
#elif defined(PORTAUDIO)
serverRxSetup.port = ui->audioOutputCombo->itemData(serverAudioInputIndex).toInt();
#else
QVariant v = ui->serverRXAudioInputCombo->currentData();
serverRxSetup.port = v.value<QAudioDeviceInfo>();
#endif
}
ui->serverRXAudioInputCombo->blockSignals(false);
serverRxSetup.resampleQuality = settings->value("ResampleQuality", "4").toInt();
serverRxSetup.resampleQuality = rxSetup.resampleQuality;
ui->serverTXAudioOutputCombo->blockSignals(true);
serverTxSetup.name = settings->value("ServerAudioOutput", "").toString();
qInfo(logGui()) << "Got Server Audio Output: " << serverTxSetup.name;
int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverTxSetup.name);
if (serverAudioOutputIndex != -1) {
ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex);
#if defined(RTAUDIO)
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(serverAudioOutputIndex).toInt();
#elif defined(PORTAUDIO)
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(serverAudioOutputIndex).toInt();
#else
QVariant v = ui->serverTXAudioOutputCombo->currentData();
serverRxSetup.port = v.value<QAudioDeviceInfo>();
#endif
}
ui->serverTXAudioOutputCombo->blockSignals(false);
serverTxSetup.resampleQuality = settings->value("ResampleQuality", "4").toInt();
serverTxSetup.resampleQuality = rxSetup.resampleQuality;
int row = 0;
ui->serverUsersTable->setRowCount(0);
foreach(SERVERUSER user, serverConfig.users)
{
if (user.username != "" && user.password != "")
{
serverAddUserLine(user.username, user.password, user.userType);
row++;
}
}
if (row == 0) {
serverAddUserLine("", "", 0);
}
settings->endGroup();
// Memory channels
@ -1686,7 +1615,7 @@ void wfmain::loadSettings()
// Also annoying that the preference groups are not written in
// the order they are specified here.
for (int i = 0; i < size; i++)
for(int i=0; i < size; i++)
{
settings->setArrayIndex(i);
chan = settings->value("chan", 0).toInt();
@ -1694,7 +1623,7 @@ void wfmain::loadSettings()
mode = settings->value("mode", 0).toInt();
isSet = settings->value("isSet", false).toBool();
if (isSet)
if(isSet)
{
mem.setPreset(chan, freq, (mode_kind)mode);
}
@ -1703,45 +1632,10 @@ void wfmain::loadSettings()
settings->endArray();
settings->endGroup();
emit sendServerConfig(serverConfig);
}
void wfmain::serverAddUserLine(const QString& user, const QString& pass, const int& type)
{
ui->serverUsersTable->insertRow(ui->serverUsersTable->rowCount());
ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 0, new QTableWidgetItem(user));
ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 1, new QTableWidgetItem());
ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 2, new QTableWidgetItem());
QLineEdit* password = new QLineEdit();
password->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1);
password->setEchoMode(QLineEdit::PasswordEchoOnEdit);
password->setText(pass);
connect(password, SIGNAL(editingFinished()), this, SLOT(onServerPasswordChanged()));
ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 1, password);
QComboBox* comboBox = new QComboBox();
comboBox->insertItems(0, { "Full User","Full with no TX","Monitor only" });
comboBox->setCurrentIndex(type);
ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 2, comboBox);
}
void wfmain::onServerPasswordChanged()
{
int row = sender()->property("row").toInt();
QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(row, 1);
QByteArray pass;
passcode(password->text(), pass);
password->setText(pass);
qInfo() << "password row" << row << "changed";
}
void wfmain::on_serverUsersTable_cellClicked(int row, int col)
{
qInfo() << "Clicked on " << row << "," << col;
if (row == ui->serverUsersTable->model()->rowCount() - 1 && ui->serverUsersTable->item(row, 0) != NULL) {
serverAddUserLine("", "", 0);
}
}
void wfmain::saveSettings()
@ -1872,37 +1766,11 @@ void wfmain::saveSettings()
settings->beginGroup("Server");
serverConfig.controlPort = ui->serverControlPortText->text().toInt();
serverConfig.civPort = ui->serverCivPortText->text().toInt();
serverConfig.audioPort = ui->serverAudioPortText->text().toInt();
settings->setValue("ServerEnabled", serverConfig.enabled);
settings->setValue("ServerControlPort", serverConfig.controlPort);
settings->setValue("ServerCivPort", serverConfig.civPort);
settings->setValue("ServerAudioPort", serverConfig.audioPort);
settings->setValue("ServerNumUsers", serverConfig.users.count());
settings->setValue("ServerAudioOutput", serverTxSetup.name);
settings->setValue("ServerAudioInput", serverRxSetup.name);
serverConfig.users.clear();
for (int row = 0; row < ui->serverUsersTable->model()->rowCount(); row++)
{
if (ui->serverUsersTable->item(row, 0) != NULL)
{
SERVERUSER user;
user.username = ui->serverUsersTable->item(row, 0)->text();
QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(row, 1);
user.password = password->text();
QComboBox* comboBox = (QComboBox*)ui->serverUsersTable->cellWidget(row, 2);
user.userType = comboBox->currentIndex();
serverConfig.users.append(user);
}
else {
ui->serverUsersTable->removeRow(row);
}
}
for (int f = 0; f < serverConfig.users.count(); f++)
{
settings->setValue("ServerUsername_" + QString::number(f), serverConfig.users[f].username);
@ -1910,8 +1778,6 @@ void wfmain::saveSettings()
settings->setValue("ServerUserType_" + QString::number(f), serverConfig.users[f].userType);
}
qInfo() << "Server config stored";
settings->endGroup();
@ -4468,6 +4334,7 @@ void wfmain::on_serialEnableBtn_clicked(bool checked)
ui->audioInputCombo->setEnabled(!checked);
ui->baudRateCombo->setEnabled(checked);
ui->serialDeviceListCombo->setEnabled(checked);
//ui->udpServerSetupBtn->setEnabled(true);
}
void wfmain::on_lanEnableBtn_clicked(bool checked)
@ -4489,6 +4356,7 @@ void wfmain::on_lanEnableBtn_clicked(bool checked)
ui->audioInputCombo->setEnabled(checked);
ui->baudRateCombo->setEnabled(!checked);
ui->serialDeviceListCombo->setEnabled(!checked);
//ui->udpServerSetupBtn->setEnabled(false);
if(checked)
{
showStatusBarText("After filling in values, press Save Settings.");
@ -4543,35 +4411,6 @@ void wfmain::on_audioInputCombo_currentIndexChanged(int value)
qDebug(logGui()) << "Changed default audio input to:" << txSetup.name;
}
void wfmain::on_serverRXAudioInputCombo_currentIndexChanged(int value)
{
#if defined(RTAUDIO)
serverRxSetup.port = ui->serverRXaudioInputCombo->itemData(value).toInt();
#elif defined(PORTAUDIO)
serverRxSetup.port = ui->serverRXaudioInputCombo->itemData(value).toInt();
#else
QVariant v = ui->serverRXAudioInputCombo->itemData(value);
serverRxSetup.port = v.value<QAudioDeviceInfo>();
#endif
serverRxSetup.name = ui->serverRXAudioInputCombo->itemText(value);
qDebug(logGui()) << "Changed default server audio input to:" << serverRxSetup.name;
}
void wfmain::on_serverTXAudioOutputCombo_currentIndexChanged(int value)
{
#if defined(RTAUDIO)
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(value).toInt();
#elif defined(PORTAUDIO)
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(value).toInt();
#else
QVariant v = ui->serverTXAudioOutputCombo->itemData(value);
serverTxSetup.port = v.value<QAudioDeviceInfo>();
#endif
serverTxSetup.name = ui->serverTXAudioOutputCombo->itemText(value);
qDebug(logGui()) << "Changed default server audio output to:" << serverTxSetup.name;
}
void wfmain::on_audioSampleRateCombo_currentIndexChanged(QString text)
{
//udpPrefs.audioRXSampleRate = text.toInt();
@ -4634,6 +4473,10 @@ void wfmain::on_connectBtn_clicked()
}
}
void wfmain::on_udpServerSetupBtn_clicked()
{
srv->show();
}
void wfmain::on_sqlSlider_valueChanged(int value)
{
issueCmd(cmdSetSql, (unsigned char)value);
@ -4989,6 +4832,22 @@ void wfmain::receiveSpectrumRefLevel(int level)
changeSliderQuietly(ui->scopeRefLevelSlider, level);
}
// Slot to send/receive server config.
// If store is true then write to config otherwise send current config by signal
void wfmain::serverConfigRequested(SERVERCONFIG conf, bool store)
{
if (!store) {
emit sendServerConfig(serverConfig);
}
else {
// Store config in file!
qInfo(logSystem()) << "Storing server config";
serverConfig = conf;
}
}
void wfmain::on_modInputCombo_activated(int index)
{
emit setModInput( (rigInput)ui->modInputCombo->currentData().toInt(), false );
@ -5669,12 +5528,6 @@ void wfmain::on_setClockBtn_clicked()
setRadioTimeDatePrep();
}
void wfmain::on_serverEnableCheckbox_clicked(bool checked)
{
ui->serverSetupGroup->setEnabled(checked);
serverConfig.enabled = checked;
}
// --- DEBUG FUNCTION ---
void wfmain::on_debugBtn_clicked()
{

Wyświetl plik

@ -23,6 +23,7 @@
#include "repeatersetup.h"
#include "satellitesetup.h"
#include "transceiveradjustments.h"
#include "udpserversetup.h"
#include "udpserver.h"
#include "qledlabel.h"
#include "rigctld.h"
@ -162,6 +163,7 @@ signals:
void sendCloseComm();
void sendChangeLatency(quint16 latency);
void initServer();
void sendServerConfig(SERVERCONFIG conf);
void sendRigCaps(rigCapabilities caps);
void requestRigState();
void stateUpdated();
@ -266,6 +268,7 @@ private slots:
void handlePlotScroll(QWheelEvent *);
void sendRadioCommandLoop();
void showStatusBarText(QString text);
void serverConfigRequested(SERVERCONFIG conf, bool store);
void receiveBaudRate(quint32 baudrate);
void setRadioTimeDateSend();
@ -384,10 +387,6 @@ private slots:
void on_audioInputCombo_currentIndexChanged(int value);
void on_serverTXAudioOutputCombo_currentIndexChanged(int value);
void on_serverRXAudioInputCombo_currentIndexChanged(int value);
void on_toFixedBtn_clicked();
void on_connectBtn_clicked();
@ -412,6 +411,7 @@ private slots:
void on_dataModeBtn_toggled(bool checked);
void on_udpServerSetupBtn_clicked();
void on_transmitBtn_clicked();
@ -508,12 +508,6 @@ private slots:
void on_setClockBtn_clicked();
void on_serverEnableCheckbox_clicked(bool checked);
void on_serverUsersTable_cellClicked(int row, int col);
void onServerPasswordChanged();
private:
Ui::wfmain *ui;
void closeEvent(QCloseEvent *event);
@ -762,9 +756,6 @@ private:
audioSetup rxSetup;
audioSetup txSetup;
audioSetup serverRxSetup;
audioSetup serverTxSetup;
colors defaultColors;
void setDefaultColors(); // populate with default values
@ -833,6 +824,7 @@ private:
repeaterSetup *rpt;
satelliteSetup *sat;
transceiverAdjustments *trxadj;
udpServerSetup *srv;
aboutbox *abtBox;
@ -865,8 +857,6 @@ private:
rigstate* rigState = Q_NULLPTR;
SERVERCONFIG serverConfig;
void serverAddUserLine(const QString& user, const QString& pass, const int& type);
};
Q_DECLARE_METATYPE(struct rigCapabilities)

366
wfmain.ui
Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>940</width>
<width>948</width>
<height>554</height>
</rect>
</property>
@ -2066,7 +2066,7 @@
<item>
<widget class="QStackedWidget" name="settingsStack">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="radioAccess">
<layout class="QVBoxLayout" name="verticalLayout_21">
@ -3025,32 +3025,20 @@
</widget>
<widget class="QWidget" name="radioServer">
<layout class="QVBoxLayout" name="verticalLayout_27">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_35">
<layout class="QHBoxLayout" name="horizontalLayout_32">
<item>
<widget class="QCheckBox" name="serverEnableCheckbox">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
<widget class="QPushButton" name="udpServerSetupBtn">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Press here to set up the built-in rig server. The built-in server is intended to allow access over the network to a serial or USB-connected radio. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable</string>
<string>Server Setup</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_24">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -3065,323 +3053,35 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_41">
<layout class="QHBoxLayout" name="horizontalLayout_33">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="serverSetupGroup">
<property name="title">
<string>Server Setup</string>
<widget class="QLabel" name="label_26">
<property name="text">
<string>Audio Sources here</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_40">
<item>
<widget class="QLabel" name="label_38">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Contol Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="serverControlPortText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="inputMask">
<string>99999</string>
</property>
<property name="text">
<string>50001</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_25">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_37">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Civ Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="serverCivPortText">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="inputMask">
<string>99999</string>
</property>
<property name="text">
<string>50002</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_26">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_36">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Audio Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="serverAudioPortText">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="inputMask">
<string>99999</string>
</property>
<property name="text">
<string>50003</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_33">
<item>
<widget class="QLabel" name="label_33">
<property name="text">
<string>RX Audio Input</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="serverRXAudioInputCombo"/>
</item>
<item>
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_34">
<property name="text">
<string>TX Audio Output</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="serverTXAudioOutputCombo"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_7">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_32">
<item>
<widget class="QTableWidget" name="serverUsersTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>160</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>750</width>
<height>330</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Username</string>
</property>
</column>
<column>
<property name="text">
<string>Password</string>
</property>
</column>
<column>
<property name="text">
<string>Admin</string>
</property>
</column>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>320</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="externalControl">
@ -3647,8 +3347,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>940</width>
<height>21</height>
<width>948</width>
<height>22</height>
</rect>
</property>
</widget>

Wyświetl plik

@ -49,7 +49,7 @@ DEFINES += PREFIX=\\\"$$PREFIX\\\"
# Choose audio system, uses QTMultimedia if both are commented out.
# DEFINES += RTAUDIO
# DEFINES += PORTAUDIO
DEFINES += PORTAUDIO
contains(DEFINES, RTAUDIO) {
# RTAudio defines
@ -152,6 +152,7 @@ SOURCES += main.cpp\
audiohandler.cpp \
calibrationwindow.cpp \
satellitesetup.cpp \
udpserversetup.cpp \
udpserver.cpp \
meter.cpp \
qledlabel.cpp \
@ -173,6 +174,7 @@ HEADERS += wfmain.h \
audiohandler.h \
calibrationwindow.h \
satellitesetup.h \
udpserversetup.h \
udpserver.h \
packettypes.h \
meter.h \