Fix some gcc warning.

This commit is contained in:
dismine 2013-09-12 17:18:31 +03:00
parent ea072a35f4
commit fb99e19f27
24 changed files with 79 additions and 68 deletions

View File

@ -134,13 +134,13 @@ qint64 VContainer::getId(){
}
qint64 VContainer::getNextId(){
this->_id++;
_id++;
return _id;
}
void VContainer::UpdateId(qint64 newId){
if(newId > this->_id){
this->_id = newId;
if(newId > _id){
_id = newId;
}
}
@ -208,6 +208,9 @@ void VContainer::IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode){
}
}
break;
default:
qWarning()<<"Get wrong scene type.";
break;
}
}
@ -254,6 +257,9 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
}
}
break;
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
}
}
QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10));

View File

@ -1,4 +1,5 @@
#include "dialogdetail.h"
#include <QDebug>
DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), details(VDetail()){
@ -36,6 +37,9 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){
case(Scene::SplinePath):
NewItem(id, Tools::NodeSplinePath, mode, NodeDetail::Contour);
break;
default:
qWarning()<<"Get wrong scene object. Ignore.";
break;
}
this->show();
}
@ -94,6 +98,9 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod
name = data->GetNameSplinePath(splPath, mode);
break;
}
default:
qWarning()<<"Get wrong tools. Ignore.";
break;
}
QListWidgetItem *item = new QListWidgetItem(name);

View File

@ -9,7 +9,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *p
DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
formula(QString()), angle(0), basePointId(0){
ui->setupUi(this);
spinBoxAngle = ui->spinBoxAngle;
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
@ -109,13 +109,13 @@ void DialogEndLine::setFormula(const QString &value){
ui->lineEditFormula->setText(formula);
}
qint32 DialogEndLine::getAngle() const{
qreal DialogEndLine::getAngle() const{
return angle;
}
void DialogEndLine::setAngle(const qint32 &value){
void DialogEndLine::setAngle(const qreal &value){
angle = value;
ui->spinBoxAngle->setValue(angle);
ui->doubleSpinBoxAngle->setValue(angle);
}
qint64 DialogEndLine::getBasePointId() const{
@ -130,7 +130,7 @@ void DialogEndLine::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->lineEditFormula->text();
angle = ui->spinBoxAngle->value();
angle = ui->doubleSpinBoxAngle->value();
basePointId = getCurrentPointId(ui->comboBoxBasePoint);
emit DialogClosed(QDialog::Accepted);
}

View File

@ -26,8 +26,8 @@ public:
void setTypeLine(const QString &value);
QString getFormula() const;
void setFormula(const QString &value);
qint32 getAngle() const;
void setAngle(const qint32 &value);
qreal getAngle() const;
void setAngle(const qreal &value);
qint64 getBasePointId() const;
void setBasePointId(const qint64 &value, const qint64 &id);
public slots:
@ -38,7 +38,7 @@ private:
QString pointName;
QString typeLine;
QString formula;
qint32 angle;
qreal angle;
qint64 basePointId;
DialogEndLine(const DialogEndLine &dialog);
const DialogEndLine &operator=(const DialogEndLine& dialog);

View File

@ -315,7 +315,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -324,16 +324,10 @@
</property>
<property name="minimumSize">
<size>
<width>52</width>
<width>57</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>360</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>

View File

@ -1,14 +1,13 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "dialoghistory.h"
#include "ui_dialoghistory.h"
#pragma GCC diagnostic pop
#include "geometry/varc.h"
#include "geometry/vspline.h"
#include "geometry/vsplinepath.h"
#include <QDebug>
DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) :
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0){
DialogTool(data, Draw::Calculation, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0),
cursorToolRecordRow(0){
ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
@ -230,6 +229,9 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
}
return record;
}

View File

@ -6,7 +6,7 @@ DialogNormal::DialogNormal(const VContainer *data, Draw::Mode mode, QWidget *par
DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0){
ui->setupUi(this);
spinBoxAngle = ui->spinBoxAngle;
spinBoxAngle = ui->doubleSpinBoxAngle;
listWidget = ui->listWidget;
labelResultCalculation = ui->labelResultCalculation;
labelDescription = ui->labelDescription;
@ -105,7 +105,7 @@ void DialogNormal::DialogAccepted(){
pointName = ui->lineEditNamePoint->text();
typeLine = GetTypeLine(ui->comboBoxLineType);
formula = ui->lineEditFormula->text();
angle = ui->spinBoxAngle->value();
angle = ui->doubleSpinBoxAngle->value();
firstPointId = getCurrentPointId(ui->comboBoxFirstPoint);
secondPointId = getCurrentPointId(ui->comboBoxSecondPoint);
emit DialogClosed(QDialog::Accepted);
@ -127,13 +127,13 @@ void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id){
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id);
}
qint32 DialogNormal::getAngle() const{
qreal DialogNormal::getAngle() const{
return angle;
}
void DialogNormal::setAngle(const qint32 &value){
void DialogNormal::setAngle(const qreal &value){
angle = value;
ui->spinBoxAngle->setValue(angle);
ui->doubleSpinBoxAngle->setValue(angle);
}
QString DialogNormal::getFormula() const{

View File

@ -26,8 +26,8 @@ public:
void setTypeLine(const QString &value);
QString getFormula() const;
void setFormula(const QString &value);
qint32 getAngle() const;
void setAngle(const qint32 &value);
qreal getAngle() const;
void setAngle(const qreal &value);
qint64 getFirstPointId() const;
void setFirstPointId(const qint64 &value, const qint64 &id);
qint64 getSecondPointId() const;
@ -41,7 +41,7 @@ private:
QString pointName;
QString typeLine;
QString formula;
qint32 angle;
qreal angle;
qint64 firstPointId;
qint64 secondPointId;
DialogNormal(const DialogNormal &dialog);

View File

@ -338,7 +338,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxAngle">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -347,16 +347,10 @@
</property>
<property name="minimumSize">
<size>
<width>52</width>
<width>56</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>360</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>

View File

@ -3,7 +3,7 @@
#include <QDialog>
#include <QComboBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QLineEdit>
#include <QListWidget>
@ -54,7 +54,7 @@ protected:
bool flagFormula;
QTimer *timerFormula;
QPushButton *bOk;
QSpinBox *spinBoxAngle;
QDoubleSpinBox *spinBoxAngle;
QLineEdit *lineEditFormula;
QListWidget *listWidget;
QLabel *labelResultCalculation;

View File

@ -589,6 +589,9 @@ void MainWindow::CanselTool(){
dialogDetail.clear();
ui->toolButtonNewDetail->setChecked(false);
break;
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
}
}

View File

@ -317,7 +317,7 @@ void TableWindow::PngFile(const QString &name) const{
QRectF r = paper->rect();
qreal x=0, y=0, w=0, h=0;
r.getRect(&x,&y,&w,&h);// Re-shrink the scene to it's bounding contents
QImage image(QSize(w, h), QImage::Format_ARGB32); // Create the image with the exact size of the shrunk scene
QImage image(QSize(static_cast<qint32>(w), static_cast<qint32>(h)), QImage::Format_ARGB32); // Create the image with the exact size of the shrunk scene
image.fill(Qt::transparent); // Start all pixels transparent
QPainter painter(&image);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );

View File

@ -1,10 +1,10 @@
#include "vtoolendline.h"
#include <QDebug>
#include <QMenu>
#include "../../widgets/vmaingraphicsscene.h"
#include "widgets/vmaingraphicsscene.h"
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId,
const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -26,19 +26,19 @@ void VToolEndLine::setDialog(){
}
}
void VToolEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data){
void VToolEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data){
QString pointName = dialog->getPointName();
QString typeLine = dialog->getTypeLine();
QString formula = dialog->getFormula();
qint32 angle = dialog->getAngle();
qreal angle = dialog->getAngle();
qint64 basePointId = dialog->getBasePointId();
Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse,
Tool::FromGui);
}
void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){

View File

@ -10,14 +10,14 @@ class VToolEndLine : public VToolLinePoint
Q_OBJECT
public:
VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint32 &angle,
const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId, const qreal &mx, const qreal &my,
const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
public slots:

View File

@ -2,13 +2,13 @@
VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &basePointId,
const qint32 &angle, QGraphicsItem *parent):VToolPoint(doc, data, id, parent),
const qreal &angle, QGraphicsItem *parent):VToolPoint(doc, data, id, parent),
typeLine(typeLine), formula(formula), angle(angle), basePointId(basePointId), mainLine(0){
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
//Лінія, що з'єднує дві точки
QPointF point1 = data->GetPoint(basePointId).toQPointF();
QPointF point2 = data->GetPoint(id).toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this);
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
if(typeLine == "none"){
@ -32,7 +32,7 @@ void VToolLinePoint::RefreshGeometry(){
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
QPointF point = VDrawTool::data.GetPoint(id).toQPointF();
QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, 0));
mainLine->setLine(QLineF(basePoint - point, QPointF()));
if(typeLine == "none"){
mainLine->setVisible(false);
} else {

View File

@ -9,13 +9,13 @@ class VToolLinePoint : public VToolPoint
public:
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qint32 &angle, QGraphicsItem * parent = 0);
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
public slots:
virtual void ChangedActivDraw(const QString newName);
protected:
QString typeLine;
QString formula;
qint32 angle;
qreal angle;
qint64 basePointId;
QGraphicsLineItem *mainLine;
virtual void RefreshGeometry();

View File

@ -34,7 +34,7 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScen
qint64 secondPointId = dialog->getSecondPointId();
QString typeLine = dialog->getTypeLine();
QString pointName = dialog->getPointName();
qint32 angle = dialog->getAngle();
qreal angle = dialog->getAngle();
Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
Document::FullParse, Tool::FromGui);
}

View File

@ -4,7 +4,7 @@
#include "widgets/vmaingraphicsscene.h"
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId,
const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -31,7 +31,7 @@ VModelingEndLine *VModelingEndLine::Create(QSharedPointer<DialogEndLine> &dialog
QString pointName = dialog->getPointName();
QString typeLine = dialog->getTypeLine();
QString formula = dialog->getFormula();
qint32 angle = dialog->getAngle();
qreal angle = dialog->getAngle();
qint64 basePointId = dialog->getBasePointId();
return Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, doc, data, Document::FullParse,
Tool::FromGui);
@ -39,7 +39,7 @@ VModelingEndLine *VModelingEndLine::Create(QSharedPointer<DialogEndLine> &dialog
VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &pointName,
const QString &typeLine, const QString &formula,
const qint32 &angle, const qint64 &basePointId, const qreal &mx,
const qreal &angle, const qint64 &basePointId, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){
VModelingEndLine *point = 0;

View File

@ -10,14 +10,14 @@ class VModelingEndLine : public VModelingLinePoint
Q_OBJECT
public:
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint32 &angle,
const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint32 &angle, const qint64 &basePointId,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation);
public slots:

View File

@ -2,13 +2,13 @@
VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &basePointId,
const qint32 &angle, QGraphicsItem *parent):
const qreal &angle, QGraphicsItem *parent):
VModelingPoint(doc, data, id, parent), typeLine(typeLine), formula(formula), angle(angle),
basePointId(basePointId), mainLine(0){
//Лінія, що з'єднує дві точки
QPointF point1 = data->GetModelingPoint(basePointId).toQPointF();
QPointF point2 = data->GetModelingPoint(id).toQPointF();
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, 0), this);
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
if(typeLine == "none"){
@ -22,7 +22,7 @@ void VModelingLinePoint::RefreshGeometry(){
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetModelingPoint(id));
QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF();
QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, 0));
mainLine->setLine(QLineF(basePoint - point, QPointF()));
if(typeLine == "none"){
mainLine->setVisible(false);
} else {

View File

@ -9,11 +9,11 @@ class VModelingLinePoint : public VModelingPoint
public:
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qint32 &angle, QGraphicsItem * parent = 0);
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
protected:
QString typeLine;
QString formula;
qint32 angle;
qreal angle;
qint64 basePointId;
QGraphicsLineItem *mainLine;
virtual void RefreshGeometry();

View File

@ -34,7 +34,7 @@ VModelingNormal* VModelingNormal::Create(QSharedPointer<DialogNormal> &dialog, V
qint64 secondPointId = dialog->getSecondPointId();
QString typeLine = dialog->getTypeLine();
QString pointName = dialog->getPointName();
qint32 angle = dialog->getAngle();
qreal angle = dialog->getAngle();
return Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, doc, data,
Document::FullParse, Tool::FromGui);
}

View File

@ -137,6 +137,9 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
tool->setParentItem(this);
break;
}
default:
qWarning()<<"Get wrong tool type. Ignore.";
break;
}
}
this->setFlag(QGraphicsItem::ItemIsMovable, true);

View File

@ -43,6 +43,8 @@ private:
VMainGraphicsScene *sceneDetails;
void RefreshGeometry ();
void AddNode(QDomElement &domElement, VNodeDetail &node);
VToolDetail(const VToolDetail &tool);
VToolDetail &operator=(const VToolDetail &tool);
};
#endif // VTOOLDETAIL_H