From c7a0ac9ad20d7228171d4efe076f82de67ad97e5 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 20 Nov 2014 19:52:51 +0200 Subject: [PATCH] More new messages for log. --HG-- branch : develop --- src/app/core/vapplication.cpp | 8 +++ src/app/exception/vexception.cpp | 4 ++ src/app/main.cpp | 6 ++ src/app/mainwindow.cpp | 79 ++++++++++++++++----- src/app/mainwindow.h | 2 +- src/app/undocommands/adddet.cpp | 15 ++-- src/app/undocommands/adddetnode.cpp | 15 ++-- src/app/undocommands/addpatternpiece.cpp | 7 ++ src/app/undocommands/addtocalc.cpp | 17 +++-- src/app/undocommands/adduniondetails.cpp | 15 ++-- src/app/undocommands/deletedetail.cpp | 11 ++- src/app/undocommands/deletepatternpiece.cpp | 7 ++ src/app/undocommands/deltool.cpp | 7 ++ src/app/undocommands/movedetail.cpp | 13 +++- src/app/undocommands/movespline.cpp | 9 ++- src/app/undocommands/movesplinepath.cpp | 9 ++- src/app/undocommands/movespoint.cpp | 11 ++- src/app/undocommands/renamepp.cpp | 11 ++- src/app/undocommands/savedetailoptions.cpp | 11 ++- src/app/undocommands/savetooloptions.cpp | 11 ++- src/app/undocommands/vundocommand.h | 1 - src/app/xml/vdomdocument.cpp | 4 ++ src/app/xml/vpattern.cpp | 5 +- 23 files changed, 225 insertions(+), 53 deletions(-) diff --git a/src/app/core/vapplication.cpp b/src/app/core/vapplication.cpp index 2a2d1044a..c14a98337 100644 --- a/src/app/core/vapplication.cpp +++ b/src/app/core/vapplication.cpp @@ -46,6 +46,9 @@ #include #include #include +#include + +Q_LOGGING_CATEGORY(vApp, "v.application") //--------------------------------------------------------------------------------------------------------------------- inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) @@ -171,6 +174,7 @@ VApplication::VApplication(int &argc, char **argv) //--------------------------------------------------------------------------------------------------------------------- VApplication::~VApplication() { + qCDebug(vApp)<<"Application closing."; qInstallMessageHandler(0); // Resore the message handler delete out; @@ -188,6 +192,8 @@ VApplication::~VApplication() */ void VApplication::NewValentina(const QString &fileName) { + qCDebug(vApp)<<"Open new detached process."; + QProcess *v = new QProcess(); QStringList arguments; arguments << fileName; @@ -1980,6 +1986,8 @@ bool VApplication::SafeCopy(const QString &source, const QString &destination, Q //--------------------------------------------------------------------------------------------------------------------- void VApplication::StartLogging() { + QLoggingCategory::setFilterRules("*.debug=true\n"); + QDir logDir(LogDirPath()); if (logDir.exists() == false) { diff --git a/src/app/exception/vexception.cpp b/src/app/exception/vexception.cpp index a00b963f7..25ab65a2b 100644 --- a/src/app/exception/vexception.cpp +++ b/src/app/exception/vexception.cpp @@ -32,6 +32,9 @@ #include #include #include "../options.h" +#include + +Q_LOGGING_CATEGORY(vExcep, "v.excep") //--------------------------------------------------------------------------------------------------------------------- /** @@ -100,6 +103,7 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent) #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif + qCDebug(vExcep)<<"Critical error!"<getSettings()->value("configuration/locale", QLocale::system().name()).toString(); + qDebug()<<"Checked locale:"< #include #include +#include + +Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow") //--------------------------------------------------------------------------------------------------------------------- /** @@ -795,6 +798,7 @@ void MainWindow::showEvent( QShowEvent *event ) */ void MainWindow::closeEvent(QCloseEvent *event) { + qCDebug(vMainWindow)<<"Closing main window"; if (MaybeSave()) { FileClosedCorrect(); @@ -804,6 +808,7 @@ void MainWindow::closeEvent(QCloseEvent *event) } else { + qCDebug(vMainWindow)<<"Closing canceled."; event->ignore(); } } @@ -1152,6 +1157,7 @@ void MainWindow::ArrowTool() ui->view->setCursor(cur); helpLabel->setText(""); ui->view->setShowToolOptions(true); + qCDebug(vMainWindow)<<"Enabled arrow tool."; } //--------------------------------------------------------------------------------------------------------------------- @@ -1217,6 +1223,7 @@ void MainWindow::ActionDraw(bool checked) { if (checked) { + qCDebug(vMainWindow)<<"Show draw scene"; ui->actionDetails->setChecked(false); SaveCurrentScene(); @@ -1253,6 +1260,7 @@ void MainWindow::ActionDetails(bool checked) { if (checked) { + qCDebug(vMainWindow)<<"Show details scene"; ui->actionDraw->setChecked(false); SaveCurrentScene(); @@ -1311,7 +1319,19 @@ bool MainWindow::SaveAs() { fileName += ".val"; } - return SavePattern(fileName); + QString error; + bool result = SavePattern(fileName, error); + if (result == false) + { + QMessageBox messageBox; + messageBox.setIcon(QMessageBox::Warning); + messageBox.setInformativeText(tr("Could not save file")); + messageBox.setDefaultButton(QMessageBox::Ok); + messageBox.setDetailedText(error); + messageBox.setStandardButtons(QMessageBox::Ok); + messageBox.exec(); + } + return result; } //--------------------------------------------------------------------------------------------------------------------- @@ -1327,13 +1347,24 @@ bool MainWindow::Save() } else { - bool result = SavePattern(curFile); + QString error; + bool result = SavePattern(curFile, error); if (result) { QString autofile = curFile +".autosave"; QFile file(autofile); file.remove(); } + else + { + QMessageBox messageBox; + messageBox.setIcon(QMessageBox::Warning); + messageBox.setInformativeText(tr("Could not save file")); + messageBox.setDefaultButton(QMessageBox::Ok); + messageBox.setDetailedText(error); + messageBox.setStandardButtons(QMessageBox::Ok); + messageBox.exec(); + } return result; } } @@ -1357,6 +1388,7 @@ void MainWindow::Open() //Absolute path to last open file dir = QFileInfo(files.first()).absolutePath(); } + qCDebug(vMainWindow)<<"Run QFileDialog::getOpenFileName: dir ="<actionDetails->setChecked(false); ui->actionDetails->setEnabled(false); ui->actionDraw->setChecked(true); @@ -1439,6 +1473,7 @@ void MainWindow::FileClosedCorrect() { autofile.remove(); } + qCDebug(vMainWindow)<<"File"<ClearPropertyBrowser(); try { @@ -1904,10 +1941,10 @@ void MainWindow::MinimumScrollBar() * @param fileName pattern file name. * @return true if all is good. */ -bool MainWindow::SavePattern(const QString &fileName) +bool MainWindow::SavePattern(const QString &fileName, QString &error) { + qCDebug(vMainWindow)<<"Saving pattern file"<SaveDocument(fileName, error); if (result) { @@ -1915,17 +1952,12 @@ bool MainWindow::SavePattern(const QString &fileName) { setCurrentFile(fileName); helpLabel->setText(tr("File saved")); + qCDebug(vMainWindow)<<"File"<isWindowModified() == true) { QString autofile = curFile +".autosave"; - if (SavePattern(autofile) == false) - { - qDebug()<<"Can not save pattern"<getSettings()->value("configuration/autosave/time", 1).toInt(&ok); if (ok == false) { - autoTime = 5; + autoTime = 1; } autoSaveTimer->start(autoTime*60000); - + qCDebug(vMainWindow)<<"Autosaving each"<setAutoSaveTimer(autoSaveTimer); } @@ -2252,6 +2284,8 @@ MainWindow::~MainWindow() */ void MainWindow::LoadPattern(const QString &fileName) { + qCDebug(vMainWindow)<<"Loading new file"<setText(tr("File loaded")); + qCDebug(vMainWindow)<<"File loaded."; qApp->setOpeningPattern();// End opening file @@ -2340,6 +2376,8 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) QStringList files = qApp->getSettings()->value("restoreFileList").toStringList(); if (files.size() > 0) { + qCDebug(vMainWindow)<<"Reopen files after crash."; + QStringList restoreFiles; for (int i = 0; i < files.size(); ++i) { @@ -2361,6 +2399,8 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) QMessageBox::Yes); if (reply == QMessageBox::Yes) { + qCDebug(vMainWindow)<<"User said Yes."; + for (int i = 0; i < restoreFiles.size(); ++i) { QString error; @@ -2373,7 +2413,8 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) } else { - qDebug()<< "Could not copy "< void ApplyDialog(); - bool SavePattern(const QString &curFile); + bool SavePattern(const QString &curFile, QString &error); void AutoSavePattern(); void setCurrentFile(const QString &fileName); QString strippedName(const QString &fullFileName); diff --git a/src/app/undocommands/adddet.cpp b/src/app/undocommands/adddet.cpp index e4b29ebf6..6f2985d28 100644 --- a/src/app/undocommands/adddet.cpp +++ b/src/app/undocommands/adddet.cpp @@ -28,6 +28,9 @@ #include "adddet.h" #include "../xml/vpattern.h" +#include + +Q_LOGGING_CATEGORY(vUndoAddDetail, "v.undo.add.detail") //--------------------------------------------------------------------------------------------------------------------- AddDet::AddDet(const QDomElement &xml, VPattern *doc, QUndoCommand *parent) @@ -45,6 +48,8 @@ AddDet::~AddDet() // cppcheck-suppress unusedFunction void AddDet::undo() { + qCDebug(vUndoAddDetail)<<"Undo."; + QDomElement element; if (doc->GetActivNodeElement(VPattern::TagDetails, element)) { @@ -53,19 +58,19 @@ void AddDet::undo() { if (element.removeChild(domElement).isNull()) { - qDebug()<<"Can't delete node"; + qCDebug(vUndoAddDetail)<<"Can't delete node"; return; } } else { - qDebug()<<"Can't get node by id = "<GetActivNodeElement(VPattern::TagDetails, element)) { @@ -82,7 +89,7 @@ void AddDet::redo() } else { - qDebug()<<"Can't find tag"< + +Q_LOGGING_CATEGORY(vUndoAddDetailNode, "v.undo.add.detail.node") //--------------------------------------------------------------------------------------------------------------------- AddDetNode::AddDetNode(const QDomElement &xml, VPattern *doc, QUndoCommand *parent) @@ -44,6 +47,8 @@ AddDetNode::~AddDetNode() //--------------------------------------------------------------------------------------------------------------------- void AddDetNode::undo() { + qCDebug(vUndoAddDetailNode)<<"Undo."; + QDomElement modelingElement; if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement)) { @@ -52,19 +57,19 @@ void AddDetNode::undo() { if (modelingElement.removeChild(domElement).isNull()) { - qDebug()<<"Can't delete node"; + qCDebug(vUndoAddDetailNode)<<"Can't delete node."; return; } } else { - qDebug()<<"Can't get node by id = "<GetActivNodeElement(VPattern::TagModeling, modelingElement)) { @@ -79,7 +86,7 @@ void AddDetNode::redo() } else { - qDebug()<<"Can't find tag"< + +Q_LOGGING_CATEGORY(vUndoAddPP, "v.undo.add.pp") //--------------------------------------------------------------------------------------------------------------------- AddPatternPiece::AddPatternPiece(const QDomElement &xml, VPattern *doc, const QString &namePP, const QString &mPath, @@ -46,6 +49,8 @@ AddPatternPiece::~AddPatternPiece() //--------------------------------------------------------------------------------------------------------------------- void AddPatternPiece::undo() { + qCDebug(vUndoAddPP)<<"Undo."; + if (doc->CountPP() <= 1) { emit ClearScene(); @@ -62,6 +67,8 @@ void AddPatternPiece::undo() //--------------------------------------------------------------------------------------------------------------------- void AddPatternPiece::redo() { + qCDebug(vUndoAddPP)<<"Redo."; + if (doc->CountPP() == 0 && mPath.isEmpty() == false) { doc->CreateEmptyFile(mPath); diff --git a/src/app/undocommands/addtocalc.cpp b/src/app/undocommands/addtocalc.cpp index db5487e81..00d27682c 100644 --- a/src/app/undocommands/addtocalc.cpp +++ b/src/app/undocommands/addtocalc.cpp @@ -32,6 +32,9 @@ #include "../core/vapplication.h" #include "../widgets/vmaingraphicsscene.h" #include "../widgets/vmaingraphicsview.h" +#include + +Q_LOGGING_CATEGORY(vUndoAddToCalc, "v.undo.add.to.calc") //--------------------------------------------------------------------------------------------------------------------- AddToCalc::AddToCalc(const QDomElement &xml, VPattern *doc, QUndoCommand *parent) @@ -48,6 +51,8 @@ AddToCalc::~AddToCalc() //--------------------------------------------------------------------------------------------------------------------- void AddToCalc::undo() { + qCDebug(vUndoAddToCalc)<<"Undo."; + doc->ChangeActivPP(nameActivDraw);//User will not see this change doc->setCursor(cursor); @@ -59,19 +64,19 @@ void AddToCalc::undo() { if (calcElement.removeChild(domElement).isNull()) { - qDebug()<<"Can't delete node"; + qCDebug(vUndoAddToCalc)<<"Can't delete node."; return; } } else { - qDebug()<<"Can't get tool by id = "< 0) @@ -86,6 +91,8 @@ void AddToCalc::undo() //--------------------------------------------------------------------------------------------------------------------- void AddToCalc::redo() { + qCDebug(vUndoAddToCalc)<<"Redo."; + doc->ChangeActivPP(nameActivDraw);//User will not see this change doc->setCursor(cursor); @@ -106,14 +113,14 @@ void AddToCalc::redo() } else { - qDebug()<<"Can not find the element after which you want to insert."<< Q_FUNC_INFO; + qCDebug(vUndoAddToCalc)<<"Can not find the element after which you want to insert."; return; } } } else { - qDebug()<<"Can't find tag Calculation"<< Q_FUNC_INFO; + qCDebug(vUndoAddToCalc)<<"Can't find tag Calculation."; return; } RedoFullParsing(); diff --git a/src/app/undocommands/adduniondetails.cpp b/src/app/undocommands/adduniondetails.cpp index 99d1b4759..6e841a01b 100644 --- a/src/app/undocommands/adduniondetails.cpp +++ b/src/app/undocommands/adduniondetails.cpp @@ -28,6 +28,9 @@ #include "adduniondetails.h" #include "../xml/vpattern.h" +#include + +Q_LOGGING_CATEGORY(vUndoAddUnionDetails, "v.undo.add.union.details") //--------------------------------------------------------------------------------------------------------------------- AddUnionDetails::AddUnionDetails(const QDomElement &xml, VPattern *doc, QUndoCommand *parent) @@ -44,6 +47,8 @@ AddUnionDetails::~AddUnionDetails() //--------------------------------------------------------------------------------------------------------------------- void AddUnionDetails::undo() { + qCDebug(vUndoAddUnionDetails)<<"Undo."; + QDomElement modelingElement; if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement)) { @@ -52,19 +57,19 @@ void AddUnionDetails::undo() { if (modelingElement.removeChild(domElement).isNull()) { - qDebug()<<"Can't delete node"; + qCDebug(vUndoAddUnionDetails)<<"Can't delete node."; return; } } else { - qDebug()<<"Can't get node by id = "<GetActivNodeElement(VPattern::TagModeling, modelingElement)) { @@ -80,7 +87,7 @@ void AddUnionDetails::redo() } else { - qDebug()<<"Can't find tag"< + +Q_LOGGING_CATEGORY(vUndoDeleteDetail, "v.undo.delete.detail") //--------------------------------------------------------------------------------------------------------------------- DeleteDetail::DeleteDetail(VPattern *doc, quint32 id, QUndoCommand *parent) @@ -54,7 +57,7 @@ DeleteDetail::DeleteDetail(VPattern *doc, quint32 id, QUndoCommand *parent) } else { - qDebug()<<"Can't get detail by id = "<elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -90,7 +97,7 @@ void DeleteDetail::redo() } else { - qDebug()<<"Can't get detail by id = "< + +Q_LOGGING_CATEGORY(vUndoDeletePP, "v.undo.delete.pp") //--------------------------------------------------------------------------------------------------------------------- DeletePatternPiece::DeletePatternPiece(VPattern *doc, const QString &namePP, QUndoCommand *parent) @@ -51,6 +54,8 @@ DeletePatternPiece::~DeletePatternPiece() //--------------------------------------------------------------------------------------------------------------------- void DeletePatternPiece::undo() { + qCDebug(vUndoDeletePP)<<"Undo."; + QDomElement rootElement = doc->documentElement(); QDomNode previousPP = doc->GetPPElement(previousPPName); rootElement.insertAfter(patternPiece, previousPP); @@ -62,6 +67,8 @@ void DeletePatternPiece::undo() //--------------------------------------------------------------------------------------------------------------------- void DeletePatternPiece::redo() { + qCDebug(vUndoDeletePP)<<"Redo."; + QDomElement rootElement = doc->documentElement(); QDomElement patternPiece = doc->GetPPElement(namePP); rootElement.removeChild(patternPiece); diff --git a/src/app/undocommands/deltool.cpp b/src/app/undocommands/deltool.cpp index 5097f5a10..661ae5c63 100644 --- a/src/app/undocommands/deltool.cpp +++ b/src/app/undocommands/deltool.cpp @@ -30,6 +30,9 @@ #include "../xml/vpattern.h" #include #include "../tools/vtooldetail.h" +#include + +Q_LOGGING_CATEGORY(vUndoDeleteTool, "v.undo.delete.tool") //--------------------------------------------------------------------------------------------------------------------- DelTool::DelTool(VPattern *doc, quint32 id, QUndoCommand *parent) @@ -50,6 +53,8 @@ DelTool::~DelTool() //--------------------------------------------------------------------------------------------------------------------- void DelTool::undo() { + qCDebug(vUndoDeleteTool)<<"Undo."; + UndoDeleteAfterSibling(parentNode, siblingId); emit NeedFullParsing(); doc->SetCurrentPP(nameActivDraw); @@ -58,6 +63,8 @@ void DelTool::undo() //--------------------------------------------------------------------------------------------------------------------- void DelTool::redo() { + qCDebug(vUndoDeleteTool)<<"Redo."; + QDomElement domElement = doc->NodeById(nodeId); parentNode.removeChild(domElement); emit NeedFullParsing(); diff --git a/src/app/undocommands/movedetail.cpp b/src/app/undocommands/movedetail.cpp index bfe53d144..ef2ca2cd0 100644 --- a/src/app/undocommands/movedetail.cpp +++ b/src/app/undocommands/movedetail.cpp @@ -32,6 +32,9 @@ #include "../xml/vpattern.h" #include "../tools/vabstracttool.h" #include "../core/vapplication.h" +#include + +Q_LOGGING_CATEGORY(vUndoMoveDetail, "v.undo.move.detail") //--------------------------------------------------------------------------------------------------------------------- MoveDetail::MoveDetail(VPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene, @@ -50,7 +53,7 @@ MoveDetail::MoveDetail(VPattern *doc, const double &x, const double &y, const qu } else { - qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveDetail)<<"Can't find detail with id ="<elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -74,7 +79,7 @@ void MoveDetail::undo() } else { - qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveDetail)<<"Can't find detail with id ="<elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -98,7 +105,7 @@ void MoveDetail::redo() } else { - qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveDetail)<<"Can't find detail with id ="< #include #include "../xml/vpattern.h" +#include + +Q_LOGGING_CATEGORY(vUndoMoveSpline, "v.undo.move.spline") //--------------------------------------------------------------------------------------------------------------------- MoveSpline::MoveSpline(VPattern *doc, const VSpline *oldSpl, const VSpline &newSpl, const quint32 &id, @@ -50,12 +53,16 @@ MoveSpline::~MoveSpline() //--------------------------------------------------------------------------------------------------------------------- void MoveSpline::undo() { + qCDebug(vUndoMoveSpline)<<"Undo."; + Do(oldSpline); } //--------------------------------------------------------------------------------------------------------------------- void MoveSpline::redo() { + qCDebug(vUndoMoveSpline)<<"Redo."; + Do(newSpline); } @@ -100,7 +107,7 @@ void MoveSpline::Do(const VSpline &spl) } else { - qDebug()<<"Can't find spline with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveSpline)<<"Can't find spline with id ="< #include "../tools/drawTools/vtoolsplinepath.h" +#include + +Q_LOGGING_CATEGORY(vUndoMoveSplinePath, "v.undo.move.splinepath") //--------------------------------------------------------------------------------------------------------------------- MoveSplinePath::MoveSplinePath(VPattern *doc, const VSplinePath &oldSplPath, const VSplinePath &newSplPath, @@ -48,12 +51,16 @@ MoveSplinePath::~MoveSplinePath() //--------------------------------------------------------------------------------------------------------------------- void MoveSplinePath::undo() { + qCDebug(vUndoMoveSplinePath)<<"Undo."; + Do(oldSplinePath); } //--------------------------------------------------------------------------------------------------------------------- void MoveSplinePath::redo() { + qCDebug(vUndoMoveSplinePath)<<"Redo."; + Do(newSplinePath); } @@ -95,7 +102,7 @@ void MoveSplinePath::Do(const VSplinePath &splPath) } else { - qDebug()<<"Can't find spline path with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveSplinePath)<<"Can't find spline path with id ="< + +Q_LOGGING_CATEGORY(vUndoMoveSPoint, "v.undo.move.spoint") //--------------------------------------------------------------------------------------------------------------------- MoveSPoint::MoveSPoint(VPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene, @@ -50,7 +53,7 @@ MoveSPoint::MoveSPoint(VPattern *doc, const double &x, const double &y, const qu } else { - qDebug()<<"Can't find spoint with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoMoveSPoint)<<"Can't find spoint with id ="< #include "../options.h" #include "../xml/vpattern.h" +#include +Q_LOGGING_CATEGORY(vUndoRenamePP, "v.undo.rename.pp") //--------------------------------------------------------------------------------------------------------------------- RenamePP::RenamePP(VPattern *doc, const QString &newPPname, QComboBox *combo, QUndoCommand *parent) @@ -46,16 +48,23 @@ RenamePP::RenamePP(VPattern *doc, const QString &newPPname, QComboBox *combo, QU RenamePP::~RenamePP() {} +//--------------------------------------------------------------------------------------------------------------------- void RenamePP::undo() { + qCDebug(vUndoRenamePP)<<"Undo."; + ChangeName(newPPname, oldPPname); } +//--------------------------------------------------------------------------------------------------------------------- void RenamePP::redo() { + qCDebug(vUndoRenamePP)<<"Redo."; + ChangeName(oldPPname, newPPname); } +//--------------------------------------------------------------------------------------------------------------------- bool RenamePP::mergeWith(const QUndoCommand *command) { const RenamePP *renameCommand = static_cast(command); @@ -86,6 +95,6 @@ void RenamePP::ChangeName(const QString &oldName, const QString &newName) } else { - qWarning()<<"Can't change pattern piece name"; + qCWarning(vUndoRenamePP)<<"Can't change pattern piece name"; } } diff --git a/src/app/undocommands/savedetailoptions.cpp b/src/app/undocommands/savedetailoptions.cpp index c3776104f..4c2d7d0d4 100644 --- a/src/app/undocommands/savedetailoptions.cpp +++ b/src/app/undocommands/savedetailoptions.cpp @@ -29,6 +29,9 @@ #include "savedetailoptions.h" #include "../tools/nodeDetails/vabstractnode.h" #include +#include + +Q_LOGGING_CATEGORY(vUndoSaveDetailOptions, "v.undo.save.detail.options") SaveDetailOptions::SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VPattern *doc, const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent) @@ -45,6 +48,8 @@ SaveDetailOptions::~SaveDetailOptions() //--------------------------------------------------------------------------------------------------------------------- void SaveDetailOptions::undo() { + qCDebug(vUndoSaveDetailOptions)<<"Undo."; + QDomElement domElement = doc->elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -72,7 +77,7 @@ void SaveDetailOptions::undo() } else { - qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoSaveDetailOptions)<<"Can't find detail with id ="<elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -107,7 +114,7 @@ void SaveDetailOptions::redo() } else { - qDebug()<<"Can't find detail with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoSaveDetailOptions)<<"Can't find detail with id ="< + +Q_LOGGING_CATEGORY(vUndoSaveToolOptions, "v.undo.save.tool.options") //--------------------------------------------------------------------------------------------------------------------- SaveToolOptions::SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VPattern *doc, const quint32 &id, @@ -46,6 +49,8 @@ SaveToolOptions::~SaveToolOptions() //--------------------------------------------------------------------------------------------------------------------- void SaveToolOptions::undo() { + qCDebug(vUndoSaveToolOptions)<<"Undo."; + QDomElement domElement = doc->elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -55,7 +60,7 @@ void SaveToolOptions::undo() } else { - qDebug()<<"Can't find tool with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoSaveToolOptions)<<"Can't find tool with id ="<elementById(QString().setNum(nodeId)); if (domElement.isElement()) { @@ -72,7 +79,7 @@ void SaveToolOptions::redo() } else { - qDebug()<<"Can't find tool with id ="<< nodeId << Q_FUNC_INFO; + qCDebug(vUndoSaveToolOptions)<<"Can't find tool with id ="< #include - #include "../xml/vpattern.h" enum class UndoCommand: char { AddPatternPiece, diff --git a/src/app/xml/vdomdocument.cpp b/src/app/xml/vdomdocument.cpp index e389c006d..82625bd29 100644 --- a/src/app/xml/vdomdocument.cpp +++ b/src/app/xml/vdomdocument.cpp @@ -39,6 +39,7 @@ #include #include #include +#include //This class need for validation pattern file using XSD shema class MessageHandler : public QAbstractMessageHandler @@ -90,6 +91,8 @@ void MessageHandler::handleMessage(QtMsgType type, const QString &description, c m_sourceLocation = sourceLocation; } +Q_LOGGING_CATEGORY(vDocument, "v.document") + const QString VDomDocument::AttrId = QStringLiteral("id"); const QString VDomDocument::AttrUnit = QStringLiteral("unit"); const QString VDomDocument::UnitMM = QStringLiteral("mm"); @@ -354,6 +357,7 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa */ void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) { + qCDebug(vDocument)<<"Validation xml file"< #include #include +#include + +Q_LOGGING_CATEGORY(vPatt, "v.pattern") const QString VPattern::TagPattern = QStringLiteral("pattern"); const QString VPattern::TagCalculation = QStringLiteral("calculation"); @@ -298,6 +301,7 @@ bool VPattern::ChangeNamePP(const QString& oldName, const QString &newName) */ void VPattern::Parse(const Document &parse) { + qCDebug(vPatt)<<"Parsing pattern."; SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDetail != nullptr); QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes @@ -370,7 +374,6 @@ VDataTool *VPattern::getTool(const quint32 &id) return tools.value(id); } - //--------------------------------------------------------------------------------------------------------------------- void VPattern::ToolExists(const quint32 &id) const {