Browse Source

Configuration controls for channel hiding

Neal Wilson 11 years ago
parent
commit
799722b242
2 changed files with 70 additions and 0 deletions
  1. 14
    0
      src/dataqsdk.w
  2. 56
    0
      src/typica.w

+ 14
- 0
src/dataqsdk.w View File

827
 		void resetCalibration();
827
 		void resetCalibration();
828
 		void updateInput(Measurement measure);
828
 		void updateInput(Measurement measure);
829
 		void updateOutput(Measurement measure);
829
 		void updateOutput(Measurement measure);
830
+		void updateHidden(bool hidden);
830
 	private:
831
 	private:
831
 		QPushButton *startButton;
832
 		QPushButton *startButton;
832
 		QPushButton *resetButton;
833
 		QPushButton *resetButton;
899
 	QCheckBox *smoothingBox = new QCheckBox(tr("Enable smoothing"));
900
 	QCheckBox *smoothingBox = new QCheckBox(tr("Enable smoothing"));
900
 	topLayout->addRow(smoothingBox);
901
 	topLayout->addRow(smoothingBox);
901
 	layout->addLayout(topLayout);
902
 	layout->addLayout(topLayout);
903
+	QCheckBox *hideSeries = new QCheckBox(tr("Hide this channel"));
904
+	topLayout->addRow(hideSeries);
902
 	QLabel *calibrationLabel = new QLabel(tr("Calibration settings"));
905
 	QLabel *calibrationLabel = new QLabel(tr("Calibration settings"));
903
 	layout->addWidget(calibrationLabel);
906
 	layout->addWidget(calibrationLabel);
904
 	QHBoxLayout *calibrationLayout = new QHBoxLayout;
907
 	QHBoxLayout *calibrationLayout = new QHBoxLayout;
989
 		{
992
 		{
990
 			sensitivityEdit->setText(node.attribute("value"));
993
 			sensitivityEdit->setText(node.attribute("value"));
991
 		}
994
 		}
995
+		else if(node.attribute("name") == "hidden")
996
+		{
997
+			hideSeries->setChecked(node.attribute("value") == "true");
998
+		}
992
 	}
999
 	}
993
 	updateColumnName(columnEdit->text());
1000
 	updateColumnName(columnEdit->text());
994
 	updateUnits(unitSelector->currentText());
1001
 	updateUnits(unitSelector->currentText());
999
 	updateMappedUpper(mappedUpperEdit->text());
1006
 	updateMappedUpper(mappedUpperEdit->text());
1000
 	updateClosedInterval(closedBox->isChecked());
1007
 	updateClosedInterval(closedBox->isChecked());
1001
 	updateSensitivity(sensitivityEdit->text());
1008
 	updateSensitivity(sensitivityEdit->text());
1009
+	updateHidden(hideSeries->isChecked());
1002
 	connect(columnEdit, SIGNAL(textChanged(QString)),
1010
 	connect(columnEdit, SIGNAL(textChanged(QString)),
1003
 	        this, SLOT(updateColumnName(QString)));
1011
 	        this, SLOT(updateColumnName(QString)));
1004
 	connect(unitSelector, SIGNAL(currentIndexChanged(QString)),
1012
 	connect(unitSelector, SIGNAL(currentIndexChanged(QString)),
1017
 	        this, SLOT(updateClosedInterval(bool)));
1025
 	        this, SLOT(updateClosedInterval(bool)));
1018
 	connect(sensitivityEdit, SIGNAL(textChanged(QString)),
1026
 	connect(sensitivityEdit, SIGNAL(textChanged(QString)),
1019
 	        this, SLOT(updateSensitivity(QString)));
1027
 	        this, SLOT(updateSensitivity(QString)));
1028
+	connect(hideSeries, SIGNAL(toggled(bool)), this, SLOT(updateHidden(bool)));
1020
 	setLayout(layout);
1029
 	setLayout(layout);
1021
 }
1030
 }
1022
 
1031
 
1077
 	calibrator->setSensitivity(value.toDouble());
1086
 	calibrator->setSensitivity(value.toDouble());
1078
 }
1087
 }
1079
 
1088
 
1089
+void DataqSdkChannelConfWidget::updateHidden(bool hidden)
1090
+{
1091
+	updateAttribute("hidden", hidden ? "true" : "false");
1092
+}
1093
+
1080
 @ When calibrating a device, we must know certain information to open a
1094
 @ When calibrating a device, we must know certain information to open a
1081
 connection to the appropriate hardware and know which channel we are interested
1095
 connection to the appropriate hardware and know which channel we are interested
1082
 in.
1096
 in.

+ 56
- 0
src/typica.w View File

15455
 	@[private slots@]:@/
15455
 	@[private slots@]:@/
15456
 		void updateThermocoupleType(const QString &type);
15456
 		void updateThermocoupleType(const QString &type);
15457
 		void updateColumnName(const QString &name);
15457
 		void updateColumnName(const QString &name);
15458
+		void updateHidden(bool hidden);
15458
 };
15459
 };
15459
 
15460
 
15460
 @ This follows the same pattern of previous device configuration widgets. The
15461
 @ This follows the same pattern of previous device configuration widgets. The
15480
 	typeSelector->addItem("R");
15481
 	typeSelector->addItem("R");
15481
 	typeSelector->addItem("S");
15482
 	typeSelector->addItem("S");
15482
 	layout->addRow(tr("Thermocouple Type:"), typeSelector);
15483
 	layout->addRow(tr("Thermocouple Type:"), typeSelector);
15484
+	QCheckBox *hideSeries = new QCheckBox("Hide this channel");
15485
+	layout->addRow(hideSeries);
15483
 	setLayout(layout);
15486
 	setLayout(layout);
15484
 	@<Get device configuration data for current node@>@;
15487
 	@<Get device configuration data for current node@>@;
15485
 	for(int i = 0; i < configData.size(); i++)
15488
 	for(int i = 0; i < configData.size(); i++)
15494
 		{
15497
 		{
15495
 			columnName->setText(node.attribute("value"));
15498
 			columnName->setText(node.attribute("value"));
15496
 		}
15499
 		}
15500
+		else if(node.attribute("name") == "hidden")
15501
+		{
15502
+			hideSeries->setChecked(node.attribute("value") == "true");
15503
+		}
15497
 	}
15504
 	}
15498
 	updateThermocoupleType(typeSelector->currentText());
15505
 	updateThermocoupleType(typeSelector->currentText());
15499
 	updateColumnName(columnName->text());
15506
 	updateColumnName(columnName->text());
15507
+	updateHidden(hideSeries->isChecked());
15500
 	connect(typeSelector, SIGNAL(currentIndexChanged(QString)),
15508
 	connect(typeSelector, SIGNAL(currentIndexChanged(QString)),
15501
 	        this, SLOT(updateThermocoupleType(QString)));
15509
 	        this, SLOT(updateThermocoupleType(QString)));
15502
 	connect(columnName, SIGNAL(textEdited(QString)), this, SLOT(updateColumnName(QString)));
15510
 	connect(columnName, SIGNAL(textEdited(QString)), this, SLOT(updateColumnName(QString)));
15511
+	connect(hideSeries, SIGNAL(toggled(bool)), this, SLOT(updateHidden(bool)));
15503
 }
15512
 }
15504
 
15513
 
15505
 @ Two slots are used to pass configuration changes back to the underlying XML
15514
 @ Two slots are used to pass configuration changes back to the underlying XML
15516
 	updateAttribute("columnname", name);
15525
 	updateAttribute("columnname", name);
15517
 }
15526
 }
15518
 
15527
 
15528
+void Ni9211TcConfWidget::updateHidden(bool hidden)
15529
+{
15530
+	updateAttribute("hidden", hidden ? "true" : "false");
15531
+}
15532
+
15519
 @ These three widgets need to be registered so the configuration widget can
15533
 @ These three widgets need to be registered so the configuration widget can
15520
 instantiate them when the nodes are selected.
15534
 instantiate them when the nodes are selected.
15521
 
15535
 
15668
 		void updateDeviceId(const QString &newId);
15682
 		void updateDeviceId(const QString &newId);
15669
 		void updateThermocoupleType(const QString &type);
15683
 		void updateThermocoupleType(const QString &type);
15670
 		void updateColumnName(const QString &name);
15684
 		void updateColumnName(const QString &name);
15685
+		void updateHidden(bool hidden);
15671
 };
15686
 };
15672
 
15687
 
15673
 @ The implementation is similar to the other configuration widgets.
15688
 @ The implementation is similar to the other configuration widgets.
15692
 	typeSelector->addItem("R");
15707
 	typeSelector->addItem("R");
15693
 	typeSelector->addItem("S");
15708
 	typeSelector->addItem("S");
15694
 	layout->addRow(tr("Thermocouple Type:"), typeSelector);
15709
 	layout->addRow(tr("Thermocouple Type:"), typeSelector);
15710
+	QCheckBox *hideSeries = new QCheckBox(tr("Hide this channel"));
15711
+	layout->addRow(hideSeries);
15695
 	@<Get device configuration data for current node@>@;
15712
 	@<Get device configuration data for current node@>@;
15696
 	for(int i = 0; i < configData.size(); i++)
15713
 	for(int i = 0; i < configData.size(); i++)
15697
 	{
15714
 	{
15708
 		{
15725
 		{
15709
 			columnName->setText(node.attribute("value"));
15726
 			columnName->setText(node.attribute("value"));
15710
 		}
15727
 		}
15728
+		else if(node.attribute("name") == "hidden")
15729
+		{
15730
+			hideSeries->setChecked(node.attribute("value") == "true");
15731
+		}
15711
 	}
15732
 	}
15712
 	updateDeviceId(deviceId->text());
15733
 	updateDeviceId(deviceId->text());
15713
 	updateThermocoupleType(typeSelector->currentText());
15734
 	updateThermocoupleType(typeSelector->currentText());
15714
 	updateColumnName(columnName->text());
15735
 	updateColumnName(columnName->text());
15736
+	updateHidden(hideSeries->isChecked());
15715
 	connect(deviceId, SIGNAL(textEdited(QString)), this, SLOT(updateDeviceId(QString)));
15737
 	connect(deviceId, SIGNAL(textEdited(QString)), this, SLOT(updateDeviceId(QString)));
15716
 	connect(typeSelector, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateThermocoupleType(QString)));
15738
 	connect(typeSelector, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateThermocoupleType(QString)));
15717
 	connect(columnName, SIGNAL(textEdited(QString)), this, SLOT(updateColumnName(QString)));
15739
 	connect(columnName, SIGNAL(textEdited(QString)), this, SLOT(updateColumnName(QString)));
15718
 	setLayout(layout);
15740
 	setLayout(layout);
15741
+	connect(hideSeries, SIGNAL(toggled(bool)), this, SLOT(updateHidden(bool)));
15719
 }
15742
 }
15720
 
15743
 
15721
 void NiDaqMxTc01ConfWidget::updateDeviceId(const QString &newId)
15744
 void NiDaqMxTc01ConfWidget::updateDeviceId(const QString &newId)
15733
 	updateAttribute("columnname", name);
15756
 	updateAttribute("columnname", name);
15734
 }
15757
 }
15735
 
15758
 
15759
+void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
15760
+{
15761
+	updateAttribute("hidden", hidden ? "true" : "false");
15762
+}
15763
+
15736
 @ These configuration widgets need to be registered so they can be instantiated
15764
 @ These configuration widgets need to be registered so they can be instantiated
15737
 in response to node selections.
15765
 in response to node selections.
15738
 
15766
 
17701
 		void updateSVWriteAddress(int address);
17729
 		void updateSVWriteAddress(int address);
17702
 		void updatePVColumnName(const QString &name);
17730
 		void updatePVColumnName(const QString &name);
17703
 		void updateSVColumnName(const QString &name);
17731
 		void updateSVColumnName(const QString &name);
17732
+		void updatePVHidden(bool hidden);
17733
+		void updateSVHidden(bool hidden);
17704
 	private:@/
17734
 	private:@/
17705
 		PortSelector *port;
17735
 		PortSelector *port;
17706
 		BaudSelector *baud;
17736
 		BaudSelector *baud;
17792
 	QFormLayout *pVSection = new QFormLayout;
17822
 	QFormLayout *pVSection = new QFormLayout;
17793
 	pVSection->addRow(tr("Value relative address:"), pVAddress);
17823
 	pVSection->addRow(tr("Value relative address:"), pVAddress);
17794
 	pVSection->addRow(tr("PV column name:"), pVColumnName);
17824
 	pVSection->addRow(tr("PV column name:"), pVColumnName);
17825
+	QCheckBox *pVHideBox = new QCheckBox(tr("Hide this channel"));
17826
+	pVSection->addRow(pVHideBox);
17795
 	QGroupBox *processValueBox = new QGroupBox(tr("Process Value"));
17827
 	QGroupBox *processValueBox = new QGroupBox(tr("Process Value"));
17796
 	processValueBox->setLayout(pVSection);
17828
 	processValueBox->setLayout(pVSection);
17797
 	seriesLayout->addWidget(processValueBox);
17829
 	seriesLayout->addWidget(processValueBox);
17812
 	sVSection->addRow(tr("Upper limit:"), sVUpper);
17844
 	sVSection->addRow(tr("Upper limit:"), sVUpper);
17813
 	sVSection->addRow(tr("Output set value:"), sVWritable);
17845
 	sVSection->addRow(tr("Output set value:"), sVWritable);
17814
 	sVSection->addRow(tr("Output relative address:"), sVOutputAddr);
17846
 	sVSection->addRow(tr("Output relative address:"), sVOutputAddr);
17847
+	QCheckBox *sVHideBox = new QCheckBox(tr("Hide this channel"));
17848
+	sVSection->addRow(sVHideBox);
17815
 	QGroupBox *setValueBox = new QGroupBox(tr("Set Value"));
17849
 	QGroupBox *setValueBox = new QGroupBox(tr("Set Value"));
17816
 	setValueBox->setLayout(sVSection);
17850
 	setValueBox->setLayout(sVSection);
17817
 	seriesLayout->addWidget(setValueBox);
17851
 	seriesLayout->addWidget(setValueBox);
17970
 		{
18004
 		{
17971
 			sVColumnName->setText(node.attribute("value"));
18005
 			sVColumnName->setText(node.attribute("value"));
17972
 		}
18006
 		}
18007
+		else if(node.attribute("name") == "pvhidden")
18008
+		{
18009
+			pVHideBox->setChecked(node.attribute("value") == "true");
18010
+		}
18011
+		else if(node.attribute("name") == "svhidden")
18012
+		{
18013
+			sVHideBox->setChecked(node.attribute("value") == "true");
18014
+		}
17973
 	}
18015
 	}
17974
 	updatePort(port->currentText());
18016
 	updatePort(port->currentText());
17975
 	updateBaudRate(baud->currentText());
18017
 	updateBaudRate(baud->currentText());
17997
 	updateSVWriteAddress(sVOutputAddr->value());
18039
 	updateSVWriteAddress(sVOutputAddr->value());
17998
 	updatePVColumnName(pVColumnName->text());
18040
 	updatePVColumnName(pVColumnName->text());
17999
 	updateSVColumnName(sVColumnName->text());
18041
 	updateSVColumnName(sVColumnName->text());
18042
+	updatePVHidden(pVHideBox->isChecked());
18043
+	updateSVHidden(sVHideBox->isChecked());
18000
 	connect(port, SIGNAL(currentIndexChanged(QString)), this, SLOT(updatePort(QString)));
18044
 	connect(port, SIGNAL(currentIndexChanged(QString)), this, SLOT(updatePort(QString)));
18001
 	connect(port, SIGNAL(editTextChanged(QString)), this, SLOT(updatePort(QString)));
18045
 	connect(port, SIGNAL(editTextChanged(QString)), this, SLOT(updatePort(QString)));
18002
 	connect(baud, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateBaudRate(QString)));
18046
 	connect(baud, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateBaudRate(QString)));
18024
 	connect(sVOutputAddr, SIGNAL(valueChanged(int)), this, SLOT(updateSVWriteAddress(int)));
18068
 	connect(sVOutputAddr, SIGNAL(valueChanged(int)), this, SLOT(updateSVWriteAddress(int)));
18025
 	connect(pVColumnName, SIGNAL(textEdited(QString)), this, SLOT(updatePVColumnName(QString)));
18069
 	connect(pVColumnName, SIGNAL(textEdited(QString)), this, SLOT(updatePVColumnName(QString)));
18026
 	connect(sVColumnName, SIGNAL(textEdited(QString)), this, SLOT(updateSVColumnName(QString)));
18070
 	connect(sVColumnName, SIGNAL(textEdited(QString)), this, SLOT(updateSVColumnName(QString)));
18071
+	connect(pVHideBox, SIGNAL(toggled(bool)), this, SLOT(updatePVHidden(bool)));
18072
+	connect(sVHideBox, SIGNAL(toggled(bool)), this, SLOT(updateSVHidden(bool)));
18027
 	layout->addWidget(form);
18073
 	layout->addWidget(form);
18028
 	setLayout(layout);
18074
 	setLayout(layout);
18029
 }
18075
 }
18158
 	updateAttribute("svcolname", name);
18204
 	updateAttribute("svcolname", name);
18159
 }
18205
 }
18160
 
18206
 
18207
+void ModbusConfigurator::updatePVHidden(bool hidden)
18208
+{
18209
+	updateAttribute("pvhidden", hidden ? "true" : "false");
18210
+}
18211
+
18212
+void ModbusConfigurator::updateSVHidden(bool hidden)
18213
+{
18214
+	updateAttribute("svhidden", hidden ? "true" : "false");
18215
+}
18216
+
18161
 @ This is registered with the configuration system.
18217
 @ This is registered with the configuration system.
18162
 
18218
 
18163
 @<Register device configuration widgets@>=
18219
 @<Register device configuration widgets@>=

Loading…
Cancel
Save