GCC warnings.

--HG--
branch : XML Editor
This commit is contained in:
dismine 2014-05-16 20:24:51 +03:00
parent b28bd29092
commit e1c3f418e5
2 changed files with 16 additions and 17 deletions

View File

@ -36,14 +36,14 @@ const short int DialogPatternXmlEdit::ChangeTypeModify=3;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc) DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
:QDialog(parent), ui(new Ui::DialogPatternXmlEdit) :QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0),
currentNodeEditedStack(nullptr), ui(new Ui::DialogPatternXmlEdit), doc(nullptr), root(QDomElement()),
rootNode(nullptr), rootBases(nullptr), rootBasesNum(0), xmlmodel(nullptr), changeStackRoot(nullptr),
changeStackLast(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
xmlmodel = new VXMLTreeView(); xmlmodel = new VXMLTreeView();
currentNodeEdited=nullptr;
treeChange=false;
this->changeStackRoot = this->changeStackLast = nullptr;
doc=xmldoc; doc=xmldoc;
root = doc->documentElement(); root = doc->documentElement();
@ -53,9 +53,10 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
ui->treeView_main->setWindowTitle("XML"); ui->treeView_main->setWindowTitle("XML");
//TODO warning: use of old-style cast [-Wold-style-cast]
rootNode = (QStandardItem*) xmlmodel->invisibleRootItem(); rootNode = (QStandardItem*) xmlmodel->invisibleRootItem();
//TODO warning: conversion to 'qint16 {aka short int}' from 'int' may alter its value [-Wconversion]
qint16 drawnum=xmldoc->elementsByTagName("draw").size(); qint16 drawnum=xmldoc->elementsByTagName("draw").size();
rootBases = new VXMLTreeElement*[drawnum+1]; rootBases = new VXMLTreeElement*[drawnum+1];
rootBasesNum=1; rootBasesNum=1;
@ -524,9 +525,11 @@ void DialogPatternXmlEdit::ElementClicked ( const QModelIndex & index )
{ {
// Get item (function returns parent of clicked item) // Get item (function returns parent of clicked item)
//TODO warning: use of old-style cast [-Wold-style-cast]
VXMLTreeElement *item = (VXMLTreeElement *)index.internalPointer(); VXMLTreeElement *item = (VXMLTreeElement *)index.internalPointer();
// Get child specified by index row/column // Get child specified by index row/column
//TODO warning: use of old-style cast [-Wold-style-cast]
VXMLTreeElement * item2 = (VXMLTreeElement *) item->child(index.row(), index.column()); VXMLTreeElement * item2 = (VXMLTreeElement *) item->child(index.row(), index.column());
// Clear all data and disable buttons // Clear all data and disable buttons
@ -670,10 +673,9 @@ void DialogPatternXmlEdit::ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXML
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VXMLTreeView::VXMLTreeView(QObject *parent) : QStandardItemModel(parent) VXMLTreeView::VXMLTreeView(QObject *parent)
{ : QStandardItemModel(parent), items(nullptr), current(nullptr), last(nullptr)
current=last=items=nullptr; {}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VXMLTreeView::ClearTree() void VXMLTreeView::ClearTree()
@ -730,19 +732,17 @@ const short int VXMLTreeElement::TypeAttr=2;
const short int VXMLTreeElement::TypeRoot=3; const short int VXMLTreeElement::TypeRoot=3;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
//TODO warning: conversion to 'short int' from 'int' may alter its value [-Wconversion]
//treeNodeValueSet(false), treeNodeName(name)
// ^
VXMLTreeElement::VXMLTreeElement(QString name, int nodetype, QDomNode source, bool editor) VXMLTreeElement::VXMLTreeElement(QString name, int nodetype, QDomNode source, bool editor)
: QStandardItem(name) : QStandardItem(name), DocNode(source), addedNode(editor), elementType(nodetype), treeNodeValue("<empty>"),
treeNodeValueSet(false), treeNodeName(name)
{ {
this->elementType=nodetype;
this->DocNode=source;
this->addedNode=editor;
if (editor == false) if (editor == false)
{ {
this->DocNode=source; this->DocNode=source;
} }
this->treeNodeName=name;
this->treeNodeValue="<empty>"; // TODO : translation ?
this->treeNodeValueSet=false,
this->setText(this->displayText()); this->setText(this->displayText());
switch (this->elementType) switch (this->elementType)
{ {

View File

@ -175,7 +175,6 @@ private:
* @brief last : used to parse in iteration. * @brief last : used to parse in iteration.
*/ */
TreeElementchain * last; TreeElementchain * last;
}; };
inline VXMLTreeView::TreeElementchain * VXMLTreeView::getCurrent() inline VXMLTreeView::TreeElementchain * VXMLTreeView::getCurrent()