--HG--
branch : feature
This commit is contained in:
dismine 2014-02-26 11:51:37 +02:00
parent 25e6df1c1d
commit 79f2ddde2a
19 changed files with 71 additions and 57 deletions

View File

@ -125,12 +125,12 @@ void ConfigDialog::createIcons()
void ConfigDialog::Apply() void ConfigDialog::Apply()
{ {
switch(contentsWidget->currentRow()) switch (contentsWidget->currentRow())
{ {
case(0): case (0):
configurationPage->Apply(); configurationPage->Apply();
break; break;
case(1): case (1):
patternPage->Apply(); patternPage->Apply();
break; break;
default: default:

View File

@ -31,8 +31,9 @@
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui
class DialogIndividualMeasurements; {
class DialogIndividualMeasurements;
} }
class DialogIndividualMeasurements : public QDialog class DialogIndividualMeasurements : public QDialog

View File

@ -31,8 +31,9 @@
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui
class DialogMeasurements; {
class DialogMeasurements;
} }
namespace Measurements namespace Measurements

View File

@ -32,8 +32,9 @@
#include <QDialog> #include <QDialog>
#include "../../xml/vpattern.h" #include "../../xml/vpattern.h"
namespace Ui { namespace Ui
class DialogPatternProperties; {
class DialogPatternProperties;
} }
class DialogPatternProperties : public QDialog class DialogPatternProperties : public QDialog

View File

@ -31,8 +31,9 @@
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui
class DialogStandardMeasurements; {
class DialogStandardMeasurements;
} }
class DialogStandardMeasurements : public QDialog class DialogStandardMeasurements : public QDialog

View File

@ -213,7 +213,7 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
QString DialogTool::GetTypeLine(const QComboBox *box) const QString DialogTool::GetTypeLine(const QComboBox *box) const
{ {
switch(lineStyles.indexOf(box->currentText())) switch (lineStyles.indexOf(box->currentText()))
{ {
case 0: //No line case 0: //No line
return VAbstractTool::TypeLineNone; return VAbstractTool::TypeLineNone;

View File

@ -389,7 +389,8 @@ protected:
* @param id don't show this id in list * @param id don't show this id in list
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
*/ */
void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, const quint32 &id, void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
const quint32 &id,
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const; ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
/** /**
* @brief getCurrentPointId return current point id in combobox * @brief getCurrentPointId return current point id in combobox

View File

@ -72,7 +72,8 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail)
return det.Containes(id); return det.Containes(id);
} }
void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index) void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail,
ptrdiff_t &index)
{ {
if (idDetail == 0) if (idDetail == 0)
{ {

View File

@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent)
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr),
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0),
drawMode(true), recentFileActs{0,0,0,0,0}, separatorAct(nullptr), autoSaveTimer(nullptr) drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), autoSaveTimer(nullptr)
{ {
CreateActions(); CreateActions();
CreateMenus(); CreateMenus();
@ -1258,9 +1258,13 @@ bool MainWindow::MaybeSave()
"Do you want to save your changes?"), "Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
if (ret == QMessageBox::Save) if (ret == QMessageBox::Save)
{
return Save(); return Save();
}
else if (ret == QMessageBox::Cancel) else if (ret == QMessageBox::Cancel)
{
return false; return false;
}
} }
return true; return true;
} }

View File

@ -490,7 +490,7 @@ void TableWindow::EpsFile(const QString &name) const
params << "-eps" << tmp.fileName() << name; params << "-eps" << tmp.fileName() << name;
PdfToPs(name, params); PdfToPs(name, params);
} }
} }
void TableWindow::PsFile(const QString &name) const void TableWindow::PsFile(const QString &name) const
@ -530,7 +530,7 @@ void TableWindow::PdfToPs(const QString &name, const QStringList &params) const
qDebug() << proc.errorString(); qDebug() << proc.errorString();
QFile f(name); QFile f(name);
if (!f.exists()) if (f.exists() == false)
{ {
QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!", QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!",
QMessageBox::Ok | QMessageBox::Default); QMessageBox::Ok | QMessageBox::Default);

View File

@ -32,10 +32,9 @@
const QString VToolBisector::ToolType = QStringLiteral("bisector"); const QString VToolBisector::ToolType = QStringLiteral("bisector");
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const quint32 &firstPointId, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation, const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0) :VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0)
{ {
this->firstPointId = firstPointId; this->firstPointId = firstPointId;

View File

@ -78,8 +78,8 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui); Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui);
} }
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation) const Document::Documents &parse, const Tool::Sources &typeCreation)
{ {
Q_CHECK_PTR(scene); Q_CHECK_PTR(scene);

View File

@ -78,8 +78,8 @@ public:
* @param parse parser file mode. * @param parse parser file mode.
* @param typeCreation way we create this tool. * @param typeCreation way we create this tool.
*/ */
static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName; static const QString TagName;
public slots: public slots:

View File

@ -32,9 +32,9 @@
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const quint32 &p1Line, const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation, const quint32 &pShoulder, const Tool::Sources &typeCreation,
QGraphicsItem * parent) QGraphicsItem * parent)
:VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder) :VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder)
{ {

View File

@ -374,7 +374,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
splPath.getKCurve()); splPath.getKCurve());
CorectControlPoints(spl, splPath, i); CorectControlPoints(spl, splPath, i);
CorectControlPoints(spl, splPath, i); CorectControlPoints(spl, splPath, i);
} }
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath); UpdatePathPoint(domElement, splPath);

View File

@ -260,24 +260,24 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool)
Qt::PenStyle VAbstractTool::LineStyle() Qt::PenStyle VAbstractTool::LineStyle()
{ {
QStringList styles = Styles(); QStringList styles = Styles();
switch(styles.indexOf(typeLine)) switch (styles.indexOf(typeLine))
{ {
case 0: case 0: // TypeLineNone
return Qt::NoPen; return Qt::NoPen;
break; break;
case 1: case 1: // TypeLineLine
return Qt::SolidLine; return Qt::SolidLine;
break; break;
case 2: case 2: // TypeLineDashLine
return Qt::DashLine; return Qt::DashLine;
break; break;
case 3: case 3: // TypeLineDotLine
return Qt::DotLine; return Qt::DotLine;
break; break;
case 4: case 4: // TypeLineDashDotLine
return Qt::DashDotLine; return Qt::DashDotLine;
break; break;
case 5: case 5: // TypeLineDashDotDotLine
return Qt::DashDotDotLine; return Qt::DashDotDotLine;
break; break;
default: default:

View File

@ -80,9 +80,10 @@ public:
* @param parse parser file mode. * @param parse parser file mode.
* @param typeCreation way we create this tool. * @param typeCreation way we create this tool.
*/ */
static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
/** /**
* @brief GetDetailFromFile parse detail from file. * @brief GetDetailFromFile parse detail from file.
* @param doc dom document container. * @param doc dom document container.

View File

@ -69,7 +69,7 @@ void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
Q_CHECK_PTR(lineEdit); Q_CHECK_PTR(lineEdit);
QString text = lineEdit->text(); QString text = lineEdit->text();
if(text.isEmpty()) if (text.isEmpty())
{ {
text = lastText; text = lastText;
} }
@ -94,7 +94,7 @@ void TextDelegate::commitAndCloseEditor()
lastText = text; lastText = text;
emit commitData(lineEdit); emit commitData(lineEdit);
} }
else if(text.isEmpty() == false) else if (text.isEmpty() == false)
{ {
lineEdit->setText(lastText); lineEdit->setText(lastText);
emit commitData(lineEdit); emit commitData(lineEdit);

View File

@ -189,7 +189,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
{ {
QStringList tags; QStringList tags;
tags << TagDraw << TagIncrements; tags << TagDraw << TagIncrements;
switch(tags.indexOf(domElement.tagName())) switch (tags.indexOf(domElement.tagName()))
{ {
case 0: // TagDraw case 0: // TagDraw
if (parse == Document::FullParse) if (parse == Document::FullParse)
@ -450,7 +450,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
{ {
QStringList tags; QStringList tags;
tags << TagCalculation << TagModeling << TagDetails; tags << TagCalculation << TagModeling << TagDetails;
switch(tags.indexOf(domElement.tagName())) switch (tags.indexOf(domElement.tagName()))
{ {
case 0: // TagCalculation case 0: // TagCalculation
data->ClearCalculationGObjects(); data->ClearCalculationGObjects();
@ -495,7 +495,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
{ {
QStringList tags; QStringList tags;
tags << TagPoint << TagLine << TagSpline << TagArc << TagTools; tags << TagPoint << TagLine << TagSpline << TagArc << TagTools;
switch(tags.indexOf(domElement.tagName())) switch (tags.indexOf(domElement.tagName()))
{ {
case 0: // TagPoint case 0: // TagPoint
ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, "")); ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
@ -555,7 +555,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
QStringList types; QStringList types;
types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline << types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline <<
VToolDetail::NodeSplinePath; VToolDetail::NodeSplinePath;
switch(types.indexOf(t)) switch (types.indexOf(t))
{ {
case 0: // VToolDetail::NodePoint case 0: // VToolDetail::NodePoint
tool = Tool::NodePoint; tool = Tool::NodePoint;
@ -624,7 +624,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
<< VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType
<< VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType
<< VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType; << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType;
switch(points.indexOf(type)) { switch (points.indexOf(type))
{
case 0: //VToolSinglePoint::ToolType case 0: //VToolSinglePoint::ToolType
{ {
VToolSinglePoint *spoint = 0; VToolSinglePoint *spoint = 0;
@ -747,8 +748,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene,
angle, mx, my, scene, this,data, parse, Tool::FromFile); this, data, parse, Tool::FromFile);
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ {
@ -815,8 +816,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this,
mx, my, scene, this,data, parse, Tool::FromFile); data, parse, Tool::FromFile);
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ {
@ -834,8 +835,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
const VPointF *point = data->GeometricObject<const VPointF *>(idObject ); const VPointF *point = data->GeometricObject<const VPointF *>(idObject );
const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject,
mx, my, idObject,Draw::Modeling)); Draw::Modeling));
VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool);
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
@ -900,8 +901,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0");
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data,
mx, my, scene, this, data, parse,Tool::FromFile); parse, Tool::FromFile);
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ {
@ -1006,7 +1007,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
QStringList splines; QStringList splines;
splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType; splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType;
switch(splines.indexOf(type)) { switch (splines.indexOf(type))
{
case 0: //VToolSpline::ToolType case 0: //VToolSpline::ToolType
try try
{ {
@ -1130,7 +1132,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
QStringList arcs; QStringList arcs;
arcs << VToolArc::ToolType << VNodeArc::ToolType; arcs << VToolArc::ToolType << VNodeArc::ToolType;
switch(arcs.indexOf(type)) { switch (arcs.indexOf(type))
{
case 0: //VToolArc::ToolType case 0: //VToolArc::ToolType
try try
{ {
@ -1185,7 +1188,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
QStringList tools; QStringList tools;
tools << VToolUnionDetails::ToolType; tools << VToolUnionDetails::ToolType;
switch(tools.indexOf(type)) { switch (tools.indexOf(type))
{
case 0: //VToolUnionDetails::ToolType case 0: //VToolUnionDetails::ToolType
try try
{ {