Merge with XML Editor.

--HG--
branch : develop
This commit is contained in:
dismine 2014-06-05 10:30:19 +03:00
commit b6311abe02
12 changed files with 2057 additions and 14 deletions

View File

@ -32,6 +32,8 @@
#include <QDate> #include <QDate>
#include <QDesktopServices> #include <QDesktopServices>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopServices>
#include <QMessageBox>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogAboutApp::DialogAboutApp(QWidget *parent) : DialogAboutApp::DialogAboutApp(QWidget *parent) :
@ -65,7 +67,7 @@ DialogAboutApp::~DialogAboutApp()
*/ */
void DialogAboutApp::webButtonClicked() void DialogAboutApp::webButtonClicked()
{ {
if ( ! QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR))) if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
{ {
QMessageBox::warning(this, tr("Warning"), tr("Cannot open your default browser")); QMessageBox::warning(this, tr("Warning"), tr("Cannot open your default browser"));
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,388 @@
/************************************************************************
**
** @file dialogpatternxmledit.h
** @author Patrick Proy <patrick(at)proy.org>
** @date 14 5, 2014
**
** @brief Include file for the XML editor dialog
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGPATTERNXMLEDIT_H
#define DIALOGPATTERNXMLEDIT_H
#include <QDialog>
#include <QStandardItemModel>
#include "../../xml/vpattern.h"
//********************************************************************************************
/**
* @brief The vXMLTreeElement class : node/attribute of xml pattern. Used by vXMLTreeView
*
*/
#define BACKGROUND_COLOR_ATTRIBUTE QBrush(Qt::GlobalColor::cyan)
#define BACKGROUND_COLOR_INACTIVE_NODE QBrush(Qt::GlobalColor::gray)
class VXMLTreeElement : public QStandardItem
{
public:
/**
* @brief vXMLTreeElement
* @param name : display name
* @param nodetype : node type (node, attribute, root)
* @param source : the source dom node
*/
explicit VXMLTreeElement (QString name, int nodetype, QDomNode source, bool editor);
explicit VXMLTreeElement (QString name, int nodetype);
~VXMLTreeElement ();
static const short int TypeNode;
static const short int TypeAttr;
static const short int TypeRoot;
/**
* @brief setNodeValue : set value of node (content or attribute)
* @param value : the value
*/
void SetTreeNodeValue(QString value);
/**
* @brief displayText : text to display
* @return text to display
*/
QString DisplayText();
/**
* @brief getDocNode
* @return current document node
*/
QDomNode GetDocNode();
/**
* @brief SetDocNode set tree element DomNode
* @param node
*/
inline void SetDocNode(QDomNode node)
{
this->DocNode=node;
}
inline void SetAddedNode(bool state) {this->addedNode=state;}
inline bool GetAddedNode() {return this->addedNode;}
QString GettreeNodeName();
QString GettreeNodeValue();
/**
* @brief GettreeNodeValueSet check if value has been set
* @return true if value is set
*/
bool GettreeNodeValueSet();
void SetTreeNodeName(QString value);
/**
* @brief getelementType
* @return elementType value
*/
short int GetelementType();
bool IsSelectable();
void SetSetlectable(bool value);
inline void SetFatherElement(VXMLTreeElement* parent)
{
this->parentnode=parent;
}
inline VXMLTreeElement* GetFatherElement()
{
return this->parentnode;
}
private:
/**
* @brief DocNode : link to current document node
*/
QDomNode DocNode;
/**
* @brief parentnode parent node of this element. If null then the DocNode must be valid
*/
VXMLTreeElement* parentnode;
/**
* @brief addedNode : true if node is added by editor (implies empty DocNode)
*/
bool addedNode;
/**
* @brief type : element type (node, attribute, text value of node)
*/
short int elementType;
/**
* @brief nodeValue : Attribute or node value
*/
QString treeNodeValue;
/**
* @brief treeNodeValueSet : true if value has been set
*/
bool treeNodeValueSet;
/**
* @brief nodeValue : Attribute or node value
*/
QString treeNodeName;
/**
* @brief selectable : can item be selected to be changed (ex : false if father deleted).
*/
bool selectable;
Q_DISABLE_COPY(VXMLTreeElement)
};
inline bool VXMLTreeElement::IsSelectable()
{
return this->selectable;
}
inline void VXMLTreeElement::SetSetlectable(bool value)
{
this->selectable=value;
}
inline short int VXMLTreeElement::GetelementType()
{
return this->elementType;
}
inline QDomNode VXMLTreeElement::GetDocNode()
{
return this->DocNode;
}
inline QString VXMLTreeElement::GettreeNodeName()
{
return this->treeNodeName;
}
inline bool VXMLTreeElement::GettreeNodeValueSet()
{
return this->treeNodeValueSet;
}
//********************************************************************************************
/**
* @brief The vXMLTreeView class : container to display/edit xml pattern
*/
class VXMLTreeView : public QStandardItemModel
{
public:
explicit VXMLTreeView (QObject *parent = 0);
void appendchain(VXMLTreeElement* elmt);
/**
* @brief The TreeElement struct : chained list of vXMLTreeElement
*/
typedef struct TreeElementchain
{
VXMLTreeElement* elmt;
TreeElementchain* next;
} TreeElementchain;
TreeElementchain * getCurrent();
void SetCurrent(TreeElementchain * value);
TreeElementchain * GetLast();
TreeElementchain * GetItems();
/**
* @brief clearTree : clear tree elements and listed items.
*/
void ClearTree();
~VXMLTreeView ();
private:
Q_DISABLE_COPY(VXMLTreeView)
/**
* @brief items : root of chained list of vXMLTreeElement
*/
TreeElementchain * items;
/**
* @brief current : used to parse in iteration.
*/
TreeElementchain * current;
/**
* @brief last : used to parse in iteration.
*/
TreeElementchain * last;
};
inline VXMLTreeView::TreeElementchain * VXMLTreeView::getCurrent()
{
return this->current;
}
inline void VXMLTreeView::SetCurrent(VXMLTreeView::TreeElementchain * value)
{
this->current=value;
}
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetLast()
{
return this->last;
}
inline VXMLTreeView::TreeElementchain * VXMLTreeView::GetItems()
{
return this->items;
}
//********************************************************************************************
namespace Ui
{
class DialogPatternXmlEdit;
}
/**
* @brief The DialogPatternXmlEdit class : ui dialog for XML editing of pattern
*/
class DialogPatternXmlEdit : public QDialog
{
Q_OBJECT
public:
explicit DialogPatternXmlEdit(QWidget *parent = 0, VPattern *xmldoc = 0);
~DialogPatternXmlEdit();
/**
* @brief clear_edit_data : clear input boxes and disables buttons.
*/
void ClearEditData();
void NameTextEdited(QString newtext);
void ValueTextEdited(QString newtext);
void ButtonSetClicked();
void ButtonCancelClicked();
void ButtonDeleteAttributeClicked();
void ButtonAddSonClicked();
void ButtonAddAttributeClicked();
void ButtonApplyChangesClicked();
void ButtonUndoLastChange();
void ButtonDeleteNode();
// Stack of changes definition
typedef struct ChangesStackElement
{
short int type;
VXMLTreeElement *element;
QString *newText;
QString *oldText;
bool changedText;
QString *newValue;
QString *oldValue;
bool changedValue;
ChangesStackElement* next;
} ChangesStackElement;
// Change stack functions
ChangesStackElement* CreateStackElement(short int typechange);
void RemoveChangeStackElement(ChangesStackElement* elmt);
void ClearStack();
bool treeChange;
VXMLTreeElement* currentNodeEdited;
short int currentNodeEditedStatus;
ChangesStackElement* currentNodeEditedStack;
/**
* @brief UndoChange : undo change in change stack element
* @param current : change to undo
* @return true if undo has been done, false on error
*/
bool UndoChange(ChangesStackElement* current);
/**
* @brief DeleteNodeAndSons : delete node and all it's attribute and sons below
* @param currentNode : node to delete
* @param onlydeactivate : if true, dont delete just deactivate sons and attributes
* @return false if changes couldn't be done
*/
bool DeleteNodeAndSons(VXMLTreeElement *currentNode, bool onlydeactivate);
/**
* @brief ApplyAttributeChange change or add attribute for node
* @param domElement : node containing attribute
* @param name
* @param value
* @return true on success
*/
bool ApplyAttributeChange(QDomNode domElement, QString name, QString value);
/**
* @brief ApplyNodeChange Change name or text content of node
* @param domElement node
* @param name
* @param value text content of node
* @return true on success
*/
bool ApplyNodeChange(QDomNode domElement, QString name, QString value);
/**
* @brief ApplyNodeAdd add node as child of domElement and set DocNode of treeElement
* @param domElement
* @param treeElement the XMLTreeElement of added node
* @param name
* @param value
* @return true on success
*/
bool ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value);
/**
* @brief ApplyAttributeDelete delete attribute for node
* @param domElement
* @param name attribute name
* @return true on success
*/
bool ApplyAttributeDelete(QDomNode domElement, QString name);
/**
* @brief ApplyNodeDelete delete node domElement
* @param domElement
* @return true on success
*/
bool ApplyNodeDelete(QDomNode domElement);
/**
* @brief CheckChanges Check if changes made are OK
* @param message error message returned if false
* @param testRoot root of DOM to test
* @return true if validated, false otherwise
*/
bool CheckChanges(QString &message, QDomNode testRoot);
private slots:
void BaseSelectionChanged(int value);
void ElementClicked ( const QModelIndex & index );
private:
Q_DISABLE_COPY(DialogPatternXmlEdit)
Ui::DialogPatternXmlEdit *ui;
VPattern *doc;
QDomElement root;
QStandardItem *rootNode;
//typedef struct rootbases { vXMLTreeElement * root; QString name; } rootbases;
VXMLTreeElement ** rootBases;
qint16 rootBasesNum;
void ReadNodes(QDomNode dNode, VXMLTreeElement* root, VXMLTreeView *xmlmodel, bool refresh);
VXMLTreeView* xmlmodel;
// Stack of changes
static const short int ChangeTypeDelete;
static const short int ChangeTypeAdd;
static const short int ChangeTypeModify;
// Stack of changes
ChangesStackElement* changeStackRoot;
ChangesStackElement* changeStackLast;
};
#endif // DIALOGPATTERNXMLEDIT_H

View File

@ -0,0 +1,367 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogPatternXmlEdit</class>
<widget class="QDialog" name="DialogPatternXmlEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>664</width>
<height>459</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>300</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="windowTitle">
<string>XML Editor</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTreeView" name="treeView_main">
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0" columnminimumwidth="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<item row="9" column="0">
<widget class="QLabel" name="label_Value">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Value :</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLineEdit" name="lineEdit_Value">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLineEdit" name="lineEdit_Name">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_Name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Name :</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="1">
<widget class="QLabel" name="label_type_value">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;No selection&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_type_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Type : </string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_Add_attribute">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add attribute</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_Add_son">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add son</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="11" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Remove_attribute">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove attibute</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_Remove_Node">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove node</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_Set_Values">
<property name="enabled">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_Cancel_Values">
<property name="enabled">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pushButton_Apply_Changes">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Apply changes</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButton_Undo_Last_Change">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Undo last</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_Apply_Changes">
<property name="text">
<string>Immediate apply</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_Base_Selection">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Base selection</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="comboBox_Base_Selection"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>5</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogPatternXmlEdit</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -58,5 +58,6 @@
#include "app/dialogindividualmeasurements.h" #include "app/dialogindividualmeasurements.h"
#include "app/dialogstandardmeasurements.h" #include "app/dialogstandardmeasurements.h"
#include "app/dialogaboutapp.h" #include "app/dialogaboutapp.h"
#include "app/dialogpatternxmledit.h"
#endif // DIALOGS_H #endif // DIALOGS_H

View File

@ -30,7 +30,8 @@ HEADERS += \
dialogs/app/dialogstandardmeasurements.h \ dialogs/app/dialogstandardmeasurements.h \
dialogs/app/dialogindividualmeasurements.h \ dialogs/app/dialogindividualmeasurements.h \
dialogs/app/dialogaboutapp.h \ dialogs/app/dialogaboutapp.h \
dialogs/tools/dialogeditwrongformula.h dialogs/tools/dialogeditwrongformula.h \
dialogs/app/dialogpatternxmledit.h
SOURCES += \ SOURCES += \
dialogs/tools/dialogtriangle.cpp \ dialogs/tools/dialogtriangle.cpp \
@ -63,6 +64,7 @@ SOURCES += \
dialogs/app/dialogstandardmeasurements.cpp \ dialogs/app/dialogstandardmeasurements.cpp \
dialogs/app/dialogindividualmeasurements.cpp \ dialogs/app/dialogindividualmeasurements.cpp \
dialogs/app/dialogaboutapp.cpp \ dialogs/app/dialogaboutapp.cpp \
dialogs/app/dialogpatternxmledit.cpp \
dialogs/tools/dialogeditwrongformula.cpp dialogs/tools/dialogeditwrongformula.cpp
FORMS += \ FORMS += \
@ -93,4 +95,5 @@ FORMS += \
dialogs/app/dialogstandardmeasurements.ui \ dialogs/app/dialogstandardmeasurements.ui \
dialogs/app/dialogindividualmeasurements.ui \ dialogs/app/dialogindividualmeasurements.ui \
dialogs/app/dialogaboutapp.ui \ dialogs/app/dialogaboutapp.ui \
dialogs/app/dialogpatternxmledit.ui \
dialogs/tools/dialogeditwrongformula.ui dialogs/tools/dialogeditwrongformula.ui

View File

@ -685,7 +685,7 @@ void MainWindow::ClosedDialogCutArc(int result)
void MainWindow::About() void MainWindow::About()
{ {
DialogAboutApp * about_dialog = new DialogAboutApp(this); DialogAboutApp * about_dialog = new DialogAboutApp(this);
about_dialog->setAttribute(Qt::WA_DeleteOnClose,true); about_dialog->setAttribute(Qt::WA_DeleteOnClose, true);
about_dialog->show(); about_dialog->show();
} }
@ -735,6 +735,14 @@ void MainWindow::PatternProperties()
proper.exec(); proper.exec();
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::EditPatternCode()
{
DialogPatternXmlEdit *Pattern = new DialogPatternXmlEdit (this, doc);
Pattern->setAttribute(Qt::WA_DeleteOnClose, true);
Pattern->show();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief showEvent handle after show window. * @brief showEvent handle after show window.
@ -1396,6 +1404,8 @@ void MainWindow::SetEnableWidgets(bool enable)
} }
ui->actionTable->setEnabled(enable); ui->actionTable->setEnabled(enable);
ui->actionHistory->setEnabled(enable); ui->actionHistory->setEnabled(enable);
ui->actionPattern_properties->setEnabled(enable);
ui->actionEdit_pattern_code->setEnabled(enable);
ui->actionZoomIn->setEnabled(enable); ui->actionZoomIn->setEnabled(enable);
ui->actionZoomOut->setEnabled(enable); ui->actionZoomOut->setEnabled(enable);
} }
@ -1730,6 +1740,8 @@ void MainWindow::CreateActions()
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences); connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
connect(ui->actionPattern_properties, &QAction::triggered, this, &MainWindow::PatternProperties); connect(ui->actionPattern_properties, &QAction::triggered, this, &MainWindow::PatternProperties);
ui->actionPattern_properties->setEnabled(false); ui->actionPattern_properties->setEnabled(false);
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
ui->actionEdit_pattern_code->setEnabled(false);
//Actions for recent files loaded by a main window application. //Actions for recent files loaded by a main window application.
for (int i = 0; i < MaxRecentFiles; ++i) for (int i = 0; i < MaxRecentFiles; ++i)

View File

@ -129,6 +129,10 @@ public slots:
void ShowToolTip(const QString &toolTip); void ShowToolTip(const QString &toolTip);
void OpenRecentFile(); void OpenRecentFile();
void Clear(); void Clear();
/**
* @brief Edit XML code of pattern
*/
void EditPatternCode();
signals: signals:
/** /**
* @brief ModelChosen emit after calculation all details. * @brief ModelChosen emit after calculation all details.

View File

@ -699,6 +699,7 @@
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionPattern_properties"/> <addaction name="actionPattern_properties"/>
<addaction name="actionEdit_pattern_code"/>
</widget> </widget>
<widget class="QMenu" name="menuMeasurements"> <widget class="QMenu" name="menuMeasurements">
<property name="title"> <property name="title">
@ -1055,6 +1056,11 @@
<property name="toolTip"> <property name="toolTip">
<string>Zoom out</string> <string>Zoom out</string>
</property> </property>
</action>
<action name="actionEdit_pattern_code">
<property name="text">
<string>Edit pattern XML code</string>
</property>
</action> </action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

View File

@ -163,7 +163,7 @@ QString VApplication::pathToTables() const
return QApplication::applicationDirPath() + QStringLiteral("/tables/standard"); return QApplication::applicationDirPath() + QStringLiteral("/tables/standard");
#else #else
QDir dir(QApplication::applicationDirPath() + QStringLiteral("/tables/standard")); QDir dir(QApplication::applicationDirPath() + QStringLiteral("/tables/standard"));
if(dir.exist()) if (dir.exist())
{ {
return dir.absolutePath(); return dir.absolutePath();
} }
@ -186,7 +186,7 @@ QString VApplication::translationsPath() const
return QApplication::applicationDirPath() + QStringLiteral("/translations"); return QApplication::applicationDirPath() + QStringLiteral("/translations");
#else #else
QDir dir(QApplication::applicationDirPath() + QStringLiteral("/translations")); QDir dir(QApplication::applicationDirPath() + QStringLiteral("/translations"));
if(dir.exist()) if (dir.exist())
{ {
return dir.absolutePath(); return dir.absolutePath();
} }

View File

@ -80,7 +80,7 @@ namespace qmu
static qreal Avg(const qreal*, int); // mean value static qreal Avg(const qreal*, int); // mean value
static qreal Min(const qreal*, int); // minimum static qreal Min(const qreal*, int); // minimum
static qreal Max(const qreal*, int); // maximum static qreal Max(const qreal*, int); // maximum
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**