diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2017-07-01 21:51:23 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2017-07-11 04:30:17 +0000 |
commit | fb284d4c2aa768fe06b8220144283e1a5ac01ae5 (patch) | |
tree | 9f0a13c94fafd0c24f07fe18eb2d95ef87706848 /examples/serialbus | |
parent | fee04e6eb05386f391207c36a0444a158d21d909 (diff) |
CAN-Example: Rename slots to describe their purpose better
Change-Id: Ic63e01635273704196b8fc6e4f00d6aff409f5ab
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/serialbus')
-rw-r--r-- | examples/serialbus/can/mainwindow.cpp | 19 | ||||
-rw-r--r-- | examples/serialbus/can/mainwindow.h | 8 |
2 files changed, 12 insertions, 15 deletions
diff --git a/examples/serialbus/can/mainwindow.cpp b/examples/serialbus/can/mainwindow.cpp index 7a8f78a..03e169c 100644 --- a/examples/serialbus/can/mainwindow.cpp +++ b/examples/serialbus/can/mainwindow.cpp @@ -77,7 +77,7 @@ void MainWindow::initActionsConnections() m_ui->actionDisconnect->setEnabled(false); m_ui->sendMessagesBox->setEnabled(false); - connect(m_ui->sendButton, &QPushButton::clicked, this, &MainWindow::sendMessage); + connect(m_ui->sendButton, &QPushButton::clicked, this, &MainWindow::sendFrame); connect(m_ui->actionConnect, &QAction::triggered, m_connectDialog, &ConnectDialog::show); connect(m_connectDialog, &QDialog::accepted, this, &MainWindow::connectDevice); connect(m_ui->actionDisconnect, &QAction::triggered, this, &MainWindow::disconnectDevice); @@ -89,7 +89,7 @@ void MainWindow::initActionsConnections() }); } -void MainWindow::receiveError(QCanBusDevice::CanBusError error) const +void MainWindow::processErrors(QCanBusDevice::CanBusError error) const { switch (error) { case QCanBusDevice::ReadError: @@ -116,12 +116,9 @@ void MainWindow::connectDevice() return; } - connect(m_canDevice, &QCanBusDevice::errorOccurred, - this, &MainWindow::receiveError); - connect(m_canDevice, &QCanBusDevice::framesReceived, - this, &MainWindow::checkMessages); - connect(m_canDevice, &QCanBusDevice::framesWritten, - this, &MainWindow::framesWritten); + connect(m_canDevice, &QCanBusDevice::errorOccurred, this, &MainWindow::processErrors); + connect(m_canDevice, &QCanBusDevice::framesReceived, this, &MainWindow::processReceivedFrames); + connect(m_canDevice, &QCanBusDevice::framesWritten, this, &MainWindow::processFramesWritten); if (p.useConfigurationEnabled) { for (const ConnectDialog::ConfigurationItem &item : p.configurations) @@ -168,7 +165,7 @@ void MainWindow::disconnectDevice() m_status->setText(tr("Disconnected")); } -void MainWindow::framesWritten(qint64 count) +void MainWindow::processFramesWritten(qint64 count) { qDebug() << "Number of frames written:" << count; } @@ -193,7 +190,7 @@ static QString frameFlags(const QCanBusFrame &frame) return result; } -void MainWindow::checkMessages() +void MainWindow::processReceivedFrames() { if (!m_canDevice) return; @@ -224,7 +221,7 @@ static QByteArray dataFromHex(const QString &hex) return QByteArray::fromHex(line); } -void MainWindow::sendMessage() const +void MainWindow::sendFrame() const { if (!m_canDevice) return; diff --git a/examples/serialbus/can/mainwindow.h b/examples/serialbus/can/mainwindow.h index 8cd53a9..a23fbae 100644 --- a/examples/serialbus/can/mainwindow.h +++ b/examples/serialbus/can/mainwindow.h @@ -67,12 +67,12 @@ public: ~MainWindow(); private slots: - void checkMessages(); - void sendMessage() const; - void receiveError(QCanBusDevice::CanBusError) const; + void processReceivedFrames(); + void sendFrame() const; + void processErrors(QCanBusDevice::CanBusError) const; void connectDevice(); void disconnectDevice(); - void framesWritten(qint64); + void processFramesWritten(qint64); protected: void closeEvent(QCloseEvent *event) override; |