mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04:00
Populate serial port lists with available actual devices
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4976 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
fc22351e02
commit
531c3753a1
@ -805,7 +805,7 @@ set_target_properties (wsjtx PROPERTIES
|
||||
)
|
||||
|
||||
target_link_libraries (wsjtx wsjt_fort wsjt_cxx wsjt_qt ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
|
||||
qt5_use_modules (wsjtx Widgets OpenGL Network Multimedia)
|
||||
qt5_use_modules (wsjtx Widgets OpenGL Network Multimedia SerialPort)
|
||||
|
||||
set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
if (WIN32)
|
||||
|
@ -154,6 +154,7 @@
|
||||
#include <QFont>
|
||||
#include <QFontDialog>
|
||||
#include <QColorDialog>
|
||||
#include <QSerialPortInfo>
|
||||
#include <QDebug>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
@ -2375,38 +2376,15 @@ void Configuration::impl::enumerate_rigs ()
|
||||
void Configuration::impl::fill_port_combo_box (QComboBox * cb)
|
||||
{
|
||||
auto current_text = cb->currentText ();
|
||||
|
||||
cb->clear ();
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
for (int i {1}; i < 100; ++i)
|
||||
Q_FOREACH (auto const& p, QSerialPortInfo::availablePorts ())
|
||||
{
|
||||
auto item = "COM" + QString::number (i);
|
||||
cb->addItem (item);
|
||||
if (!p.isBusy ())
|
||||
{
|
||||
cb->addItem (p.portName ());
|
||||
}
|
||||
}
|
||||
cb->addItem("USB");
|
||||
|
||||
#else
|
||||
|
||||
QStringList ports = {
|
||||
"/dev/ttyS0"
|
||||
, "/dev/ttyS1"
|
||||
, "/dev/ttyS2"
|
||||
, "/dev/ttyS3"
|
||||
, "/dev/ttyS4"
|
||||
, "/dev/ttyS5"
|
||||
, "/dev/ttyS6"
|
||||
, "/dev/ttyS7"
|
||||
, "/dev/ttyUSB0"
|
||||
, "/dev/ttyUSB1"
|
||||
, "/dev/ttyUSB2"
|
||||
, "/dev/ttyUSB3"
|
||||
};
|
||||
cb->addItems (ports);
|
||||
|
||||
#endif
|
||||
|
||||
cb->setEditText (current_text);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user