More new messages for log.

--HG--
branch : develop
This commit is contained in:
dismine 2014-11-20 19:52:51 +02:00
parent c05480b7c4
commit c7a0ac9ad2
23 changed files with 225 additions and 53 deletions

View file

@ -46,6 +46,9 @@
#include <QFile>
#include <QStandardPaths>
#include <QMessageBox>
#include <QLoggingCategory>
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)
{

View file

@ -32,6 +32,9 @@
#include <QSpacerItem>
#include <QApplication>
#include "../options.h"
#include <QLoggingCategory>
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!"<<situation<<ErrorMessage()<<DetailedInformation();
msgBox.exec();
}

View file

@ -68,7 +68,13 @@ int main(int argc, char *argv[])
// Run creation log after sending crash report
app.StartLogging();
qDebug()<<"Version:"<<APP_VERSION;
qDebug()<<"Based on Qt "<<QT_VERSION_STR<<"(32 bit)";
qDebug()<<"Built on"<<__DATE__<<"at"<<__TIME__;
qDebug()<<"Command-line arguments:"<<app.arguments();
QString checkedLocale = qApp->getSettings()->value("configuration/locale", QLocale::system().name()).toString();
qDebug()<<"Checked locale:"<<checkedLocale;
QTranslator qtTranslator;
#if defined(Q_OS_WIN)

View file

@ -59,6 +59,9 @@
#include <QtGlobal>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QLoggingCategory>
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 ="<<dir<<".";
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter);
OpenPattern(filePath);
}
@ -1386,6 +1418,8 @@ void MainWindow::RepotBug()
*/
void MainWindow::Clear()
{
qCDebug(vMainWindow)<<"Reseting main window";
ui->actionDetails->setChecked(false);
ui->actionDetails->setEnabled(false);
ui->actionDraw->setChecked(true);
@ -1439,6 +1473,7 @@ void MainWindow::FileClosedCorrect()
{
autofile.remove();
}
qCDebug(vMainWindow)<<"File"<<curFile<<"closed correct.";
}
//---------------------------------------------------------------------------------------------------------------------
@ -1458,6 +1493,8 @@ void MainWindow::ResetWindow()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::FullParseFile()
{
qCDebug(vMainWindow)<<"Full parsing file";
toolOptions->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"<<fileName<<".";
QFileInfo tempInfo(fileName);
QString error;
const bool result = doc->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"<<fileName<<"saved.";
}
}
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();
qCDebug(vMainWindow)<<"Could not save file"<<fileName<<"."<<error<<".";
}
return result;
}
@ -1936,13 +1968,13 @@ bool MainWindow::SavePattern(const QString &fileName)
*/
void MainWindow::AutoSavePattern()
{
qCDebug(vMainWindow)<<"Autosaving pattern.";
if (curFile.isEmpty() == false && this->isWindowModified() == true)
{
QString autofile = curFile +".autosave";
if (SavePattern(autofile) == false)
{
qDebug()<<"Can not save pattern"<<Q_FUNC_INFO;
}
QString error;
SavePattern(autofile, error);
}
}
@ -2180,7 +2212,7 @@ void MainWindow::CreateActions()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::InitAutoSave()
{
//Autosaving file each 5 minutes
//Autosaving file each 1 minutes
delete autoSaveTimer;
autoSaveTimer = nullptr;
@ -2196,10 +2228,10 @@ void MainWindow::InitAutoSave()
qint32 autoTime = qApp->getSettings()->value("configuration/autosave/time", 1).toInt(&ok);
if (ok == false)
{
autoTime = 5;
autoTime = 1;
}
autoSaveTimer->start(autoTime*60000);
qCDebug(vMainWindow)<<"Autosaving each"<<autoTime<<"minutes.";
}
qApp->setAutoSaveTimer(autoSaveTimer);
}
@ -2252,6 +2284,8 @@ MainWindow::~MainWindow()
*/
void MainWindow::LoadPattern(const QString &fileName)
{
qCDebug(vMainWindow)<<"Loading new file"<<fileName<<".";
//We have unsaved changes or load more then one file per time
OpenNewValentina(fileName);
@ -2289,6 +2323,7 @@ void MainWindow::LoadPattern(const QString &fileName)
{
QMessageBox::critical(this, tr("Wrong units."),
tr("Application doesn't support standard table with inches."));
qCDebug(vMainWindow)<<"Application doesn't support standard table with inches.";
Clear();
return;
}
@ -2324,6 +2359,7 @@ void MainWindow::LoadPattern(const QString &fileName)
PatternWasModified(!patternModified);
}
helpLabel->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 "<<restoreFiles.at(i) +".autosave"<<"to"<<restoreFiles.at(i)<<error;
qCDebug(vMainWindow) << "Could not copy "<<restoreFiles.at(i) +".autosave"<<"to"
<<restoreFiles.at(i)<<error;
}
}
}

View file

@ -228,7 +228,7 @@ private:
void ClosedDialogWithApply(int result);
template <typename DrawTool>
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);

View file

@ -28,6 +28,9 @@
#include "adddet.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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 = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoAddDetail)<<"Can't get node by id = "<<nodeId<<".";
return;
}
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagDetails<< Q_FUNC_INFO;
qCDebug(vUndoAddDetail)<<"Can't find tag"<<VPattern::TagDetails<<".";
return;
}
emit NeedFullParsing();
@ -75,6 +80,8 @@ void AddDet::undo()
// cppcheck-suppress unusedFunction
void AddDet::redo()
{
qCDebug(vUndoAddDetail)<<"Redo.";
QDomElement element;
if (doc->GetActivNodeElement(VPattern::TagDetails, element))
{
@ -82,7 +89,7 @@ void AddDet::redo()
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagDetails<< Q_FUNC_INFO;
qCDebug(vUndoAddDetail)<<"Can't find tag"<<VPattern::TagDetails<<".";
return;
}
RedoFullParsing();

View file

@ -28,6 +28,9 @@
#include "adddetnode.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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 = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoAddDetailNode)<<"Can't get node by id = "<<nodeId<<".";
return;
}
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagModeling<< Q_FUNC_INFO;
qCDebug(vUndoAddDetailNode)<<"Can't find tag"<<VPattern::TagModeling<<".";
return;
}
}
@ -72,6 +77,8 @@ void AddDetNode::undo()
//---------------------------------------------------------------------------------------------------------------------
void AddDetNode::redo()
{
qCDebug(vUndoAddDetailNode)<<"Redo.";
QDomElement modelingElement;
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
{
@ -79,7 +86,7 @@ void AddDetNode::redo()
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagModeling<< Q_FUNC_INFO;
qCDebug(vUndoAddDetailNode)<<"Can't find tag"<<VPattern::TagModeling<<".";
return;
}
}

View file

@ -28,6 +28,9 @@
#include "addpatternpiece.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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);

View file

@ -32,6 +32,9 @@
#include "../core/vapplication.h"
#include "../widgets/vmaingraphicsscene.h"
#include "../widgets/vmaingraphicsview.h"
#include <QLoggingCategory>
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 = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoAddToCalc)<<"Can't get tool by id = "<<nodeId<<".";
return;
}
}
else
{
qDebug()<<"Can't find tag Calculation"<< Q_FUNC_INFO;
qCDebug(vUndoAddToCalc)<<"Can't find tag Calculation.";
return;
}
if (cursor > 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();

View file

@ -28,6 +28,9 @@
#include "adduniondetails.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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 = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoAddUnionDetails)<<"Can't get node by id = "<<nodeId<<".";
return;
}
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagModeling<< Q_FUNC_INFO;
qCDebug(vUndoAddUnionDetails)<<"Can't find tag"<<VPattern::TagModeling<<".";
return;
}
emit NeedFullParsing();
@ -73,6 +78,8 @@ void AddUnionDetails::undo()
//---------------------------------------------------------------------------------------------------------------------
void AddUnionDetails::redo()
{
qCDebug(vUndoAddUnionDetails)<<"Redo.";
QDomElement modelingElement;
if (doc->GetActivNodeElement(VPattern::TagModeling, modelingElement))
{
@ -80,7 +87,7 @@ void AddUnionDetails::redo()
}
else
{
qDebug()<<"Can't find tag"<<VPattern::TagModeling<< Q_FUNC_INFO;
qCDebug(vUndoAddUnionDetails)<<"Can't find tag"<<VPattern::TagModeling<<".";
return;
}
RedoFullParsing();

View file

@ -29,6 +29,9 @@
#include "deletedetail.h"
#include "../xml/vpattern.h"
#include "../tools/vtooldetail.h"
#include <QLoggingCategory>
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 = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoDeleteDetail)<<"Can't get detail by id ="<<nodeId<<".";
return;
}
}
@ -66,6 +69,8 @@ DeleteDetail::~DeleteDetail()
//---------------------------------------------------------------------------------------------------------------------
void DeleteDetail::undo()
{
qCDebug(vUndoDeleteDetail)<<"Undo.";
UndoDeleteAfterSibling(parentNode, siblingId);
emit NeedFullParsing();
}
@ -73,6 +78,8 @@ void DeleteDetail::undo()
//---------------------------------------------------------------------------------------------------------------------
void DeleteDetail::redo()
{
qCDebug(vUndoDeleteDetail)<<"Redo.";
QDomElement domElement = doc->elementById(QString().setNum(nodeId));
if (domElement.isElement())
{
@ -90,7 +97,7 @@ void DeleteDetail::redo()
}
else
{
qDebug()<<"Can't get detail by id = "<<nodeId<<Q_FUNC_INFO;
qCDebug(vUndoDeleteDetail)<<"Can't get detail by id = "<<nodeId<<".";
return;
}
}

View file

@ -29,6 +29,9 @@
#include "deletepatternpiece.h"
#include "../xml/vpattern.h"
#include "addpatternpiece.h"
#include <QLoggingCategory>
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);

View file

@ -30,6 +30,9 @@
#include "../xml/vpattern.h"
#include <QGraphicsItem>
#include "../tools/vtooldetail.h"
#include <QLoggingCategory>
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();

View file

@ -32,6 +32,9 @@
#include "../xml/vpattern.h"
#include "../tools/vabstracttool.h"
#include "../core/vapplication.h"
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}
@ -62,6 +65,8 @@ MoveDetail::~MoveDetail()
//---------------------------------------------------------------------------------------------------------------------
void MoveDetail::undo()
{
qCDebug(vUndoMoveDetail)<<"Undo.";
QDomElement domElement = doc->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 ="<<nodeId<<".";
return;
}
}
@ -82,6 +87,8 @@ void MoveDetail::undo()
//---------------------------------------------------------------------------------------------------------------------
void MoveDetail::redo()
{
qCDebug(vUndoMoveDetail)<<"Redo.";
QDomElement domElement = doc->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 ="<<nodeId<<".";
return;
}
}

View file

@ -31,6 +31,9 @@
#include <QDomElement>
#include <QGraphicsView>
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}

View file

@ -29,6 +29,9 @@
#include "movesplinepath.h"
#include <QDomElement>
#include "../tools/drawTools/vtoolsplinepath.h"
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}

View file

@ -32,6 +32,9 @@
#include "../xml/vpattern.h"
#include "../tools/vabstracttool.h"
#include "../core/vapplication.h"
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}
@ -62,12 +65,16 @@ MoveSPoint::~MoveSPoint()
//---------------------------------------------------------------------------------------------------------------------
void MoveSPoint::undo()
{
qCDebug(vUndoMoveSPoint)<<"Undo.";
Do(oldX, oldY);
}
//---------------------------------------------------------------------------------------------------------------------
void MoveSPoint::redo()
{
qCDebug(vUndoMoveSPoint)<<"Redo.";
Do(newX, newY);
}
@ -110,7 +117,7 @@ void MoveSPoint::Do(double x, double y)
}
else
{
qDebug()<<"Can't find spoint with id ="<< nodeId << Q_FUNC_INFO;
qCDebug(vUndoMoveSPoint)<<"Can't find spoint with id ="<<nodeId<<".";
return;
}
}

View file

@ -31,7 +31,9 @@
#include <QComboBox>
#include "../options.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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<const RenamePP *>(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";
}
}

View file

@ -29,6 +29,9 @@
#include "savedetailoptions.h"
#include "../tools/nodeDetails/vabstractnode.h"
#include <QGraphicsView>
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}
@ -80,6 +85,8 @@ void SaveDetailOptions::undo()
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::redo()
{
qCDebug(vUndoSaveDetailOptions)<<"Redo.";
QDomElement domElement = doc->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 ="<<nodeId<<".";
return;
}
}

View file

@ -29,6 +29,9 @@
#include "savetooloptions.h"
#include "../options.h"
#include "../xml/vpattern.h"
#include <QLoggingCategory>
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 ="<<nodeId<<".";
return;
}
}
@ -63,6 +68,8 @@ void SaveToolOptions::undo()
//---------------------------------------------------------------------------------------------------------------------
void SaveToolOptions::redo()
{
qCDebug(vUndoSaveToolOptions)<<"Redo.";
QDomElement domElement = doc->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 ="<<nodeId<<".";
return;
}
}

View file

@ -31,7 +31,6 @@
#include <QUndoCommand>
#include <QDomElement>
#include "../xml/vpattern.h"
enum class UndoCommand: char { AddPatternPiece,

View file

@ -39,6 +39,7 @@
#include <QFile>
#include <QFileInfo>
#include <QTemporaryFile>
#include <QLoggingCategory>
//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"<<fileName<<".";
QFile pattern(fileName);
if (pattern.open(QIODevice::ReadOnly) == false)
{

View file

@ -46,6 +46,9 @@
#include <QMessageBox>
#include <QUndoStack>
#include <QtCore/qmath.h>
#include <QLoggingCategory>
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
{