kopia lustrzana https://gitlab.com/eliggett/wfview
Added serial port drop-down population code. Untested.
rodzic
5a611f5c94
commit
ce6cc451b9
56
wfmain.cpp
56
wfmain.cpp
|
@ -312,6 +312,18 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
|
|||
periodicPollingTimer->setSingleShot(false);
|
||||
connect(periodicPollingTimer, SIGNAL(timeout()), this, SLOT(runPeriodicCommands()));
|
||||
|
||||
|
||||
ui->serialDeviceListCombo->blockSignals(true);
|
||||
ui->serialDeviceListCombo->addItem("Auto", 0);
|
||||
int i=0;
|
||||
foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
portList.append(serialPortInfo.portName());
|
||||
ui->serialDeviceListCombo->addItem(serialPortInfo.portName(), i++);
|
||||
}
|
||||
ui->serialDeviceListCombo->addItem("Manual...", 256);
|
||||
ui->serialDeviceListCombo->blockSignals(false);
|
||||
|
||||
openRig();
|
||||
|
||||
qRegisterMetaType<rigCapabilities>();
|
||||
|
@ -479,14 +491,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
|
|||
freqLock = false;
|
||||
|
||||
|
||||
// Not needed since we automate this now.
|
||||
/*
|
||||
foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
portList.append(serialPortInfo.portName());
|
||||
// ui->commPortDrop->addItem(serialPortInfo.portName());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
|
@ -3464,6 +3468,41 @@ void wfmain::on_tuneLockChk_clicked(bool checked)
|
|||
freqLock = checked;
|
||||
}
|
||||
|
||||
void wfmain::on_serialDeviceListCombo_activated(const QString &arg1)
|
||||
{
|
||||
QString manualPort;
|
||||
bool ok;
|
||||
if(arg1==QString("Manual..."))
|
||||
{
|
||||
manualPort = QInputDialog::getText(this, tr("Manual port assignment"),
|
||||
tr("Enter serial port assignment:"),
|
||||
QLineEdit::Normal,
|
||||
tr("/dev/device"), &ok);
|
||||
if(manualPort.isEmpty() || !ok)
|
||||
{
|
||||
ui->serialDeviceListCombo->blockSignals(true);
|
||||
ui->serialDeviceListCombo->setCurrentIndex(0);
|
||||
ui->serialDeviceListCombo->blockSignals(false);
|
||||
return;
|
||||
} else {
|
||||
prefs.serialPortRadio = manualPort;
|
||||
showStatusBarText("Setting preferences to use manually-assigned serial port: " + manualPort);
|
||||
ui->serialEnableBtn->setChecked(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(arg1==QString("Auto"))
|
||||
{
|
||||
prefs.serialPortRadio = "Auto";
|
||||
showStatusBarText("Setting preferences to automatically find rig serial port.");
|
||||
ui->serialEnableBtn->setChecked(true);
|
||||
return;
|
||||
}
|
||||
|
||||
prefs.serialPortRadio = arg1;
|
||||
showStatusBarText("Setting preferences to use manually-assigned serial port: " + arg1);
|
||||
ui->serialEnableBtn->setChecked(true);
|
||||
}
|
||||
|
||||
// --- DEBUG FUNCTION ---
|
||||
void wfmain::on_debugBtn_clicked()
|
||||
|
@ -3483,4 +3522,3 @@ void wfmain::on_debugBtn_clicked()
|
|||
emit getScopeMode();
|
||||
|
||||
}
|
||||
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -377,6 +377,8 @@ private slots:
|
|||
|
||||
void on_tuningStepCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_serialDeviceListCombo_activated(const QString &arg1);
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
QSettings settings;
|
||||
|
|
10
wfmain.ui
10
wfmain.ui
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mainTab">
|
||||
<attribute name="title">
|
||||
|
@ -1643,7 +1643,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="serialDeviceListCombo"/>
|
||||
<widget class="QComboBox" name="serialDeviceListCombo">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Select a serial port here. </p><p><br/></p><p>Once selected, check &quot;Enable USB(serial), press &quot;Save Settings&quot;, exit, and re-start wfview. </p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="tuneSpacer">
|
||||
|
@ -2000,7 +2004,7 @@
|
|||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="radioConnectionSerialNetworkGrp"/>
|
||||
<buttongroup name="duplexBtnGrp"/>
|
||||
<buttongroup name="radioConnectionSerialNetworkGrp"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
Ładowanie…
Reference in New Issue