8 #include "igsioCommon.h" 12 #include <vtkXMLUtilities.h> 13 #include <vtkXMLDataElement.h> 16 #include <QFileDialog> 27 connect(
ui.pushButton_Save, SIGNAL(clicked()),
this, SLOT(
SaveClicked()));
42 LOG_TRACE(
"QPlusConfigFileSaverDialog::OpenDestinationDirectoryClicked");
45 QString dirName = QFileDialog::getExistingDirectory(NULL, QString(tr(
"Select destination directory")),
m_DestinationDirectory);
53 ui.lineEdit_DestinationDirectory->setText(dirName);
54 ui.lineEdit_DestinationDirectory->setToolTip(dirName);
60 LOG_TRACE(
"QPlusConfigFileSaverDialog::SetDestinationDirectory(" << aDirectory <<
")");
71 LOG_TRACE(
"QPlusConfigFileSaverDialog::ReadConfiguration");
75 if (dataCollection == NULL)
77 LOG_ERROR(
"No DataCollection element is found in the XML tree!");
81 vtkXMLDataElement* deviceSet = dataCollection->FindNestedElementWithName(
"DeviceSet");
82 if (deviceSet == NULL)
84 LOG_ERROR(
"No DeviceSet element is found in the XML tree!");
90 if (igsioCommon::XML::SafeCheckAttributeValueInsensitive(*deviceSet,
"Name",
"", isEqual) ==
PLUS_FAIL || isEqual)
92 LOG_WARNING(
"Name attribute cannot be found in DeviceSet element!");
96 if (igsioCommon::XML::SafeCheckAttributeValueInsensitive(*deviceSet,
"Description",
"", isEqual) ==
PLUS_FAIL || isEqual)
98 LOG_WARNING(
"Description attribute cannot be found in DeviceSet element!");
103 ui.lineEdit_DeviceSetName->setText(deviceSet->GetAttribute(
"Name"));
104 ui.textEdit_Description->setText(deviceSet->GetAttribute(
"Description"));
112 LOG_TRACE(
"QPlusConfigFileSaverDialog::SaveClicked");
116 if (configRootElement == NULL)
118 LOG_ERROR(
"No configuration XML found!");
123 vtkXMLDataElement* dataCollection = configRootElement->FindNestedElementWithName(
"DataCollection");
124 if (dataCollection == NULL)
126 LOG_ERROR(
"No DataCollection element is found in the XML tree!");
130 vtkXMLDataElement* deviceSet = dataCollection->FindNestedElementWithName(
"DeviceSet");
131 if (deviceSet == NULL)
133 LOG_ERROR(
"No DeviceSet element is found in the XML tree!");
137 deviceSet->SetAttribute(
"Name",
ui.lineEdit_DeviceSetName->text().toStdString().c_str());
138 deviceSet->SetAttribute(
"Description",
ui.textEdit_Description->toPlainText().toStdString().c_str());
141 QString filter = QString(tr(
"XML files ( *.xml );;"));
143 QString fileName = QFileDialog::getSaveFileName(NULL, tr(
"Save result configuration XML"), destinationFile, filter);
145 if (!fileName.isNull())
148 LOG_INFO(
"Device set configuration saved as '" << fileName.toStdString() <<
"'");
PlusStatus ReadConfiguration()
Ui::ConfigFileSaverDialog ui
static vtkPlusConfig * GetInstance()
~QPlusConfigFileSaverDialog()
void OpenDestinationDirectoryClicked()
QString m_DestinationDirectory
void SetDestinationDirectory(const std::string &aDirectory)
virtual vtkXMLDataElement * GetDeviceSetConfigurationData()
QPlusConfigFileSaverDialog(QWidget *aParent)