From f62324b1b0a323a424028198adc29134a6f0d931 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 24 Nov 2014 15:51:07 +0200 Subject: [PATCH] Continue creation logging system. --HG-- branch : develop --- .../dialogs/app/dialogstandardmeasurements.cpp | 14 ++++++++++++-- src/app/mainwindow.cpp | 17 ++++++++++++++++- src/app/xml/vdomdocument.cpp | 9 ++++++++- src/app/xml/vpattern.cpp | 7 ++++++- 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/app/dialogs/app/dialogstandardmeasurements.cpp b/src/app/dialogs/app/dialogstandardmeasurements.cpp index fb0385b24..e6701d4b5 100644 --- a/src/app/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/app/dialogs/app/dialogstandardmeasurements.cpp @@ -34,6 +34,9 @@ #include "../../xml/vstandardmeasurements.h" #include "../../core/vapplication.h" #include "../../container/vcontainer.h" +#include + +Q_LOGGING_CATEGORY(vStMeasur, "v.st.measurements") //--------------------------------------------------------------------------------------------------------------------- DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, @@ -57,6 +60,7 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected); } + qCDebug(vStMeasur)<<"Pattern piece name"<<_name; ui->lineEditName->setText(_name); LoadStandardTables(); @@ -143,6 +147,7 @@ void DialogStandardMeasurements::CheckState() //--------------------------------------------------------------------------------------------------------------------- void DialogStandardMeasurements::LoadStandardTables() { + qCDebug(vStMeasur)<<"Loading standard table."; QStringList filters{"*.vst"}; QDir tablesDir(qApp->pathToTables()); tablesDir.setNameFilters(filters); @@ -151,11 +156,13 @@ void DialogStandardMeasurements::LoadStandardTables() const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); if (allFiles.isEmpty() == true) { + qCDebug(vStMeasur)<<"Can't find standard measurements in path"<pathToTables(); ui->comboBoxTables->clear(); CheckState(); return; } + qCDebug(vStMeasur)<<"Was found"<STDescription(m.Id()); if (trDesc.isEmpty() == false) { + qCDebug(vStMeasur)<<"Adding user table from"<comboBoxTables->addItem(trDesc, QVariant(fi.absoluteFilePath())); } else if (m.Description().isEmpty() == false) { + qCDebug(vStMeasur)<<"Adding table with id"<comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath())); } } } catch (VException &e) { - qDebug()<<"File error."<count()+1); + qCDebug(vMainWindow)<<"Generated PP name:"<count() == 0) { + qCDebug(vMainWindow)<<"First PP"; DialogMeasurements measurements(this); if (measurements.exec() == QDialog::Rejected) { + qCDebug(vMainWindow)<<"Creation PP was canceled"; return; } if (measurements.type() == MeasurementsType::Standard) { + qCDebug(vMainWindow)<<"PP with standard measurements"; qApp->setPatternType(MeasurementsType::Standard); DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this); if (stMeasurements.exec() == QDialog::Accepted) { patternPieceName = stMeasurements.name(); + qCDebug(vMainWindow)<<"PP name:"<count(); patternPieceName = PatternPieceName(patternPieceName); + qCDebug(vMainWindow)<<"PP name:"<MPath(); } if (doc->appendPP(patternPieceName) == false) { - qDebug()<<"Error creating pattern piece with the name "<blockSignals(true); diff --git a/src/app/xml/vdomdocument.cpp b/src/app/xml/vdomdocument.cpp index 1dce30c7d..56ecdcc94 100644 --- a/src/app/xml/vdomdocument.cpp +++ b/src/app/xml/vdomdocument.cpp @@ -375,7 +375,14 @@ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) MessageHandler messageHandler; QXmlSchema sch; sch.setMessageHandler(&messageHandler); - sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName())); + if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false) + { + pattern.close(); + fileSchema.close(); + const QString errorMsg(tr("Could not load schema file.").arg(fileSchema.fileName())); + throw VException(errorMsg); + } + qCDebug(vXML)<<"Schema loaded."; bool errorOccurred = false; if (sch.isValid() == false) diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index f599ef77e..239b2709f 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -2463,13 +2463,16 @@ QString VPattern::GenerateLabel(const LabelType &type) const } ++i; } + qCDebug(vXML)<<"Point label:"<IsUnique(name) == false); + qCDebug(vXML)<<"Point label:"<(type); return QString(); }