More implementation of the signal editor. It is nearly 100% functional to edit signals themselves. Adding new signals and adding/editing values still to go.
This commit is contained in:
+2
-1
@@ -73,4 +73,5 @@ FORMS += mainwindow.ui \
|
|||||||
DISTFILES +=
|
DISTFILES +=
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
icons.qrc
|
icons.qrc \
|
||||||
|
images.qrc
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CONFIG
|
#ifndef CONFIG
|
||||||
#define CONFIG
|
#define CONFIG
|
||||||
|
|
||||||
#define VERSION 120
|
#define VERSION 121
|
||||||
|
|
||||||
//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
|
||||||
|
|||||||
+115
-11
@@ -13,6 +13,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
|||||||
|
|
||||||
dbcHandler = handler;
|
dbcHandler = handler;
|
||||||
dbcMessage = NULL;
|
dbcMessage = NULL;
|
||||||
|
currentSignal = NULL;
|
||||||
|
|
||||||
QStringList headers2;
|
QStringList headers2;
|
||||||
headers2 << "Value" << "Text";
|
headers2 << "Value" << "Text";
|
||||||
@@ -22,7 +23,8 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
|||||||
ui->valuesTable->setHorizontalHeaderLabels(headers2);
|
ui->valuesTable->setHorizontalHeaderLabels(headers2);
|
||||||
ui->valuesTable->horizontalHeader()->setStretchLastSection(true);
|
ui->valuesTable->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
ui->comboType->addItem("INTEGER");
|
ui->comboType->addItem("UNSIGNED INTEGER");
|
||||||
|
ui->comboType->addItem("SIGNED INTEGER");
|
||||||
ui->comboType->addItem("SINGLE PRECISION");
|
ui->comboType->addItem("SINGLE PRECISION");
|
||||||
ui->comboType->addItem("DOUBLE PRECISION");
|
ui->comboType->addItem("DOUBLE PRECISION");
|
||||||
ui->comboType->addItem("STRING");
|
ui->comboType->addItem("STRING");
|
||||||
@@ -34,6 +36,104 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
|||||||
|
|
||||||
connect(ui->signalsList, SIGNAL(currentRowChanged(int)), this, SLOT(clickSignalList(int)));
|
connect(ui->signalsList, SIGNAL(currentRowChanged(int)), this, SLOT(clickSignalList(int)));
|
||||||
connect(ui->bitfield, SIGNAL(gridClicked(int,int)), this, SLOT(bitfieldClicked(int,int)));
|
connect(ui->bitfield, SIGNAL(gridClicked(int,int)), this, SLOT(bitfieldClicked(int,int)));
|
||||||
|
|
||||||
|
//now with 100% more lambda expressions just to make it interesting (and shorter, and easier...)
|
||||||
|
connect(ui->cbIntelFormat, &QCheckBox::toggled,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->comboReceiver, &QComboBox::currentTextChanged,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
currentSignal->receiver = dbcHandler->findNodeByName(ui->comboReceiver->currentText());
|
||||||
|
});
|
||||||
|
connect(ui->comboType, &QComboBox::currentTextChanged,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
switch (ui->comboType->currentIndex())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
currentSignal->valType = UNSIGNED_INT;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
currentSignal->valType = SIGNED_INT;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
currentSignal->valType = SP_FLOAT;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
currentSignal->valType = DP_FLOAT;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
currentSignal->valType = STRING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(ui->txtBias, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
bool result;
|
||||||
|
temp = ui->txtBias->text().toDouble();
|
||||||
|
if (result) currentSignal->bias = temp;
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->txtMaxVal, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
bool result;
|
||||||
|
temp = ui->txtMaxVal->text().toDouble();
|
||||||
|
if (result) currentSignal->max = temp;
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->txtMinVal, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
bool result;
|
||||||
|
temp = ui->txtMinVal->text().toDouble();
|
||||||
|
if (result) currentSignal->min = temp;
|
||||||
|
});
|
||||||
|
connect(ui->txtScale, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
bool result;
|
||||||
|
temp = ui->txtScale->text().toDouble();
|
||||||
|
if (result) currentSignal->factor = temp;
|
||||||
|
});
|
||||||
|
connect(ui->txtComment, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
currentSignal->comment = ui->txtComment->text();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->txtUnitName, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
currentSignal->unitName = ui->txtUnitName->text();
|
||||||
|
});
|
||||||
|
connect(ui->txtBitLength, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
int temp;
|
||||||
|
temp = ui->txtBitLength->text().toInt();
|
||||||
|
if (temp < 0) return;
|
||||||
|
if (temp > 63) return;
|
||||||
|
currentSignal->signalSize = temp;
|
||||||
|
fillSignalForm(currentSignal);
|
||||||
|
});
|
||||||
|
connect(ui->txtName, &QLineEdit::editingFinished,
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
currentSignal->name = ui->txtName->text();
|
||||||
|
//need to update the list too.
|
||||||
|
//ui->signalsList->currentItem()->setText(currentSignal->name);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBCSignalEditor::~DBCSignalEditor()
|
DBCSignalEditor::~DBCSignalEditor()
|
||||||
@@ -78,10 +178,12 @@ void DBCSignalEditor::showEvent(QShowEvent* event)
|
|||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
|
|
||||||
refreshSignalsList();
|
refreshSignalsList();
|
||||||
|
currentSignal = NULL;
|
||||||
if (dbcMessage->msgSignals.count() > 0)
|
if (dbcMessage->msgSignals.count() > 0)
|
||||||
{
|
{
|
||||||
fillSignalForm(&dbcMessage->msgSignals[0]);
|
currentSignal = &dbcMessage->msgSignals[0];
|
||||||
fillValueTable(&dbcMessage->msgSignals[0]);
|
fillSignalForm(currentSignal);
|
||||||
|
fillValueTable(currentSignal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,18 +243,20 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
|
|||||||
switch (sig->valType)
|
switch (sig->valType)
|
||||||
{
|
{
|
||||||
case UNSIGNED_INT:
|
case UNSIGNED_INT:
|
||||||
case SIGNED_INT:
|
|
||||||
ui->comboType->setCurrentIndex(0);
|
ui->comboType->setCurrentIndex(0);
|
||||||
break;
|
break;
|
||||||
case SP_FLOAT:
|
case SIGNED_INT:
|
||||||
ui->comboType->setCurrentIndex(1);
|
ui->comboType->setCurrentIndex(1);
|
||||||
break;
|
break;
|
||||||
case DP_FLOAT:
|
case SP_FLOAT:
|
||||||
ui->comboType->setCurrentIndex(2);
|
ui->comboType->setCurrentIndex(2);
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case DP_FLOAT:
|
||||||
ui->comboType->setCurrentIndex(3);
|
ui->comboType->setCurrentIndex(3);
|
||||||
break;
|
break;
|
||||||
|
case STRING:
|
||||||
|
ui->comboType->setCurrentIndex(4);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ui->comboReceiver->count(); i++)
|
for (int i = 0; i < ui->comboReceiver->count(); i++)
|
||||||
@@ -187,6 +291,7 @@ void DBCSignalEditor::clickSignalList(int row)
|
|||||||
//qDebug() << ui->signalsList->item(row)->text();
|
//qDebug() << ui->signalsList->item(row)->text();
|
||||||
DBC_SIGNAL *thisSig = dbcHandler->findSignalByName(dbcMessage, ui->signalsList->item(row)->text());
|
DBC_SIGNAL *thisSig = dbcHandler->findSignalByName(dbcMessage, ui->signalsList->item(row)->text());
|
||||||
if (thisSig == NULL) return;
|
if (thisSig == NULL) return;
|
||||||
|
currentSignal = thisSig;
|
||||||
fillSignalForm(thisSig);
|
fillSignalForm(thisSig);
|
||||||
fillValueTable(thisSig);
|
fillValueTable(thisSig);
|
||||||
|
|
||||||
@@ -195,8 +300,7 @@ void DBCSignalEditor::clickSignalList(int row)
|
|||||||
void DBCSignalEditor::bitfieldClicked(int x, int y)
|
void DBCSignalEditor::bitfieldClicked(int x, int y)
|
||||||
{
|
{
|
||||||
int bit = (x) + (y * 8);
|
int bit = (x) + (y * 8);
|
||||||
DBC_SIGNAL *thisSig = dbcHandler->findSignalByIdx(dbcMessage, ui->signalsList->currentRow());
|
if (currentSignal == NULL) return;
|
||||||
if (thisSig == NULL) return;
|
currentSignal->startBit = bit;
|
||||||
thisSig->startBit = bit;
|
fillSignalForm(currentSignal);
|
||||||
fillSignalForm(thisSig);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ private:
|
|||||||
Ui::DBCSignalEditor *ui;
|
Ui::DBCSignalEditor *ui;
|
||||||
DBCHandler *dbcHandler;
|
DBCHandler *dbcHandler;
|
||||||
DBC_MESSAGE *dbcMessage;
|
DBC_MESSAGE *dbcMessage;
|
||||||
|
DBC_SIGNAL *currentSignal;
|
||||||
|
|
||||||
void refreshSignalsList();
|
void refreshSignalsList();
|
||||||
void fillSignalForm(DBC_SIGNAL *sig);
|
void fillSignalForm(DBC_SIGNAL *sig);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>images/LaunchScreen.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
Reference in New Issue
Block a user