Changeset - 1d9b6c31956c
[Not reviewed]
portlist
0 2 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-09-05 03:41:17
hy@ozderya.net
removed keepPortName, its functionality is now provided by PortList
2 files changed with 0 insertions and 27 deletions:
0 comments (0 inline, 0 general)
portcontrol.cpp
Show inline comments
 
@@ -63,16 +63,12 @@ PortControl::PortControl(QSerialPort* po
 
    // TODO: port name coming from combobox is dirty, create a separate layer of signals
 
    //       that will sanitize this information
 
    QObject::connect(ui->cbPortList,
 
                     SELECT<const QString&>::OVERLOAD_OF(&QComboBox::activated),
 
                     this, &PortControl::selectPort);
 

	
 
    QObject::connect(ui->cbPortList,
 
                     SELECT<const QString&>::OVERLOAD_OF(&QComboBox::activated),
 
                     this, &PortControl::onPortNameChanged);
 

	
 
    QObject::connect(ui->cbBaudRate,
 
                     SELECT<const QString&>::OVERLOAD_OF(&QComboBox::activated),
 
                     this, &PortControl::selectBaudRate);
 

	
 
    // setup parity selection buttons
 
    parityButtons.addButton(ui->rbNoParity, (int) QSerialPort::NoParity);
 
@@ -276,30 +272,12 @@ void PortControl::selectPort(QString por
 

	
 
void PortControl::enableSkipByte(bool enabled)
 
{
 
    ui->pbSkipByte->setDisabled(enabled);
 
}
 

	
 
void PortControl::keepPortName(QString portName)
 
{
 
    if(!discoveredPorts.contains(portName) &&
 
       !userEnteredPorts.contains(portName))
 
    {
 
        userEnteredPorts << portName;
 
    }
 
    if(ui->cbPortList->findText(portName) < 0)
 
    {
 
        ui->cbPortList->addItem(portName);
 
    }
 
}
 

	
 
void PortControl::onPortNameChanged(QString portName)
 
{
 
    keepPortName(portName);
 
}
 

	
 
QToolBar* PortControl::toolBar()
 
{
 
    return &portToolBar;
 
}
 

	
 
void PortControl::openActionTriggered(bool checked)
portcontrol.h
Show inline comments
 
@@ -56,16 +56,12 @@ private:
 

	
 
    QToolBar portToolBar;
 
    QAction openAction;
 
    QComboBox tbPortList;
 
    PortList portList;
 

	
 
    QStringList discoveredPorts; // list of port names returned by availablePorts
 
    QStringList userEnteredPorts; // list of port names entered by user
 
    void keepPortName(QString portName); // if it's not already in userEn. or discv. list
 

	
 
public slots:
 
    void loadPortList();
 
    void loadBaudRateList();
 
    void togglePort();
 
    void selectPort(QString portName);
 
    void enableSkipByte(bool enabled = true);
 
@@ -74,13 +70,12 @@ public slots:
 
    void selectParity(int parity); // parity must be one of QSerialPort::Parity
 
    void selectDataBits(int dataBits); // bits must be one of QSerialPort::DataBits
 
    void selectStopBits(int stopBits); // stopBits must be one of QSerialPort::StopBits
 
    void selectFlowControl(int flowControl); // flowControl must be one of QSerialPort::FlowControl
 

	
 
private slots:
 
    void onPortNameChanged(QString portName);
 
    void openActionTriggered(bool checked);
 

	
 
    void onCbPortListActivated(int index);
 
    void onTbPortListActivated(int index);
 

	
 
signals:
0 comments (0 inline, 0 general)