2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file dialoghistory.cpp
|
2013-11-15 13:41:26 +01:00
|
|
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-08-15 22:39:00 +02:00
|
|
|
#include "dialoghistory.h"
|
|
|
|
#include "ui_dialoghistory.h"
|
2013-11-06 18:06:00 +01:00
|
|
|
#include "../geometry/varc.h"
|
|
|
|
#include "../geometry/vspline.h"
|
|
|
|
#include "../geometry/vsplinepath.h"
|
2013-09-12 16:18:31 +02:00
|
|
|
#include <QDebug>
|
2013-08-15 22:39:00 +02:00
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent)
|
|
|
|
:DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
|
|
|
|
cursorToolRecordRow(0)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
ui->setupUi(this);
|
|
|
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
|
|
|
|
FillTable();
|
|
|
|
InitialTable();
|
|
|
|
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
|
|
|
|
connect(this, &DialogHistory::ShowHistoryTool, doc, &VDomDocument::ShowHistoryTool);
|
|
|
|
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
|
|
|
|
connect(doc, &VDomDocument::haveChange, this, &DialogHistory::UpdateHistory);
|
|
|
|
connect(doc, &VDomDocument::ChangedActivDraw, this, &DialogHistory::UpdateHistory);
|
|
|
|
ShowPoint();
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
DialogHistory::~DialogHistory()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::DialogAccepted()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
|
|
|
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
emit ShowHistoryTool(id, Qt::green, false);
|
|
|
|
emit DialogClosed(QDialog::Accepted);
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::cellClicked(int row, int column)
|
|
|
|
{
|
|
|
|
if (column == 0)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
|
|
|
|
item->setIcon(QIcon());
|
|
|
|
|
|
|
|
item = ui->tableWidget->item(row, 0);
|
|
|
|
cursorRow = row;
|
|
|
|
item->setIcon(QIcon("://icon/32x32/put_after.png"));
|
|
|
|
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
disconnect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
|
|
|
|
doc->setCursor(id);
|
|
|
|
connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor);
|
2013-11-04 21:35:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
|
|
|
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
emit ShowHistoryTool(id, Qt::green, false);
|
|
|
|
|
|
|
|
cursorToolRecordRow = row;
|
|
|
|
item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
|
|
|
id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
emit ShowHistoryTool(id, Qt::green, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::ChangedCursor(qint64 id)
|
|
|
|
{
|
|
|
|
for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
|
|
|
qint64 rId = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (rId == id)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *oldCursorItem = ui->tableWidget->item(cursorRow, 0);
|
|
|
|
oldCursorItem->setIcon(QIcon());
|
|
|
|
cursorRow = i;
|
|
|
|
item->setIcon(QIcon("://icon/32x32/put_after.png"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::UpdateHistory()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
FillTable();
|
|
|
|
InitialTable();
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::FillTable()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
ui->tableWidget->clear();
|
|
|
|
QVector<VToolRecord> *history = doc->getHistory();
|
|
|
|
qint32 currentRow = -1;
|
|
|
|
qint32 count = 0;
|
|
|
|
ui->tableWidget->setRowCount(history->size());
|
2013-11-04 21:35:15 +01:00
|
|
|
for (qint32 i = 0; i< history->size(); ++i)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
VToolRecord tool = history->at(i);
|
2013-11-04 21:35:15 +01:00
|
|
|
if (tool.getNameDraw() != doc->GetNameActivDraw())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
currentRow++;
|
|
|
|
|
|
|
|
QTableWidgetItem *item = new QTableWidgetItem(QString());
|
|
|
|
item->setTextAlignment(Qt::AlignHCenter);
|
|
|
|
item->setData(Qt::UserRole, tool.getId());
|
|
|
|
ui->tableWidget->setItem(currentRow, 0, item);
|
|
|
|
|
|
|
|
QString historyRecord = Record(tool);
|
|
|
|
item = new QTableWidgetItem(historyRecord);
|
|
|
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
|
|
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
|
|
|
|
ui->tableWidget->setItem(currentRow, 1, item);
|
|
|
|
++count;
|
|
|
|
}
|
|
|
|
ui->tableWidget->setRowCount(count);
|
2013-11-04 21:35:15 +01:00
|
|
|
if (history->size()>0)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
cursorRow = currentRow;
|
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
|
|
|
|
item->setIcon(QIcon("://icon/32x32/put_after.png"));
|
|
|
|
}
|
|
|
|
ui->tableWidget->resizeColumnsToContents();
|
|
|
|
ui->tableWidget->resizeRowsToContents();
|
|
|
|
ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
QString DialogHistory::Record(const VToolRecord &tool)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QString record = QString();
|
|
|
|
qint64 basePointId = 0;
|
|
|
|
qint64 secondPointId = 0;
|
|
|
|
qint64 firstPointId = 0;
|
|
|
|
qint64 thirdPointId = 0;
|
|
|
|
qint64 p1Line1 = 0;
|
|
|
|
qint64 p2Line1 = 0;
|
|
|
|
qint64 p1Line2 = 0;
|
|
|
|
qint64 p2Line2 = 0;
|
2013-08-28 10:55:11 +02:00
|
|
|
qint64 center = 0;
|
2013-08-15 22:39:00 +02:00
|
|
|
QDomElement domElement;
|
2013-11-04 21:35:15 +01:00
|
|
|
switch ( tool.getTypeTool() )
|
|
|
|
{
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::ArrowTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::SinglePointTool:
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%1 - Base point")).arg(data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::EndLineTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(basePointId).name(),
|
|
|
|
data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::LineTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(data->GetPoint(firstPointId).name(),
|
|
|
|
data->GetPoint(secondPointId).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::AlongLineTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%3 - Point along line %1_%2")).arg(data->GetPoint(basePointId).name(),
|
|
|
|
data->GetPoint(secondPointId).name(),
|
|
|
|
data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::ShoulderPointTool:
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%1 - Point of soulder")).arg(data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::NormalTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%3 - Normal to line %1_%2")).arg(data->GetPoint(basePointId).name(),
|
|
|
|
data->GetPoint(secondPointId).name(),
|
|
|
|
data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::BisectorTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
basePointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%4 - Bisector of angle %1_%2_%3")).arg(data->GetPoint(firstPointId).name(),
|
|
|
|
data->GetPoint(basePointId).name(),
|
|
|
|
data->GetPoint(thirdPointId).name(),
|
|
|
|
data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::LineIntersectTool:
|
2013-08-15 22:39:00 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
|
|
|
|
p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
|
|
|
|
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
|
|
|
|
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
|
|
|
|
}
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("%5 - Point of intersection lines %1_%2 and %3_%4")).arg(data->GetPoint(p1Line1).name(),
|
|
|
|
data->GetPoint(p2Line1).name(),
|
|
|
|
data->GetPoint(p1Line2).name(),
|
|
|
|
data->GetPoint(p2Line2).name(),
|
2013-11-04 21:35:15 +01:00
|
|
|
data->GetPoint(tool.getId()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
break;
|
2013-11-04 21:35:15 +01:00
|
|
|
case Tool::SplineTool:
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
VSpline spl = data->GetSpline(tool.getId());
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("Curve %1_%2")).arg(data->GetPoint(spl.GetP1()).name(),
|
2013-08-15 22:39:00 +02:00
|
|
|
data->GetPoint(spl.GetP4()).name());
|
|
|
|
}
|
|
|
|
break;
|
2013-11-04 21:35:15 +01:00
|
|
|
case Tool::ArcTool:
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
VArc arc = data->GetArc(tool.getId());
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("Arc with center in point %1")).arg(data->GetPoint(arc.GetCenter()).name());
|
2013-08-15 22:39:00 +02:00
|
|
|
}
|
|
|
|
break;
|
2013-11-04 21:35:15 +01:00
|
|
|
case Tool::SplinePathTool:
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
VSplinePath splPath = data->GetSplinePath(tool.getId());
|
|
|
|
QVector<VSplinePoint> points = splPath.GetSplinePath();
|
2013-11-04 21:35:15 +01:00
|
|
|
if (points.size() != 0 )
|
|
|
|
{
|
2013-10-04 18:51:03 +02:00
|
|
|
record = QString(tr("Curve point %1")).arg(data->GetPoint(points[0].P()).name());
|
2013-11-04 21:35:15 +01:00
|
|
|
for (qint32 i = 1; i< points.size(); ++i)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QString name = QString("_%1").arg(data->GetPoint(points[i].P()).name());
|
|
|
|
record.append(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
break;
|
2013-09-27 11:17:00 +02:00
|
|
|
case Tool::PointOfContact:
|
2013-08-28 10:55:11 +02:00
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-08-28 10:55:11 +02:00
|
|
|
center = domElement.attribute("center", "").toLongLong();
|
|
|
|
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
record = QString(tr("%4 - Point of contact arc with center in point %1 and line %2_%3")).arg(
|
|
|
|
data->GetPoint(center).name(), data->GetPoint(firstPointId).name(),
|
|
|
|
data->GetPoint(secondPointId).name(), data->GetPoint(tool.getId()).name());
|
2013-08-28 10:55:11 +02:00
|
|
|
break;
|
2013-11-04 21:35:15 +01:00
|
|
|
case Tool::Height:
|
|
|
|
{
|
2013-10-18 12:03:01 +02:00
|
|
|
qint64 p1LineId = 0;
|
|
|
|
qint64 p2LineId = 0;
|
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-10-18 12:03:01 +02:00
|
|
|
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
|
|
|
p1LineId = domElement.attribute("p1Line", "").toLongLong();
|
|
|
|
p2LineId = domElement.attribute("p2Line", "").toLongLong();
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
record = QString(tr("Point of perpendical from point %1 to line %2_%3")).arg(
|
|
|
|
data->GetPoint(basePointId).name(), data->GetPoint(p1LineId).name(),
|
|
|
|
data->GetPoint(p2LineId).name());
|
2013-10-18 12:03:01 +02:00
|
|
|
break;
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
case Tool::Triangle:
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
qint64 axisP1Id = 0;
|
|
|
|
qint64 axisP2Id = 0;
|
|
|
|
domElement = doc->elementById(QString().setNum(tool.getId()));
|
2013-11-04 21:35:15 +01:00
|
|
|
if (domElement.isElement())
|
|
|
|
{
|
2013-10-18 20:20:54 +02:00
|
|
|
axisP1Id = domElement.attribute("axisP1", "").toLongLong();
|
|
|
|
axisP2Id = domElement.attribute("axisP2", "").toLongLong();
|
|
|
|
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
|
|
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
|
|
|
}
|
|
|
|
record = QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(
|
2013-11-04 21:35:15 +01:00
|
|
|
data->GetPoint(axisP1Id).name(), data->GetPoint(axisP2Id).name(),
|
2013-10-18 20:20:54 +02:00
|
|
|
data->GetPoint(firstPointId).name(), data->GetPoint(secondPointId).name());
|
|
|
|
break;
|
|
|
|
}
|
2013-09-12 16:18:31 +02:00
|
|
|
default:
|
2013-10-04 18:51:03 +02:00
|
|
|
qWarning()<<tr("Get wrong tool type. Ignore.");
|
2013-09-12 16:18:31 +02:00
|
|
|
break;
|
2013-08-15 22:39:00 +02:00
|
|
|
}
|
|
|
|
return record;
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::InitialTable()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
ui->tableWidget->setSortingEnabled(false);
|
|
|
|
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
|
2013-10-04 18:51:03 +02:00
|
|
|
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
|
2013-08-15 22:39:00 +02:00
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::ShowPoint()
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QVector<VToolRecord> *history = doc->getHistory();
|
2013-11-04 21:35:15 +01:00
|
|
|
if (history->size()>0)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(0, 1);
|
|
|
|
item->setSelected(true);
|
|
|
|
cursorToolRecordRow = 0;
|
|
|
|
item = ui->tableWidget->item(0, 0);
|
|
|
|
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
emit ShowHistoryTool(id, Qt::green, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
void DialogHistory::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
|
|
|
qint64 id = qvariant_cast<qint64>(item->data(Qt::UserRole));
|
|
|
|
emit ShowHistoryTool(id, Qt::green, false);
|
|
|
|
DialogTool::closeEvent(event);
|
|
|
|
}
|