Fix to allow proper setting of the graph name (editing within the new graph window too!)

This commit is contained in:
Collin Kidder
2015-08-09 19:51:48 -04:00
parent b3d0b76cc6
commit 7b2f36aea3
4 changed files with 35 additions and 25 deletions
+6 -4
View File
@@ -481,9 +481,12 @@ void GraphingWindow::loadDefinitions()
void GraphingWindow::showParamsDialog(int idx = -1)
{
NewGraphDialog *thisDialog = new NewGraphDialog(dbcHandler);
QString oldName;
if (idx > -1) oldName = graphParams[idx].graphName;
if (idx > -1) thisDialog->setParams(graphParams[idx]);
if (idx > -1)
{
thisDialog->setParams(graphParams[idx]);
}
if (thisDialog->exec() == QDialog::Accepted)
{
if (idx > -1) //if there was an existing graph then delete it
@@ -494,7 +497,6 @@ void GraphingWindow::showParamsDialog(int idx = -1)
//create a new graph with the returned parameters.
GraphParams params;
thisDialog->getParams(params);
params.graphName = oldName;
createGraph(params);
}
delete thisDialog;
+2 -3
View File
@@ -57,8 +57,7 @@ void NewGraphDialog::setParams(GraphParams &params)
ui->txtScale->setText(QString::number(params.scale));
ui->txtStride->setText(QString::number(params.stride));
ui->cbSigned->setChecked(params.isSigned);
graphName = params.graphName;
ui->txtName->setText(params.graphName);
if (params.endByte > -1)
{
@@ -100,7 +99,7 @@ void NewGraphDialog::getParams(GraphParams &params)
if (params.mask == 0) params.mask = 0xFFFFFFFF;
if (fabs(params.scale) < 0.00000001) params.scale = 1.0f;
if (params.stride < 1) params.stride = 1;
params.graphName = graphName;
params.graphName = ui->txtName->text();
}
void NewGraphDialog::loadMessages()
-1
View File
@@ -29,7 +29,6 @@ private slots:
private:
Ui::NewGraphDialog *ui;
DBCHandler *dbcHandler;
QString graphName;
};
#endif // NEWGRAPHDIALOG_H
+27 -17
View File
@@ -18,41 +18,41 @@
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="txtID"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Data:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="txtData"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Signed:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="cbSigned">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
@@ -62,47 +62,47 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLineEdit" name="txtMask"/>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bias:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="txtBias"/>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="txtScale"/>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Stride</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLineEdit" name="txtStride"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QPushButton" name="colorSwatch">
<property name="autoFillBackground">
<bool>true</bool>
@@ -115,13 +115,23 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QPushButton" name="btnAddGraph">
<property name="text">
<string>Add this graph</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Name:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtName"/>
</item>
</layout>
</item>
<item>