--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()
{
switch(contentsWidget->currentRow())
switch (contentsWidget->currentRow())
{
case(0):
case (0):
configurationPage->Apply();
break;
case(1):
case (1):
patternPage->Apply();
break;
default:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -389,7 +389,8 @@ protected:
* @param id don't show this id in list
* @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;
/**
* @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);
}
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)
{

View File

@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent)
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr),
view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr),
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();
CreateMenus();
@ -1258,9 +1258,13 @@ bool MainWindow::MaybeSave()
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
if (ret == QMessageBox::Save)
{
return Save();
}
else if (ret == QMessageBox::Cancel)
{
return false;
}
}
return true;
}

View File

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

View File

@ -32,10 +32,9 @@
const QString VToolBisector::ToolType = QStringLiteral("bisector");
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation,
QGraphicsItem *parent)
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0)
{
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);
}
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation)
{
Q_CHECK_PTR(scene);

View File

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

View File

@ -32,9 +32,9 @@
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation,
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const Tool::Sources &typeCreation,
QGraphicsItem * parent)
: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());
CorectControlPoints(spl, splPath, i);
CorectControlPoints(spl, splPath, i);
}
}
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);

View File

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

View File

@ -80,9 +80,10 @@ public:
* @param parse parser file mode.
* @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,
const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation);
static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id,
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
/**
* @brief GetDetailFromFile parse detail from file.
* @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);
Q_CHECK_PTR(lineEdit);
QString text = lineEdit->text();
if(text.isEmpty())
if (text.isEmpty())
{
text = lastText;
}
@ -94,7 +94,7 @@ void TextDelegate::commitAndCloseEditor()
lastText = text;
emit commitData(lineEdit);
}
else if(text.isEmpty() == false)
else if (text.isEmpty() == false)
{
lineEdit->setText(lastText);
emit commitData(lineEdit);

View File

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