当前位置: 首页>>代码示例>>C++>>正文


C++ SerialPort::devNameEditable方法代码示例

本文整理汇总了C++中SerialPort::devNameEditable方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialPort::devNameEditable方法的具体用法?C++ SerialPort::devNameEditable怎么用?C++ SerialPort::devNameEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SerialPort的用法示例。


在下文中一共展示了SerialPort::devNameEditable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateDetailsUi

void ChooseConnectionDlg::updateDetailsUi(Connection * conn)
{
    updateEditText(ui->connectionNameEdit, conn->name());
    ui->actionRemoveConnection->setEnabled(conn->removable());
    ui->actionConnect->setEnabled(conn->state() == st_disconnected);
    ui->actionDisconnect->setEnabled(conn->state() == st_connected || conn->state() == st_connect_pending || conn->state() == st_disconnecting);
    ui->programmerSelection->setVisible(false);
    ui->persistNameButton->setVisible(conn->isNamePersistable());
    ui->persistNameButton->setEnabled(!conn->hasDefaultName());

    switch (conn->getType())
    {
    case CONNECTION_SERIAL_PORT:
        {
            SerialPort * sp = static_cast<SerialPort *>(conn);
            ui->settingsStack->setCurrentWidget(ui->serialPortPage);
            updateEditText(ui->spBaudRateEdit->lineEdit(), QString::number((int)sp->baudRate()));
            updateEditText(ui->spDeviceNameEdit, sp->deviceName());
            updateComboIndex(ui->spParity, (int)sp->parity());
            updateComboIndex(ui->spStopBits, (int)sp->stopBits());
            updateComboText(ui->spDataBits, QString::number(sp->dataBits()));
            ui->spDeviceNameEdit->setEnabled(sp->devNameEditable());
            ui->programmerSelection->setVisible(m_allowedConns & pct_port_programmable);
            setActiveProgBtn(sp->programmerType());
        }
        break;
    case CONNECTION_TCP_SOCKET:
        {
            TcpSocket * tc = static_cast<TcpSocket *>(conn);
            ui->settingsStack->setCurrentWidget(ui->tcpClientPage);
            updateEditText(ui->tcHostEdit, tc->host());
            ui->tcPortEdit->setValue(tc->port());
            ui->programmerSelection->setVisible(m_allowedConns & pct_port_programmable);
            setActiveProgBtn(tc->programmerType());
        }
        break;
    case CONNECTION_USB_ACM2:
        {
            UsbAcmConnection2 * c = static_cast<UsbAcmConnection2 *>(conn);
            ui->settingsStack->setCurrentWidget(ui->usbAcmConnPage);

            updateComboText(ui->usbBaudRateEdit, QString::number((int)c->baudRate()));
            updateComboIndex(ui->usbParityCombo, (int)c->parity());
            updateComboIndex(ui->usbStopBitsCombo, (int)c->stopBits());
            updateComboText(ui->usbDataBitsCombo, QString::number(c->dataBits()));

            updateEditText(ui->usbVidEdit, QString("%1").arg(c->vid(), 4, 16, QChar('0')));
            updateEditText(ui->usbPidEdit, QString("%1").arg(c->pid(), 4, 16, QChar('0')));
            updateEditText(ui->usbAcmSnEdit, c->serialNumber());
            updateEditText(ui->usbIntfNameEdit, c->intfName());

            bool editable = !c->enumerated() && (c->state() == st_disconnected || c->state() == st_missing);
            ui->usbVidEdit->setEnabled(editable);
            ui->usbPidEdit->setEnabled(editable);
            ui->usbAcmSnEdit->setEnabled(editable);
            ui->usbIntfNameEdit->setEnabled(editable);

            ui->programmerSelection->setVisible(m_allowedConns & pct_port_programmable);
            setActiveProgBtn(c->programmerType());
        }
        break;
    case CONNECTION_USB_SHUPITO:
    case CONNECTION_SHUPITO23:
        {
            ShupitoConnection * c = static_cast<ShupitoConnection *>(conn);
            ShupitoFirmwareDetails fd;
            if (c->getFirmwareDetails(fd))
            {
                ui->shupito23HardwareLabel->setText(QString("%1.%2").arg(fd.hw_major).arg(fd.hw_minor));
                ui->shupito23FirmwareLabel->setText(fd.firmwareFilename());
                ui->settingsStack->setCurrentWidget(ui->shupito23Page);
            }
            else
            {
                ui->settingsStack->setCurrentWidget(ui->noSettingsPage);
            }
        }
        break;
    case CONNECTION_SHUPITO_TUNNEL:
        {
            ShupitoTunnel * st = static_cast<ShupitoTunnel *>(conn);
            ui->programmerSelection->setVisible(m_allowedConns & pct_port_programmable);
            setActiveProgBtn(st->programmerType());

            ui->settingsStack->setCurrentWidget(ui->noSettingsPage);
        }
        break;
    default:
        {
            ui->settingsStack->setCurrentWidget(ui->noSettingsPage);
        }
        break;
    }
}
开发者ID:onenonlycasper,项目名称:Lorris,代码行数:94,代码来源:chooseconnectiondlg.cpp


注:本文中的SerialPort::devNameEditable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。