diff --git a/.gitignore b/.gitignore index cff24fb8..a94745f4 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ **/moc_* **/ui_*.h **/qrc_*.cpp +SavvyCAN.pro.user.* diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index 26e4c70d..a3b4cb47 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -59,6 +59,8 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) : connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &ConnectionWindow::currentRowChanged); connect(ui->tabBuses, &QTabBar::currentChanged, this, &ConnectionWindow::currentTabChanged); connect(ui->btnSaveBus, &QPushButton::clicked, this, &ConnectionWindow::saveBusSettings); + connect(ui->btnMoveUp, &QPushButton::clicked, this, &ConnectionWindow::moveConnUp); + connect(ui->btnMoveDown, &QPushButton::clicked, this, &ConnectionWindow::moveConnDown); ui->cbBusSpeed->addItem("50000"); ui->cbBusSpeed->addItem("100000"); @@ -480,3 +482,29 @@ void ConnectionWindow::saveConnections() settings.setValue("connections/types", QVariant::fromValue(devTypes)); settings.setValue("connections/driverNames", QVariant::fromValue(driverNames)); } + +void ConnectionWindow::moveConnUp() +{ + int selIdx = ui->tableConnections->selectionModel()->currentIndex().row(); + if (selIdx > 0) + { + CANConnection* selConn = connModel->getAtIdx(selIdx); + CANConnection* prevConn = connModel->getAtIdx(selIdx - 1); + connModel->replace(selIdx - 1, selConn); + connModel->replace(selIdx, prevConn); + ui->tableConnections->selectRow(selIdx - 1); + } +} + +void ConnectionWindow::moveConnDown() +{ + int selIdx = ui->tableConnections->selectionModel()->currentIndex().row(); + if (selIdx < connModel->rowCount() - 1) + { + CANConnection* selConn = connModel->getAtIdx(selIdx); + CANConnection* nextConn = connModel->getAtIdx(selIdx + 1); + connModel->replace(selIdx + 1, selConn); + connModel->replace(selIdx, nextConn); + ui->tableConnections->selectRow(selIdx + 1); + } +} diff --git a/connections/connectionwindow.h b/connections/connectionwindow.h index 22769fca..dc081b3c 100644 --- a/connections/connectionwindow.h +++ b/connections/connectionwindow.h @@ -51,6 +51,8 @@ private slots: void handleSendHex(); void handleSendText(); void saveBusSettings(); + void moveConnUp(); + void moveConnDown(); void connectionStatus(CANConStatus); void readPendingDatagrams(); diff --git a/icons.qrc b/icons.qrc index 49ac17c4..427d23b9 100644 --- a/icons.qrc +++ b/icons.qrc @@ -15,5 +15,7 @@ images/signal_new.png images/node_new.png images/message_new.png + images/move_up.png + images/move_down.png diff --git a/images/move_down.png b/images/move_down.png new file mode 100644 index 00000000..20d199d3 Binary files /dev/null and b/images/move_down.png differ diff --git a/images/move_up.png b/images/move_up.png new file mode 100644 index 00000000..5be4bdce Binary files /dev/null and b/images/move_up.png differ diff --git a/ui/connectionwindow.ui b/ui/connectionwindow.ui index 12a6ada3..0cf7ea42 100644 --- a/ui/connectionwindow.ui +++ b/ui/connectionwindow.ui @@ -2,28 +2,44 @@ ConnectionWindow + + true + 0 0 - 956 - 665 + 1086 + 744 Connection Settings - + + + QLayout::SetDefaultConstraint + - - - + + + QLayout::SetMaximumSize + + + - Connected Devices: + Disconnect Selected Device - + + + + Reset Selected Device + + + + true @@ -36,28 +52,7 @@ - - - - Add New Device Connection - - - - - - - Reset Selected Device - - - - - - - Disconnect Selected Device - - - - + false @@ -124,11 +119,86 @@ + + + + true + + + + 0 + 0 + + + + + 20 + 16777215 + + + + + + + + :/icons/images/move_down.png:/icons/images/move_down.png + + + + + + + Connected Devices: + + + + + + + Add New Device Connection + + + + + + + true + + + + 0 + 0 + + + + + 20 + 16777215 + + + + + + + + :/icons/images/move_up.png:/icons/images/move_up.png + + + + 16 + 16 + + + + - - + + + QLayout::SetNoConstraint + + Enable Console @@ -208,6 +278,8 @@
qtabbar.h
- + + +