mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 21:34:12 +02:00
d5ae15f568
The element description dialog only offered typing, so every article of a catalogue had to be copied in by hand into the Artikelbeschreibung row of each block, over and over. Settings > General now keeps the path of a CSV material list (Créer... writes a template with the header lines), and the Artikelbeschreibung row of every block of the Bauteil dialog shows a "..." button opening a searchable listing of that file. "Appliquer" fills the fields of that block only -- the main block gets everything but label and formula, an auxiliary block gets description, number, manufacturer, references, supplier, quantity, unit and additional info -- and a cell that is empty in the file never erases a value already in the element. The symbol editor is left alone. - sources/materiallist/: CSV reading and writing (UTF-8 BOM, ';', every field quoted, atomic write through QSaveFile), two header lines (translated labels then the canonical English keys), the selection window and the new entry form. - The selection window reads the file again every time it opens, keeps its size, column widths, column order and sort between openings, shows every column of the file, scrolls all four directions with the wheel (Shift + wheel moves the columns) and puts back the order of the file when the corner above the row numbers or a row number is clicked. - German translations for the new strings in lang/qet_de.ts.
94 lines
2.8 KiB
C++
94 lines
2.8 KiB
C++
/*
|
|
Copyright 2006-2026 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 ELEMENTINFOWIDGET_H
|
|
#define ELEMENTINFOWIDGET_H
|
|
|
|
#include "../diagramcontext.h"
|
|
#include "abstractelementpropertieseditorwidget.h"
|
|
|
|
#include <QWidget>
|
|
|
|
class Element;
|
|
class QUndoCommand;
|
|
class ElementInfoPartWidget;
|
|
class CustomElementInfoPartWidget;
|
|
class ChangeElementInformationCommand;
|
|
class QCheckBox;
|
|
class QPushButton;
|
|
struct MaterialRecord;
|
|
|
|
namespace Ui {
|
|
class ElementInfoWidget;
|
|
}
|
|
|
|
/**
|
|
@brief The ElementInfoWidget class
|
|
this class is a widget to edit an element informations.
|
|
*/
|
|
class ElementInfoWidget : public AbstractElementPropertiesEditorWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
//METHODS
|
|
public:
|
|
explicit ElementInfoWidget(Element *elmt, QWidget *parent = nullptr);
|
|
~ElementInfoWidget() override;
|
|
|
|
void setElement(Element *element) override;
|
|
void apply() override;
|
|
QUndoCommand *associatedUndo () const override;
|
|
QString title() const override {return tr("Informations");}
|
|
bool setLiveEdit(bool live_edit) override;
|
|
void updateUi() override;
|
|
DiagramContext currentInfo() const;
|
|
|
|
|
|
protected:
|
|
bool event(QEvent *event) override;
|
|
void enableLiveEdit() override;
|
|
void disableLiveEdit() override;
|
|
|
|
private:
|
|
void buildInterface();
|
|
void setupMaterialButtons();
|
|
void materialFromFile(int block);
|
|
void applyMaterialRecord(const MaterialRecord &record, int block);
|
|
ElementInfoPartWidget *infoPartWidgetForKey(const QString &key) const;
|
|
QStringList predefinedKeys() const;
|
|
void updateSuggestions();
|
|
|
|
private slots:
|
|
void firstActivated();
|
|
void elementInfoChange();
|
|
void addCustomProperty(const QString &key = QString(), const QString &value = QString());
|
|
void removeCustomProperty(CustomElementInfoPartWidget *widget);
|
|
|
|
//ATTRIBUTES
|
|
private:
|
|
Ui::ElementInfoWidget *ui;
|
|
QList <ElementInfoPartWidget *> m_eipw_list;
|
|
QList <CustomElementInfoPartWidget *> m_custom_eipw_list;
|
|
QPushButton *m_add_custom_property_btn = nullptr;
|
|
QCheckBox *m_potential_isolating_cb = nullptr;
|
|
QCheckBox *m_exclude_from_bom_cb = nullptr;
|
|
bool m_first_activation;
|
|
bool m_ui_builded = false;
|
|
};
|
|
|
|
#endif // ELEMENTINFOWIDGET_H
|