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,6 +827,7 @@ class DataqSdkChannelConfWidget : public BasicDeviceConfigurationWidget
827 827
 		void resetCalibration();
828 828
 		void updateInput(Measurement measure);
829 829
 		void updateOutput(Measurement measure);
830
+		void updateHidden(bool hidden);
830 831
 	private:
831 832
 		QPushButton *startButton;
832 833
 		QPushButton *resetButton;
@@ -899,6 +900,8 @@ DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel *model,
899 900
 	QCheckBox *smoothingBox = new QCheckBox(tr("Enable smoothing"));
900 901
 	topLayout->addRow(smoothingBox);
901 902
 	layout->addLayout(topLayout);
903
+	QCheckBox *hideSeries = new QCheckBox(tr("Hide this channel"));
904
+	topLayout->addRow(hideSeries);
902 905
 	QLabel *calibrationLabel = new QLabel(tr("Calibration settings"));
903 906
 	layout->addWidget(calibrationLabel);
904 907
 	QHBoxLayout *calibrationLayout = new QHBoxLayout;
@@ -989,6 +992,10 @@ DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel *model,
989 992
 		{
990 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 1000
 	updateColumnName(columnEdit->text());
994 1001
 	updateUnits(unitSelector->currentText());
@@ -999,6 +1006,7 @@ DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel *model,
999 1006
 	updateMappedUpper(mappedUpperEdit->text());
1000 1007
 	updateClosedInterval(closedBox->isChecked());
1001 1008
 	updateSensitivity(sensitivityEdit->text());
1009
+	updateHidden(hideSeries->isChecked());
1002 1010
 	connect(columnEdit, SIGNAL(textChanged(QString)),
1003 1011
 	        this, SLOT(updateColumnName(QString)));
1004 1012
 	connect(unitSelector, SIGNAL(currentIndexChanged(QString)),
@@ -1017,6 +1025,7 @@ DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel *model,
1017 1025
 	        this, SLOT(updateClosedInterval(bool)));
1018 1026
 	connect(sensitivityEdit, SIGNAL(textChanged(QString)),
1019 1027
 	        this, SLOT(updateSensitivity(QString)));
1028
+	connect(hideSeries, SIGNAL(toggled(bool)), this, SLOT(updateHidden(bool)));
1020 1029
 	setLayout(layout);
1021 1030
 }
1022 1031
 
@@ -1077,6 +1086,11 @@ void DataqSdkChannelConfWidget::updateSensitivity(const QString &value)
1077 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 1094
 @ When calibrating a device, we must know certain information to open a
1081 1095
 connection to the appropriate hardware and know which channel we are interested
1082 1096
 in.

+ 56
- 0
src/typica.w View File

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

Loading…
Cancel
Save