Some additional work on new connection window.

This commit is contained in:
Collin Kidder
2016-05-06 14:48:05 -04:00
parent 0210e963d5
commit 8f7dc4a34b
3 changed files with 29 additions and 11 deletions
+17 -1
View File
@@ -58,6 +58,9 @@ ConnectionWindow::ConnectionWindow(CANFrameModel *cModel, QWidget *parent) :
connect(ui->btnRevert, &QPushButton::clicked, this, &ConnectionWindow::handleRevert); connect(ui->btnRevert, &QPushButton::clicked, this, &ConnectionWindow::handleRevert);
connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ConnectionWindow::handleConnSelectionChanged); connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ConnectionWindow::handleConnSelectionChanged);
connect(ui->btnNewConn, &QPushButton::clicked, this, &ConnectionWindow::handleNewConn); 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() ConnectionWindow::~ConnectionWindow()
@@ -101,6 +104,7 @@ void ConnectionWindow::handleOKButton()
CAN_Bus *bus = connModel->getBus(whichRow); CAN_Bus *bus = connModel->getBus(whichRow);
bus->setListenOnly(ui->ckListenOnly->isChecked()); bus->setListenOnly(ui->ckListenOnly->isChecked());
bus->setSingleWire(ui->ckSingleWire->isChecked()); bus->setSingleWire(ui->ckSingleWire->isChecked());
bus->setEnabled(ui->ckEnabled->isChecked());
if (ui->cbSpeed->currentIndex() == 1) if (ui->cbSpeed->currentIndex() == 1)
{ {
bus->speed = 0; bus->speed = 0;
@@ -126,7 +130,7 @@ void ConnectionWindow::handleOKButton()
qDebug() << "Setup initial connection object"; qDebug() << "Setup initial connection object";
CAN_Bus bus; CAN_Bus bus;
bus.active = true; bus.active = ui->ckEnabled->isChecked();
bus.busNum = serial->getBusBase(); bus.busNum = serial->getBusBase();
bus.connection = serial; bus.connection = serial;
bus.listenOnly = ui->ckListenOnly->isChecked(); bus.listenOnly = ui->ckListenOnly->isChecked();
@@ -204,6 +208,7 @@ void ConnectionWindow::handleConnSelectionChanged()
ui->cbPort->setCurrentIndex(0); ui->cbPort->setCurrentIndex(0);
ui->ckListenOnly->setChecked(false); ui->ckListenOnly->setChecked(false);
ui->ckSingleWire->setChecked(false); ui->ckSingleWire->setChecked(false);
ui->ckEnabled->setChecked(true);
} }
else else
{ {
@@ -218,6 +223,7 @@ void ConnectionWindow::handleConnSelectionChanged()
if (bus->connection->getConnTypeName() == "SOCKETCAN") ui->rbSocketCAN->setChecked(true); if (bus->connection->getConnTypeName() == "SOCKETCAN") ui->rbSocketCAN->setChecked(true);
ui->ckListenOnly->setChecked(bus->isListenOnly()); ui->ckListenOnly->setChecked(bus->isListenOnly());
ui->ckSingleWire->setChecked(bus->isSingleWire()); ui->ckSingleWire->setChecked(bus->isSingleWire());
ui->ckEnabled->setChecked(bus->isActive());
int speed = bus->getSpeed(); int speed = bus->getSpeed();
setSpeed(speed); setSpeed(speed);
//connModel->refreshView(); //connModel->refreshView();
@@ -337,6 +343,16 @@ void ConnectionWindow::handleRevert()
} }
void ConnectionWindow::handleEnableAll()
{
}
void ConnectionWindow::handleDisableAll()
{
}
void ConnectionWindow::sendFrame(const CANFrame *frame) void ConnectionWindow::sendFrame(const CANFrame *frame)
{ {
CAN_Bus *bus = connModel->getBus(frame->bus); CAN_Bus *bus = connModel->getBus(frame->bus);
+2
View File
@@ -54,6 +54,8 @@ private slots:
void handleConnTypeChanged(); void handleConnTypeChanged();
void handleConnSelectionChanged(); void handleConnSelectionChanged();
void handleRemoveConn(); void handleRemoveConn();
void handleEnableAll();
void handleDisableAll();
void handleRevert(); void handleRevert();
void handleNewConn(); void handleNewConn();
void receiveBusStatus(int bus, int speed, int status); void receiveBusStatus(int bus, int speed, int status);
+9 -9
View File
@@ -33,6 +33,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QPushButton" name="btnNewConn"> <widget class="QPushButton" name="btnNewConn">
<property name="text"> <property name="text">
@@ -40,15 +42,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="btnBusActivate">
<property name="text">
<string>Activate Selected Connection</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="btnRemoveBus"> <widget class="QPushButton" name="btnRemoveBus">
<property name="text"> <property name="text">
@@ -152,6 +145,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ckEnabled">
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,2"> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,2">
<item> <item>