Add terminal strip editor widget

This commit is contained in:
joshua
2021-04-02 20:52:38 +02:00
parent 39aee4ad07
commit bbfe9ed377
6 changed files with 151 additions and 12 deletions

View File

@@ -161,7 +161,8 @@ HEADERS += $$files(sources/*.h) $$files(sources/ui/*.h) \
$$files(sources/dataBase/ui/*.h) \
$$files(sources/factory/ui/*.h) \
$$files(sources/print/*.h) \
$$files(sources/TerminalStrip/*.h)
$$files(sources/TerminalStrip/*.h) \
$$files(sources/TerminalStrip/ui/*.h)
SOURCES += $$files(sources/*.cpp) \
$$files(sources/editor/*.cpp) \
@@ -195,7 +196,8 @@ SOURCES += $$files(sources/*.cpp) \
$$files(sources/dataBase/ui/*.cpp) \
$$files(sources/factory/ui/*.cpp) \
$$files(sources/print/*.cpp) \
$$files(sources/TerminalStrip/*.cpp)
$$files(sources/TerminalStrip/*.cpp) \
$$files(sources/TerminalStrip/ui/*.cpp)
# Liste des fichiers qui seront incorpores au binaire en tant que ressources Qt
RESOURCES += qelectrotech.qrc
@@ -221,7 +223,8 @@ FORMS += $$files(sources/richtext/*.ui) \
$$files(sources/qetgraphicsitem/ViewItem/ui/*.ui) \
$$files(sources/dataBase/ui/*.ui) \
$$files(sources/factory/ui/*.ui) \
$$files(sources/print/*.ui)
$$files(sources/print/*.ui) \
$$files(sources/TerminalStrip/ui/*.ui)
UI_SOURCES_DIR = sources/ui/
UI_HEADERS_DIR = sources/ui/

View File

@@ -0,0 +1,32 @@
/*
Copyright 2006-2021 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalstripeditor.h"
#include "ui_terminalstripeditor.h"
TerminalStripEditor::TerminalStripEditor(QETProject *project, QWidget *parent) :
QDialog(parent),
ui(new Ui::TerminalStripEditor),
m_project(project)
{
ui->setupUi(this);
}
TerminalStripEditor::~TerminalStripEditor()
{
delete ui;
}

View File

@@ -0,0 +1,42 @@
/*
Copyright 2006-2021 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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 2 of the License, or
(at your option) any later version.
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TERMINALSTRIPEDITOR_H
#define TERMINALSTRIPEDITOR_H
#include <QDialog>
namespace Ui {
class TerminalStripEditor;
}
class QETProject;
class TerminalStripEditor : public QDialog
{
Q_OBJECT
public:
explicit TerminalStripEditor(QETProject *project, QWidget *parent = nullptr);
~TerminalStripEditor() override;
private:
Ui::TerminalStripEditor *ui;
QETProject *m_project = nullptr;
};
#endif // TERMINALSTRIPEDITOR_H

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TerminalStripEditor</class>
<widget class="QDialog" name="TerminalStripEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>923</width>
<height>484</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QTableView" name="tableView"/>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Ajouter un bornier</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Supprimer le bornier</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTreeWidget" name="treeWidget">
<column>
<property name="text">
<string>Explorateur de bornier</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -42,6 +42,7 @@
#include "undocommand/rotateselectioncommand.h"
#include "undocommand/rotatetextscommand.h"
#include "diagram.h"
#include "TerminalStrip/ui/terminalstripeditor.h"
#ifdef BUILD_WITHOUT_KF5
#else
@@ -436,6 +437,16 @@ void QETDiagramEditor::setUpActions()
}
});
m_terminal_strip_dialog = new QAction(QET::Icons::TerminalStrip, tr("Gestionnaire de borniers (DEV)"), this);
connect(m_terminal_strip_dialog, &QAction::triggered, [this]()
{
if (auto project = this->currentProject())
{
auto str = new TerminalStripEditor(project, this);
str->show();
}
});
//Lauch the plugin of terminal generator
m_project_terminalBloc = new QAction(QET::Icons::TerminalStrip, tr("Lancer le plugin de création de borniers"), this);
connect(m_project_terminalBloc, &QAction::triggered, this, &QETDiagramEditor::generateTerminalBlock);
@@ -809,6 +820,7 @@ void QETDiagramEditor::setUpMenu()
menu_project -> addAction(m_add_nomenclature);
menu_project -> addAction(m_csv_export);
menu_project -> addAction(m_project_export_conductor_num);
menu_project -> addAction(m_terminal_strip_dialog);
menu_project -> addAction(m_project_terminalBloc);
#ifdef QET_EXPORT_PROJECT_DB
menu_project -> addSeparator();
@@ -1502,16 +1514,7 @@ void QETDiagramEditor::slot_updateActions()
m_close_file-> setEnabled(opened_project);
m_save_file-> setEnabled(opened_project);
m_save_file_as-> setEnabled(opened_project);
m_project_edit_properties-> setEnabled(opened_project);
m_project_export_conductor_num->setEnabled(opened_project);
//prj_terminalBloc -> setEnabled(opened_project);
m_rotate_texts-> setEnabled(editable_project);
m_project_add_diagram-> setEnabled(editable_project);
m_remove_diagram_from_project-> setEnabled(editable_project);
m_clean_project-> setEnabled(editable_project);
m_add_nomenclature-> setEnabled(editable_project);
m_add_summary-> setEnabled(editable_project);
m_csv_export-> setEnabled(editable_project);
m_export_to_images-> setEnabled(opened_diagram);
m_print-> setEnabled(opened_diagram);
m_export_to_pdf-> setEnabled(opened_diagram);
@@ -1522,6 +1525,17 @@ void QETDiagramEditor::slot_updateActions()
m_row_column_actions_group. setEnabled(editable_project);
m_grey_background-> setEnabled(opened_diagram);
//Project menu
m_project_edit_properties -> setEnabled(opened_project);
m_project_add_diagram -> setEnabled(editable_project);
m_remove_diagram_from_project -> setEnabled(editable_project);
m_clean_project -> setEnabled(editable_project);
m_add_summary -> setEnabled(editable_project);
m_add_nomenclature -> setEnabled(editable_project);
m_csv_export -> setEnabled(editable_project);
m_project_export_conductor_num-> setEnabled(opened_project);
m_terminal_strip_dialog -> setEnabled(editable_project);
slot_updateUndoStack();
slot_updateModeActions();

View File

@@ -192,6 +192,7 @@ class QETDiagramEditor : public QETMainWindow
*m_csv_export, ///< generate nomenclature
*m_add_nomenclature, ///< Add nomenclature graphics item;
*m_add_summary, ///<Add summary graphics item
*m_terminal_strip_dialog = nullptr, ///<Lauch terminal strip dialog
*m_project_terminalBloc, ///< generate terminal block
*m_project_export_conductor_num,///<Export the wire num to csv
*m_export_project_db, ///Export to file the internal database of the current project