1 #include "QnetFixedPointDialog.h"
10 #include <QRadioButton>
12 #include <QVBoxLayout>
17 #include "SerialNumberList.h"
18 #include "ControlPoint.h"
36 QnetFixedPointDialog::QnetFixedPointDialog(
QnetTool *qnetTool, QString defaultPointId,
38 m_qnetTool = qnetTool;
40 m_avg =
new QRadioButton(
"Average Measures");
41 m_avg->setChecked(
true);
42 m_select =
new QRadioButton(
"Select Measures");
43 m_select->setChecked(
false);
52 m_ptIdLabel =
new QLabel(
"Point ID:");
53 m_ptIdValue =
new QLineEdit;
54 m_ptIdLabel->setBuddy(m_ptIdValue);
55 m_ptIdValue->setText(defaultPointId);
56 m_ptIdValue->selectAll();
57 connect(m_ptIdValue,SIGNAL(textChanged(
const QString &)),
60 QGroupBox *pointTypeGroup =
new QGroupBox(
"Point Type");
61 m_fixed =
new QRadioButton(
"Fixed");
62 m_constrained =
new QRadioButton(
"Constrained");
63 m_constrained->setChecked(
true);
64 QVBoxLayout *pointTypeLayout =
new QVBoxLayout;
65 pointTypeLayout->addWidget(m_fixed);
66 pointTypeLayout->addWidget(m_constrained);
67 pointTypeGroup->setLayout(pointTypeLayout);
69 QLabel *listLabel =
new QLabel(
"Select Files:");
71 m_fileList =
new QListWidget();
72 m_fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
76 m_okButton =
new QPushButton(
"OK");
77 m_okButton->setEnabled(
false);
78 QPushButton *cancelButton =
new QPushButton(
"Cancel");
79 QHBoxLayout *buttonLayout =
new QHBoxLayout;
80 buttonLayout->addWidget(m_okButton);
81 buttonLayout->addWidget(cancelButton);
83 connect(m_okButton, SIGNAL(clicked()),
this, SLOT(accept()));
84 connect(cancelButton, SIGNAL(clicked()),
this, SLOT(reject()));
86 QHBoxLayout *ptIdLayout =
new QHBoxLayout;
87 ptIdLayout->addWidget(m_ptIdLabel);
88 ptIdLayout->addWidget(m_ptIdValue);
90 QVBoxLayout *vLayout =
new QVBoxLayout;
91 vLayout->addLayout(ptIdLayout);
92 vLayout->addWidget(pointTypeGroup);
93 vLayout->addWidget(listLabel);
94 vLayout->addWidget(m_fileList);
95 vLayout->addLayout(buttonLayout);
98 setWindowTitle(
"Create Fixed or Constrained ControlPoint");
103 QnetFixedPointDialog::~QnetFixedPointDialog() {
109 bool QnetFixedPointDialog::isFixed()
const {
110 return m_fixed->isChecked();
114 bool QnetFixedPointDialog::isConstrained()
const {
115 return m_constrained->isChecked();
119 QString QnetFixedPointDialog::pointId()
const {
120 return m_ptIdValue->text();
124 QStringList QnetFixedPointDialog::selectedFiles()
const {
127 foreach (QListWidgetItem *fileItem, m_fileList->selectedItems()) {
128 result.append(fileItem->text());
147 int bottomMostSelectedItemIndex = 0;
152 for (
int i = 0; i < snList->
size(); i++) {
153 QString label = snList->
fileName(i);
154 QListWidgetItem *item =
new QListWidgetItem(label);
160 if (pointFiles.contains(label)) {
161 m_fileList->insertItem(bottomMostSelectedItemIndex++, item);
162 item->setSelected(
true);
165 m_fileList->addItem(item);
179 m_okButton->setEnabled(!text.isEmpty());