Major revamp of the connection window. Hopefully it is more clear and

intuitive now.
This commit is contained in:
Collin Kidder
2019-03-05 21:25:32 -05:00
parent 70e8af85af
commit ec49413f61
17 changed files with 611 additions and 661 deletions
+6 -3
View File
@@ -66,7 +66,8 @@ SOURCES += main.cpp\
frameplaybackobject.cpp \ frameplaybackobject.cpp \
helpwindow.cpp \ helpwindow.cpp \
blfhandler.cpp \ blfhandler.cpp \
re/sniffer/SnifferDelegate.cpp re/sniffer/SnifferDelegate.cpp \
connections/newconnectiondialog.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
can_structs.h \ can_structs.h \
@@ -123,7 +124,8 @@ HEADERS += mainwindow.h \
frameplaybackobject.h \ frameplaybackobject.h \
helpwindow.h \ helpwindow.h \
blfhandler.h \ blfhandler.h \
re/sniffer/SnifferDelegate.h re/sniffer/SnifferDelegate.h \
connections/newconnectiondialog.h
FORMS += ui/candatagrid.ui \ FORMS += ui/candatagrid.ui \
ui/connectionwindow.ui \ ui/connectionwindow.ui \
@@ -150,7 +152,8 @@ FORMS += ui/candatagrid.ui \
ui/udsscanwindow.ui \ ui/udsscanwindow.ui \
ui/bisectwindow.ui \ ui/bisectwindow.ui \
ui/signalviewerwindow.ui \ ui/signalviewerwindow.ui \
helpwindow.ui helpwindow.ui \
ui/newconnectiondialog.ui
DISTFILES += DISTFILES +=
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef CONFIG #ifndef CONFIG
#define CONFIG #define CONFIG
#define VERSION 192 #define VERSION 193
//try to keep this in sync. //try to keep this in sync.
//SavvyCAN will complain if you connect a GVRET board with a revision //SavvyCAN will complain if you connect a GVRET board with a revision
+1 -1
View File
@@ -40,7 +40,7 @@ void CANBus::setSingleWire(bool mode){
singleWire = mode; singleWire = mode;
} }
void CANBus::setEnabled(bool mode){ void CANBus::setActive(bool mode){
//qDebug() << "CANBUS SetEnabled = " << mode; //qDebug() << "CANBUS SetEnabled = " << mode;
active = mode; active = mode;
} }
+1 -1
View File
@@ -20,7 +20,7 @@ public:
void setSpeed(int); // new speed void setSpeed(int); // new speed
void setListenOnly(bool); //bool for whether to only listen void setListenOnly(bool); //bool for whether to only listen
void setSingleWire(bool); //bool for whether to use single wire mode void setSingleWire(bool); //bool for whether to use single wire mode
void setEnabled(bool); //whether this bus should be enabled or not. void setActive(bool); //whether this bus should be enabled or not.
int getSpeed(); int getSpeed();
bool isListenOnly(); bool isListenOnly();
bool isSingleWire(); bool isSingleWire();
+11
View File
@@ -77,6 +77,17 @@ int CANConManager::getNumBuses()
return buses; return buses;
} }
int CANConManager::getBusBase(CANConnection *which)
{
int buses = 0;
foreach(CANConnection* conn_p, mConns)
{
if (conn_p != which) buses += conn_p->getNumBuses();
else return buses;
}
return -1;
}
void CANConManager::refreshCanList() void CANConManager::refreshCanList()
{ {
QObject* sender_p = QObject::sender(); QObject* sender_p = QObject::sender();
+1
View File
@@ -26,6 +26,7 @@ public:
void resetTimeBasis(); void resetTimeBasis();
int getNumBuses(); int getNumBuses();
int getBusBase(CANConnection *);
/** /**
* @brief sendFrame sends a single frame out the desired bus * @brief sendFrame sends a single frame out the desired bus
+1 -1
View File
@@ -210,7 +210,7 @@ void CANConnection::setConfigured(int pBusId, bool pConfigured) {
bool CANConnection::getBusConfig(int pBusId, CANBus& pBus) { bool CANConnection::getBusConfig(int pBusId, CANBus& pBus) {
if( pBusId < 0 || pBusId >= getNumBuses() || !isConfigured(pBusId)) if( pBusId < 0 || pBusId >= getNumBuses() || !isConfigured(pBusId))
return false; return false;
qDebug() << "getBusConfig id: " << pBusId;
pBus = mBusData[pBusId].mBus; pBus = mBusData[pBusId].mBus;
return true; return true;
} }
+20 -134
View File
@@ -12,14 +12,11 @@ CANConnectionModel::~CANConnectionModel()
} }
enum class Column { enum class Column {
Bus = 0, ///< A sequential number describing the bus Type = 0, ///< The CAN driver/backend type, e.g. GVRET, peakcan, or socketcan
Type = 1, ///< The CAN driver/backend type, e.g. GVRET, peakcan, or socketcan Subtype = 1, ///< Mostly used by SerialBus devices to pick the sub type
Port = 2, ///< The CAN hardware port, e.g. can0 for socketcan Port = 2, ///< The CAN hardware port, e.g. can0 for socketcan
Speed = 3, ///< The bus speed in bit/second NumBuses = 3, ///< Number of buses exposed by this device. Usually non-GVRET devices will just have one
ListenOnly = 4, ///< True if the bus is in listen-only mode Status = 4 ///< The bus status as text message
SingleWire = 5, ///< True if the bus operates in single-wire mode
Active = 6, ///< True if the bus is activated for sending and receiving
Status = 7 ///< The bus status as text message
}; };
QVariant CANConnectionModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant CANConnectionModel::headerData(int section, Qt::Orientation orientation, int role) const
@@ -31,20 +28,14 @@ QVariant CANConnectionModel::headerData(int section, Qt::Orientation orientation
{ {
switch (Column(section)) switch (Column(section))
{ {
case Column::Bus:
return QString(tr("Bus"));
case Column::Type: case Column::Type:
return QString(tr("Type")); return QString(tr("Type"));
case Column::Subtype:
return QString(tr("Subtype"));
case Column::Port: case Column::Port:
return QString(tr("Port")); return QString(tr("Port"));
case Column::Speed: case Column::NumBuses:
return QString(tr("Speed")); return QString(tr("Buses"));
case Column::ListenOnly:
return QString(tr("Listen Only"));
case Column::SingleWire:
return QString(tr("Single Wire"));
case Column::Active:
return QString(tr("Active"));
case Column::Status: case Column::Status:
return QString(tr("Status")); return QString(tr("Status"));
} }
@@ -59,7 +50,7 @@ QVariant CANConnectionModel::headerData(int section, Qt::Orientation orientation
int CANConnectionModel::columnCount(const QModelIndex &parent) const int CANConnectionModel::columnCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
return 8; return 5;
} }
@@ -67,78 +58,9 @@ int CANConnectionModel::rowCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
int rows = 0;
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections(); QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
foreach(const CANConnection* conn_p, conns) return conns.count();
rows += conn_p->getNumBuses();
//qDebug() << "Num Rows: " << rows;
return rows;
}
Qt::ItemFlags CANConnectionModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemFlag::NoItemFlags;
int busId;
CANConnection *conn_p = getAtIdx(index.row(), busId);
if (!conn_p) return Qt::ItemFlag::NoItemFlags;
//socketcan is limited for what you can set but the other serialbus
//devices should be able to set the stuff. For now let anyone try
//and the underlying drivers can do with them as they will
bool editParams = true;
//if (conn_p->getType() == CANCon::GVRET_SERIAL) editParams = true;
switch (Column(index.column()))
{
case Column::Speed:
if (editParams) return Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsEnabled;
return Qt::ItemFlag::NoItemFlags;
case Column::ListenOnly:
case Column::SingleWire:
if (editParams) return Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsUserCheckable;
return Qt::ItemFlag::NoItemFlags;
case Column::Active:
return Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsUserCheckable;
default:
return Qt::ItemFlag::ItemIsEnabled;
}
}
bool CANConnectionModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
qDebug() << "setData: " << index.row() << ":" << index.column() << " role: " << role << " Val: " << value;
int busId;
CANConnection *conn_p = getAtIdx(index.row(), busId);
if (!conn_p) return false;
CANBus bus;
bool ret;
ret = conn_p->getBusSettings(busId, bus);
if (!ret) return false;
switch (Column(index.column()))
{
case Column::Speed:
bus.speed = value.toInt();
break;
case Column::ListenOnly:
bus.listenOnly = value.toBool();
break;
case Column::SingleWire:
bus.singleWire = value.toBool();
break;
case Column::Active:
bus.active = value.toBool();
break;
default: {}
}
conn_p->setBusSettings(busId, bus);
return true;
} }
QVariant CANConnectionModel::data(const QModelIndex &index, int role) const QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
@@ -147,23 +69,16 @@ QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
//qDebug() << "Row: " << index.row(); //qDebug() << "Row: " << index.row();
int busId; CANConnection *conn_p = getAtIdx(index.row());
CANConnection *conn_p = getAtIdx(index.row(), busId);
CANBus bus;
bool ret; bool ret;
if (!conn_p) return QVariant(); if (!conn_p) return QVariant();
ret = conn_p->getBusSettings(busId, bus);
bool isSocketCAN = (conn_p->getType() == CANCon::SERIALBUS) ? true: false;
//qDebug() << "ConnP: " << conn_p << " ret " << ret; bool isSocketCAN = (conn_p->getType() == CANCon::SERIALBUS) ? true: false;
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
switch (Column(index.column())) switch (Column(index.column()))
{ {
case Column::Bus:
//return QString::number(busId);
return QString::number(index.row());
case Column::Type: case Column::Type:
if (conn_p) if (conn_p)
switch (conn_p->getType()) { switch (conn_p->getType()) {
@@ -178,34 +93,16 @@ QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
if (conn_p) return conn_p->getPort(); if (conn_p) return conn_p->getPort();
else qDebug() << "Tried to show connection port but connection was NULL"; else qDebug() << "Tried to show connection port but connection was NULL";
break; break;
case Column::Speed: case Column::Subtype:
if(!ret) return QVariant(); return conn_p->getDriver();
if (!isSocketCAN) return QString::number(bus.speed); break;
else return QString("N/A"); case Column::NumBuses:
case Column::ListenOnly: return conn_p->getNumBuses();
return QVariant(); break;
case Column::SingleWire:
return QVariant();
case Column::Active:
return QVariant();
case Column::Status: case Column::Status:
return (conn_p->getStatus()==CANCon::CONNECTED) ? "Connected" : "Not Connected"; return (conn_p->getStatus()==CANCon::CONNECTED) ? "Connected" : "Not Connected";
} }
} }
if (role == Qt::CheckStateRole)
{
switch (Column(index.column()))
{
case Column::ListenOnly:
return (bus.listenOnly) ? Qt::Checked : Qt::Unchecked;
case Column::SingleWire:
return (bus.singleWire) ? Qt::Checked : Qt::Unchecked;
case Column::Active:
return (bus.active) ? Qt::Checked : Qt::Unchecked;
default: {}
}
}
return QVariant(); return QVariant();
} }
@@ -230,25 +127,14 @@ void CANConnectionModel::remove(CANConnection* pConn_p)
} }
CANConnection* CANConnectionModel::getAtIdx(int pIdx, int& pBusId) const CANConnection* CANConnectionModel::getAtIdx(int pIdx) const
{ {
if (pIdx < 0) if (pIdx < 0)
return NULL; return NULL;
int i=0;
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections(); QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
foreach(CANConnection* conn_p, conns) return conns.at(pIdx);
{
if( i <= pIdx && pIdx < i+conn_p->getNumBuses() ) {
pBusId = pIdx - i;
return conn_p;
}
i+= conn_p->getNumBuses();
}
return NULL;
} }
void CANConnectionModel::refresh(int pIndex) void CANConnectionModel::refresh(int pIndex)
+1 -4
View File
@@ -21,15 +21,12 @@ public:
int columnCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
void add(CANConnection* pConn_p); void add(CANConnection* pConn_p);
void remove(CANConnection* pConn_p); void remove(CANConnection* pConn_p);
CANConnection* getAtIdx(int, int&) const; CANConnection* getAtIdx(int) const;
void refresh(int pIndex=-1); void refresh(int pIndex=-1);
}; };
+120 -292
View File
@@ -10,6 +10,7 @@
#include "connections/canconmanager.h" #include "connections/canconmanager.h"
#include "canbus.h" #include "canbus.h"
#include <QSettings> #include <QSettings>
#include <connections/newconnectiondialog.h>
ConnectionWindow::ConnectionWindow(QWidget *parent) : ConnectionWindow::ConnectionWindow(QWidget *parent) :
QDialog(parent), QDialog(parent),
@@ -24,16 +25,15 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
qRegisterMetaType<const CANFrame *>("const CANFrame *"); qRegisterMetaType<const CANFrame *>("const CANFrame *");
qRegisterMetaType<const QList<CANFrame> *>("const QList<CANFrame> *"); qRegisterMetaType<const QList<CANFrame> *>("const QList<CANFrame> *");
//List of devices with details. None of it can be edited. connection type, serialbus type, port name, number of buses, status
connModel = new CANConnectionModel(this); connModel = new CANConnectionModel(this);
ui->tableConnections->setModel(connModel); ui->tableConnections->setModel(connModel);
ui->tableConnections->setColumnWidth(0, 40); ui->tableConnections->setColumnWidth(0, 100);
ui->tableConnections->setColumnWidth(1, 70); ui->tableConnections->setColumnWidth(1, 100);
ui->tableConnections->setColumnWidth(2, 70); ui->tableConnections->setColumnWidth(2, 100);
ui->tableConnections->setColumnWidth(3, 70); ui->tableConnections->setColumnWidth(3, 70);
ui->tableConnections->setColumnWidth(4, 70); ui->tableConnections->setColumnWidth(4, 200);
ui->tableConnections->setColumnWidth(5, 70);
ui->tableConnections->setColumnWidth(6, 70);
ui->tableConnections->setColumnWidth(7, 90);
QHeaderView *HorzHdr = ui->tableConnections->horizontalHeader(); QHeaderView *HorzHdr = ui->tableConnections->horizontalHeader();
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
@@ -49,30 +49,28 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
loadConnections(); loadConnections();
} }
ui->rbSocketCAN->setEnabled(isSerialBusAvailable()); connect(ui->btnDisconnect, &QPushButton::clicked, this, &ConnectionWindow::handleRemoveConn);
connect(ui->btnOK, &QAbstractButton::clicked, this, &ConnectionWindow::handleOKButton);
connect(ui->rbGVRET, &QAbstractButton::clicked, this, &ConnectionWindow::handleConnTypeChanged);
connect(ui->rbSocketCAN, &QAbstractButton::clicked, this, &ConnectionWindow::handleConnTypeChanged);
connect(ui->rbRemote, &QAbstractButton::clicked, this, &ConnectionWindow::handleConnTypeChanged);
connect(ui->cbDeviceType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ConnectionWindow::handleDeviceTypeChanged);
connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &ConnectionWindow::currentRowChanged);
connect(ui->btnActivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleEnableAll);
connect(ui->btnDeactivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleDisableAll);
connect(ui->btnReconnect, &QPushButton::clicked, this, &ConnectionWindow::handleReconnect);
connect(ui->btnRemoveBus, &QPushButton::clicked, this, &ConnectionWindow::handleRemoveConn);
connect(ui->btnClearDebug, &QPushButton::clicked, this, &ConnectionWindow::handleClearDebugText);
connect(ui->btnSendHex, &QPushButton::clicked, this, &ConnectionWindow::handleSendHex); connect(ui->btnSendHex, &QPushButton::clicked, this, &ConnectionWindow::handleSendHex);
connect(ui->btnSendText, &QPushButton::clicked, this, &ConnectionWindow::handleSendText); connect(ui->btnSendText, &QPushButton::clicked, this, &ConnectionWindow::handleSendText);
connect(ui->ckEnableConsole, &QCheckBox::toggled, this, &ConnectionWindow::consoleEnableChanged); connect(ui->ckEnableConsole, &QCheckBox::toggled, this, &ConnectionWindow::consoleEnableChanged);
connect(ui->btnClearDebug, &QPushButton::clicked, this, &ConnectionWindow::handleClearDebugText);
connect(ui->btnNewConnection, &QPushButton::clicked, this, &ConnectionWindow::handleNewConn);
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);
ui->lblDeviceType->setHidden(true); ui->cbBusSpeed->addItem("50000");
ui->cbDeviceType->setHidden(true); ui->cbBusSpeed->addItem("100000");
ui->cbBusSpeed->addItem("125000");
ui->cbBusSpeed->addItem("250000");
ui->cbBusSpeed->addItem("500000");
ui->cbBusSpeed->addItem("1000000");
rxBroadcast = new QUdpSocket(this); rxBroadcast = new QUdpSocket(this);
rxBroadcast->bind(QHostAddress::AnyIPv4, 17222); rxBroadcast->bind(QHostAddress::AnyIPv4, 17222);
connect(rxBroadcast, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); connect(rxBroadcast, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
} }
@@ -114,7 +112,6 @@ void ConnectionWindow::showEvent(QShowEvent* event)
readSettings(); readSettings();
ui->tableConnections->selectRow(0); ui->tableConnections->selectRow(0);
currentRowChanged(ui->tableConnections->currentIndex(), ui->tableConnections->currentIndex()); currentRowChanged(ui->tableConnections->currentIndex(), ui->tableConnections->currentIndex());
handleConnTypeChanged();
} }
void ConnectionWindow::closeEvent(QCloseEvent *event) void ConnectionWindow::closeEvent(QCloseEvent *event)
@@ -163,48 +160,6 @@ void ConnectionWindow::writeSettings()
} }
} }
void ConnectionWindow::setSuspendAll(bool pSuspend)
{
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
foreach(CANConnection* conn_p, conns)
conn_p->suspend(pSuspend);
connModel->refresh();
}
void ConnectionWindow::setActiveAll(bool pActive)
{
CANBus bus;
QList<CANConnection*>& conns = CANConManager::getInstance()->getConnections();
foreach(CANConnection* conn_p, conns)
{
for(int i=0 ; i<conn_p->getNumBuses() ; i++) {
if( conn_p->getBusSettings(i, bus) ) {
bus.active = pActive;
conn_p->setBusSettings(i, bus);
}
}
}
connModel->refresh();
}
void ConnectionWindow::handleReconnect()
{
int selIdx = ui->tableConnections->selectionModel()->currentIndex().row();
if (selIdx <0) return;
int busId;
CANConnection* conn_p = connModel->getAtIdx(selIdx, busId);
if(!conn_p) return;
conn_p->stop();
conn_p->start();
}
void ConnectionWindow::consoleEnableChanged(bool checked) { void ConnectionWindow::consoleEnableChanged(bool checked) {
ui->textConsole->setEnabled(checked); ui->textConsole->setEnabled(checked);
ui->btnClearDebug->setEnabled(checked); ui->btnClearDebug->setEnabled(checked);
@@ -229,35 +184,21 @@ void ConnectionWindow::consoleEnableChanged(bool checked) {
void ConnectionWindow::handleNewConn() void ConnectionWindow::handleNewConn()
{ {
ui->tableConnections->setCurrentIndex(QModelIndex()); NewConnectionDialog *thisDialog = new NewConnectionDialog(&remoteDeviceIP);
currentRowChanged(ui->tableConnections->currentIndex(), ui->tableConnections->currentIndex()); CANCon::type newType;
} QString newPort;
QString newDriver;
CANConnection *conn;
if (thisDialog->exec() == QDialog::Accepted)
void ConnectionWindow::handleEnableAll()
{ {
setActiveAll(true); newType = thisDialog->getConnectionType();
newPort = thisDialog->getPortName();
newDriver = thisDialog->getDriverName();
conn = create(newType, newPort, newDriver);
if (conn) connModel->add(conn);
} }
delete thisDialog;
void ConnectionWindow::handleDisableAll()
{
setActiveAll(false);
}
void ConnectionWindow::handleConnTypeChanged()
{
if (ui->rbGVRET->isChecked()) selectSerial();
if (ui->rbSocketCAN->isChecked()) selectSocketCan();
if (ui->rbRemote->isChecked()) selectRemote();
}
void ConnectionWindow::handleDeviceTypeChanged()
{
ui->cbPort->clear();
canDevices = QCanBus::instance()->availableDevices(ui->cbDeviceType->currentText());
for (int i = 0; i < canDevices.count(); i++)
ui->cbPort->addItem(canDevices[i].name());
} }
/* status */ /* status */
@@ -269,22 +210,79 @@ void ConnectionWindow::connectionStatus(CANConStatus pStatus)
connModel->refresh(); connModel->refresh();
} }
void ConnectionWindow::saveBusSettings()
void ConnectionWindow::handleOKButton()
{ {
CANConnection* conn_p = nullptr; int selIdx = ui->tableConnections->currentIndex().row();
int offset = ui->tabBuses->currentIndex();
if( ! CANConManager::getInstance()->getByName(getPortName()) ) /* set parameters */
{ if (selIdx == -1) {
/* create connection */
//qDebug() << "Create connection type: " << getConnectionType() << " port: " << getPortName() << " driver: " << getDriverName();
conn_p = create(getConnectionType(), getPortName(), getDriverName());
if(!conn_p)
return; return;
/* add connection to model */
connModel->add(conn_p);
consoleEnableChanged(ui->ckEnableConsole->isChecked());
} }
else
{
CANConnection* conn_p = connModel->getAtIdx(selIdx);
CANBus bus;
if(!conn_p) return;
if (!conn_p->getBusSettings(offset, bus))
{
qDebug() << "Could not retrieve bus settings!";
return;
}
bus.setSpeed(ui->cbBusSpeed->currentText().toInt());
bus.setActive(ui->ckEnable->isChecked());
bus.setListenOnly(ui->ckListenOnly->isChecked());
conn_p->setBusSettings(offset, bus);
}
}
void ConnectionWindow::populateBusDetails(int offset)
{
int selIdx = ui->tableConnections->currentIndex().row();
/* set parameters */
if (selIdx == -1) {
return;
}
else
{
bool ret;
int numBuses;
CANConnection* conn_p = connModel->getAtIdx(selIdx);
CANBus bus;
if(!conn_p) return;
if (!conn_p->getBusSettings(offset, bus))
{
qDebug() << "Could not retrieve bus settings!";
return;
}
int busBase = CANConManager::getInstance()->getBusBase(conn_p);
ui->lblBusNum->setText(QString::number(busBase + offset));
ui->ckListenOnly->setChecked(bus.isListenOnly());
ui->ckEnable->setChecked(bus.isActive());
bool found = false;
for (int i = 0; i < ui->cbBusSpeed->count(); i++)
{
if (bus.getSpeed() == ui->cbBusSpeed->itemText(i).toInt())
{
found = true;
ui->cbBusSpeed->setCurrentIndex(i);
break;
}
}
if (!found) ui->cbBusSpeed->addItem(QString::number(bus.getSpeed()));
}
}
void ConnectionWindow::currentTabChanged(int newIdx)
{
populateBusDetails(newIdx);
} }
void ConnectionWindow::currentRowChanged(const QModelIndex &current, const QModelIndex &previous) void ConnectionWindow::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
@@ -293,43 +291,33 @@ void ConnectionWindow::currentRowChanged(const QModelIndex &current, const QMode
int selIdx = current.row(); int selIdx = current.row();
int busId; disconnect(connModel->getAtIdx(previous.row()), SIGNAL(debugOutput(QString)), 0, 0);
disconnect(this, SIGNAL(sendDebugData(QByteArray)), connModel->getAtIdx(previous.row()), SLOT(debugInput(QByteArray)));
disconnect(connModel->getAtIdx(previous.row(), busId), SIGNAL(debugOutput(QString)), 0, 0);
disconnect(this, SIGNAL(sendDebugData(QByteArray)), connModel->getAtIdx(previous.row(), busId), SLOT(debugInput(QByteArray)));
return;
/* enable / diable connection type */
ui->stPort->setEnabled(selIdx==-1);
ui->gbType->setEnabled(selIdx==-1);
ui->lPort->setEnabled(selIdx==-1);
/* set parameters */ /* set parameters */
if (selIdx == -1) if (selIdx == -1) {
{ ui->groupBus->setEnabled(false);
ui->btnOK->setText(tr("Create New Connection")); return;
ui->rbGVRET->setChecked(true);
setSpeed(0);
setPortName(CANCon::GVRET_SERIAL, "", "");
} }
else else
{ {
bool ret; bool ret;
CANBus bus; ui->groupBus->setEnabled(true);
CANConnection* conn_p = connModel->getAtIdx(selIdx, busId); int numBuses;
CANConnection* conn_p = connModel->getAtIdx(selIdx);
if(!conn_p) return; if(!conn_p) return;
if (ui->ckEnableConsole->isChecked()) { //only connect if console is actually enabled numBuses = conn_p->getNumBuses();
connect(conn_p, SIGNAL(debugOutput(QString)), this, SLOT(getDebugText(QString))); if (numBuses == 1) //remove all tabs if there is only one bus
connect(this, SIGNAL(sendDebugData(QByteArray)), conn_p, SLOT(debugInput(QByteArray))); {
for (int i = 0; i < ui->tabBuses->count(); i++) ui->tabBuses->removeTab(0);
} }
else
ret = conn_p->getBusSettings(busId, bus); {
if(!ret) return; for (int i = 0; i < numBuses; i++) ui->tabBuses->addTab(QString::number(i+1));
}
ui->btnOK->setText(tr("Update Connection Settings")); populateBusDetails(0);
setSpeed(bus.getSpeed());
setPortName(conn_p->getType(), conn_p->getPort(), conn_p->getDriver());
} }
} }
@@ -357,152 +345,6 @@ void ConnectionWindow::handleSendText() {
emit sendDebugData(bytes); emit sendDebugData(bytes);
} }
void ConnectionWindow::selectSerial()
{
ui->lPort->setText("Port:");
/* set combobox page visible */
ui->stPort->setCurrentWidget(ui->cbPage);
ui->lblDeviceType->setHidden(true);
ui->cbDeviceType->setHidden(true);
ui->cbPort->clear();
ports = QSerialPortInfo::availablePorts();
for (int i = 0; i < ports.count(); i++)
ui->cbPort->addItem(ports[i].portName());
}
void ConnectionWindow::selectSocketCan()
{
ui->lPort->setText("Port:");
/* set edit text page visible */
ui->stPort->setCurrentWidget(ui->cbPage);
ui->lblDeviceType->setHidden(false);
ui->cbDeviceType->setHidden(false);
ui->cbDeviceType->clear();
QStringList plugins;
plugins = QCanBus::instance()->plugins();
for (int i = 0; i < plugins.count(); i++)
ui->cbDeviceType->addItem(plugins[i]);
}
void ConnectionWindow::selectRemote()
{
ui->lPort->setText("IP Address:");
ui->stPort->setCurrentWidget(ui->cbPage);
ui->lblDeviceType->setHidden(true);
ui->cbDeviceType->setHidden(true);
ui->cbPort->clear();
foreach(QString pName, remoteDeviceIP)
{
ui->cbPort->addItem(pName);
}
}
void ConnectionWindow::setSpeed(int speed0)
{
Q_UNUSED(speed0);
}
void ConnectionWindow::setPortName(CANCon::type pType, QString pPortName, QString pDriver)
{
switch(pType)
{
case CANCon::GVRET_SERIAL:
ui->rbGVRET->setChecked(true);
break;
case CANCon::SERIALBUS:
ui->rbSocketCAN->setChecked(true);
//you can't configure any of the below three with socketcan so dim them out
break;
default: {}
}
/* refresh names whenever needed */
handleConnTypeChanged();
switch(pType)
{
case CANCon::GVRET_SERIAL:
{
int idx = ui->cbPort->findText(pPortName);
if( idx<0 ) idx=0;
ui->cbPort->setCurrentIndex(idx);
break;
}
case CANCon::SERIALBUS:
{
int idx = ui->cbDeviceType->findText(pDriver);
if (idx < 0) idx = 0;
ui->cbDeviceType->setCurrentIndex(idx);
idx = ui->cbPort->findText(pPortName);
if( idx < 0 ) idx = 0;
ui->cbPort->setCurrentIndex(idx);
break;
}
case CANCon::REMOTE:
{
int idx = ui->cbPort->findText(pPortName);
if (idx > -1) ui->cbPort->setCurrentIndex(idx);
else ui->cbPort->addItem(pPortName);
break;
}
default: {}
}
}
//-1 means leave it at whatever it booted up to. 0 means disable. Otherwise the actual rate we want.
int ConnectionWindow::getSpeed()
{
return -1;
}
QString ConnectionWindow::getPortName()
{
switch( getConnectionType() ) {
case CANCon::GVRET_SERIAL:
case CANCon::SERIALBUS:
case CANCon::REMOTE:
return ui->cbPort->currentText();
default:
qDebug() << "getPortName: can't get port";
}
return "";
}
QString ConnectionWindow::getDriverName()
{
if (getConnectionType() == CANCon::SERIALBUS)
{
return ui->cbDeviceType->currentText();
}
return "";
}
CANCon::type ConnectionWindow::getConnectionType()
{
if (ui->rbGVRET->isChecked()) return CANCon::GVRET_SERIAL;
if (ui->rbSocketCAN->isChecked()) return CANCon::SERIALBUS;
if (ui->rbRemote->isChecked()) return CANCon::REMOTE;
qDebug() << "getConnectionType: error";
return CANCon::NONE;
}
void ConnectionWindow::setSWMode(bool mode)
{
Q_UNUSED(mode);
}
bool ConnectionWindow::getSWMode()
{
return false;
}
void ConnectionWindow::handleRemoveConn() void ConnectionWindow::handleRemoveConn()
{ {
int selIdx = ui->tableConnections->selectionModel()->currentIndex().row(); int selIdx = ui->tableConnections->selectionModel()->currentIndex().row();
@@ -510,8 +352,7 @@ void ConnectionWindow::handleRemoveConn()
qDebug() << "remove connection at index: " << selIdx; qDebug() << "remove connection at index: " << selIdx;
int busId; CANConnection* conn_p = connModel->getAtIdx(selIdx);
CANConnection* conn_p = connModel->getAtIdx(selIdx, busId);
if(!conn_p) return; if(!conn_p) return;
/* remove connection from model & manager */ /* remove connection from model & manager */
@@ -525,19 +366,6 @@ void ConnectionWindow::handleRemoveConn()
ui->tableConnections->selectRow(0); ui->tableConnections->selectRow(0);
} }
void ConnectionWindow::handleRevert()
{
}
bool ConnectionWindow::isSerialBusAvailable()
{
if (QCanBus::instance()->plugins().count() > 0) return true;
return false;
}
CANConnection* ConnectionWindow::create(CANCon::type pTye, QString pPortName, QString pDriver) CANConnection* ConnectionWindow::create(CANCon::type pTye, QString pPortName, QString pDriver)
{ {
CANConnection* conn_p; CANConnection* conn_p;
+4 -29
View File
@@ -3,8 +3,8 @@
#include <QSerialPortInfo>
#include <QDialog> #include <QDialog>
#include <QSerialPortInfo>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QTimer> #include <QTimer>
@@ -30,61 +30,36 @@ public:
explicit ConnectionWindow(QWidget *parent = 0); explicit ConnectionWindow(QWidget *parent = 0);
~ConnectionWindow(); ~ConnectionWindow();
CANCon::type getConnectionType();
bool getSWMode();
signals: signals:
void updateBusSettings(CANBus *bus); void updateBusSettings(CANBus *bus);
void updatePortName(QString port); void updatePortName(QString port);
void sendDebugData(QByteArray bytes); void sendDebugData(QByteArray bytes);
public slots: public slots:
void setSpeed(int speed0);
void setSWMode(bool mode);
void setSuspendAll(bool pSuspend);
void getDebugText(QString debugText); void getDebugText(QString debugText);
private slots: private slots:
void handleOKButton();
void handleConnTypeChanged();
void handleDeviceTypeChanged();
void currentRowChanged(const QModelIndex &current, const QModelIndex &previous); void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void currentTabChanged(int newIdx);
void consoleEnableChanged(bool checked); void consoleEnableChanged(bool checked);
void handleRemoveConn(); void handleRemoveConn();
void handleEnableAll();
void handleDisableAll();
void handleReconnect();
void handleRevert();
void handleNewConn(); void handleNewConn();
void handleClearDebugText(); void handleClearDebugText();
void handleSendHex(); void handleSendHex();
void handleSendText(); void handleSendText();
void saveBusSettings();
void connectionStatus(CANConStatus); void connectionStatus(CANConStatus);
void readPendingDatagrams(); void readPendingDatagrams();
private: private:
Ui::ConnectionWindow *ui; Ui::ConnectionWindow *ui;
QList<QSerialPortInfo> ports;
QList<QCanBusDeviceInfo> canDevices;
QSettings *settings; QSettings *settings;
CANConnectionModel *connModel; CANConnectionModel *connModel;
QUdpSocket *rxBroadcast; QUdpSocket *rxBroadcast;
QVector<QString> remoteDeviceIP; QVector<QString> remoteDeviceIP;
void selectSerial();
void selectKvaser();
void selectSocketCan();
void selectRemote();
bool isSerialBusAvailable();
int getSpeed();
QString getPortName();
QString getDriverName();
void setPortName(CANCon::type pType, QString pPortName, QString pDriver);
void setActiveAll(bool pActive);
CANConnection* create(CANCon::type pTye, QString pPortName, QString pDriver); CANConnection* create(CANCon::type pTye, QString pPortName, QString pDriver);
void populateBusDetails(int offset);
void loadConnections(); void loadConnections();
void saveConnections(); void saveConnections();
void showEvent(QShowEvent *); void showEvent(QShowEvent *);
+3 -3
View File
@@ -819,8 +819,8 @@ void GVRetSerial::procRXChar(unsigned char c)
qDebug() << "Baud 1 = " << can1Baud; qDebug() << "Baud 1 = " << can1Baud;
mBusData[0].mBus.setSpeed(can0Baud); mBusData[0].mBus.setSpeed(can0Baud);
mBusData[1].mBus.setSpeed(can1Baud); mBusData[1].mBus.setSpeed(can1Baud);
mBusData[0].mBus.setEnabled(can0Enabled); mBusData[0].mBus.setActive(can0Enabled);
mBusData[1].mBus.setEnabled(can1Enabled); mBusData[1].mBus.setActive(can1Enabled);
mBusData[0].mConfigured = true; mBusData[0].mConfigured = true;
mBusData[1].mConfigured = true; mBusData[1].mConfigured = true;
@@ -962,7 +962,7 @@ void GVRetSerial::procRXChar(unsigned char c)
if (getNumBuses() > 2) if (getNumBuses() > 2)
{ {
mBusData[2].mBus.setSpeed(swcanBaud); mBusData[2].mBus.setSpeed(swcanBaud);
mBusData[2].mBus.setEnabled(swcanEnabled); mBusData[2].mBus.setActive(swcanEnabled);
} }
setStatus(CANCon::CONNECTED); setStatus(CANCon::CONNECTED);
+177
View File
@@ -0,0 +1,177 @@
#include <QCanBus>
#include "newconnectiondialog.h"
#include "ui_newconnectiondialog.h"
NewConnectionDialog::NewConnectionDialog(QVector<QString>* ips, QWidget *parent) :
QDialog(parent),
ui(new Ui::NewConnectionDialog),
remoteDeviceIP(ips)
{
ui->setupUi(this);
ui->rbSocketCAN->setEnabled(isSerialBusAvailable());
connect(ui->rbGVRET, &QAbstractButton::clicked, this, &NewConnectionDialog::handleConnTypeChanged);
connect(ui->rbSocketCAN, &QAbstractButton::clicked, this, &NewConnectionDialog::handleConnTypeChanged);
connect(ui->rbRemote, &QAbstractButton::clicked, this, &NewConnectionDialog::handleConnTypeChanged);
connect(ui->cbDeviceType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &NewConnectionDialog::handleDeviceTypeChanged);
connect(ui->btnOK, &QPushButton::clicked, this, &NewConnectionDialog::handleCreateButton);
ui->lblDeviceType->setHidden(true);
ui->cbDeviceType->setHidden(true);
selectSerial();
}
NewConnectionDialog::~NewConnectionDialog()
{
delete ui;
}
void NewConnectionDialog::handleCreateButton()
{
accept();
}
void NewConnectionDialog::handleConnTypeChanged()
{
if (ui->rbGVRET->isChecked()) selectSerial();
if (ui->rbSocketCAN->isChecked()) selectSocketCan();
if (ui->rbRemote->isChecked()) selectRemote();
}
void NewConnectionDialog::handleDeviceTypeChanged()
{
ui->cbPort->clear();
canDevices = QCanBus::instance()->availableDevices(ui->cbDeviceType->currentText());
for (int i = 0; i < canDevices.count(); i++)
ui->cbPort->addItem(canDevices[i].name());
}
void NewConnectionDialog::selectSerial()
{
ui->lPort->setText("Serial Port:");
ui->lblDeviceType->setHidden(true);
ui->cbDeviceType->setHidden(true);
ui->cbPort->clear();
ports = QSerialPortInfo::availablePorts();
for (int i = 0; i < ports.count(); i++)
ui->cbPort->addItem(ports[i].portName());
}
void NewConnectionDialog::selectSocketCan()
{
ui->lPort->setText("Port:");
ui->lblDeviceType->setHidden(false);
ui->cbDeviceType->setHidden(false);
ui->cbDeviceType->clear();
QStringList plugins;
plugins = QCanBus::instance()->plugins();
for (int i = 0; i < plugins.count(); i++)
ui->cbDeviceType->addItem(plugins[i]);
}
void NewConnectionDialog::selectRemote()
{
ui->lPort->setText("IP Address:");
ui->lblDeviceType->setHidden(true);
ui->cbDeviceType->setHidden(true);
ui->cbPort->clear();
foreach(QString pName, *remoteDeviceIP)
{
ui->cbPort->addItem(pName);
}
}
void NewConnectionDialog::setPortName(CANCon::type pType, QString pPortName, QString pDriver)
{
switch(pType)
{
case CANCon::GVRET_SERIAL:
ui->rbGVRET->setChecked(true);
break;
case CANCon::SERIALBUS:
ui->rbSocketCAN->setChecked(true);
//you can't configure any of the below three with socketcan so dim them out
break;
default: {}
}
/* refresh names whenever needed */
//handleConnTypeChanged();
switch(pType)
{
case CANCon::GVRET_SERIAL:
{
int idx = ui->cbPort->findText(pPortName);
if( idx<0 ) idx=0;
ui->cbPort->setCurrentIndex(idx);
break;
}
case CANCon::SERIALBUS:
{
int idx = ui->cbDeviceType->findText(pDriver);
if (idx < 0) idx = 0;
ui->cbDeviceType->setCurrentIndex(idx);
idx = ui->cbPort->findText(pPortName);
if( idx < 0 ) idx = 0;
ui->cbPort->setCurrentIndex(idx);
break;
}
case CANCon::REMOTE:
{
int idx = ui->cbPort->findText(pPortName);
if (idx > -1) ui->cbPort->setCurrentIndex(idx);
else ui->cbPort->addItem(pPortName);
break;
}
default: {}
}
}
QString NewConnectionDialog::getPortName()
{
switch( getConnectionType() ) {
case CANCon::GVRET_SERIAL:
case CANCon::SERIALBUS:
case CANCon::REMOTE:
return ui->cbPort->currentText();
default:
qDebug() << "getPortName: can't get port";
}
return "";
}
QString NewConnectionDialog::getDriverName()
{
if (getConnectionType() == CANCon::SERIALBUS)
{
return ui->cbDeviceType->currentText();
}
return "N/A";
}
CANCon::type NewConnectionDialog::getConnectionType()
{
if (ui->rbGVRET->isChecked()) return CANCon::GVRET_SERIAL;
if (ui->rbSocketCAN->isChecked()) return CANCon::SERIALBUS;
if (ui->rbRemote->isChecked()) return CANCon::REMOTE;
qDebug() << "getConnectionType: error";
return CANCon::NONE;
}
bool NewConnectionDialog::isSerialBusAvailable()
{
if (QCanBus::instance()->plugins().count() > 0) return true;
return false;
}
+47
View File
@@ -0,0 +1,47 @@
#ifndef NEWCONNECTIONDIALOG_H
#define NEWCONNECTIONDIALOG_H
#include <QDialog>
#include <QCanBusDeviceInfo>
#include <QSerialPortInfo>
#include <QDebug>
#include <QUdpSocket>
#include "canconnectionmodel.h"
#include "connections/canconnection.h"
namespace Ui {
class NewConnectionDialog;
}
class NewConnectionDialog : public QDialog
{
Q_OBJECT
public:
explicit NewConnectionDialog(QVector<QString>* ips, QWidget *parent = nullptr);
~NewConnectionDialog();
CANCon::type getConnectionType();
QString getPortName();
QString getDriverName();
public slots:
void handleConnTypeChanged();
void handleDeviceTypeChanged();
void handleCreateButton();
private:
Ui::NewConnectionDialog *ui;
QList<QSerialPortInfo> ports;
QList<QCanBusDeviceInfo> canDevices;
QVector<QString>* remoteDeviceIP;
void selectSerial();
void selectKvaser();
void selectSocketCan();
void selectRemote();
bool isSerialBusAvailable();
void setPortName(CANCon::type pType, QString pPortName, QString pDriver);
};
#endif // NEWCONNECTIONDIALOG_H
+2 -2
View File
@@ -46,7 +46,7 @@ void SerialBusConnection::piStarted()
mTimer.setInterval(1000); mTimer.setInterval(1000);
mTimer.setSingleShot(false); //keep ticking mTimer.setSingleShot(false); //keep ticking
mTimer.start(); mTimer.start();
mBusData[0].mBus.setEnabled(true); mBusData[0].mBus.setActive(true);
mBusData[0].mConfigured = true; mBusData[0].mConfigured = true;
} }
@@ -281,7 +281,7 @@ void SerialBusConnection::testConnection() {
CANBus bus; CANBus bus;
if(getBusConfig(0, bus)) if(getBusConfig(0, bus))
{ {
bus.setEnabled(true); bus.setActive(true);
setBusSettings(0, bus); setBusSettings(0, bus);
} }
+82 -166
View File
@@ -19,7 +19,7 @@
<item alignment="Qt::AlignHCenter"> <item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Connections:</string> <string>Connected Devices:</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -37,195 +37,104 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <widget class="QPushButton" name="btnNewConnection">
<item>
<widget class="QPushButton" name="btnReconnect">
<property name="text"> <property name="text">
<string>Reconnect</string> <string>Add New Device Connection</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnRemoveBus"> <widget class="QPushButton" name="btnDisconnect">
<property name="text"> <property name="text">
<string>Remove Selected Connection</string> <string>Disconnect Selected Device</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnActivateAll"> <widget class="QGroupBox" name="groupBus">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Bus Details:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QVBoxLayout" name="qhBox20">
<item>
<widget class="QTabBar" name="tabBuses" native="true"/>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text"> <property name="text">
<string>Activate All Connections</string> <string>CAN Bus Number:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QPushButton" name="btnDeactivateAll"> <widget class="QLabel" name="lblBusNum">
<property name="text"> <property name="text">
<string>Deactivate All Connections</string> <string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cbBusSpeed"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Listen Only:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="ckListenOnly">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Enable Bus:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="ckEnable">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="btnSaveBus">
<property name="text">
<string>Save Bus Settings</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="gbType">
<property name="title">
<string>Connection Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="rbGVRET">
<property name="text">
<string>GVRET Serial</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbSocketCAN">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>QT SerialBus Devices (SocketCAN, PeakCAN, etc)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbRemote">
<property name="text">
<string>Remote Host</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDeviceType">
<property name="text">
<string>Device Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbDeviceType"/>
</item>
<item>
<widget class="QLabel" name="lPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="cbPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QComboBox" name="cbPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>341</width>
<height>16777215</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="etPage">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLineEdit" name="lePort">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="btnOK">
<property name="text">
<string>Create New Connection</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignHCenter"> <item alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="ckEnableConsole"> <widget class="QCheckBox" name="ckEnableConsole">
<property name="text"> <property name="text">
@@ -299,6 +208,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QTabBar</class>
<extends>QWidget</extends>
<header>qtabbar.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>
+109
View File
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewConnectionDialog</class>
<widget class="QDialog" name="NewConnectionDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>282</height>
</rect>
</property>
<property name="windowTitle">
<string>New Connection</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="gbType">
<property name="title">
<string>Connection Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="rbGVRET">
<property name="text">
<string>Serial Connection</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbSocketCAN">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>QT SerialBus Devices (SocketCAN, PeakCAN, etc)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbRemote">
<property name="text">
<string>Network connection</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDeviceType">
<property name="text">
<string>SerialBus Device Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbDeviceType"/>
</item>
<item>
<widget class="QLabel" name="lPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Serial Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbPort">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>341</width>
<height>16777215</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOK">
<property name="text">
<string>Create New Connection</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>