forked from qt-creator/qt-creator
SerialTerminal: Save and restore selected port name
+ Populate serial ports on startup. Change-Id: Ie7216bb09ba1ffbb0036019cb4974a14119fc55f Reviewed-by: Benjamin Balga <balga.benjamin@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
fc5caf3e0f
commit
08b38cff4c
@@ -381,7 +381,8 @@ void SerialOutputPane::createToolButtons()
|
||||
m_portsSelection = new ComboBox;
|
||||
m_portsSelection->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
m_portsSelection->setModel(m_devicesModel);
|
||||
connect(m_portsSelection, &ComboBox::opened, m_devicesModel, &SerialDeviceModel::update);
|
||||
updatePortsList();
|
||||
connect(m_portsSelection, &ComboBox::opened, this, &SerialOutputPane::updatePortsList);
|
||||
connect(m_portsSelection, static_cast<void (ComboBox::*)(int)>(&ComboBox::currentIndexChanged),
|
||||
this, &SerialOutputPane::activePortNameChanged);
|
||||
// TODO: the ports are not updated with the box opened (if the user wait for it) -> add a timer?
|
||||
@@ -409,6 +410,12 @@ void SerialOutputPane::updateLineEndingsComboBox()
|
||||
m_lineEndingsSelection->setCurrentIndex(m_settings.defaultLineEndingIndex);
|
||||
}
|
||||
|
||||
void SerialOutputPane::updatePortsList()
|
||||
{
|
||||
m_devicesModel->update();
|
||||
m_portsSelection->setCurrentIndex(m_devicesModel->indexForPort(m_settings.portName));
|
||||
}
|
||||
|
||||
int SerialOutputPane::indexOf(const SerialControl *rc) const
|
||||
{
|
||||
return Utils::indexOf(m_serialControlTabs, [rc](const SerialControlTab &tab) {
|
||||
@@ -618,6 +625,8 @@ void SerialOutputPane::activePortNameChanged(int index)
|
||||
|
||||
// Update current port name
|
||||
m_currentPortName = pn;
|
||||
m_settings.setPortName(pn);
|
||||
emit settingsChanged(m_settings);
|
||||
}
|
||||
|
||||
void SerialOutputPane::activeBaudRateChanged(int index)
|
||||
|
||||
Reference in New Issue
Block a user