Skip to content

Commit 8df01a1

Browse files
author
Mich
committed
Added get boudRates to serial class, removed getPortsCount
1 parent 05c8e71 commit 8df01a1

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void MainWindow::setupGUI()
7979

8080
// ----------------------- standardBaudRates ----------------------- //
8181
{
82-
foreach (auto item, QSerialPortInfo::standardBaudRates())
82+
foreach (auto item, serial.getAvailibleBaudRates())
8383
ui->comboBoxBaudRates->addItem(QString::number(item));
8484

8585
ui->comboBoxBaudRates->setCurrentIndex(ui->comboBoxBaudRates->count() / 2); // select middle
@@ -1583,7 +1583,7 @@ void MainWindow::on_pushButtonSerialConnect_toggled(bool checked)
15831583
{
15841584
if (checked)
15851585
{
1586-
if (serial.getAvailiblePortsCount() < 1)
1586+
if (serial.getAvailiblePorts().count() < 1)
15871587
{
15881588
addLog("App >>\t No devices available", true);
15891589
addLog("App >>\t Unable to open serial port!", true);

src/mainwindow.ui

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@
219219
<rect>
220220
<x>0</x>
221221
<y>0</y>
222-
<width>563</width>
223-
<height>91</height>
222+
<width>698</width>
223+
<height>109</height>
224224
</rect>
225225
</property>
226226
<property name="sizePolicy">
@@ -734,8 +734,8 @@ p, li { white-space: pre-wrap; }
734734
<rect>
735735
<x>0</x>
736736
<y>0</y>
737-
<width>1200</width>
738-
<height>97</height>
737+
<width>1061</width>
738+
<height>115</height>
739739
</rect>
740740
</property>
741741
<layout class="QGridLayout" name="gridLayout_24">
@@ -1636,7 +1636,7 @@ p, li { white-space: pre-wrap; }
16361636
<enum>QTabWidget::Rounded</enum>
16371637
</property>
16381638
<property name="currentIndex">
1639-
<number>2</number>
1639+
<number>0</number>
16401640
</property>
16411641
<property name="elideMode">
16421642
<enum>Qt::ElideMiddle</enum>
@@ -2487,7 +2487,7 @@ p, li { white-space: pre-wrap; }
24872487
<x>0</x>
24882488
<y>0</y>
24892489
<width>600</width>
2490-
<height>78</height>
2490+
<height>81</height>
24912491
</rect>
24922492
</property>
24932493
<property name="sizePolicy">
@@ -3273,7 +3273,7 @@ p, li { white-space: pre-wrap; }
32733273
<x>0</x>
32743274
<y>0</y>
32753275
<width>1797</width>
3276-
<height>22</height>
3276+
<height>23</height>
32773277
</rect>
32783278
</property>
32793279
<widget class="QMenu" name="menuFile">

src/serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ QList<QSerialPortInfo> Serial::getAvailiblePorts()
184184
return QSerialPortInfo::availablePorts();
185185
}
186186

187-
int Serial::getAvailiblePortsCount()
187+
QList<int> Serial::getAvailibleBaudRates()
188188
{
189-
return QSerialPortInfo::availablePorts().count();
189+
return QSerialPortInfo::standardBaudRates();
190190
}
191191

192192
bool Serial::begin(QString parsedPortName, int parsedBaudRate, int dataBits, int parity, int stopBits, int flowControl, bool dtrOn)

src/serial.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Serial : public QObject
3232
QString getString(bool clearBuffer = true);
3333
void clearAll(bool clearHardwareBuffers = false);
3434
void clearString();
35+
QList<int> getAvailibleBaudRates();
3536
signals:
3637

3738
public slots:

0 commit comments

Comments
 (0)