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) void GraphingWindow::showParamsDialog(int idx = -1)
{ {
NewGraphDialog *thisDialog = new NewGraphDialog(dbcHandler); NewGraphDialog *thisDialog = new NewGraphDialog(dbcHandler);
QString oldName;
if (idx > -1) oldName = graphParams[idx].graphName; if (idx > -1)
if (idx > -1) thisDialog->setParams(graphParams[idx]); {
thisDialog->setParams(graphParams[idx]);
}
if (thisDialog->exec() == QDialog::Accepted) if (thisDialog->exec() == QDialog::Accepted)
{ {
if (idx > -1) //if there was an existing graph then delete it 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. //create a new graph with the returned parameters.
GraphParams params; GraphParams params;
thisDialog->getParams(params); thisDialog->getParams(params);
params.graphName = oldName;
createGraph(params); createGraph(params);
} }
delete thisDialog; delete thisDialog;
+2 -3
View File
@@ -57,8 +57,7 @@ void NewGraphDialog::setParams(GraphParams &params)
ui->txtScale->setText(QString::number(params.scale)); ui->txtScale->setText(QString::number(params.scale));
ui->txtStride->setText(QString::number(params.stride)); ui->txtStride->setText(QString::number(params.stride));
ui->cbSigned->setChecked(params.isSigned); ui->cbSigned->setChecked(params.isSigned);
ui->txtName->setText(params.graphName);
graphName = params.graphName;
if (params.endByte > -1) if (params.endByte > -1)
{ {
@@ -100,7 +99,7 @@ void NewGraphDialog::getParams(GraphParams &params)
if (params.mask == 0) params.mask = 0xFFFFFFFF; if (params.mask == 0) params.mask = 0xFFFFFFFF;
if (fabs(params.scale) < 0.00000001) params.scale = 1.0f; if (fabs(params.scale) < 0.00000001) params.scale = 1.0f;
if (params.stride < 1) params.stride = 1; if (params.stride < 1) params.stride = 1;
params.graphName = graphName; params.graphName = ui->txtName->text();
} }
void NewGraphDialog::loadMessages() void NewGraphDialog::loadMessages()
-1
View File
@@ -29,7 +29,6 @@ private slots:
private: private:
Ui::NewGraphDialog *ui; Ui::NewGraphDialog *ui;
DBCHandler *dbcHandler; DBCHandler *dbcHandler;
QString graphName;
}; };
#endif // NEWGRAPHDIALOG_H #endif // NEWGRAPHDIALOG_H
+27 -17
View File
@@ -18,41 +18,41 @@
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>ID:</string> <string>ID:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QLineEdit" name="txtID"/> <widget class="QLineEdit" name="txtID"/>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Data:</string> <string>Data:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="txtData"/> <widget class="QLineEdit" name="txtData"/>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Signed:</string> <string>Signed:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="cbSigned"> <widget class="QCheckBox" name="cbSigned">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@@ -62,47 +62,47 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QLineEdit" name="txtMask"/> <widget class="QLineEdit" name="txtMask"/>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Bias:</string> <string>Bias:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="QLineEdit" name="txtBias"/> <widget class="QLineEdit" name="txtBias"/>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Scale</string> <string>Scale</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QLineEdit" name="txtScale"/> <widget class="QLineEdit" name="txtScale"/>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Stride</string> <string>Stride</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="QLineEdit" name="txtStride"/> <widget class="QLineEdit" name="txtStride"/>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Color</string> <string>Color</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QPushButton" name="colorSwatch"> <widget class="QPushButton" name="colorSwatch">
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>true</bool> <bool>true</bool>
@@ -115,13 +115,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<widget class="QPushButton" name="btnAddGraph"> <widget class="QPushButton" name="btnAddGraph">
<property name="text"> <property name="text">
<string>Add this graph</string> <string>Add this graph</string>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>