1 /*
2 	Copyright 2006-2019 The QElectroTech Team
3 	This file is part of QElectroTech.
4 
5 	QElectroTech is free software: you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation, either version 2 of the License, or
8 	(at your option) any later version.
9 
10 	QElectroTech is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef CONDUCTORPROPERTIESWIDGET_H
19 #define CONDUCTORPROPERTIESWIDGET_H
20 
21 #include <QWidget>
22 #include "conductorproperties.h"
23 class QTextOrientationSpinBoxWidget;
24 class QComboBox;
25 class QPushButton;
26 
27 namespace Ui {
28 	class ConductorPropertiesWidget;
29 }
30 
31 class ConductorPropertiesWidget : public QWidget
32 {
33 		Q_OBJECT
34 
35 	public:
36 		explicit ConductorPropertiesWidget(QWidget *parent = nullptr);
37 		explicit ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent = nullptr);
38 		~ConductorPropertiesWidget() override;
39 
40 	//METHODS
41 		void setProperties(const ConductorProperties &properties);
42 		ConductorProperties properties() const;
43 		void setReadOnly(const bool &ro);
44 
45 		void addAutonumWidget (QWidget *widget);
46 		void setHiddenOneTextPerFolio   (const bool &hide);
47 		void setDisabledShowText        (const bool &disable = true);
48 		void setHiddenAvailableAutonum (const bool &hide);
49 		QComboBox *autonumComboBox() const;
50 		QPushButton *editAutonumPushButton() const;
51 
52 	private:
53 		void initWidget();
54 		void setConductorType(ConductorProperties::ConductorType type);
55 
56 	protected:
57 		bool event(QEvent *event) override;
58 
59 	//SLOTS
60 	public slots:
61 		void updatePreview(bool b = true);
62 
63 	private slots:
64 		void on_m_earth_cb_toggled(bool checked);
65 		void on_m_neutral_cb_toggled(bool checked);
66 		void on_m_update_preview_pb_clicked();
67 
68 	private:
69 		Ui::ConductorPropertiesWidget *ui;
70 		ConductorProperties m_properties;
71 		QTextOrientationSpinBoxWidget *m_verti_select, *m_horiz_select;
72 };
73 
74 #endif // CONDUCTORPROPERTIESWIDGET_H
75