Changeset - 196054fd9816
[Not reviewed]
default
0 1 0
Hasan Yavuz ÖZDERYA - 8 years ago 2017-08-27 13:41:17
hy@ozderya.net
don't show usb icon for "tty" ports even if they have a VID&PID defined
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/portlist.cpp
Show inline comments
 
/*
 
  Copyright © 2016 Hasan Yavuz Özderya
 
  Copyright © 2017 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
  serialplot is free software: you can redistribute it and/or modify
 
  it under the terms of the GNU General Public License as published by
 
  the Free Software Foundation, either version 3 of the License, or
 
  (at your option) any later version.
 

	
 
  serialplot is distributed in the hope that it will be useful,
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  GNU General Public License for more details.
 
@@ -41,25 +41,26 @@ PortListItem::PortListItem(QSerialPortIn
 
    {
 
        construct(portInfo->portName());
 
    }
 
}
 

	
 
void PortListItem::construct(QString name, QString description, quint16 vid, quint16 pid)
 
{
 
    QString text = name;
 
    if (!description.isEmpty())
 
    {
 
        text += QString(" ") + description;
 
    }
 
    if (vid && pid)
 
    // Note: in some cases internal ports or RS232 ports may have VID&PID
 
    if (vid && pid && !name.contains("tty"))
 
    {
 
        text += QString("[%1:").arg(vid, 4, 16, QChar('0'));
 
        text += QString("%1]").arg(pid, 4, 16, QChar('0'));
 
        setIcon(QIcon(":/usb_icon.png"));
 
    }
 
    else if (name.contains("rfcomm"))
 
    {
 
        setIcon(QIcon(":/bluetooth_icon.png"));
 
    }
 
    else
 
    {
 
        setIcon(QIcon(":/rs232_icon.png"));
0 comments (0 inline, 0 general)