Unix Line Endings. Need for Vera++.

--HG--
branch : XML Editor
This commit is contained in:
dismine 2014-05-16 19:39:46 +03:00
parent cc572df448
commit 1489dc6a1c
4 changed files with 1181 additions and 1181 deletions

View File

@ -1,65 +1,65 @@
/************************************************************************ /************************************************************************
** **
** @file dialogaboutapp.cpp ** @file dialogaboutapp.cpp
** @author Patrick Proy <patrick(at)proy.org> ** @author Patrick Proy <patrick(at)proy.org>
** @date 6 5, 2014 ** @date 6 5, 2014
** **
** @brief ** @brief
** @copyright ** @copyright
** This source code is part of the Valentine project, a pattern making ** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing. ** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project ** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved. ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
** **
** Valentina is free software: you can redistribute it and/or modify ** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Valentina is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
** **
** You should have received a copy of the GNU General Public License ** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>. ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
** **
*************************************************************************/ *************************************************************************/
#include "dialogaboutapp.h" #include "dialogaboutapp.h"
#include "ui_dialogaboutapp.h" #include "ui_dialogaboutapp.h"
#include "../../version.h" #include "../../version.h"
DialogAboutApp::DialogAboutApp(QWidget *parent) : DialogAboutApp::DialogAboutApp(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::DialogAboutApp) ui(new Ui::DialogAboutApp)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION)); ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
ui->label_QT_Version->setText(tr("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR)); ui->label_QT_Version->setText(tr("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR));
QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy")); QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
ui->label_Valentina_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__)); ui->label_Valentina_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__));
ui->label_Legal_Stuff->setText(WARRANTY); ui->label_Legal_Stuff->setText(WARRANTY);
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR)); ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR));
connect(ui->pushButton_Web_Site, &QPushButton::clicked, connect(ui->pushButton_Web_Site, &QPushButton::clicked,
this, &DialogAboutApp::webButtonClicked ); this, &DialogAboutApp::webButtonClicked );
} }
DialogAboutApp::~DialogAboutApp() DialogAboutApp::~DialogAboutApp()
{ {
delete ui; delete ui;
} }
void DialogAboutApp::webButtonClicked() { void DialogAboutApp::webButtonClicked() {
if ( ! QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR))) { if ( ! QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR))) {
QMessageBox::warning(this, QMessageBox::warning(this,
tr("Warning"), tr("Warning"),
tr("Cannot open your default browser")); tr("Cannot open your default browser"));
} }
} }

View File

@ -1,57 +1,57 @@
/************************************************************************ /************************************************************************
** **
** @file dialogaboutapp.h ** @file dialogaboutapp.h
** @author Patrick Proy <patrick(at)proy.org> ** @author Patrick Proy <patrick(at)proy.org>
** @date 6 5, 2014 ** @date 6 5, 2014
** **
** @brief ** @brief
** @copyright ** @copyright
** This source code is part of the Valentine project, a pattern making ** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing. ** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project ** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved. ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
** **
** Valentina is free software: you can redistribute it and/or modify ** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Valentina is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
** **
** You should have received a copy of the GNU General Public License ** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>. ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
** **
*************************************************************************/ *************************************************************************/
#ifndef DIALOGABOUTAPP_H #ifndef DIALOGABOUTAPP_H
#define DIALOGABOUTAPP_H #define DIALOGABOUTAPP_H
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
class DialogAboutApp; class DialogAboutApp;
} }
class DialogAboutApp : public QDialog class DialogAboutApp : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DialogAboutApp(QWidget *parent = 0); explicit DialogAboutApp(QWidget *parent = 0);
~DialogAboutApp(); ~DialogAboutApp();
private: private:
Ui::DialogAboutApp *ui; Ui::DialogAboutApp *ui;
Q_DISABLE_COPY(DialogAboutApp) Q_DISABLE_COPY(DialogAboutApp)
private slots: private slots:
/** /**
* @brief Fake button clicked * @brief Fake button clicked
*/ */
void webButtonClicked(); void webButtonClicked();
}; };
#endif // DIALOGABOUTAPP_H #endif // DIALOGABOUTAPP_H

File diff suppressed because it is too large Load Diff

View File

@ -1,282 +1,282 @@
/************************************************************************ /************************************************************************
** **
** @file dialogpatternxmledit.h ** @file dialogpatternxmledit.h
** @author Patrick Proy <patrick(at)proy.org> ** @author Patrick Proy <patrick(at)proy.org>
** @date 14 5, 2014 ** @date 14 5, 2014
** **
** @brief Include file for the XML editor dialog ** @brief Include file for the XML editor dialog
** @copyright ** @copyright
** This source code is part of the Valentine project, a pattern making ** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing. ** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project ** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved. ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
** **
** Valentina is free software: you can redistribute it and/or modify ** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or ** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** Valentina is distributed in the hope that it will be useful, ** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
** **
** You should have received a copy of the GNU General Public License ** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>. ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
** **
*************************************************************************/ *************************************************************************/
#ifndef DIALOGPATTERNXMLEDIT_H #ifndef DIALOGPATTERNXMLEDIT_H
#define DIALOGPATTERNXMLEDIT_H #define DIALOGPATTERNXMLEDIT_H
#include <QDialog> #include <QDialog>
#include <QStandardItemModel> #include <QStandardItemModel>
#include "../../xml/vpattern.h" #include "../../xml/vpattern.h"
//******************************************************************************************** //********************************************************************************************
/** /**
* @brief The vXMLTreeElement class : node/attribute of xml pattern. Used by vXMLTreeView * @brief The vXMLTreeElement class : node/attribute of xml pattern. Used by vXMLTreeView
* *
********************************************************************************************** **********************************************************************************************
*/ */
#define BACKGROUND_COLOR_ATTRIBUTE QBrush(Qt::GlobalColor::cyan) #define BACKGROUND_COLOR_ATTRIBUTE QBrush(Qt::GlobalColor::cyan)
class VXMLTreeElement : public QStandardItem class VXMLTreeElement : public QStandardItem
{ {
public: public:
/** /**
* @brief vXMLTreeElement * @brief vXMLTreeElement
* @param name : display name * @param name : display name
* @param nodetype : node type (node, attribute, root) * @param nodetype : node type (node, attribute, root)
* @param source : the source dom node * @param source : the source dom node
*/ */
explicit VXMLTreeElement (QString name, int nodetype, QDomNode source,bool editor); explicit VXMLTreeElement (QString name, int nodetype, QDomNode source,bool editor);
explicit VXMLTreeElement (QString name, int nodetype); explicit VXMLTreeElement (QString name, int nodetype);
~VXMLTreeElement (); ~VXMLTreeElement ();
static const short int TypeNode; static const short int TypeNode;
static const short int TypeAttr; static const short int TypeAttr;
static const short int TypeRoot; static const short int TypeRoot;
/** /**
* @brief setNodeValue : set value of node (content or attribute) * @brief setNodeValue : set value of node (content or attribute)
* @param value : the value * @param value : the value
*/ */
void setTreeNodeValue(QString value); void setTreeNodeValue(QString value);
/** /**
* @brief displayText : text to display * @brief displayText : text to display
* @return text to display * @return text to display
*/ */
QString displayText(); QString displayText();
/** /**
* @brief getDocNode * @brief getDocNode
* @return current document node * @return current document node
*/ */
QDomNode getDocNode(); QDomNode getDocNode();
QString gettreeNodeName(); QString gettreeNodeName();
QString gettreeNodeValue(); QString gettreeNodeValue();
bool gettreeNodeValueSet(); bool gettreeNodeValueSet();
void setTreeNodeName(QString value); void setTreeNodeName(QString value);
/** /**
* @brief getelementType * @brief getelementType
* @return elementType value * @return elementType value
*/ */
short int getelementType(); short int getelementType();
private: private:
/** /**
* @brief DocNode : link to current document node * @brief DocNode : link to current document node
*/ */
QDomNode DocNode; QDomNode DocNode;
/** /**
* @brief addedNode : true if node is added by editor (implies empty DocNode) * @brief addedNode : true if node is added by editor (implies empty DocNode)
*/ */
bool addedNode; bool addedNode;
/** /**
* @brief type : element type (node, attribute, text value of node) * @brief type : element type (node, attribute, text value of node)
*/ */
short int elementType; short int elementType;
/** /**
* @brief nodeValue : Attribute or node value * @brief nodeValue : Attribute or node value
*/ */
QString treeNodeValue; QString treeNodeValue;
/** /**
* @brief treeNodeValueSet : true if value has been set * @brief treeNodeValueSet : true if value has been set
*/ */
bool treeNodeValueSet; bool treeNodeValueSet;
/** /**
* @brief nodeValue : Attribute or node value * @brief nodeValue : Attribute or node value
*/ */
QString treeNodeName; QString treeNodeName;
Q_DISABLE_COPY(VXMLTreeElement) Q_DISABLE_COPY(VXMLTreeElement)
}; };
inline short int VXMLTreeElement::getelementType() inline short int VXMLTreeElement::getelementType()
{ {
return this->elementType; return this->elementType;
} }
inline QDomNode VXMLTreeElement::getDocNode() inline QDomNode VXMLTreeElement::getDocNode()
{ {
return this->DocNode; return this->DocNode;
} }
inline QString VXMLTreeElement::gettreeNodeName() inline QString VXMLTreeElement::gettreeNodeName()
{ {
return this->treeNodeName; return this->treeNodeName;
} }
inline bool VXMLTreeElement::gettreeNodeValueSet() inline bool VXMLTreeElement::gettreeNodeValueSet()
{ {
return this->treeNodeValueSet; return this->treeNodeValueSet;
} }
//******************************************************************************************** //********************************************************************************************
/** /**
* @brief The vXMLTreeView class : container to display/edit xml pattern * @brief The vXMLTreeView class : container to display/edit xml pattern
*/ */
class VXMLTreeView : public QStandardItemModel class VXMLTreeView : public QStandardItemModel
{ {
public: public:
explicit VXMLTreeView (QObject *parent = 0); explicit VXMLTreeView (QObject *parent = 0);
void appendchain(VXMLTreeElement* elmt); void appendchain(VXMLTreeElement* elmt);
/** /**
* @brief The TreeElement struct : chained list of vXMLTreeElement * @brief The TreeElement struct : chained list of vXMLTreeElement
*/ */
typedef struct TreeElementchain { typedef struct TreeElementchain {
VXMLTreeElement* elmt; VXMLTreeElement* elmt;
TreeElementchain* next; TreeElementchain* next;
} TreeElementchain; } TreeElementchain;
TreeElementchain * getCurrent(); TreeElementchain * getCurrent();
void SetCurrent(TreeElementchain * value); void SetCurrent(TreeElementchain * value);
TreeElementchain * GetLast(); TreeElementchain * GetLast();
TreeElementchain * GetItems(); TreeElementchain * GetItems();
/** /**
* @brief clearTree : clear tree elements and listed items. * @brief clearTree : clear tree elements and listed items.
*/ */
void ClearTree(); void ClearTree();
~VXMLTreeView (); ~VXMLTreeView ();
private: private:
Q_DISABLE_COPY(VXMLTreeView) Q_DISABLE_COPY(VXMLTreeView)
/** /**
* @brief items : root of chained list of vXMLTreeElement * @brief items : root of chained list of vXMLTreeElement
*/ */
TreeElementchain * items; TreeElementchain * items;
/** /**
* @brief current : used to parse in iteration. * @brief current : used to parse in iteration.
*/ */
TreeElementchain * current; TreeElementchain * current;
/** /**
* @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()
{ {
return this->current; return this->current;
} }
inline void VXMLTreeView::SetCurrent(VXMLTreeView::TreeElementchain * value) inline void VXMLTreeView::SetCurrent(VXMLTreeView::TreeElementchain * value)
{ {
this->current=value; this->current=value;
} }
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetLast() inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetLast()
{ {
return this->last; return this->last;
} }
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetItems() inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetItems()
{ {
return this->items; return this->items;
} }
//******************************************************************************************** //********************************************************************************************
namespace Ui { namespace Ui {
class DialogPatternXmlEdit; class DialogPatternXmlEdit;
} }
/** /**
* @brief The DialogPatternXmlEdit class : ui dialog for XML editing of pattern * @brief The DialogPatternXmlEdit class : ui dialog for XML editing of pattern
*/ */
class DialogPatternXmlEdit : public QDialog class DialogPatternXmlEdit : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DialogPatternXmlEdit(QWidget *parent = 0, VPattern *xmldoc = 0); explicit DialogPatternXmlEdit(QWidget *parent = 0, VPattern *xmldoc = 0);
~DialogPatternXmlEdit(); ~DialogPatternXmlEdit();
/** /**
* @brief clear_edit_data : clear input boxes and disables buttons. * @brief clear_edit_data : clear input boxes and disables buttons.
*/ */
void ClearEditData(); void ClearEditData();
void NameTextEdited(QString newtext); void NameTextEdited(QString newtext);
void ValueTextEdited(QString newtext); void ValueTextEdited(QString newtext);
void ButtonSetClicked(); void ButtonSetClicked();
void ButtonCancelClicked(); void ButtonCancelClicked();
void ButtonDeleteAttributeClicked(); void ButtonDeleteAttributeClicked();
void ButtonAddSonClicked(); void ButtonAddSonClicked();
void ButtonAddAttributeClicked(); void ButtonAddAttributeClicked();
void ButtonApplyChangesClicked() ; void ButtonApplyChangesClicked() ;
// Stack of changes definition // Stack of changes definition
typedef struct ChangesStackElement { typedef struct ChangesStackElement {
short int type; short int type;
VXMLTreeElement *element; VXMLTreeElement *element;
QString *newText; QString *newText;
bool changedText; bool changedText;
QString *newValue; QString *newValue;
bool changedValue; bool changedValue;
ChangesStackElement* next; ChangesStackElement* next;
} ChangesStackElement; } ChangesStackElement;
// Change stack functions // Change stack functions
ChangesStackElement* CreateStackElement(short int typechange); ChangesStackElement* CreateStackElement(short int typechange);
void RemoveChangeStackElement(ChangesStackElement* elmt); void RemoveChangeStackElement(ChangesStackElement* elmt);
void ClearStack(); void ClearStack();
bool treeChange; bool treeChange;
VXMLTreeElement* currentNodeEdited; VXMLTreeElement* currentNodeEdited;
short int currentNodeEditedStatus; short int currentNodeEditedStatus;
ChangesStackElement* currentNodeEditedStack; ChangesStackElement* currentNodeEditedStack;
private slots: private slots:
void BaseSelectionChanged(int value); void BaseSelectionChanged(int value);
void ElementClicked ( const QModelIndex & index ); void ElementClicked ( const QModelIndex & index );
private: private:
Q_DISABLE_COPY(DialogPatternXmlEdit) Q_DISABLE_COPY(DialogPatternXmlEdit)
Ui::DialogPatternXmlEdit *ui; Ui::DialogPatternXmlEdit *ui;
VPattern *doc; VPattern *doc;
QDomElement root; QDomElement root;
QStandardItem *rootNode; QStandardItem *rootNode;
//typedef struct rootbases { vXMLTreeElement * root; QString name; } rootbases; //typedef struct rootbases { vXMLTreeElement * root; QString name; } rootbases;
VXMLTreeElement ** rootBases; VXMLTreeElement ** rootBases;
qint16 rootBasesNum; qint16 rootBasesNum;
void ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXMLTreeView *xmlmodel, bool refresh); void ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXMLTreeView *xmlmodel, bool refresh);
VXMLTreeView* xmlmodel; VXMLTreeView* xmlmodel;
// Stack of changes // Stack of changes
static const short int ChangeTypeDelete; static const short int ChangeTypeDelete;
static const short int ChangeTypeAdd; static const short int ChangeTypeAdd;
static const short int ChangeTypeModify; static const short int ChangeTypeModify;
// Stack of changes // Stack of changes
ChangesStackElement* changeStackRoot; ChangesStackElement* changeStackRoot;
ChangesStackElement* changeStackLast; ChangesStackElement* changeStackLast;
}; };
#endif // DIALOGPATTERNXMLEDIT_H #endif // DIALOGPATTERNXMLEDIT_H