Continue creation logging system.

--HG--
branch : develop
This commit is contained in:
dismine 2014-11-24 16:51:27 +02:00
parent f62324b1b0
commit d5f3540770
4 changed files with 28 additions and 5 deletions

View File

@ -55,8 +55,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
{ {
ui->setupUi(this); ui->setupUi(this);
qCDebug(vDialog)<<"Showing variables.";
if (qApp->patternType() == MeasurementsType::Individual) if (qApp->patternType() == MeasurementsType::Individual)
{ {
qCDebug(vDialog)<<"Pattern with individual measurements.";
const QString filePath = doc->MPath(); const QString filePath = doc->MPath();
try try
{ {
@ -599,6 +601,7 @@ void DialogIncrements::OpenTable()
*/ */
void DialogIncrements::clickedToolButtonAdd() void DialogIncrements::clickedToolButtonAdd()
{ {
qCDebug(vDialog)<<"Add new increment";
ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason); ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason);
ui->tableWidgetIncrement->blockSignals(true); ui->tableWidgetIncrement->blockSignals(true);
qint32 currentRow = ui->tableWidgetIncrement->rowCount(); qint32 currentRow = ui->tableWidgetIncrement->rowCount();
@ -667,6 +670,7 @@ void DialogIncrements::clickedToolButtonRemove()
qint32 row = item->row(); qint32 row = item->row();
QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
qCDebug(vDialog)<<"Remove increment"<<itemName->text();
data->RemoveIncrement(itemName->text()); data->RemoveIncrement(itemName->text());
quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole)); quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
@ -676,6 +680,10 @@ void DialogIncrements::clickedToolButtonRemove()
QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements); QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
list.at(0).removeChild(domElement); list.at(0).removeChild(domElement);
} }
else
{
qCDebug(vDialog)<<"Could not find object with id"<<id;
}
ui->tableWidgetIncrement->removeRow(row); ui->tableWidgetIncrement->removeRow(row);
if (ui->tableWidgetIncrement->rowCount() == 0) if (ui->tableWidgetIncrement->rowCount() == 0)
@ -700,6 +708,9 @@ void DialogIncrements::clickedToolButtonRemove()
void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize, void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize,
const qreal &kheight, const QString &description) const qreal &kheight, const QString &description)
{ {
qCDebug(vDialog)<<"Saving new increment to file.";
qCDebug(vDialog)<<QString("Increment: id(%1), name(%2), base(%3), ksize(%4), kheight(%5), description(%6)")
.arg(id).arg(name).arg(base).arg(ksize).arg(kheight).arg(description);
QDomElement element = doc->createElement(VPattern::TagIncrement); QDomElement element = doc->createElement(VPattern::TagIncrement);
doc->SetAttribute(element, VDomDocument::AttrId, id); doc->SetAttribute(element, VDomDocument::AttrId, id);
@ -731,42 +742,47 @@ void DialogIncrements::HideColumns(QTableWidget *table)
*/ */
void DialogIncrements::IncrementChanged ( qint32 row, qint32 column ) void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
{ {
qCDebug(vDialog)<<"Increment changed.";
const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column); const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column);
const quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole)); const quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement() == false) if (domElement.isElement() == false)
{ {
qDebug()<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO; qCDebug(vDialog)<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
return; return;
} }
this->row = row; this->row = row;
switch (column) switch (column)
{ {
case 0: // VPattern::IncrementName case 0: // VPattern::IncrementName
qCDebug(vDialog)<<"Changed name to"<<item->text();
doc->SetAttribute(domElement, VPattern::IncrementName, item->text()); doc->SetAttribute(domElement, VPattern::IncrementName, item->text());
data->ClearVariables(VarType::Increment); data->ClearVariables(VarType::Increment);
this->column = 2; this->column = 2;
emit FullUpdateTree(Document::LiteParse); emit FullUpdateTree(Document::LiteParse);
break; break;
case 2: // VPattern::IncrementBase case 2: // VPattern::IncrementBase
qCDebug(vDialog)<<"Changed base to"<<item->text();
doc->SetAttribute(domElement, VPattern::IncrementBase, item->text()); doc->SetAttribute(domElement, VPattern::IncrementBase, item->text());
this->column = 3; this->column = 3;
emit FullUpdateTree(Document::LiteParse); emit FullUpdateTree(Document::LiteParse);
break; break;
case 3: // VPattern::IncrementKsize case 3: // VPattern::IncrementKsize
qCDebug(vDialog)<<"Changed ksize to"<<item->text();
doc->SetAttribute(domElement, VPattern::IncrementKsize, item->text()); doc->SetAttribute(domElement, VPattern::IncrementKsize, item->text());
this->column = 4; this->column = 4;
emit FullUpdateTree(Document::LiteParse); emit FullUpdateTree(Document::LiteParse);
break; break;
case 4: // VPattern::IncrementKgrowth case 4: // VPattern::IncrementKgrowth
qCDebug(vDialog)<<"Changed kheight to"<<item->text();
doc->SetAttribute(domElement, VPattern::IncrementKgrowth, item->text()); doc->SetAttribute(domElement, VPattern::IncrementKgrowth, item->text());
this->column = 5; this->column = 5;
emit FullUpdateTree(Document::LiteParse); emit FullUpdateTree(Document::LiteParse);
break; break;
case 5: // VPattern::IncrementDescription case 5: // VPattern::IncrementDescription
{ {
qCDebug(vDialog)<<"Changed description to"<<item->text();
doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text()); doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text());
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(itemName->text()); QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(itemName->text());
incr->SetDescription(item->text()); incr->SetDescription(item->text());
@ -786,6 +802,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::MeasurementChanged(qint32 row, qint32 column) void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
{ {
qCDebug(vDialog)<<"Measurement changed.";
switch (column) switch (column)
{ {
case 2:// value column case 2:// value column
@ -799,7 +816,7 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
QDomElement domElement = list.at(0).toElement(); QDomElement domElement = list.at(0).toElement();
if (domElement.isElement() == false) if (domElement.isElement() == false)
{ {
qDebug()<<"Can't find measurement "<<tag<<Q_FUNC_INFO; qCDebug(vDialog)<<"Can't find measurement "<<tag<<Q_FUNC_INFO;
return; return;
} }
@ -809,12 +826,13 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
{ {
measur->SetBase(0); measur->SetBase(0);
item->setText("0"); item->setText("0");
qDebug()<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO; qCDebug(vDialog)<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO;
} }
else else
{ {
measur->SetBase(base); measur->SetBase(base);
} }
qCDebug(vDialog)<<"Changed value to"<<base;
// Convert value to measurements table unit // Convert value to measurements table unit
base = VAbstractMeasurements::UnitConvertor(base, qApp->patternUnit(), m->MUnit()); base = VAbstractMeasurements::UnitConvertor(base, qApp->patternUnit(), m->MUnit());

View File

@ -49,6 +49,8 @@
#include <QPushButton> #include <QPushButton>
#include <QDoubleSpinBox> #include <QDoubleSpinBox>
Q_LOGGING_CATEGORY(vDialog, "v.dialog")
#define DIALOG_MAX_FORMULA_HEIGHT 64 #define DIALOG_MAX_FORMULA_HEIGHT 64
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -37,6 +37,9 @@
#include "../../core/vapplication.h" #include "../../core/vapplication.h"
#include <QPushButton> #include <QPushButton>
#include <QCheckBox> #include <QCheckBox>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(vDialog)
class QDoubleSpinBox; class QDoubleSpinBox;
class QLabel; class QLabel;

View File

@ -752,7 +752,7 @@ void VPattern::LiteParseTree(const Document &parse)
Parse(parse); Parse(parse);
break; break;
case Document::FullParse: case Document::FullParse:
qWarning()<<"Lite parsing doesn't support full parsing"; qCWarning(vXML)<<"Lite parsing doesn't support full parsing";
break; break;
default: default:
break; break;