From 8f7dc4a34b4c212e378a66e28ab94185599f6972 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Fri, 6 May 2016 14:48:05 -0400 Subject: [PATCH] Some additional work on new connection window. --- connectionwindow.cpp | 20 ++++++++++++++++++-- connectionwindow.h | 2 ++ connectionwindow.ui | 18 +++++++++--------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/connectionwindow.cpp b/connectionwindow.cpp index fe757f6..134c8ee 100644 --- a/connectionwindow.cpp +++ b/connectionwindow.cpp @@ -58,6 +58,9 @@ ConnectionWindow::ConnectionWindow(CANFrameModel *cModel, QWidget *parent) : connect(ui->btnRevert, &QPushButton::clicked, this, &ConnectionWindow::handleRevert); connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ConnectionWindow::handleConnSelectionChanged); connect(ui->btnNewConn, &QPushButton::clicked, this, &ConnectionWindow::handleNewConn); + connect(ui->btnActivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleEnableAll); + connect(ui->btnDeactivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleDisableAll); + connect(ui->btnRemoveBus, &QPushButton::clicked, this, &ConnectionWindow::handleRemoveConn); } ConnectionWindow::~ConnectionWindow() @@ -101,6 +104,7 @@ void ConnectionWindow::handleOKButton() CAN_Bus *bus = connModel->getBus(whichRow); bus->setListenOnly(ui->ckListenOnly->isChecked()); bus->setSingleWire(ui->ckSingleWire->isChecked()); + bus->setEnabled(ui->ckEnabled->isChecked()); if (ui->cbSpeed->currentIndex() == 1) { bus->speed = 0; @@ -126,7 +130,7 @@ void ConnectionWindow::handleOKButton() qDebug() << "Setup initial connection object"; CAN_Bus bus; - bus.active = true; + bus.active = ui->ckEnabled->isChecked(); bus.busNum = serial->getBusBase(); bus.connection = serial; bus.listenOnly = ui->ckListenOnly->isChecked(); @@ -204,6 +208,7 @@ void ConnectionWindow::handleConnSelectionChanged() ui->cbPort->setCurrentIndex(0); ui->ckListenOnly->setChecked(false); ui->ckSingleWire->setChecked(false); + ui->ckEnabled->setChecked(true); } else { @@ -211,13 +216,14 @@ void ConnectionWindow::handleConnSelectionChanged() ui->cbPort->setEnabled(false); ui->rbGVRET->setEnabled(false); ui->rbKvaser->setEnabled(false); - ui->rbSocketCAN->setEnabled(false); + ui->rbSocketCAN->setEnabled(false); CAN_Bus *bus = connModel->getBus(selIdx); if (bus->connection->getConnTypeName() == "GVRET") ui->rbGVRET->setChecked(true); if (bus->connection->getConnTypeName() == "KVASER") ui->rbKvaser->setChecked(true); if (bus->connection->getConnTypeName() == "SOCKETCAN") ui->rbSocketCAN->setChecked(true); ui->ckListenOnly->setChecked(bus->isListenOnly()); ui->ckSingleWire->setChecked(bus->isSingleWire()); + ui->ckEnabled->setChecked(bus->isActive()); int speed = bus->getSpeed(); setSpeed(speed); //connModel->refreshView(); @@ -337,6 +343,16 @@ void ConnectionWindow::handleRevert() } +void ConnectionWindow::handleEnableAll() +{ + +} + +void ConnectionWindow::handleDisableAll() +{ + +} + void ConnectionWindow::sendFrame(const CANFrame *frame) { CAN_Bus *bus = connModel->getBus(frame->bus); diff --git a/connectionwindow.h b/connectionwindow.h index b3efdd5..b07a002 100644 --- a/connectionwindow.h +++ b/connectionwindow.h @@ -54,6 +54,8 @@ private slots: void handleConnTypeChanged(); void handleConnSelectionChanged(); void handleRemoveConn(); + void handleEnableAll(); + void handleDisableAll(); void handleRevert(); void handleNewConn(); void receiveBusStatus(int bus, int speed, int status); diff --git a/connectionwindow.ui b/connectionwindow.ui index db0cd9a..f157991 100644 --- a/connectionwindow.ui +++ b/connectionwindow.ui @@ -33,19 +33,12 @@ - - - - New Connection - - - - + - Activate Selected Connection + New Connection @@ -152,6 +145,13 @@ + + + + Enabled + + +