1 #include "QnetNewPointDialog.h"
42 m_qnetTool = qnetTool;
44 m_ptIdLabel =
new QLabel(
"Point ID:");
45 m_ptIdEdit =
new QLineEdit;
46 m_ptIdLabel->setBuddy(m_ptIdEdit);
47 m_ptIdEdit->setText(defaultPointId);
48 m_ptIdEdit->selectAll();
49 connect(m_ptIdEdit, SIGNAL(textChanged(
const QString &)),
52 QLabel *listLabel =
new QLabel(
"Select Files:");
54 m_fileList =
new QListWidget;
55 m_fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
58 m_okButton =
new QPushButton(
"OK");
63 QPushButton *cancelButton =
new QPushButton(
"Cancel");
64 QHBoxLayout *buttonLayout =
new QHBoxLayout;
65 buttonLayout->addWidget(m_okButton);
66 buttonLayout->addWidget(cancelButton);
68 connect(m_okButton, SIGNAL(clicked()),
this, SLOT(accept()));
69 connect(cancelButton, SIGNAL(clicked()),
this, SLOT(reject()));
71 QHBoxLayout *ptIdLayout =
new QHBoxLayout;
72 ptIdLayout->addWidget(m_ptIdLabel);
73 ptIdLayout->addWidget(m_ptIdEdit);
75 QVBoxLayout *vLayout =
new QVBoxLayout;
76 vLayout->addLayout(ptIdLayout);
77 vLayout->addWidget(listLabel);
78 vLayout->addWidget(m_fileList);
79 vLayout->addLayout(buttonLayout);
82 setWindowTitle(
"Create New ControlPoint");
87 QString QnetNewPointDialog::pointId()
const {
88 return m_ptIdEdit->text();
92 QStringList QnetNewPointDialog::selectedFiles()
const {
95 foreach (QListWidgetItem *fileItem, m_fileList->selectedItems()) {
96 result.append(fileItem->text());
112 int bottomMostSelectedItemIndex = 0;
115 for (
int i = 0; i < snList->
size(); i++) {
118 QString label = snList->
fileName(i);
119 QListWidgetItem *item =
new QListWidgetItem(label);
125 if (pointFiles.contains(label)) {
126 m_fileList->insertItem(bottomMostSelectedItemIndex++, item);
127 item->setSelected(
true);
130 m_fileList->addItem(item);
143 m_okButton->setEnabled(!m_ptIdEdit->text().isEmpty() &&
144 !m_qnetTool->controlNet()->
ContainsPoint(m_ptIdEdit->text()));
void enableOkButton(const QString &text)
bool ContainsPoint(QString pointId) const
int size() const
How many serial number / filename combos are in the list.
void setFiles(QStringList pointFiles)
QnetNewPointDialog(QnetTool *qnetTool, QString defaultPointId, QWidget *parent=0)
QnetNewPointDialog constructor.
QString fileName(const QString &sn)
Return a filename given a serial number.
Serial Number list generator.