Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/qet/qet

This commit is contained in:
David Varley
2020-09-07 22:14:07 +10:00
52 changed files with 25276 additions and 33438 deletions

View File

@@ -606,20 +606,13 @@ void BorderTitleBlock::draw(QPainter *painter)
/**
@brief BorderTitleBlock::drawDxf
@param width
@param height
@param keep_aspect_ratio
@param file_path
@param color
*/
void BorderTitleBlock::drawDxf(
int width,
int height,
bool keep_aspect_ratio,
QString &file_path,
int color) {
Q_UNUSED (width); Q_UNUSED (height); Q_UNUSED (keep_aspect_ratio);
int color)
{
// Transform to DXF scale.
columns_header_height_ *= Createdxf::yScale;
rows_height_ *= Createdxf::yScale;
@@ -675,8 +668,7 @@ void BorderTitleBlock::drawDxf(
2,
xCoord+recWidth/2,
1,
color,
0);
color);
}
}
@@ -710,8 +702,7 @@ void BorderTitleBlock::drawDxf(
2,
xCoord+recWidth/2,
1,
color,
0);
color);
row_string = incrementLetters(row_string);
}
}

View File

@@ -47,7 +47,7 @@ class BorderTitleBlock : public QObject
//METHODS
public:
void draw(QPainter *painter);
void drawDxf(int, int, bool, QString &, int);
void drawDxf(QString &, int);
//METHODS TO GET DIMENSION
//COLUMNS

View File

@@ -104,7 +104,7 @@ void SingleLineProperties::draw(QPainter *painter,
if (hasGround && i == 1) {
drawGround(painter, direction, symbol_p2, symbol_width * 2.0);
} else if (hasNeutral && ((i == 1 && !hasGround) || (i == 2 && hasGround))) {
drawNeutral(painter, direction, symbol_p2, symbol_width * 1.5);
drawNeutral(painter, symbol_p2, symbol_width * 1.5);
}
}
}
@@ -149,15 +149,14 @@ void SingleLineProperties::drawGround(QPainter *painter,
/**
Dessine le cercle correspondant au symbole du neutre sur un conducteur unifilaire
@param painter QPainter a utiliser pour dessiner le segment
@param direction direction du segment sur lequel le symbole apparaitra
@param center centre du cercle
@param size diametre du cercle
*/
void SingleLineProperties::drawNeutral(QPainter *painter,
QET::ConductorSegmentType direction,
QPointF center,
qreal size) {
Q_UNUSED(direction);
void SingleLineProperties::drawNeutral(
QPainter *painter,
QPointF center,
qreal size)
{
painter -> save();
// prepare le QPainter
@@ -199,7 +198,7 @@ void SingleLineProperties::drawPen(QPainter *painter,
// QSizeF(size * 1.5, size * 1.5)
// )
//);
drawNeutral(painter, direction, center, size * 1.5);
drawNeutral(painter, center, size * 1.5);
int offset = (size * 1.5 / 2.0);
QPointF pos = center + (direction == QET::Horizontal ? QPointF(0.0, -offset - 0.5) : QPointF(offset + 0.5, 0.0));

View File

@@ -55,7 +55,7 @@ class SingleLineProperties {
private:
unsigned short int phases;
void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal);
void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
void drawNeutral(QPainter *, QPointF, qreal);
void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
};

View File

@@ -798,23 +798,20 @@ void Createdxf::drawText(const QString& fileName,
/* draw aligned text in DXF Format */
// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small,
// then the text is either centered or left-aligned, depnding on the value of leftAlign.
void Createdxf::drawTextAligned(const QString& fileName,
const QString& text,
double x,
double y,
double height,
double rotation,
double oblique,
int hAlign,
int vAlign,
double xAlign,
double xScale,
int colour,
bool leftAlign,
float scale)
void Createdxf::drawTextAligned(
const QString& fileName,
const QString& text,
double x,
double y,
double height,
double rotation,
double oblique,
int hAlign,
int vAlign,
double xAlign,
double xScale,
int colour)
{
Q_UNUSED(scale);
if (!fileName.isEmpty()) {
QFile file(fileName);
if (!file.open(QFile::Append)) {

View File

@@ -102,9 +102,7 @@ class Createdxf
int vAlign,
double xAlign,
double xScale,
int colour,
bool leftAlign = false,
float scale = 0);
int colour);
static int getcolorCode (const long red,

View File

@@ -288,18 +288,16 @@ void ElementScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
\~French Dessine l'arriere-plan de l'editeur, cad l'indicateur de hotspot.
\~ @param p : The QPainter to use for drawing
\~French Le QPainter a utiliser pour dessiner
\~ @param rect : The rectangle of the area to be drawn
\~French Le rectangle de la zone a dessiner
*/
void ElementScene::drawForeground(QPainter *p, const QRectF &rect) {
Q_UNUSED(rect);
void ElementScene::drawForeground(QPainter *p, const QRectF &)
{
p -> save();
// desactive tout antialiasing, sauf pour le texte
p -> setRenderHint(QPainter::Antialiasing, false);
p -> setRenderHint(QPainter::TextAntialiasing, true);
p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
QPen pen(Qt::red);
pen.setCosmetic(true);
p -> setPen(pen);

View File

@@ -215,9 +215,8 @@ bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item,
@param reload_collections :
true for read all collections since their sources (files, projects ...)
*/
void ElementsPanel::reload(bool reload_collections) {
Q_UNUSED(reload_collections);
void ElementsPanel::reload()
{
QIcon system_icon(":/ico/16x16/qet.png");
QIcon user_icon(":/ico/16x16/go-home.png");

View File

@@ -57,7 +57,7 @@ class ElementsPanel : public GenericPanel {
public slots:
void slot_doubleClick(QTreeWidgetItem *, int);
void reload(bool = false);
void reload();
void filter(const QString &, QET::Filtering = QET::RegularFilter);
void projectWasOpened(QETProject *);
void projectWasClosed(QETProject *);

View File

@@ -25,6 +25,13 @@
#include "templatedeleter.h"
/*
When the ENABLE_PANEL_WIDGET_DND_CHECKS flag is set, the panel
performs checks during drag'n drop of items and categories.
For example, it checks that a target category is writable
before authorizing the drop of an element.
Removing this flag allows you to test the behavior of management functions
items (copy, move, etc.).
Lorsque le flag ENABLE_PANEL_WIDGET_DND_CHECKS est defini, le panel
effectue des verifications lors des drag'n drop d'elements et categories.
Par exemple, il verifie qu'une categorie cible est accessible en ecriture
@@ -152,7 +159,7 @@ void ElementsPanelWidget::copyPathForSelectedItem() {
*/
void ElementsPanelWidget::reloadAndFilter() {
// recharge tous les elements
elements_panel -> reload(true);
elements_panel -> reload();
// reapplique le filtre
if (!filter_textfield -> text().isEmpty()) {
elements_panel -> filter(filter_textfield -> text());

View File

@@ -397,13 +397,11 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee
@param diagram Schema a exporter en DXF
@param width Largeur de l'export DXF
@param height Hauteur de l'export DXF
@param keep_aspect_ratio True pour conserver le ratio, false sinon
@param file_path
*/
void ExportDialog::generateDxf(Diagram *diagram,
int width,
int height,
bool keep_aspect_ratio,
QString &file_path) {
saveReloadDiagramParameters(diagram, true);
@@ -427,10 +425,7 @@ void ExportDialog::generateDxf(Diagram *diagram,
double(height)*Createdxf::yScale,
0);
}
diagram -> border_and_titleblock.drawDxf(width,
height,
keep_aspect_ratio,
file_path,
diagram -> border_and_titleblock.drawDxf(file_path,
0);
// Build the lists of elements.
@@ -809,7 +804,6 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
diagram_line -> diagram,
diagram_line -> width -> value(),
diagram_line -> height -> value(),
diagram_line -> keep_ratio -> isChecked(),
diagram_path
);
} else {

View File

@@ -89,7 +89,7 @@ class ExportDialog : public QDialog {
QWidget *initDiagramsListPart();
void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &);
void generateDxf(Diagram *, int, int, bool, QString &);
void generateDxf(Diagram *, int, int, QString &);
QImage generateImage(Diagram *, int, int, bool);
void exportDiagram(ExportDiagramLine *);
qreal diagramRatio(Diagram *);

View File

@@ -291,7 +291,7 @@ QTreeWidgetItem *GenericPanel::addDiagram(Diagram *diagram,
&creation_required);
updateDiagramItem(diagram_qtwi, diagram, options, creation_required);
reparent(diagram_qtwi, parent_item);
fillDiagramItem(diagram_qtwi, diagram, options, creation_required);
fillDiagramItem(diagram_qtwi, options, creation_required);
return(diagram_qtwi);
}
@@ -394,16 +394,15 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi,
/**
@brief GenericPanel::fillDiagramItem
@param diagram_qtwi
@param diagram (unused)
@param options
@param freshly_created
@return fillItem(diagram_qtwi, options, freshly_created)
*/
QTreeWidgetItem *GenericPanel::fillDiagramItem(QTreeWidgetItem *diagram_qtwi,
Diagram *diagram,
PanelOptions options,
bool freshly_created) {
Q_UNUSED(diagram)
QTreeWidgetItem *GenericPanel::fillDiagramItem(
QTreeWidgetItem *diagram_qtwi,
PanelOptions options,
bool freshly_created)
{
return(fillItem(diagram_qtwi, options, freshly_created));
}

View File

@@ -101,10 +101,10 @@ class GenericPanel : public QTreeWidget {
Diagram *,
PanelOptions = AddAllChild,
bool = false);
virtual QTreeWidgetItem *fillDiagramItem (QTreeWidgetItem *,
Diagram *,
PanelOptions = AddAllChild,
bool = false);
virtual QTreeWidgetItem *fillDiagramItem(
QTreeWidgetItem *,
PanelOptions = AddAllChild,
bool = false);
// title block templates collections methods
public:

View File

@@ -81,6 +81,7 @@ void Machine_info::send_info_to_debug()
qInfo()<< "Qt library location Qt settings:"
<< QLibraryInfo::location(QLibraryInfo::SettingsPath);
#endif
qInfo()<< "GitRevision " + QString(GIT_COMMIT_SHA);
qInfo()<< "QElectroTech V " + QET::displayedVersion;
qInfo()<< tr("Compilation : ") + pc.built.version;
qInfo()<< "Built with Qt " + pc.built.QT

View File

@@ -22,6 +22,9 @@
#include "machine_info.h"
#include <QStyleFactory>
#include <QtCore>
#include <QtWidgets>
/**
@brief myMessageOutput
for debugging
@@ -204,6 +207,32 @@ int main(int argc, char **argv)
delete my_ma;
}
if(! QET::FileFormatStable){
QMessageBox::StandardButton btn = QMessageBox::critical(
nullptr,
QCoreApplication::translate(
"main",
"Unstable file format!"),
QCoreApplication::translate(
"main",
"<p><b>ATTENTION: This application version is UNSTABLE!</b></p>"
"<p>Everything you do with this application can break your "
"workspace, libraries or projects! Saved files will not be "
"readable with stable releases of QElectroTech. It's highly "
"recommended to create a backup before proceeding. If you are "
"unsure, please download an official stable release instead.</p>"
// "<p>For details, please take a look at QElectroTech's "
// "<a href=\"%1\">versioning concept</a>.</p>"
"<p>Are you really sure to continue with the risk of breaking your "
"files?!</p>","this text is not finished yet, expect changes!")
.arg("doc_release_workflow"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if (!(btn == QMessageBox::Yes))
return 1;
}
return app.exec();
}

View File

@@ -28,10 +28,19 @@ class QActionGroup;
anywhere else within the QElectroTech application.
*/
namespace QET {
/// Read the release workflow documentation
/// before making changes here!!!
/// QElectroTech version (as string, used to mark projects and elements XML documents)
const QString version = "0.80";
/// QElectroTech displayed version
const QString displayedVersion = "0.80-DEV";
/**
@brief FileFormatStable
- On all non-release branches: false
- On release branches: true
*/
const bool FileFormatStable = false;
QString license();
//Describe the current state of a graphic item

View File

@@ -2306,110 +2306,64 @@ void QETDiagramEditor::generateTerminalBlock()
}
#endif
if ( !success ) {
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
QMessageBox::warning(nullptr,
tr("Error launching qet_tb_generator plugin"),
QObject::tr("To install the plugin qet_tb_generator"
"<br>"
"Visit :"
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br>"
"Requires python 3.5 or above."
"<br>"
"<B>""<U>"
" First install on Windows"
"</B>""</U>"
"<br>"
"1. Install, if required, python 3.5 or above"
"<br>"
" Visit :"
"<br>"
"<a href='https://www.python.org/downloads/'>python.org</a>"
"<br>"
"2. pip install qet_tb_generator"
"<br>"
"<B>""<U>"
" Update on Windows"
"</B>""</U>"
"<br>"
"python -m pip install --upgrade qet_tb_generator"
"<br>"
">>user could launch in a terminal this script in this directory"
"<br>"
" C:\\users\\XXXX\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts "
"<br>"
));
}
}
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
QString message=QObject::tr(
"To install the plugin qet_tb_generator"
"<br>Visit :"
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br>Requires python 3.5 or above."
"<br><B><U> First install on Windows</B></U>"
"<br>1. Install, if required, python 3.5 or above"
"<br> Visit :"
"<br>"
"<a href='https://www.python.org/downloads/'>python.org</a>"
"<br>2. pip install qet_tb_generator"
"<br><B><U> Update on Windows</B></U>"
"<br>python -m pip install --upgrade qet_tb_generator"
"<br>"
">>user could launch in a terminal this script in this directory"
"<br>"
" C:\\users\\XXXX\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts "
"<br>");
#elif defined(Q_OS_MAC)
QMessageBox::warning(nullptr,
QObject::tr("Error launching qet_tb_generator plugin"),
QObject::tr("To install the plugin qet_tb_generator"
"<br>"
"Visit :"
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br>"
"<B>""<U>"
" First install on macOSX"
"</B>""</U>"
"<br>"
"1. Install, if required, python 3.8 bundle only, because program use hardcoded PATH for localise qet-tb-generator plugin "
"<br>"
" Visit :"
"<br>"
"<a href='https://qelectrotech.org/forum/viewtopic.php?pid=5674#p5674'>howto</a>"
"<br>"
"2. pip3 install qet_tb_generator"
"<br>"
"<B>""<U>"
" Update on macOSX"
"</B>""</U>"
"<br>"
" pip3 install --upgrade qet_tb_generator"
"<br>"
));
}
}
QString message=QObject::tr(
"To install the plugin qet_tb_generator"
"<br>Visit :"
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br><B><U> First install on macOSX</B></U>"
"<br>1. Install, if required, python 3.8 bundle only, "
"because program use hardcoded PATH for localise qet-tb-generator plugin "
"<br> Visit :"
"<br>"
"<a href='https://qelectrotech.org/forum/viewtopic.php?pid=5674#p5674'>howto</a>"
"<br>2. pip3 install qet_tb_generator"
"<br><B><U> Update on macOSX</B></U>"
"<br> pip3 install --upgrade qet_tb_generator"
"<br>");
#else
QString message=QObject::tr(
"To install the plugin qet_tb_generator"
"<br>Visit :"
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br>"
"<br>Requires python 3.5 or above."
"<br>"
"<br><B><U> First install on Linux</B>""</U>"
"<br>1. check you have pip3 installed: pip3 --version"
"<br>If not install with: sudo apt-get install python3-pip"
"<br>2. Install the program: sudo pip3 install qet_tb_generator"
"<br>3. Run the program: qet_tb_generator"
"<br>"
"<br><B>""<U> Update on Linux</B>""</U>"
"<br>sudo pip3 install --upgrade qet_tb_generator"
"<br>");
#endif
if ( !success ) {
QMessageBox::warning(nullptr,
QObject::tr("Error launching qet_tb_generator plugin"),
QObject::tr("To install the plugin qet_tb_generator"
"<br>"
"Visit : "
"<br>"
"<a href='https://pypi.python.org/pypi/qet-tb-generator'>qet-tb-generator</a>"
"<br>"
"<br>"
"Requires python 3.5 or above."
"<br>"
"<br>"
"<B>""<U>"
" First install on Linux"
"</B>""</U>"
"<br>"
"1. check you have pip3 installed: pip3 --version"
"<br>"
"If not install with: sudo apt-get install python3-pip"
"<br>"
"2. Install the program: sudo pip3 install qet_tb_generator"
"<br>"
"3. Run the program: qet_tb_generator"
"<br>"
"<br>"
"<B>""<U>"
" Update on Linux"
"</B>""</U>"
"<br>"
"sudo pip3 install --upgrade qet_tb_generator"
"<br>"
));
QObject::tr("Error launching qet_tb_generator plugin"),
message);
}
}
#endif

View File

@@ -243,9 +243,10 @@ void ConductorTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
change m_mouse_hover to false(used in paint() function )
@param e QGraphicsSceneHoverEvent
*/
void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
{
Q_UNUSED(e);
//qDebug() << "Leave mouse over";
qDebug() << "Leave mouse over";
m_mouse_hover = false;
update();
}
@@ -254,7 +255,7 @@ void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Do nothing default function .
@param e QGraphicsSceneHoverEvent
*/
void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
QGraphicsTextItem::hoverMoveEvent(e);
void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e)
{
QGraphicsTextItem::hoverMoveEvent(e);
}

View File

@@ -295,9 +295,10 @@ QPainterPath QetShapeItem::shape() const
@param option
@param widget
*/
void QetShapeItem::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
void QetShapeItem::paint(
QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
Q_UNUSED(option)
Q_UNUSED(widget)
@@ -425,17 +426,17 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{
if(event->type() == QEvent::GraphicsSceneMousePress) //Click
{
handlerMousePressEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event));
handlerMousePressEvent();
return true;
}
else if(event->type() == QEvent::GraphicsSceneMouseMove) //Move
{
handlerMouseMoveEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event));
handlerMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
return true;
}
else if (event->type() == QEvent::GraphicsSceneMouseRelease) //Release
{
handlerMouseReleaseEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event));
handlerMouseReleaseEvent();
return true;
}
}
@@ -703,11 +704,8 @@ void QetShapeItem::removePoint()
@param qghi
@param event
*/
void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
void QetShapeItem::handlerMousePressEvent()
{
Q_UNUSED(qghi)
Q_UNUSED(event)
m_old_P1 = m_P1;
m_old_P2 = m_P2;
m_old_polygon = m_polygon;
@@ -720,13 +718,10 @@ void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphic
/**
@brief QetShapeItem::handlerMouseMoveEvent
@param qghi
@param event
*/
void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(qghi)
QPointF new_pos = event->scenePos();
if (event->modifiers() != Qt::ControlModifier)
new_pos = Diagram::snapToGrid(event->scenePos());
@@ -787,11 +782,8 @@ void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphics
@param qghi
@param event
*/
void QetShapeItem::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event)
void QetShapeItem::handlerMouseReleaseEvent()
{
Q_UNUSED(qghi);
Q_UNUSED(event);
m_modifie_radius_equaly = false;
if (diagram())

View File

@@ -121,9 +121,9 @@ class QetShapeItem : public QetGraphicsItem
void insertPoint();
void removePoint();
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event);
void handlerMousePressEvent();
void handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event);
void handlerMouseReleaseEvent();
///ATTRIBUTES
private:

View File

@@ -1858,9 +1858,7 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
vAlign,
x2,
ratio,
color,
cell.alignment & Qt::AlignLeft,
0);
color);
}
/**