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 mainwindow.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)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-06-20 16:09:50 +02:00
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
2013-08-05 10:37:56 +02:00
|
|
|
|
#include "geometry/vspline.h"
|
2014-01-28 19:53:35 +01:00
|
|
|
|
#include "geometry/vequidistant.h"
|
2013-09-23 14:08:06 +02:00
|
|
|
|
#include "exception/vexceptionobjecterror.h"
|
|
|
|
|
#include "exception/vexceptionconversionerror.h"
|
|
|
|
|
#include "exception/vexceptionemptyparameter.h"
|
2014-03-03 18:32:38 +01:00
|
|
|
|
#include "exception/vexceptionwrongid.h"
|
2014-06-24 10:23:39 +02:00
|
|
|
|
#include "exception/vexceptionundo.h"
|
2013-10-23 12:40:51 +02:00
|
|
|
|
#include "version.h"
|
2014-03-24 16:02:57 +01:00
|
|
|
|
#include "xml/vstandardmeasurements.h"
|
2014-06-08 20:10:57 +02:00
|
|
|
|
#include "xml/vindividualmeasurements.h"
|
2014-06-04 14:14:57 +02:00
|
|
|
|
#include "widgets/vapplication.h"
|
2014-06-24 10:23:39 +02:00
|
|
|
|
#include "widgets/undoevent.h"
|
2013-06-20 16:09:50 +02:00
|
|
|
|
|
2013-11-21 13:05:26 +01:00
|
|
|
|
#include <QInputDialog>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QShowEvent>
|
|
|
|
|
#include <QScrollBar>
|
|
|
|
|
#include <QFileDialog>
|
2014-01-19 11:00:20 +01:00
|
|
|
|
#include <QSourceLocation>
|
2014-06-17 11:50:11 +02:00
|
|
|
|
#include <QUndoStack>
|
|
|
|
|
#include <QAction>
|
2014-01-19 11:00:20 +01:00
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief MainWindow constructor.
|
|
|
|
|
* @param parent parent widget.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
2014-06-12 09:22:29 +02:00
|
|
|
|
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool),
|
2014-02-26 10:22:05 +01:00
|
|
|
|
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
|
|
|
|
|
view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr),
|
2014-06-12 09:22:29 +02:00
|
|
|
|
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
|
2014-03-21 11:08:29 +01:00
|
|
|
|
currentToolBoxIndex(0), drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr),
|
2014-06-24 10:23:39 +02:00
|
|
|
|
autoSaveTimer(nullptr), guiEnabled(true)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 20:31:22 +01:00
|
|
|
|
CreateActions();
|
|
|
|
|
CreateMenus();
|
2013-07-03 14:29:26 +02:00
|
|
|
|
ToolBarDraws();
|
2014-03-26 05:39:07 +01:00
|
|
|
|
InitToolButtons();
|
2014-02-10 20:31:22 +01:00
|
|
|
|
|
2014-01-11 18:08:40 +01:00
|
|
|
|
sceneDraw = new VMainGraphicsScene();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
currentScene = sceneDraw;
|
|
|
|
|
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
2014-01-11 18:08:40 +01:00
|
|
|
|
sceneDetails = new VMainGraphicsScene();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
view = new VMainGraphicsView();
|
|
|
|
|
ui->LayoutView->addWidget(view);
|
2014-05-27 11:06:36 +02:00
|
|
|
|
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
|
|
|
|
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
2013-08-28 10:55:11 +02:00
|
|
|
|
view->setScene(currentScene);
|
2014-01-11 15:09:44 +01:00
|
|
|
|
|
|
|
|
|
sceneDraw->setTransform(view->transform());
|
|
|
|
|
sceneDetails->setTransform(view->transform());
|
|
|
|
|
|
2013-10-16 11:17:34 +02:00
|
|
|
|
connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
|
policy.setHorizontalStretch(12);
|
|
|
|
|
view->setSizePolicy(policy);
|
2014-06-08 12:59:39 +02:00
|
|
|
|
qApp->setSceneView(view);
|
2014-02-14 18:49:50 +01:00
|
|
|
|
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
|
2013-07-03 14:29:26 +02:00
|
|
|
|
ui->statusBar->addWidget(helpLabel);
|
|
|
|
|
|
2014-06-24 10:47:28 +02:00
|
|
|
|
ToolBarTools();
|
2014-06-02 20:42:46 +02:00
|
|
|
|
|
2013-12-29 17:48:57 +01:00
|
|
|
|
pattern = new VContainer();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
|
2014-06-05 13:35:38 +02:00
|
|
|
|
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
|
2014-05-30 15:22:03 +02:00
|
|
|
|
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
|
2014-06-18 18:11:14 +02:00
|
|
|
|
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
2014-06-06 12:36:34 +02:00
|
|
|
|
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
|
2014-06-09 15:13:15 +02:00
|
|
|
|
connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified);
|
|
|
|
|
|
2014-02-14 12:29:04 +01:00
|
|
|
|
InitAutoSave();
|
2013-10-05 14:07:04 +02:00
|
|
|
|
|
2013-10-06 18:22:21 +02:00
|
|
|
|
ui->toolBox->setCurrentIndex(0);
|
2014-02-10 17:10:20 +01:00
|
|
|
|
|
|
|
|
|
ReadSettings();
|
|
|
|
|
|
|
|
|
|
setCurrentFile("");
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
2014-06-06 12:36:34 +02:00
|
|
|
|
* @brief ActionNewPP add to scene new pattern piece.
|
2014-05-27 11:27:02 +02:00
|
|
|
|
*/
|
2014-06-06 12:36:34 +02:00
|
|
|
|
void MainWindow::ActionNewPP()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-16 07:32:52 +01:00
|
|
|
|
QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1);
|
2014-06-06 17:06:41 +02:00
|
|
|
|
QString path;
|
2014-03-10 16:55:51 +01:00
|
|
|
|
if (comboBoxDraws->count() == 0)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-10 16:55:51 +01:00
|
|
|
|
DialogMeasurements measurements(this);
|
2014-06-06 12:36:34 +02:00
|
|
|
|
if (measurements.exec() == QDialog::Rejected)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (measurements.type() == MeasurementsType::Standard)
|
2014-03-10 16:55:51 +01:00
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
qApp->setPatternType(MeasurementsType::Standard);
|
2014-03-16 07:32:52 +01:00
|
|
|
|
DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this);
|
2014-03-10 16:55:51 +01:00
|
|
|
|
if (stMeasurements.exec() == QDialog::Accepted)
|
|
|
|
|
{
|
2014-03-16 07:32:52 +01:00
|
|
|
|
patternPieceName = stMeasurements.name();
|
|
|
|
|
path = stMeasurements.tablePath();
|
2014-03-28 14:11:46 +01:00
|
|
|
|
VStandardMeasurements m(pattern);
|
|
|
|
|
m.setContent(path);
|
|
|
|
|
m.SetSize();
|
|
|
|
|
m.SetHeight();
|
|
|
|
|
m.Measurements();
|
2014-03-10 16:55:51 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
qApp->setPatternType(MeasurementsType::Individual);
|
2014-03-16 07:32:52 +01:00
|
|
|
|
DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this);
|
2014-03-10 16:55:51 +01:00
|
|
|
|
if (indMeasurements.exec() == QDialog::Accepted)
|
|
|
|
|
{
|
2014-03-16 07:32:52 +01:00
|
|
|
|
patternPieceName = indMeasurements.name();
|
|
|
|
|
path = indMeasurements.tablePath();
|
2014-03-28 14:11:46 +01:00
|
|
|
|
VIndividualMeasurements m(pattern);
|
|
|
|
|
m.setContent(path);
|
|
|
|
|
m.Measurements();
|
2014-03-10 16:55:51 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-03-16 07:32:52 +01:00
|
|
|
|
patternPieceName = PatternPieceName(patternPieceName);
|
|
|
|
|
if (patternPieceName.isEmpty())
|
2014-03-10 16:55:51 +01:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-06-15 10:04:49 +02:00
|
|
|
|
path = doc->MPath();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2014-06-06 17:06:41 +02:00
|
|
|
|
if (doc->appendPP(patternPieceName) == false)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-06-06 17:06:41 +02:00
|
|
|
|
qDebug()<<"Error creating pattern piece with the name "<<patternPieceName<<".";
|
2013-09-18 18:52:49 +02:00
|
|
|
|
return;
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2013-08-15 22:39:00 +02:00
|
|
|
|
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::currentDrawChanged);
|
2014-03-16 07:32:52 +01:00
|
|
|
|
comboBoxDraws->addItem(patternPieceName);
|
2014-02-06 16:21:37 +01:00
|
|
|
|
|
2014-01-02 16:50:01 +01:00
|
|
|
|
pattern->ClearGObjects();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
//Create single point
|
2014-05-01 13:33:40 +02:00
|
|
|
|
const quint32 id = pattern->AddGObject(new VPointF(qApp->toPixel((10+comboBoxDraws->count()*5)), qApp->toPixel(10),
|
|
|
|
|
"А", 5, 10));
|
2014-06-12 09:22:29 +02:00
|
|
|
|
VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Source::FromGui, patternPieceName, path);
|
2013-08-28 10:55:11 +02:00
|
|
|
|
sceneDraw->addItem(spoint);
|
|
|
|
|
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
2013-10-16 11:17:34 +02:00
|
|
|
|
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
2014-02-25 15:40:24 +01:00
|
|
|
|
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(tools != nullptr);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
tools->insert(id, spoint);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
VDrawTool::AddRecord(id, Tool::SinglePointTool, doc);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
SetEnableTool(true);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
SetEnableWidgets(true);
|
2014-02-06 16:21:37 +01:00
|
|
|
|
|
2014-03-16 07:32:52 +01:00
|
|
|
|
const qint32 index = comboBoxDraws->findText(patternPieceName);
|
2014-02-06 16:21:37 +01:00
|
|
|
|
if ( index != -1 )
|
|
|
|
|
{ // -1 for not found
|
|
|
|
|
comboBoxDraws->setCurrentIndex(index);
|
2014-06-15 10:04:49 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
comboBoxDraws->setCurrentIndex(0);
|
2014-02-06 16:21:37 +01:00
|
|
|
|
}
|
|
|
|
|
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
|
|
|
|
&MainWindow::currentDrawChanged);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief OptionDraw help change name of pattern peace.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::OptionDraw()
|
|
|
|
|
{
|
2014-03-03 16:30:04 +01:00
|
|
|
|
const QString activDraw = doc->GetNameActivDraw();
|
|
|
|
|
const QString nameDraw = PatternPieceName(activDraw);
|
|
|
|
|
if (nameDraw.isEmpty())
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-03 16:30:04 +01:00
|
|
|
|
return;
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if (doc->SetNameDraw(nameDraw))
|
|
|
|
|
{
|
2014-03-03 16:30:04 +01:00
|
|
|
|
comboBoxDraws->setItemText(comboBoxDraws->findText(activDraw), nameDraw);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-19 11:42:00 +01:00
|
|
|
|
QMessageBox::warning(this, tr("Error saving change!!!"), tr("Can't save new label of pattern piece"));
|
2013-10-10 12:00:04 +02:00
|
|
|
|
}
|
2013-07-03 14:29:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SetToolButton set tool and show dialog.
|
|
|
|
|
* @param checked true if tool button checked.
|
|
|
|
|
* @param t tool type.
|
|
|
|
|
* @param cursor path tool cursor icon.
|
|
|
|
|
* @param toolTip first tooltipe.
|
|
|
|
|
* @param closeDialogSlot function what handle after close dialog.
|
|
|
|
|
*/
|
2013-08-13 18:48:36 +02:00
|
|
|
|
template <typename Dialog, typename Func>
|
2014-06-12 09:22:29 +02:00
|
|
|
|
void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
2014-02-06 14:57:23 +01:00
|
|
|
|
Func closeDialogSlot)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
2014-01-16 14:54:01 +01:00
|
|
|
|
CancelTool();
|
2013-08-13 18:48:36 +02:00
|
|
|
|
tool = t;
|
|
|
|
|
QPixmap pixmap(cursor);
|
|
|
|
|
QCursor cur(pixmap, 2, 3);
|
|
|
|
|
view->setCursor(cur);
|
2013-10-07 13:11:56 +02:00
|
|
|
|
helpLabel->setText(toolTip);
|
2014-02-06 14:57:23 +01:00
|
|
|
|
dialogTool = new Dialog(pattern, this);
|
|
|
|
|
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
|
|
|
|
|
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
|
|
|
|
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
2014-02-25 15:02:09 +01:00
|
|
|
|
connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(tButton != nullptr);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
tButton->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-25 23:50:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
template <typename Dialog, typename Func, typename Func2>
|
2014-05-27 20:39:54 +02:00
|
|
|
|
/**
|
2014-06-09 18:37:11 +02:00
|
|
|
|
* @brief SetToolButtonWithApply set tool and show dialog.
|
2014-05-27 20:39:54 +02:00
|
|
|
|
* @param checked true if tool button checked.
|
|
|
|
|
* @param t tool type.
|
|
|
|
|
* @param cursor path tool cursor icon.
|
|
|
|
|
* @param toolTip first tooltipe.
|
|
|
|
|
* @param closeDialogSlot function to handle close of dialog.
|
|
|
|
|
* @param applyDialogSlot function to handle apply in dialog.
|
|
|
|
|
*/
|
2014-06-12 09:22:29 +02:00
|
|
|
|
void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cursor, const QString &toolTip,
|
2014-05-25 23:50:21 +02:00
|
|
|
|
Func closeDialogSlot, Func2 applyDialogSlot)
|
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
|
|
|
|
CancelTool();
|
|
|
|
|
tool = t;
|
|
|
|
|
QPixmap pixmap(cursor);
|
|
|
|
|
QCursor cur(pixmap, 2, 3);
|
|
|
|
|
view->setCursor(cur);
|
|
|
|
|
helpLabel->setText(toolTip);
|
|
|
|
|
dialogTool = new Dialog(pattern, this);
|
|
|
|
|
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject);
|
|
|
|
|
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
|
|
|
|
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
|
|
|
|
|
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
|
|
|
|
connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(tButton != nullptr);
|
2014-05-25 23:50:21 +02:00
|
|
|
|
tButton->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialog handle close dialog
|
|
|
|
|
* @param result result working dialog.
|
|
|
|
|
*/
|
2014-02-06 14:57:23 +01:00
|
|
|
|
template <typename DrawTool>
|
|
|
|
|
void MainWindow::ClosedDialog(int result)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(dialogTool != nullptr);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if (result == QDialog::Accepted)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
DrawTool::Create(dialogTool, currentScene, doc, pattern);
|
2013-07-25 14:00:51 +02:00
|
|
|
|
}
|
|
|
|
|
ArrowTool();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-26 13:48:42 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 20:39:54 +02:00
|
|
|
|
/**
|
2014-06-09 18:37:11 +02:00
|
|
|
|
* @brief ClosedDialogWithApply handle close dialog that has apply button
|
2014-05-27 20:39:54 +02:00
|
|
|
|
* @param result result working dialog.
|
|
|
|
|
*/
|
2014-05-26 13:48:42 +02:00
|
|
|
|
template <typename DrawTool>
|
2014-06-09 15:00:26 +02:00
|
|
|
|
void MainWindow::ClosedDialogWithApply(int result)
|
2014-05-27 20:39:54 +02:00
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(dialogTool != nullptr);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if (result == QDialog::Accepted)
|
|
|
|
|
{
|
2014-05-26 13:48:42 +02:00
|
|
|
|
// Only create tool if not already created with apply
|
2014-05-26 09:03:51 +02:00
|
|
|
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
|
|
|
|
{
|
2014-05-26 13:48:42 +02:00
|
|
|
|
dialogTool->SetAssociatedTool(
|
|
|
|
|
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ // Or update associated tool with data
|
|
|
|
|
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
|
|
|
|
vtool->FullUpdateFromGuiApply();
|
2014-05-26 09:03:51 +02:00
|
|
|
|
}
|
2013-07-25 14:00:51 +02:00
|
|
|
|
}
|
2014-05-26 13:48:42 +02:00
|
|
|
|
if (dialogTool->GetAssociatedTool() != nullptr)
|
|
|
|
|
{
|
|
|
|
|
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
|
|
|
|
vtool->DialogLinkDestroy();
|
|
|
|
|
}
|
2013-07-25 14:00:51 +02:00
|
|
|
|
ArrowTool();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-25 23:50:21 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 20:39:54 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialog handle apply in dialog
|
|
|
|
|
*/
|
2014-05-25 23:50:21 +02:00
|
|
|
|
template <typename DrawTool>
|
|
|
|
|
void MainWindow::ApplyDialog()
|
2014-06-09 18:37:11 +02:00
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
|
SCASSERT(dialogTool != nullptr);
|
2014-05-25 23:50:21 +02:00
|
|
|
|
|
2014-05-26 13:48:42 +02:00
|
|
|
|
// Only create tool if not already created with apply
|
2014-05-26 09:03:51 +02:00
|
|
|
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
|
|
|
|
{
|
|
|
|
|
dialogTool->SetAssociatedTool(
|
2014-05-26 13:48:42 +02:00
|
|
|
|
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ // Or update associated tool with data
|
|
|
|
|
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
|
|
|
|
|
vtool->FullUpdateFromGuiApply();
|
2014-05-26 09:03:51 +02:00
|
|
|
|
}
|
2014-05-25 23:50:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolEndLine handler tool endLine.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolEndLine(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogEndLine>(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"),
|
2014-06-16 19:18:36 +02:00
|
|
|
|
&MainWindow::ClosedDialogEndLine, &MainWindow::ApplyDialogEndLine);
|
2014-05-25 23:50:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-09 18:37:11 +02:00
|
|
|
|
/**
|
2014-05-27 20:39:54 +02:00
|
|
|
|
* @brief ApplyDialogEndLine actions after apply in DialogEndLine.
|
|
|
|
|
*/
|
2014-05-25 23:50:21 +02:00
|
|
|
|
void MainWindow::ApplyDialogEndLine()
|
2014-06-09 18:37:11 +02:00
|
|
|
|
{
|
2014-05-25 23:50:21 +02:00
|
|
|
|
ApplyDialog<VToolEndLine>();
|
2013-10-29 16:17:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogEndLine actions after closing DialogEndLine.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogEndLine(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolEndLine>(result);
|
2013-10-29 16:17:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolLine handler tool line.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolLine(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
|
2014-02-06 14:57:23 +01:00
|
|
|
|
&MainWindow::ClosedDialogLine);
|
2013-07-25 20:39:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogLine actions after closing DialogLine.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogLine(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolLine>(result);
|
2013-07-25 20:39:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolAlongLine handler tool alongLine.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolAlongLine(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png",
|
2014-06-08 11:14:16 +02:00
|
|
|
|
tr("Select point"), &MainWindow::ClosedDialogAlongLine, &MainWindow::ApplyDialogAlongLine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialogAlongLine actions after apply in DialogAlongLine.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogAlongLine()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolAlongLine>();
|
2013-07-28 00:18:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogAlongLine actions after closing DialogAlongLine.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogAlongLine(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolAlongLine>(result);
|
2013-07-28 00:18:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolShoulderPoint handler tool shoulderPoint.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolShoulderPoint(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
2014-06-09 12:56:07 +02:00
|
|
|
|
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint,
|
|
|
|
|
&MainWindow::ApplyDialogShoulderPoint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
2014-06-09 18:37:11 +02:00
|
|
|
|
* @brief ApplyDialogShoulderPoint actions after apply in DialogShoulderPoint.
|
2014-06-09 12:56:07 +02:00
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogShoulderPoint()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolShoulderPoint>();
|
2013-07-29 14:55:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogShoulderPoint actions after closing DialogShoulderPoint.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogShoulderPoint(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolShoulderPoint>(result);
|
2013-07-29 14:55:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolNormal handler tool normal.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolNormal(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogNormal>(checked, Tool::NormalTool, ":/cursor/normal_cursor.png",
|
2014-06-08 22:28:09 +02:00
|
|
|
|
tr("Select first point of line"), &MainWindow::ClosedDialogNormal,
|
|
|
|
|
&MainWindow::ApplyDialogNormal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
2014-06-09 18:37:11 +02:00
|
|
|
|
* @brief ApplyDialogNormal actions after apply in DialogNormal.
|
2014-06-08 22:28:09 +02:00
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogNormal()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolNormal>();
|
2013-07-30 15:09:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogNormal actions after closing DialogNormal.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogNormal(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolNormal>(result);
|
2013-07-30 15:09:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolBisector handler tool bisector.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolBisector(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogBisector>(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png",
|
2014-06-08 19:56:09 +02:00
|
|
|
|
tr("Select first point of angle"), &MainWindow::ClosedDialogBisector,
|
|
|
|
|
&MainWindow::ApplyDialogBisector);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialogBisector actions after apply in DialogBisector.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogBisector()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolBisector>();
|
2013-07-30 20:46:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogBisector actions after closing DialogBisector.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogBisector(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolBisector>(result);
|
2013-07-30 20:46:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolLineIntersect handler tool lineIntersect.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolLineIntersect(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogLineIntersect>(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect);
|
2013-07-31 13:34:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogLineIntersect actions after closing DialogLineIntersect.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogLineIntersect(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolLineIntersect>(result);
|
2013-07-31 13:34:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolSpline handler tool spline.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolSpline(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogSpline>(checked, Tool::SplineTool, ":/cursor/spline_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select first point curve"), &MainWindow::ClosedDialogSpline);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogSpline actions after closing DialogSpline.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogSpline(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolSpline>(result);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolCutSpline handler tool CutSpline.
|
|
|
|
|
* @param checked true - button is checked
|
|
|
|
|
*/
|
2013-12-18 12:13:32 +01:00
|
|
|
|
void MainWindow::ToolCutSpline(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogCutSpline>(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline);
|
2013-12-18 12:13:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogCutSpline actions after closing DialogCutSpline.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-12-18 12:13:32 +01:00
|
|
|
|
void MainWindow::ClosedDialogCutSpline(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolCutSpline>(result);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolArc handler tool arc.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolArc(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogArc>(checked, Tool::ArcTool, ":/cursor/arc_cursor.png",
|
2014-06-09 22:38:10 +02:00
|
|
|
|
tr("Select point of center of arc"), &MainWindow::ClosedDialogArc,
|
|
|
|
|
&MainWindow::ApplyDialogArc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialogArc actions after apply in DialogArc.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogArc()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolArc>();
|
2013-08-06 09:56:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogArc actions after closing DialogArc.
|
|
|
|
|
* @param result result of dialog working..
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogArc(int result)
|
|
|
|
|
{
|
2014-06-09 22:38:10 +02:00
|
|
|
|
ClosedDialogWithApply<VToolArc>(result);
|
2013-08-06 09:56:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolSplinePath handler tool splinePath.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolSplinePath(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogSplinePath>(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogSplinePath actions after closing DialogSplinePath.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogSplinePath(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolSplinePath>(result);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolCutSplinePath handler tool CutSplinePath.
|
|
|
|
|
* @param checked true - button is checked
|
|
|
|
|
*/
|
2013-12-18 12:13:32 +01:00
|
|
|
|
void MainWindow::ToolCutSplinePath(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogCutSplinePath>(checked, Tool::CutSplinePathTool,
|
2014-05-01 13:33:40 +02:00
|
|
|
|
":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"),
|
|
|
|
|
&MainWindow::ClosedDialogCutSplinePath);
|
2013-12-18 12:13:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogCutSplinePath actions after closing DialogCutSplinePath.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-12-18 12:13:32 +01:00
|
|
|
|
void MainWindow::ClosedDialogCutSplinePath(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolCutSplinePath>(result);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolPointOfContact handler tool pointOfContact.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolPointOfContact(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogPointOfContact>(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png",
|
2014-06-09 15:00:26 +02:00
|
|
|
|
tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact,
|
|
|
|
|
&MainWindow::ApplyDialogPointOfContact);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialogPointOfContact actions after apply in DialogPointOfContact.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogPointOfContact()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolPointOfContact>();
|
2013-08-21 10:03:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogPointOfContact actions after closing DialogPointOfContact.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogPointOfContact(int result)
|
|
|
|
|
{
|
2014-06-09 15:00:26 +02:00
|
|
|
|
ClosedDialogWithApply<VToolPointOfContact>(result);
|
2013-08-28 10:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolDetail handler tool detail.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolDetail(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogDetail>(checked, Tool::DetailTool, "://cursor/new_detail_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail);
|
2013-08-28 10:55:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogDetail actions after closing DialogDetail.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogDetail(int result)
|
|
|
|
|
{
|
|
|
|
|
if (result == QDialog::Accepted)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
|
2013-08-21 10:03:53 +02:00
|
|
|
|
}
|
|
|
|
|
ArrowTool();
|
2014-06-05 11:52:00 +02:00
|
|
|
|
doc->LiteParseTree();
|
2013-08-21 10:03:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolHeight handler tool height.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolHeight(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogHeight>(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"),
|
2014-02-06 14:57:23 +01:00
|
|
|
|
&MainWindow::ClosedDialogHeight);
|
2013-10-18 12:03:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogHeight actions after closing DialogHeight.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogHeight(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolHeight>(result);
|
2013-10-18 12:03:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolTriangle handler tool triangle.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolTriangle(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogTriangle>(checked, Tool::Triangle, ":/cursor/triangle_cursor.png",
|
2014-02-06 14:57:23 +01:00
|
|
|
|
tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle);
|
2013-10-18 20:20:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogTriangle actions after closing DialogTriangle.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogTriangle(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolTriangle>(result);
|
2013-10-18 20:20:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolPointOfIntersection handler tool pointOfIntersection.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolPointOfIntersection(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
|
2014-05-01 13:33:40 +02:00
|
|
|
|
":/cursor/pointofintersect_cursor.png", tr("Select point vertically"),
|
|
|
|
|
&MainWindow::ClosedDialogPointOfIntersection);
|
2013-10-21 16:09:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogPointOfIntersection actions after closing DialogPointOfIntersection.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedDialogPointOfIntersection(int result)
|
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolPointOfIntersection>(result);
|
2013-10-21 16:09:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolUnionDetails handler tool unionDetails.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
void MainWindow::ToolUnionDetails(bool checked)
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButton<DialogUnionDetails>(checked, Tool::UnionDetails, ":/cursor/union_cursor.png",
|
2014-05-01 13:33:40 +02:00
|
|
|
|
tr("Select detail"), &MainWindow::ClosedDialogUnionDetails);
|
2014-01-02 16:50:01 +01:00
|
|
|
|
//Must disconnect this signal here.
|
2014-02-25 15:02:09 +01:00
|
|
|
|
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList);
|
2013-12-29 17:48:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogUnionDetails actions after closing DialogUnionDetails.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2014-02-06 14:57:23 +01:00
|
|
|
|
void MainWindow::ClosedDialogUnionDetails(int result)
|
2014-01-08 15:05:32 +01:00
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
ClosedDialog<VToolUnionDetails>(result);
|
2014-06-05 11:52:00 +02:00
|
|
|
|
doc->LiteParseTree();
|
2014-01-08 15:05:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolCutArc handler tool cutArc.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2014-02-06 14:57:23 +01:00
|
|
|
|
void MainWindow::ToolCutArc(bool checked)
|
2014-01-08 15:05:32 +01:00
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
SetToolButtonWithApply<DialogCutArc>(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png",
|
2014-06-09 18:37:11 +02:00
|
|
|
|
tr("Select arc"), &MainWindow::ClosedDialogCutArc, &MainWindow::ApplyDialogCutArc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ApplyDialogCutArc actions after apply in DialogCutArc.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::ApplyDialogCutArc()
|
|
|
|
|
{
|
|
|
|
|
ApplyDialog<VToolCutArc>();
|
2014-01-08 15:05:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedDialogCutArc actions after closing DialogCutArc.
|
|
|
|
|
* @param result result of dialog working.
|
|
|
|
|
*/
|
2014-02-06 14:57:23 +01:00
|
|
|
|
void MainWindow::ClosedDialogCutArc(int result)
|
2013-12-29 17:48:57 +01:00
|
|
|
|
{
|
2014-06-09 18:37:11 +02:00
|
|
|
|
ClosedDialogWithApply<VToolCutArc>(result);
|
2013-12-29 17:48:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief About show widows about.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::About()
|
|
|
|
|
{
|
2014-05-06 16:28:49 +02:00
|
|
|
|
DialogAboutApp * about_dialog = new DialogAboutApp(this);
|
2014-05-16 19:00:13 +02:00
|
|
|
|
about_dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
2014-05-06 16:28:49 +02:00
|
|
|
|
about_dialog->show();
|
2013-10-05 14:07:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief AboutQt show widows aboutQt.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::AboutQt()
|
|
|
|
|
{
|
2013-10-05 14:07:04 +02:00
|
|
|
|
QMessageBox::aboutQt(this, tr("About Qt"));
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ShowTool highlight tool.Tip show tools tooltip.
|
|
|
|
|
* @param toolTip tooltip text.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ShowToolTip(const QString &toolTip)
|
|
|
|
|
{
|
2013-10-07 13:11:56 +02:00
|
|
|
|
helpLabel->setText(toolTip);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief tableClosed handle after close layout window.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::tableClosed()
|
|
|
|
|
{
|
2013-08-29 12:31:50 +02:00
|
|
|
|
show();
|
|
|
|
|
MinimumScrollBar();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-10 20:31:22 +01:00
|
|
|
|
void MainWindow::OpenRecentFile()
|
|
|
|
|
{
|
|
|
|
|
QAction *action = qobject_cast<QAction *>(sender());
|
|
|
|
|
if (action)
|
|
|
|
|
{
|
|
|
|
|
LoadPattern(action->data().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-19 14:32:02 +01:00
|
|
|
|
void MainWindow::PatternProperties()
|
|
|
|
|
{
|
|
|
|
|
DialogPatternProperties proper(doc, this);
|
|
|
|
|
proper.exec();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-16 14:51:39 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void MainWindow::EditPatternCode()
|
|
|
|
|
{
|
2014-05-16 19:00:13 +02:00
|
|
|
|
DialogPatternXmlEdit *Pattern = new DialogPatternXmlEdit (this, doc);
|
|
|
|
|
Pattern->setAttribute(Qt::WA_DeleteOnClose, true);
|
2014-05-16 14:51:39 +02:00
|
|
|
|
Pattern->show();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief showEvent handle after show window.
|
|
|
|
|
* @param event show event.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::showEvent( QShowEvent *event )
|
|
|
|
|
{
|
2013-07-03 14:29:26 +02:00
|
|
|
|
QMainWindow::showEvent( event );
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if ( event->spontaneous() )
|
|
|
|
|
{
|
2013-07-03 14:29:26 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if (isInitialized)
|
|
|
|
|
{
|
2013-07-03 14:29:26 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// do your init stuff here
|
2014-01-11 18:08:40 +01:00
|
|
|
|
|
2013-08-29 12:31:50 +02:00
|
|
|
|
MinimumScrollBar();
|
2013-07-03 14:29:26 +02:00
|
|
|
|
|
2013-09-18 18:52:49 +02:00
|
|
|
|
isInitialized = true;//first show windows are held
|
2013-07-03 14:29:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief closeEvent handle after close window.
|
|
|
|
|
* @param event close event.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::closeEvent(QCloseEvent *event)
|
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
if (MaybeSave())
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
WriteSettings();
|
|
|
|
|
event->accept();
|
2014-06-04 13:30:45 +02:00
|
|
|
|
qApp->closeAllWindows();
|
2014-02-10 17:10:20 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
event->ignore();
|
2013-09-26 15:47:46 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-24 10:23:39 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void MainWindow::customEvent(QEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if(event->type() == UNDO_EVENT)
|
|
|
|
|
{
|
|
|
|
|
qApp->getUndoStack()->undo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolBarOption enable option toolbar.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolBarOption()
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (qApp->patternType() == MeasurementsType::Standard)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
ui->toolBarOption->addWidget(new QLabel(tr("Height: ")));
|
|
|
|
|
|
2014-05-30 11:52:19 +02:00
|
|
|
|
QStringList list{"92", "98", "104", "110", "116", "122", "128", "134", "140", "146", "152", "158", "164", "170",
|
|
|
|
|
"176", "182", "188"};
|
2014-03-24 16:02:57 +01:00
|
|
|
|
QComboBox *comboBoxHeight = new QComboBox;
|
|
|
|
|
comboBoxHeight->addItems(list);
|
|
|
|
|
comboBoxHeight->setCurrentIndex(14);//176
|
|
|
|
|
ui->toolBarOption->addWidget(comboBoxHeight);
|
|
|
|
|
connect(comboBoxHeight, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::ChangedHeight);
|
|
|
|
|
|
|
|
|
|
ui->toolBarOption->addWidget(new QLabel(tr(" Size: ")));
|
|
|
|
|
|
|
|
|
|
list.clear();
|
|
|
|
|
list <<"22"<<"24"<<"26"<<"28"<<"30"<<"32"<<"34"<<"36"<<"38"<<"40"<<"42"<<"44"<<"46"<<"48"<<"50"<<"52"<<"54"
|
|
|
|
|
<<"56";
|
|
|
|
|
QComboBox *comboBoxSize = new QComboBox;
|
|
|
|
|
comboBoxSize->addItems(list);
|
|
|
|
|
comboBoxSize->setCurrentIndex(14);//50
|
|
|
|
|
ui->toolBarOption->addWidget(comboBoxSize);
|
|
|
|
|
connect(comboBoxSize, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::ChangedSize);
|
|
|
|
|
|
|
|
|
|
ui->toolBarOption->addSeparator();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mouseCoordinate = new QLabel("0, 0");
|
2013-07-03 14:29:26 +02:00
|
|
|
|
ui->toolBarOption->addWidget(mouseCoordinate);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ToolBarDraws enable draw toolbar.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ToolBarDraws()
|
|
|
|
|
{
|
2014-03-26 05:39:07 +01:00
|
|
|
|
QLabel *labelPtternPieceName = new QLabel(tr("Pattern Piece: "));
|
|
|
|
|
ui->toolBarDraws->addWidget(labelPtternPieceName);
|
2013-07-03 14:29:26 +02:00
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
comboBoxDraws = new QComboBox;
|
2013-07-03 14:29:26 +02:00
|
|
|
|
ui->toolBarDraws->addWidget(comboBoxDraws);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
comboBoxDraws->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
|
|
|
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::currentDrawChanged);
|
2013-07-03 14:29:26 +02:00
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->toolBarDraws->addAction(ui->actionOptionDraw);
|
|
|
|
|
ui->actionOptionDraw->setEnabled(false);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
|
|
|
|
ui->toolBarDraws->addAction(ui->actionTable);
|
|
|
|
|
ui->actionTable->setEnabled(false);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
|
|
|
|
|
ui->toolBarDraws->addAction(ui->actionHistory);
|
|
|
|
|
ui->actionHistory->setEnabled(false);
|
2013-08-29 12:31:50 +02:00
|
|
|
|
connect(ui->actionHistory, &QAction::triggered, this, &MainWindow::ActionHistory);
|
|
|
|
|
|
|
|
|
|
ui->toolBarDraws->addAction(ui->actionLayout);
|
|
|
|
|
connect(ui->actionLayout, &QAction::triggered, this, &MainWindow::ActionLayout);
|
2014-01-12 21:04:15 +01:00
|
|
|
|
ui->actionLayout->setEnabled(false);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2013-07-03 14:29:26 +02:00
|
|
|
|
|
2014-06-24 10:47:28 +02:00
|
|
|
|
void MainWindow::ToolBarTools()
|
2014-06-02 20:42:46 +02:00
|
|
|
|
{
|
|
|
|
|
/*First we will try use Standard Shortcuts from Qt, but because keypad "-" and "+" not the same keys like in main
|
|
|
|
|
keypad, shortcut Ctrl+"-" or "+" from keypad will not working with standard shortcut (QKeySequence::ZoomIn or
|
|
|
|
|
QKeySequence::ZoomOut). For examle "+" is Qt::Key_Plus + Qt::KeypadModifier for keypad.
|
|
|
|
|
Also for me don't work Qt:CTRL and work Qt::ControlModifier.*/
|
|
|
|
|
|
|
|
|
|
const QList<QKeySequence> zoomInShortcuts = {QKeySequence::ZoomIn,
|
|
|
|
|
Qt::ControlModifier + Qt::Key_Plus + Qt::KeypadModifier};
|
|
|
|
|
ui->actionZoomIn->setShortcuts(zoomInShortcuts);
|
|
|
|
|
connect(ui->actionZoomIn, &QAction::triggered, view, &VMainGraphicsView::ZoomIn);
|
|
|
|
|
|
|
|
|
|
const QList<QKeySequence> zoomOutShortcuts = {QKeySequence::ZoomOut,
|
|
|
|
|
Qt::ControlModifier + Qt::Key_Minus + Qt::KeypadModifier};
|
|
|
|
|
ui->actionZoomOut->setShortcuts(zoomOutShortcuts);
|
|
|
|
|
connect(ui->actionZoomOut, &QAction::triggered, view, &VMainGraphicsView::ZoomOut);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-26 05:39:07 +01:00
|
|
|
|
void MainWindow::InitToolButtons()
|
|
|
|
|
{
|
|
|
|
|
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
|
|
|
|
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
|
|
|
|
connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine);
|
|
|
|
|
connect(ui->toolButtonShoulderPoint, &QToolButton::clicked, this, &MainWindow::ToolShoulderPoint);
|
|
|
|
|
connect(ui->toolButtonNormal, &QToolButton::clicked, this, &MainWindow::ToolNormal);
|
|
|
|
|
connect(ui->toolButtonBisector, &QToolButton::clicked, this, &MainWindow::ToolBisector);
|
|
|
|
|
connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this, &MainWindow::ToolLineIntersect);
|
|
|
|
|
connect(ui->toolButtonSpline, &QToolButton::clicked, this, &MainWindow::ToolSpline);
|
|
|
|
|
connect(ui->toolButtonArc, &QToolButton::clicked, this, &MainWindow::ToolArc);
|
|
|
|
|
connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath);
|
|
|
|
|
connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact);
|
|
|
|
|
connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail);
|
|
|
|
|
connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight);
|
|
|
|
|
connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle);
|
|
|
|
|
connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection);
|
|
|
|
|
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
|
|
|
|
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
|
|
|
|
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
|
|
|
|
|
connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief currentDrawChanged change active pattern peace.
|
|
|
|
|
* @param index index in combobox.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::currentDrawChanged( int index )
|
|
|
|
|
{
|
|
|
|
|
if (index != -1)
|
|
|
|
|
{
|
2014-06-06 17:06:41 +02:00
|
|
|
|
doc->ChangeActivPP(comboBoxDraws->itemText(index));
|
2014-06-05 14:10:16 +02:00
|
|
|
|
doc->setCurrentData();
|
2014-01-27 17:01:24 +01:00
|
|
|
|
if (drawMode)
|
2014-01-10 10:16:55 +01:00
|
|
|
|
{
|
2014-01-12 21:08:52 +01:00
|
|
|
|
ArrowTool();
|
2014-02-25 15:40:24 +01:00
|
|
|
|
quint32 id = doc->SPointActiveDraw();
|
2014-01-12 20:23:44 +01:00
|
|
|
|
if (id != 0)
|
|
|
|
|
{
|
|
|
|
|
const VPointF *p = pattern->GeometricObject<const VPointF *>(id);
|
|
|
|
|
view->centerOn(p->toQPointF());
|
|
|
|
|
}
|
2014-01-10 10:16:55 +01:00
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2013-07-03 14:29:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief mouseMove save mouse position and show user.
|
|
|
|
|
* @param scenePos position mouse.
|
|
|
|
|
*/
|
2013-11-06 22:11:12 +01:00
|
|
|
|
void MainWindow::mouseMove(const QPointF &scenePos)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-24 16:02:57 +01:00
|
|
|
|
QString string = QString("%1, %2").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
|
|
|
|
|
.arg(static_cast<qint32>(qApp->fromPixel(scenePos.y())));
|
|
|
|
|
if (mouseCoordinate != nullptr)
|
|
|
|
|
{
|
|
|
|
|
mouseCoordinate->setText(string);
|
|
|
|
|
}
|
2013-07-03 14:29:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief CanselTool cansel tool.
|
|
|
|
|
*/
|
2014-01-16 14:54:01 +01:00
|
|
|
|
void MainWindow::CancelTool()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-06 14:57:23 +01:00
|
|
|
|
delete dialogTool;
|
2014-02-26 10:22:05 +01:00
|
|
|
|
dialogTool = nullptr;
|
2013-11-04 21:35:15 +01:00
|
|
|
|
switch ( tool )
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::ArrowTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->actionArrowTool->setChecked(false);
|
|
|
|
|
helpLabel->setText("");
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::SinglePointTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
Q_UNREACHABLE();
|
|
|
|
|
//Nothing to do here because we can't create this tool from main window.
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::EndLineTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonEndLine->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::LineTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonLine->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearFocus();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::AlongLineTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonAlongLine->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::ShoulderPointTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonShoulderPoint->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::NormalTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonNormal->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::BisectorTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonBisector->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::LineIntersectTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonLineIntersect->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::SplineTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonSpline->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::ArcTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonArc->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::SplinePathTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonSplinePath->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::PointOfContact:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonPointOfContact->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::DetailTool:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonNewDetail->setChecked(false);
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::Height:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonHeight->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::Triangle:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonTriangle->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::PointOfIntersection:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
ui->toolButtonPointOfIntersection->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::CutSplineTool:
|
2013-12-18 12:13:32 +01:00
|
|
|
|
ui->toolButtonSplineCutPoint->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::CutSplinePathTool:
|
2013-12-18 12:13:32 +01:00
|
|
|
|
ui->toolButtonSplinePathCutPoint->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::UnionDetails:
|
2014-01-02 16:50:01 +01:00
|
|
|
|
ui->toolButtonUnionDetails->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::CutArcTool:
|
2014-01-08 15:05:32 +01:00
|
|
|
|
ui->toolButtonArcCutPoint->setChecked(false);
|
|
|
|
|
currentScene->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
currentScene->clearSelection();
|
|
|
|
|
break;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
case Tool::NodePoint:
|
|
|
|
|
case Tool::NodeArc:
|
|
|
|
|
case Tool::NodeSpline:
|
|
|
|
|
case Tool::NodeSplinePath:
|
2013-11-04 21:35:15 +01:00
|
|
|
|
default:
|
2014-03-28 14:11:46 +01:00
|
|
|
|
qDebug()<<"Got wrong tool type. Ignored.";
|
2013-11-04 21:35:15 +01:00
|
|
|
|
break;
|
2013-07-03 14:29:26 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ArrowTool enable arrow tool.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ArrowTool()
|
|
|
|
|
{
|
2014-01-16 14:54:01 +01:00
|
|
|
|
CancelTool();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->actionArrowTool->setChecked(true);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
tool = Tool::ArrowTool;
|
2013-07-03 14:29:26 +02:00
|
|
|
|
QCursor cur(Qt::ArrowCursor);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
view->setCursor(cur);
|
2013-07-03 14:29:26 +02:00
|
|
|
|
helpLabel->setText("");
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionAroowTool set arrow tool. Cansel tool what was before.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionAroowTool()
|
|
|
|
|
{
|
2013-07-03 14:29:26 +02:00
|
|
|
|
ArrowTool();
|
2013-06-20 16:09:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief keyPressEvent handle key press events.
|
|
|
|
|
* @param event key event.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::keyPressEvent ( QKeyEvent * event )
|
|
|
|
|
{
|
|
|
|
|
switch (event->key())
|
|
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
|
case Qt::Key_Escape:
|
|
|
|
|
ArrowTool();
|
|
|
|
|
break;
|
2013-11-12 19:29:03 +01:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
QMainWindow::keyPressEvent ( event );
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SaveCurrentScene save scene options before set another.
|
|
|
|
|
*/
|
2014-01-11 15:09:44 +01:00
|
|
|
|
void MainWindow::SaveCurrentScene()
|
|
|
|
|
{
|
|
|
|
|
/*Save transform*/
|
|
|
|
|
currentScene->setTransform(view->transform());
|
|
|
|
|
/*Save scroll bars value for previous scene.*/
|
|
|
|
|
QScrollBar *horScrollBar = view->horizontalScrollBar();
|
|
|
|
|
currentScene->setHorScrollBar(horScrollBar->value());
|
|
|
|
|
QScrollBar *verScrollBar = view->verticalScrollBar();
|
|
|
|
|
currentScene->setVerScrollBar(verScrollBar->value());
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief RestoreCurrentScene restore scene options after change.
|
|
|
|
|
*/
|
2014-01-11 15:09:44 +01:00
|
|
|
|
void MainWindow::RestoreCurrentScene()
|
|
|
|
|
{
|
|
|
|
|
/*Set transform for current scene*/
|
|
|
|
|
view->setTransform(currentScene->transform());
|
|
|
|
|
/*Set value for current scene scroll bar.*/
|
|
|
|
|
QScrollBar *horScrollBar = view->horizontalScrollBar();
|
|
|
|
|
horScrollBar->setValue(currentScene->getHorScrollBar());
|
|
|
|
|
QScrollBar *verScrollBar = view->verticalScrollBar();
|
|
|
|
|
verScrollBar->setValue(currentScene->getVerScrollBar());
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionDraw show draw scene.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionDraw(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->actionDetails->setChecked(false);
|
2014-01-11 15:09:44 +01:00
|
|
|
|
SaveCurrentScene();
|
2013-09-17 20:13:02 +02:00
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
currentScene = sceneDraw;
|
|
|
|
|
view->setScene(currentScene);
|
2014-01-14 23:08:34 +01:00
|
|
|
|
connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
2014-01-11 15:09:44 +01:00
|
|
|
|
RestoreCurrentScene();
|
2013-09-17 20:13:02 +02:00
|
|
|
|
|
2014-06-12 09:22:29 +02:00
|
|
|
|
mode = Draw::Calculation;
|
2014-01-09 15:56:53 +01:00
|
|
|
|
comboBoxDraws->setEnabled(true);
|
2014-01-07 11:04:29 +01:00
|
|
|
|
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
|
2014-01-12 20:23:44 +01:00
|
|
|
|
drawMode = true;
|
2014-01-02 16:50:01 +01:00
|
|
|
|
|
2013-12-21 13:57:20 +01:00
|
|
|
|
SetEnableTool(true);
|
2013-08-29 12:31:50 +02:00
|
|
|
|
doc->setCurrentData();
|
2014-01-08 21:45:42 +01:00
|
|
|
|
ui->toolBox->setCurrentIndex(currentToolBoxIndex);
|
2014-01-12 21:04:15 +01:00
|
|
|
|
|
|
|
|
|
ui->actionHistory->setEnabled(true);
|
|
|
|
|
ui->actionLayout->setEnabled(false);
|
|
|
|
|
ui->actionOptionDraw->setEnabled(true);
|
|
|
|
|
ui->actionNewDraw->setEnabled(true);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->actionDraw->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionDetails show details scene.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionDetails(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->actionDraw->setChecked(false);
|
2014-01-11 15:09:44 +01:00
|
|
|
|
SaveCurrentScene();
|
2013-09-17 20:13:02 +02:00
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
currentScene = sceneDetails;
|
|
|
|
|
view->setScene(sceneDetails);
|
2014-01-14 23:08:34 +01:00
|
|
|
|
disconnect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
2014-01-11 15:09:44 +01:00
|
|
|
|
RestoreCurrentScene();
|
2014-01-02 16:50:01 +01:00
|
|
|
|
|
2014-01-12 20:23:44 +01:00
|
|
|
|
drawMode = false;
|
2014-01-07 11:04:29 +01:00
|
|
|
|
currentDrawIndex = comboBoxDraws->currentIndex();//save current pattern peace
|
2014-01-02 16:50:01 +01:00
|
|
|
|
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
|
2014-01-09 15:56:53 +01:00
|
|
|
|
comboBoxDraws->setEnabled(false);
|
2014-01-02 16:50:01 +01:00
|
|
|
|
|
2014-01-12 20:23:44 +01:00
|
|
|
|
|
2014-06-12 09:22:29 +02:00
|
|
|
|
mode = Draw::Modeling;
|
2013-12-21 13:57:20 +01:00
|
|
|
|
SetEnableTool(true);
|
2014-01-08 21:45:42 +01:00
|
|
|
|
currentToolBoxIndex = ui->toolBox->currentIndex();
|
2013-12-21 13:57:20 +01:00
|
|
|
|
ui->toolBox->setCurrentIndex(4);
|
2014-01-12 21:04:15 +01:00
|
|
|
|
|
|
|
|
|
ui->actionHistory->setEnabled(false);
|
|
|
|
|
ui->actionLayout->setEnabled(true);
|
|
|
|
|
ui->actionOptionDraw->setEnabled(false);
|
|
|
|
|
ui->actionNewDraw->setEnabled(false);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-07-13 12:51:31 +02:00
|
|
|
|
ui->actionDetails->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SaveAs save as pattern file.
|
|
|
|
|
* @return true for successes saving.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
bool MainWindow::SaveAs()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-01-15 10:04:53 +01:00
|
|
|
|
QString filters(tr("Pattern files (*.val)"));
|
2014-06-22 18:46:47 +02:00
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
|
|
|
|
QString path = settings.value("paths/pattern", QDir::homePath()).toString();
|
2014-02-12 11:55:24 +01:00
|
|
|
|
QString dir;
|
|
|
|
|
if (curFile.isEmpty())
|
|
|
|
|
{
|
2014-06-22 18:46:47 +02:00
|
|
|
|
dir = path + "/" + tr("pattern") + ".val";
|
2014-02-12 11:55:24 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dir = QFileInfo(curFile).absolutePath() + tr("/pattern.val");
|
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
2014-01-15 10:04:53 +01:00
|
|
|
|
|
2014-02-10 17:10:20 +01:00
|
|
|
|
if (fileName.isEmpty())
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
return false;
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
QFileInfo f( fileName );
|
2014-01-15 10:04:53 +01:00
|
|
|
|
if (f.suffix().isEmpty() && f.suffix() != "val")
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
fileName += ".val";
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
return SavePattern(fileName);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief Save save pattern file.
|
|
|
|
|
* @return true for successes saving.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
bool MainWindow::Save()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
if (curFile.isEmpty())
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
return SaveAs();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-02-11 19:45:34 +01:00
|
|
|
|
bool result = SavePattern(curFile);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
QString autofile = curFile +".autosave";
|
|
|
|
|
QFile file(autofile);
|
|
|
|
|
file.remove();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief Open ask user select pattern file.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::Open()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
if (MaybeSave())
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
QString filter(tr("Pattern files (*.val)"));
|
2014-05-27 12:08:16 +02:00
|
|
|
|
//Get list last open files
|
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
|
|
|
|
QStringList files = settings.value("recentFileList").toStringList();
|
2014-02-10 18:40:41 +01:00
|
|
|
|
QString dir;
|
2014-05-27 12:08:16 +02:00
|
|
|
|
if (files.isEmpty())
|
2014-02-10 18:40:41 +01:00
|
|
|
|
{
|
|
|
|
|
dir = QDir::homePath();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-05-27 12:08:16 +02:00
|
|
|
|
//Absolute path to last open file
|
|
|
|
|
dir = QFileInfo(files.first()).absolutePath();
|
2014-02-10 18:40:41 +01:00
|
|
|
|
}
|
|
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter);
|
2014-05-29 09:08:54 +02:00
|
|
|
|
if (fileName.isEmpty() == false && fileName != curFile)
|
2014-02-10 17:10:20 +01:00
|
|
|
|
{
|
2014-05-29 09:08:54 +02:00
|
|
|
|
if (curFile.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
LoadPattern(fileName);
|
2014-01-12 20:23:44 +01:00
|
|
|
|
|
2014-05-29 09:08:54 +02:00
|
|
|
|
VAbstractTool::NewSceneRect(sceneDraw, view);
|
|
|
|
|
VAbstractTool::NewSceneRect(sceneDetails, view);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
QProcess *v = new QProcess(this);
|
|
|
|
|
QStringList arguments;
|
|
|
|
|
arguments << fileName;
|
|
|
|
|
v->startDetached(QCoreApplication::applicationFilePath(), arguments);
|
|
|
|
|
delete v;
|
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
2014-06-03 10:17:58 +02:00
|
|
|
|
* @brief Preferences config dialog.
|
2014-05-27 11:27:02 +02:00
|
|
|
|
*/
|
2014-06-03 10:17:58 +02:00
|
|
|
|
void MainWindow::Preferences()
|
2014-02-14 12:29:04 +01:00
|
|
|
|
{
|
|
|
|
|
ConfigDialog dlg(this);
|
|
|
|
|
if (dlg.exec() == QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
InitAutoSave();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief Clear reset to default window.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::Clear()
|
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
setCurrentFile("");
|
2013-12-29 17:48:57 +01:00
|
|
|
|
pattern->Clear();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
doc->clear();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
sceneDraw->clear();
|
|
|
|
|
sceneDetails->clear();
|
2014-01-16 14:54:01 +01:00
|
|
|
|
CancelTool();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
comboBoxDraws->clear();
|
|
|
|
|
ui->actionOptionDraw->setEnabled(false);
|
|
|
|
|
ui->actionSave->setEnabled(false);
|
2014-02-19 14:32:02 +01:00
|
|
|
|
ui->actionPattern_properties->setEnabled(false);
|
2014-06-02 20:42:46 +02:00
|
|
|
|
ui->actionZoomIn->setEnabled(false);
|
|
|
|
|
ui->actionZoomOut->setEnabled(false);
|
2013-07-25 14:00:51 +02:00
|
|
|
|
SetEnableTool(false);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
qApp->setPatternUnit(Unit::Cm);
|
|
|
|
|
qApp->setPatternType(MeasurementsType::Individual);
|
2014-03-24 16:02:57 +01:00
|
|
|
|
ui->toolBarOption->clear();
|
2014-03-06 16:31:36 +01:00
|
|
|
|
#ifndef QT_NO_CURSOR
|
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
|
#endif
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-05 14:10:16 +02:00
|
|
|
|
void MainWindow::FullParseFile()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(true);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
doc->Parse(Document::FullParse);
|
|
|
|
|
}
|
2014-06-24 10:23:39 +02:00
|
|
|
|
catch (const VExceptionUndo &e)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(e);
|
|
|
|
|
/* If user want undo last operation before undo we need finish broken redo operation. For those we post event
|
|
|
|
|
* myself. Later in method customEvent call undo.*/
|
|
|
|
|
QApplication::postEvent(this, new UndoEvent());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-06-05 14:10:16 +02:00
|
|
|
|
catch (const VExceptionObjectError &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error parsing file."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (const VExceptionConversionError &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error can't convert value."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (const VExceptionEmptyParameter &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error empty parameter."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (const VExceptionWrongId &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error wrong id."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (VException &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error parsing file."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (const std::bad_alloc &)
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_CURSOR
|
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
|
#endif
|
2014-06-18 14:11:48 +02:00
|
|
|
|
QMessageBox::critical(this, tr("Critical error!"), tr("Error parsing file (std::bad_alloc)."), QMessageBox::Ok,
|
|
|
|
|
QMessageBox::Ok);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
#ifndef QT_NO_CURSOR
|
|
|
|
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
|
|
|
#endif
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-05 14:10:16 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString patternPiece = QString();
|
|
|
|
|
if (comboBoxDraws->currentIndex() != -1)
|
|
|
|
|
{
|
|
|
|
|
patternPiece = comboBoxDraws->itemText(comboBoxDraws->currentIndex());
|
|
|
|
|
}
|
|
|
|
|
disconnect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::currentDrawChanged);
|
|
|
|
|
comboBoxDraws->clear();
|
|
|
|
|
comboBoxDraws->addItems(doc->getPatternPieces());
|
|
|
|
|
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &MainWindow::currentDrawChanged);
|
|
|
|
|
ui->actionPattern_properties->setEnabled(true);
|
|
|
|
|
|
|
|
|
|
qint32 index = comboBoxDraws->findText(patternPiece);
|
2014-06-17 14:56:14 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if ( index != -1 )
|
|
|
|
|
{ // -1 for not found
|
|
|
|
|
currentDrawChanged(index);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
currentDrawChanged(0);
|
|
|
|
|
}
|
2014-06-05 14:10:16 +02:00
|
|
|
|
}
|
2014-06-17 14:56:14 +02:00
|
|
|
|
catch (VExceptionBadId &e)
|
2014-06-15 10:04:49 +02:00
|
|
|
|
{
|
2014-06-17 14:56:14 +02:00
|
|
|
|
e.CriticalMessageBox(tr("Bad id."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-17 14:56:14 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (const VExceptionEmptyParameter &e)
|
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("Error empty parameter."), this);
|
2014-06-24 10:23:39 +02:00
|
|
|
|
SetEnabledGUI(false);
|
2014-06-17 14:56:14 +02:00
|
|
|
|
return;
|
2014-06-15 10:04:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-05 14:10:16 +02:00
|
|
|
|
if (comboBoxDraws->count() > 0)
|
|
|
|
|
{
|
|
|
|
|
SetEnableTool(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetEnableTool(false);
|
|
|
|
|
}
|
|
|
|
|
SetEnableWidgets(true);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-24 10:23:39 +02:00
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
void MainWindow::SetEnabledGUI(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
if (guiEnabled != enabled)
|
|
|
|
|
{
|
|
|
|
|
if (enabled == false)
|
|
|
|
|
{
|
|
|
|
|
CancelTool();
|
|
|
|
|
}
|
|
|
|
|
comboBoxDraws->setEnabled(enabled);
|
|
|
|
|
ui->actionOptionDraw->setEnabled(enabled);
|
|
|
|
|
ui->actionSave->setEnabled(enabled);
|
|
|
|
|
ui->actionSaveAs->setEnabled(enabled);
|
|
|
|
|
ui->actionPattern_properties->setEnabled(enabled);
|
|
|
|
|
ui->actionEdit_pattern_code->setEnabled(enabled);
|
|
|
|
|
ui->actionZoomIn->setEnabled(enabled);
|
|
|
|
|
ui->actionZoomOut->setEnabled(enabled);
|
|
|
|
|
ui->actionArrowTool->setEnabled(enabled);
|
|
|
|
|
ui->actionHistory->setEnabled(enabled);
|
|
|
|
|
ui->actionNewDraw->setEnabled(enabled);
|
|
|
|
|
ui->actionDraw->setEnabled(enabled);
|
|
|
|
|
ui->actionDetails->setEnabled(enabled);
|
|
|
|
|
ui->actionTable->setEnabled(enabled);
|
|
|
|
|
guiEnabled = enabled;
|
|
|
|
|
|
|
|
|
|
sceneDraw->SetDisable(!enabled);
|
|
|
|
|
view->setEnabled(enabled);
|
|
|
|
|
|
|
|
|
|
SetEnableTool(enabled);
|
|
|
|
|
ui->toolBarOption->setEnabled(enabled);
|
|
|
|
|
#ifndef QT_NO_CURSOR
|
|
|
|
|
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief NewPattern create new empty pattern.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::NewPattern()
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-06-09 15:13:15 +02:00
|
|
|
|
if (this->isWindowModified() || curFile.isEmpty() == false)
|
2014-05-29 09:08:54 +02:00
|
|
|
|
{
|
|
|
|
|
QProcess *v = new QProcess(this);
|
|
|
|
|
v->startDetached(QCoreApplication::applicationFilePath ());
|
|
|
|
|
delete v;
|
|
|
|
|
}
|
2013-09-23 15:17:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief haveChange enable action save if we have unsaved change.
|
|
|
|
|
*/
|
2014-06-09 15:13:15 +02:00
|
|
|
|
void MainWindow::PatternWasModified(bool saved)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-06-24 10:23:39 +02:00
|
|
|
|
if (guiEnabled)
|
|
|
|
|
{
|
|
|
|
|
setWindowModified(!saved);
|
|
|
|
|
ui->actionSave->setEnabled(!saved);
|
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ChangedSize change new size value.
|
|
|
|
|
* @param text value size.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ChangedSize(const QString & text)
|
|
|
|
|
{
|
2013-07-17 13:38:11 +02:00
|
|
|
|
qint32 size = text.toInt();
|
2014-04-04 10:06:33 +02:00
|
|
|
|
pattern->SetSize(size);
|
2014-06-05 11:52:00 +02:00
|
|
|
|
doc->LiteParseTree();
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ChangedGrowth change new height value.
|
|
|
|
|
* @param text value height.
|
|
|
|
|
*/
|
2014-02-05 15:04:26 +01:00
|
|
|
|
void MainWindow::ChangedHeight(const QString &text)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2013-07-17 13:38:11 +02:00
|
|
|
|
qint32 growth = text.toInt();
|
2014-04-04 10:06:33 +02:00
|
|
|
|
pattern->SetHeight(growth);
|
2014-06-05 11:52:00 +02:00
|
|
|
|
doc->LiteParseTree();
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SetEnableWidgets enable action button.
|
|
|
|
|
* @param enable enable value.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::SetEnableWidgets(bool enable)
|
|
|
|
|
{
|
2013-07-17 13:38:11 +02:00
|
|
|
|
ui->actionSaveAs->setEnabled(enable);
|
|
|
|
|
ui->actionDraw->setEnabled(enable);
|
|
|
|
|
ui->actionDetails->setEnabled(enable);
|
|
|
|
|
ui->actionOptionDraw->setEnabled(enable);
|
2014-02-10 17:10:20 +01:00
|
|
|
|
if (enable == true && curFile.isEmpty() == false)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2013-07-25 14:00:51 +02:00
|
|
|
|
ui->actionSave->setEnabled(enable);
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
ui->actionTable->setEnabled(enable);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
ui->actionHistory->setEnabled(enable);
|
2014-05-19 20:03:12 +02:00
|
|
|
|
ui->actionPattern_properties->setEnabled(enable);
|
|
|
|
|
ui->actionEdit_pattern_code->setEnabled(enable);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
ui->actionZoomIn->setEnabled(enable);
|
2014-06-02 20:42:46 +02:00
|
|
|
|
ui->actionZoomOut->setEnabled(enable);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionTable show table with variables.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionTable(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
2013-12-29 17:48:57 +01:00
|
|
|
|
dialogTable = new DialogIncrements(pattern, doc, this);
|
2014-02-07 17:44:12 +01:00
|
|
|
|
connect(dialogTable, &DialogIncrements::DialogClosed, this, &MainWindow::ClosedActionTable);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
dialogTable->show();
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-07-17 13:38:11 +02:00
|
|
|
|
ui->actionTable->setChecked(true);
|
|
|
|
|
dialogTable->activateWindow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedActionTable actions after closing table with variables.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedActionTable()
|
|
|
|
|
{
|
2013-07-17 13:38:11 +02:00
|
|
|
|
ui->actionTable->setChecked(false);
|
|
|
|
|
delete dialogTable;
|
2014-02-26 10:22:05 +01:00
|
|
|
|
dialogTable = nullptr;
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionHistory show tool history.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionHistory(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (checked)
|
|
|
|
|
{
|
2013-12-29 17:48:57 +01:00
|
|
|
|
dialogHistory = new DialogHistory(pattern, doc, this);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
dialogHistory->setWindowFlags(Qt::Window);
|
2014-03-02 19:32:54 +01:00
|
|
|
|
connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory);
|
2013-08-15 22:39:00 +02:00
|
|
|
|
dialogHistory->show();
|
2013-11-04 21:35:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
|
ui->actionHistory->setChecked(true);
|
|
|
|
|
dialogHistory->activateWindow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ActionLayout begin creation layout.
|
|
|
|
|
* @param checked true - button checked.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ActionLayout(bool checked)
|
|
|
|
|
{
|
2013-08-29 12:31:50 +02:00
|
|
|
|
Q_UNUSED(checked);
|
|
|
|
|
hide();
|
|
|
|
|
QVector<VItem*> listDetails;
|
2014-02-25 15:40:24 +01:00
|
|
|
|
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
|
|
|
|
QHashIterator<quint32, VDetail> idetail(*details);
|
2014-01-28 19:53:35 +01:00
|
|
|
|
while (idetail.hasNext())
|
|
|
|
|
{
|
|
|
|
|
idetail.next();
|
|
|
|
|
QPainterPath path = VEquidistant().ContourPath(idetail.key(), pattern);
|
|
|
|
|
listDetails.append(new VItem(path, listDetails.size()));
|
|
|
|
|
}
|
2014-02-19 14:50:43 +01:00
|
|
|
|
QString description = doc->UniqueTagText("description");
|
|
|
|
|
emit ModelChosen(listDetails, curFile, description);
|
2013-08-29 12:31:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClosedActionHistory actions after closing history window with variables.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::ClosedActionHistory()
|
|
|
|
|
{
|
2013-08-15 22:39:00 +02:00
|
|
|
|
ui->actionHistory->setChecked(false);
|
|
|
|
|
delete dialogHistory;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SetEnableTool enable button.
|
|
|
|
|
* @param enable enable value.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::SetEnableTool(bool enable)
|
|
|
|
|
{
|
2013-12-21 13:57:20 +01:00
|
|
|
|
bool drawTools = false;
|
|
|
|
|
bool modelingTools = false;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (mode == Draw::Calculation)
|
2013-12-21 13:57:20 +01:00
|
|
|
|
{
|
|
|
|
|
drawTools = enable;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-23 18:23:50 +01:00
|
|
|
|
modelingTools = enable;
|
2013-12-21 13:57:20 +01:00
|
|
|
|
}
|
|
|
|
|
//Drawing Tools
|
|
|
|
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonLine->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonAlongLine->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonShoulderPoint->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonNormal->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonBisector->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonLineIntersect->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonSpline->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonArc->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonSplinePath->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonPointOfContact->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonNewDetail->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonHeight->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonTriangle->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
|
|
|
|
|
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
|
2014-01-08 15:05:32 +01:00
|
|
|
|
ui->toolButtonArcCutPoint->setEnabled(drawTools);
|
2013-12-23 18:23:50 +01:00
|
|
|
|
|
|
|
|
|
//Modeling Tools
|
|
|
|
|
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
2013-07-25 14:00:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief MinimumScrollBar set scroll bar to minimum.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::MinimumScrollBar()
|
|
|
|
|
{
|
2013-08-29 12:31:50 +02:00
|
|
|
|
QScrollBar *horScrollBar = view->horizontalScrollBar();
|
|
|
|
|
horScrollBar->setValue(horScrollBar->minimum());
|
|
|
|
|
QScrollBar *verScrollBar = view->verticalScrollBar();
|
|
|
|
|
verScrollBar->setValue(verScrollBar->minimum());
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief SavePattern save pattern file.
|
|
|
|
|
* @param fileName pattern file name.
|
|
|
|
|
* @return true if all is good.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
bool MainWindow::SavePattern(const QString &fileName)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2013-10-04 15:22:37 +02:00
|
|
|
|
QFileInfo tempInfo(fileName);
|
2014-03-28 14:11:46 +01:00
|
|
|
|
const bool result = doc->SaveDocument(fileName);
|
2013-11-04 21:35:15 +01:00
|
|
|
|
if (result)
|
|
|
|
|
{
|
2014-02-11 19:45:34 +01:00
|
|
|
|
if (tempInfo.suffix() != "autosave")
|
|
|
|
|
{
|
|
|
|
|
setCurrentFile(fileName);
|
|
|
|
|
helpLabel->setText(tr("File saved"));
|
2014-06-09 19:43:22 +02:00
|
|
|
|
qApp->getUndoStack()->clear();
|
2014-02-11 19:45:34 +01:00
|
|
|
|
}
|
2013-10-04 15:22:37 +02:00
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief AutoSavePattern start safe saving.
|
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
void MainWindow::AutoSavePattern()
|
|
|
|
|
{
|
2014-06-09 15:13:15 +02:00
|
|
|
|
if (curFile.isEmpty() == false && this->isWindowModified() == true)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-02-11 19:45:34 +01:00
|
|
|
|
QString autofile = curFile +".autosave";
|
|
|
|
|
if (SavePattern(autofile) == false)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-28 14:11:46 +01:00
|
|
|
|
qDebug()<<"Can not save pattern"<<Q_FUNC_INFO;
|
2013-10-04 16:00:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief setCurrentFile the function is called to reset the state of a few variables when a file
|
|
|
|
|
* is loaded or saved, or when the user starts editing a new file (in which case fileName is empty).
|
|
|
|
|
* @param fileName file name.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::setCurrentFile(const QString &fileName)
|
|
|
|
|
{
|
|
|
|
|
curFile = fileName;
|
|
|
|
|
setWindowModified(false);
|
|
|
|
|
|
|
|
|
|
QString shownName = strippedName(curFile);
|
|
|
|
|
if (curFile.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
shownName = tr("untitled.val");
|
|
|
|
|
}
|
2014-02-10 20:31:22 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
|
|
|
|
QStringList files = settings.value("recentFileList").toStringList();
|
|
|
|
|
files.removeAll(fileName);
|
|
|
|
|
files.prepend(fileName);
|
|
|
|
|
while (files.size() > MaxRecentFiles)
|
|
|
|
|
{
|
|
|
|
|
files.removeLast();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings.setValue("recentFileList", files);
|
|
|
|
|
UpdateRecentFileActions();
|
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
shownName+="[*]";
|
|
|
|
|
setWindowTitle(shownName);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief strippedName the function call around curFile to exclude the path to the file.
|
|
|
|
|
* @param fullFileName full path to the file.
|
|
|
|
|
* @return file name.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
QString MainWindow::strippedName(const QString &fullFileName)
|
|
|
|
|
{
|
|
|
|
|
return QFileInfo(fullFileName).fileName();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 11:27:02 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
/**
|
|
|
|
|
* @brief ReadSettings read setting for app.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::ReadSettings()
|
|
|
|
|
{
|
2014-02-10 20:31:22 +01:00
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
2014-02-10 17:10:20 +01:00
|
|
|
|
QPoint pos = settings.value("pos", QPoint(10, 10)).toPoint();
|
|
|
|
|
QSize size = settings.value("size", QSize(1000, 800)).toSize();
|
|
|
|
|
resize(size);
|
|
|
|
|
move(pos);
|
2014-06-08 12:59:39 +02:00
|
|
|
|
|
2014-06-08 13:18:34 +02:00
|
|
|
|
// Scene antialiasing
|
2014-06-08 12:59:39 +02:00
|
|
|
|
bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool();
|
|
|
|
|
view->setRenderHint(QPainter::Antialiasing, graphOutputValue);
|
|
|
|
|
view->setRenderHint(QPainter::SmoothPixmapTransform, graphOutputValue);
|
2014-06-08 13:18:34 +02:00
|
|
|
|
|
|
|
|
|
// Stack limit
|
|
|
|
|
bool ok = true;
|
|
|
|
|
qint32 count = settings.value("pattern/undo", 0).toInt(&ok);
|
|
|
|
|
if (ok == false)
|
|
|
|
|
{
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
qApp->getUndoStack()->setUndoLimit(count);
|
2014-02-10 17:10:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief WriteSettings save setting for app.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::WriteSettings()
|
|
|
|
|
{
|
2014-02-10 20:31:22 +01:00
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
2014-02-10 17:10:20 +01:00
|
|
|
|
settings.setValue("pos", pos());
|
|
|
|
|
settings.setValue("size", size());
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief MaybeSave The function is called to save pending changes.
|
|
|
|
|
* @return returns true in all cases, except when the user clicks Cancel.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
bool MainWindow::MaybeSave()
|
|
|
|
|
{
|
2014-06-09 15:13:15 +02:00
|
|
|
|
if (this->isWindowModified())
|
2014-02-10 17:10:20 +01:00
|
|
|
|
{
|
|
|
|
|
QMessageBox::StandardButton ret;
|
|
|
|
|
ret = QMessageBox::warning(this, tr("Unsaved change"), tr("The pattern has been modified.\n"
|
|
|
|
|
"Do you want to save your changes?"),
|
|
|
|
|
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
|
|
|
|
if (ret == QMessageBox::Save)
|
2014-02-26 10:51:37 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
return Save();
|
2014-02-26 10:51:37 +01:00
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
else if (ret == QMessageBox::Cancel)
|
2014-02-26 10:51:37 +01:00
|
|
|
|
{
|
2014-02-10 17:10:20 +01:00
|
|
|
|
return false;
|
2014-02-26 10:51:37 +01:00
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-10 20:31:22 +01:00
|
|
|
|
void MainWindow::UpdateRecentFileActions()
|
|
|
|
|
{
|
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
|
|
|
|
QStringList files = settings.value("recentFileList").toStringList();
|
|
|
|
|
|
|
|
|
|
int numRecentFiles = qMin(files.size(), static_cast<int>(MaxRecentFiles));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < numRecentFiles; ++i)
|
|
|
|
|
{
|
2014-06-09 21:11:33 +02:00
|
|
|
|
QString text = QString("&%1 %2").arg(i + 1).arg(strippedName(files.at(i)));
|
2014-02-10 20:31:22 +01:00
|
|
|
|
recentFileActs[i]->setText(text);
|
2014-06-09 21:11:33 +02:00
|
|
|
|
recentFileActs[i]->setData(files.at(i));
|
2014-02-10 20:31:22 +01:00
|
|
|
|
recentFileActs[i]->setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
|
|
|
|
|
{
|
|
|
|
|
recentFileActs[j]->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
separatorAct->setVisible(numRecentFiles > 0);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-10 20:31:22 +01:00
|
|
|
|
void MainWindow::CreateMenus()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
|
|
|
|
{
|
2014-06-03 10:17:58 +02:00
|
|
|
|
ui->menuFile->insertAction(ui->actionPreferences, recentFileActs[i]);
|
2014-02-10 20:31:22 +01:00
|
|
|
|
}
|
|
|
|
|
separatorAct = new QAction(this);
|
|
|
|
|
separatorAct->setSeparator(true);
|
2014-06-03 10:17:58 +02:00
|
|
|
|
ui->menuFile->insertAction(ui->actionPreferences, separatorAct);
|
2014-02-10 20:31:22 +01:00
|
|
|
|
UpdateRecentFileActions();
|
2014-06-04 14:14:57 +02:00
|
|
|
|
|
|
|
|
|
//Add Undo/Redo actions.
|
|
|
|
|
QAction *undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
|
|
|
|
undoAction->setShortcuts(QKeySequence::Undo);
|
|
|
|
|
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
|
|
|
|
|
ui->menuDrawing->insertAction(ui->actionPattern_properties, undoAction);
|
2014-06-24 10:47:28 +02:00
|
|
|
|
ui->toolBarTools->addAction(undoAction);
|
2014-06-04 14:14:57 +02:00
|
|
|
|
|
|
|
|
|
QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
|
|
|
|
redoAction->setShortcuts(QKeySequence::Redo);
|
|
|
|
|
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
|
|
|
|
|
ui->menuDrawing->insertAction(ui->actionPattern_properties, redoAction);
|
2014-06-24 10:47:28 +02:00
|
|
|
|
ui->toolBarTools->addAction(redoAction);
|
2014-06-04 14:14:57 +02:00
|
|
|
|
|
|
|
|
|
separatorAct = new QAction(this);
|
|
|
|
|
separatorAct->setSeparator(true);
|
|
|
|
|
ui->menuDrawing->insertAction(ui->actionPattern_properties, separatorAct);
|
2014-02-10 20:31:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-10 20:31:22 +01:00
|
|
|
|
void MainWindow::CreateActions()
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ActionAroowTool);
|
|
|
|
|
connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw);
|
|
|
|
|
connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails);
|
2014-06-06 12:36:34 +02:00
|
|
|
|
connect(ui->actionNewDraw, &QAction::triggered, this, &MainWindow::ActionNewPP);
|
2014-02-10 20:31:22 +01:00
|
|
|
|
connect(ui->actionOptionDraw, &QAction::triggered, this, &MainWindow::OptionDraw);
|
|
|
|
|
connect(ui->actionSaveAs, &QAction::triggered, this, &MainWindow::SaveAs);
|
|
|
|
|
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::Save);
|
|
|
|
|
connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::Open);
|
|
|
|
|
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::NewPattern);
|
|
|
|
|
connect(ui->actionTable, &QAction::triggered, this, &MainWindow::ActionTable);
|
|
|
|
|
connect(ui->actionAbout_Qt, &QAction::triggered, this, &MainWindow::AboutQt);
|
|
|
|
|
connect(ui->actionAbout_Valentina, &QAction::triggered, this, &MainWindow::About);
|
|
|
|
|
connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close);
|
2014-06-03 10:17:58 +02:00
|
|
|
|
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
|
2014-02-19 14:32:02 +01:00
|
|
|
|
connect(ui->actionPattern_properties, &QAction::triggered, this, &MainWindow::PatternProperties);
|
|
|
|
|
ui->actionPattern_properties->setEnabled(false);
|
2014-05-16 19:00:13 +02:00
|
|
|
|
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
|
2014-05-19 20:03:12 +02:00
|
|
|
|
ui->actionEdit_pattern_code->setEnabled(false);
|
2014-02-10 20:31:22 +01:00
|
|
|
|
|
|
|
|
|
//Actions for recent files loaded by a main window application.
|
|
|
|
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
|
|
|
|
{
|
|
|
|
|
recentFileActs[i] = new QAction(this);
|
|
|
|
|
recentFileActs[i]->setVisible(false);
|
|
|
|
|
connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-02-14 12:29:04 +01:00
|
|
|
|
void MainWindow::InitAutoSave()
|
|
|
|
|
{
|
|
|
|
|
//Autosaving file each 5 minutes
|
|
|
|
|
delete autoSaveTimer;
|
2014-02-26 10:22:05 +01:00
|
|
|
|
autoSaveTimer = nullptr;
|
2014-02-14 12:29:04 +01:00
|
|
|
|
|
2014-06-08 12:59:39 +02:00
|
|
|
|
autoSaveTimer = new QTimer(this);
|
|
|
|
|
autoSaveTimer->setTimerType(Qt::VeryCoarseTimer);
|
|
|
|
|
connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
|
|
|
|
autoSaveTimer->stop();
|
|
|
|
|
|
2014-02-14 12:29:04 +01:00
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
|
|
|
QApplication::applicationName());
|
|
|
|
|
bool autoSave = settings.value("configuration/autosave/state", 1).toBool();
|
|
|
|
|
if (autoSave)
|
|
|
|
|
{
|
|
|
|
|
bool ok = true;
|
|
|
|
|
qint32 autoTime = settings.value("configuration/autosave/time", 5).toInt(&ok);
|
|
|
|
|
if (ok == false)
|
|
|
|
|
{
|
|
|
|
|
autoTime = 5;
|
|
|
|
|
}
|
|
|
|
|
autoSaveTimer->start(autoTime*60000);
|
2014-06-08 12:59:39 +02:00
|
|
|
|
|
2014-02-14 12:29:04 +01:00
|
|
|
|
}
|
2014-06-08 12:59:39 +02:00
|
|
|
|
qApp->setAutoSaveTimer(autoSaveTimer);
|
2014-02-14 12:29:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-03-03 16:30:04 +01:00
|
|
|
|
QString MainWindow::PatternPieceName(const QString &text)
|
|
|
|
|
{
|
|
|
|
|
QInputDialog *dlg = new QInputDialog(this);
|
|
|
|
|
dlg->setInputMode( QInputDialog::TextInput );
|
|
|
|
|
dlg->setLabelText(tr("Pattern piece:"));
|
|
|
|
|
dlg->setTextEchoMode(QLineEdit::Normal);
|
|
|
|
|
dlg->setWindowTitle(tr("Enter a new label for the pattern piece."));
|
|
|
|
|
dlg->resize(300, 100);
|
|
|
|
|
dlg->setTextValue(text);
|
|
|
|
|
QString nameDraw;
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
const bool bOk = dlg->exec();
|
|
|
|
|
nameDraw = dlg->textValue();
|
|
|
|
|
if (bOk == false || nameDraw.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
delete dlg;
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
if (comboBoxDraws->findText(nameDraw) == -1)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete dlg;
|
|
|
|
|
return nameDraw;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2013-11-04 21:35:15 +01:00
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
2014-01-16 14:54:01 +01:00
|
|
|
|
CancelTool();
|
2013-06-20 16:09:50 +02:00
|
|
|
|
delete ui;
|
2013-07-13 12:51:31 +02:00
|
|
|
|
|
2013-12-29 17:48:57 +01:00
|
|
|
|
delete pattern;
|
2013-12-30 19:59:33 +01:00
|
|
|
|
delete doc;
|
|
|
|
|
delete sceneDetails;
|
|
|
|
|
delete sceneDraw;
|
2013-09-23 15:17:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-05-27 11:27:02 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief LoadPattern open pattern file.
|
|
|
|
|
* @param fileName name of file.
|
|
|
|
|
*/
|
2014-02-10 17:10:20 +01:00
|
|
|
|
void MainWindow::LoadPattern(const QString &fileName)
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-24 16:02:57 +01:00
|
|
|
|
try
|
2013-11-04 21:35:15 +01:00
|
|
|
|
{
|
2014-03-24 16:02:57 +01:00
|
|
|
|
VDomDocument::ValidateXML("://schema/pattern.xsd", fileName);
|
|
|
|
|
doc->setContent(fileName);
|
2014-03-14 18:54:20 +01:00
|
|
|
|
|
2014-03-24 16:02:57 +01:00
|
|
|
|
qApp->setPatternUnit(doc->MUnit());
|
|
|
|
|
qApp->setPatternType(doc->MType());
|
|
|
|
|
QString path = doc->MPath();
|
2014-03-14 18:54:20 +01:00
|
|
|
|
|
2014-03-24 16:02:57 +01:00
|
|
|
|
path = CheckPathToMeasurements(path, qApp->patternType());
|
2014-05-01 13:33:40 +02:00
|
|
|
|
if (path.isEmpty())
|
2014-03-14 18:54:20 +01:00
|
|
|
|
{
|
|
|
|
|
Clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-03-24 16:02:57 +01:00
|
|
|
|
|
|
|
|
|
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
|
|
|
|
|
.arg(doc->UnitsToStr(qApp->patternUnit()));
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (qApp->patternType() == MeasurementsType::Standard)
|
2014-03-14 18:54:20 +01:00
|
|
|
|
{
|
2014-03-24 16:02:57 +01:00
|
|
|
|
VStandardMeasurements m(pattern);
|
|
|
|
|
m.setContent(path);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
Unit mUnit = m.MUnit();
|
2014-03-24 16:02:57 +01:00
|
|
|
|
if (qApp->patternUnit() != mUnit)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::critical(this, tr("Wrong units."), text);
|
|
|
|
|
Clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m.SetSize();
|
|
|
|
|
m.SetHeight();
|
|
|
|
|
ToolBarOption();
|
2014-03-14 18:54:20 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-03-24 16:02:57 +01:00
|
|
|
|
VIndividualMeasurements m(pattern);
|
|
|
|
|
m.setContent(path);
|
2014-06-12 09:22:29 +02:00
|
|
|
|
Unit mUnit = m.MUnit();
|
2014-03-24 16:02:57 +01:00
|
|
|
|
if (qApp->patternUnit() != mUnit)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::critical(this, tr("Wrong units."), text);
|
|
|
|
|
Clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-03-14 18:54:20 +01:00
|
|
|
|
}
|
2014-03-24 16:02:57 +01:00
|
|
|
|
}
|
2014-05-01 13:33:40 +02:00
|
|
|
|
catch (VException &e)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
e.CriticalMessageBox(tr("File error."), this);
|
|
|
|
|
Clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-05 14:10:16 +02:00
|
|
|
|
FullParseFile();
|
2014-03-24 16:02:57 +01:00
|
|
|
|
|
2014-06-09 15:13:15 +02:00
|
|
|
|
bool patternModified = this->isWindowModified();
|
2014-02-10 17:10:20 +01:00
|
|
|
|
setCurrentFile(fileName);
|
2014-05-30 10:32:40 +02:00
|
|
|
|
if (patternModified)
|
|
|
|
|
{
|
|
|
|
|
//For situation where was fixed wrong formula need return for document status was modified.
|
2014-06-09 15:13:15 +02:00
|
|
|
|
PatternWasModified(patternModified);
|
2014-05-30 10:32:40 +02:00
|
|
|
|
}
|
2014-02-10 17:10:20 +01:00
|
|
|
|
helpLabel->setText(tr("File loaded"));
|
2013-06-20 16:09:50 +02:00
|
|
|
|
}
|
2014-03-24 16:02:57 +01:00
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-12 09:22:29 +02:00
|
|
|
|
QString MainWindow::CheckPathToMeasurements(const QString &path, const MeasurementsType &patternType)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
QFile table(path);
|
|
|
|
|
if (table.exists() == false)
|
|
|
|
|
{
|
|
|
|
|
QString text = tr("The measurements file <br/><br/> <b>%1</b> <br/><br/> %3").arg(path)
|
|
|
|
|
.arg(tr("could not be found. Do you want to update the file location"));
|
|
|
|
|
QMessageBox::StandardButton res = QMessageBox::question(this, "Loading measurements file", text,
|
|
|
|
|
QMessageBox::Yes | QMessageBox::No,
|
|
|
|
|
QMessageBox::Yes);
|
2014-05-01 13:33:40 +02:00
|
|
|
|
if (res == QMessageBox::No)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
QString filter;
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (patternType == MeasurementsType::Standard)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
filter = tr("Standard measurements (*.vst)");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
filter = tr("Individual measurements (*.vit)");
|
|
|
|
|
}
|
|
|
|
|
QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
|
|
|
|
|
|
2014-05-01 13:33:40 +02:00
|
|
|
|
if (mPath.isEmpty())
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
return mPath;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-06-12 09:22:29 +02:00
|
|
|
|
if (patternType == MeasurementsType::Standard)
|
2014-03-24 16:02:57 +01:00
|
|
|
|
{
|
|
|
|
|
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", mPath);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", mPath);
|
|
|
|
|
}
|
|
|
|
|
doc->SetPath(mPath);
|
|
|
|
|
return mPath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return path;
|
|
|
|
|
}
|