[qet] [2597] element editor: remove the widget for allowed orientation and internal conection and all code about this .

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2597
Author:   blacksun
Date:     2013-11-07 12:58:03 +0100 (Thu, 07 Nov 2013)
Log Message:
-----------
element editor: remove the widget for allowed orientation and internal conection and all code about this.
Now all element can be rotate in all orientation (0?\194?\176, 90?\194?\176, 180?\194?\176, 270?\194?\176) and internall conection are always possible.
element wizzard: remove the page about the orientation.

Modified Paths:
--------------
    branches/devel/sources/editor/editorcommands.cpp
    branches/devel/sources/editor/editorcommands.h
    branches/devel/sources/editor/elementscene.cpp
    branches/devel/sources/editor/elementscene.h
    branches/devel/sources/editor/elementview.cpp
    branches/devel/sources/editor/elementview.h
    branches/devel/sources/editor/qetelementeditor.cpp
    branches/devel/sources/editor/qetelementeditor.h

Removed Paths:
-------------
    branches/devel/sources/orientationsetwidget.cpp
    branches/devel/sources/orientationsetwidget.h

Modified: branches/devel/sources/editor/editorcommands.cpp
===================================================================
--- branches/devel/sources/editor/editorcommands.cpp	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/editorcommands.cpp	2013-11-07 11:58:03 UTC (rev 2597)
@@ -411,39 +411,6 @@
 
 /**
 	Constructeur
-	@param element_scene Element edite
-	@param before Orientations avant changement
-	@param after Orientations apres changement
-	@param parent QUndoCommand parent
-*/
-ChangeOrientationsCommand::ChangeOrientationsCommand(
-	ElementScene *element_scene,
-	const OrientationSet &before,
-	const OrientationSet &after,
-	QUndoCommand *parent
-) :
-	ElementEditionCommand(QObject::tr("modification orientations", "undo caption"), element_scene, 0, parent),
-	ori_before(before),
-	ori_after(after)
-{
-}
-
-/// Destructeur
-ChangeOrientationsCommand::~ChangeOrientationsCommand() {
-}
-
-/// Annule le changement
-void ChangeOrientationsCommand::undo() {
-	editor_scene_ -> setOrientations(ori_before);
-}
-
-/// Refait le changement
-void ChangeOrientationsCommand::redo() {
-	editor_scene_ -> setOrientations(ori_after);
-}
-
-/**
-	Constructeur
 	@param elmt ElementScene concernee
 	@param o Option decrivant le type de traitement applique aux zValues des parties de l'element
 	@param parent QUndoCommand parent
@@ -568,32 +535,6 @@
 /**
 	Constructeur
 	@param elmt ElementScene concernee
-	@param allow true pour que les connexions internes soient acceptees, false sinon
-	@param parent QUndoCommand parent
-*/
-AllowInternalConnectionsCommand::AllowInternalConnectionsCommand(ElementScene *elmt, bool allow, QUndoCommand *parent) :
-	ElementEditionCommand(QObject::tr("modification connexions internes", "undo caption"), elmt, 0, parent),
-	ic(allow)
-{
-}
-
-/// Destructeur
-AllowInternalConnectionsCommand::~AllowInternalConnectionsCommand() {
-}
-
-/// Annule le changement d'autorisation pour les connexions internes
-void AllowInternalConnectionsCommand::undo() {
-	editor_scene_ -> setInternalConnections(!ic);
-}
-
-/// Refait le changement d'autorisation pour les connexions internes
-void AllowInternalConnectionsCommand::redo() {
-	editor_scene_ -> setInternalConnections(ic);
-}
-
-/**
-	Constructeur
-	@param elmt ElementScene concernee
 	@param old_infos Informations complementaires precedentes
 	@param new_infos Nouvelles informations complementaires
 	@param parent QUndoCommand parent

Modified: branches/devel/sources/editor/editorcommands.h
===================================================================
--- branches/devel/sources/editor/editorcommands.h	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/editorcommands.h	2013-11-07 11:58:03 UTC (rev 2597)
@@ -249,30 +249,6 @@
 };
 
 /**
-	This command changes the allowed orientations of an electrical element.
-*/
-class ChangeOrientationsCommand : public ElementEditionCommand {
-	// constructors, destructor
-	public:
-	ChangeOrientationsCommand(ElementScene *, const OrientationSet &, const OrientationSet &, QUndoCommand * = 0);
-	virtual ~ChangeOrientationsCommand();
-	private:
-	ChangeOrientationsCommand(const ChangeOrientationsCommand &);
-	
-	// methods
-	public:
-	virtual void undo();
-	virtual void redo();
-	
-	// attributes
-	private:
-	/// Former orientations
-	OrientationSet ori_before;
-	/// New orientations
-	OrientationSet ori_after;
-};
-
-/**
 	This command changes the zValue of a set of primitives when editing an
 	electrical element.
 */
@@ -313,29 +289,6 @@
 };
 
 /**
-	This command enables or disables internal connections for an electrical
-	element.
-*/
-class AllowInternalConnectionsCommand : public ElementEditionCommand {
-	// constructors, destructor
-	public:
-	AllowInternalConnectionsCommand(ElementScene *, bool, QUndoCommand * = 0);
-	virtual ~AllowInternalConnectionsCommand();
-	private:
-	AllowInternalConnectionsCommand(const AllowInternalConnectionsCommand &);
-	
-	// methods
-	public:
-	virtual void undo();
-	virtual void redo();
-	
-	// attributes
-	private:
-	/// whether internal connections are allowed afterward
-	bool ic;
-};
-
-/**
 	This command changes extra information carried by an electrical element.
 */
 class ChangeInformationsCommand : public ElementEditionCommand {

Modified: branches/devel/sources/editor/elementscene.cpp
===================================================================
--- branches/devel/sources/editor/elementscene.cpp	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/elementscene.cpp	2013-11-07 11:58:03 UTC (rev 2597)
@@ -38,7 +38,6 @@
 */
 ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
 	QGraphicsScene(parent),
-	internal_connections(false),
 	qgi_manager(this),
 	element_editor(editor),
 	decorator_(0)
@@ -415,9 +414,9 @@
 	root.setAttribute("height",      QString("%1").arg(upheight));
 	root.setAttribute("hotspot_x",   QString("%1").arg(-(qRound(size.x() - (xmargin/2)))));
 	root.setAttribute("hotspot_y",   QString("%1").arg(-(qRound(size.y() - (ymargin/2)))));
-	root.setAttribute("orientation", ori.toString());
+	root.setAttribute("orientation", "dyyy"); //we keep the orientation for compatibility with previous version of qet
 	root.setAttribute("version", QET::version);
-	if (internal_connections) root.setAttribute("ic", "true");
+	root.setAttribute("ic", "true"); //we keep the internal connection for compatibility with previous version of qet
 	
 	// noms de l'element
 	root.appendChild(_names.toXml(xml_document));
@@ -664,58 +663,6 @@
 }
 
 /**
-	Lance un dialogue pour editer les noms de cete element
-*/
-void ElementScene::slot_editOrientations() {
-	bool is_read_only = element_editor && element_editor -> isReadOnly();
-	
-	// cree un dialogue
-	QDialog dialog_ori(element_editor);
-	dialog_ori.setModal(true);
-#ifdef Q_WS_MAC
-	dialog_ori.setWindowFlags(Qt::Sheet);
-#endif
-	dialog_ori.setMinimumSize(400, 260);
-	dialog_ori.setWindowTitle(tr("\311diter les orientations", "window title"));
-	QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_ori);
-	
-	// ajoute un champ explicatif au dialogue
-	QLabel *information_label = new QLabel(tr("L'orientation par d\351faut est l'orientation dans laquelle s'effectue la cr\351ation de l'\351l\351ment."));
-	information_label -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
-	information_label -> setWordWrap(true);
-	dialog_layout -> addWidget(information_label);
-	
-	// ajoute un OrientationSetWidget au dialogue
-	OrientationSetWidget *ori_widget = new OrientationSetWidget();
-	ori_widget -> setOrientationSet(ori);
-	ori_widget -> setReadOnly(is_read_only);
-	dialog_layout -> addWidget(ori_widget);
-	
-	// ajoute une case a cocher pour les connexions internes
-	QCheckBox *ic_checkbox = new QCheckBox(tr("Autoriser les connexions internes"));
-	ic_checkbox -> setChecked(internal_connections);
-	ic_checkbox -> setDisabled(is_read_only);
-	dialog_layout -> addWidget(ic_checkbox);
-	dialog_layout -> addStretch();
-	// ajoute deux boutons au dialogue
-	QDialogButtonBox *dialog_buttons = new QDialogButtonBox(is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	dialog_layout -> addWidget(dialog_buttons);
-	connect(dialog_buttons, SIGNAL(accepted()),    &dialog_ori, SLOT(accept()));
-	connect(dialog_buttons, SIGNAL(rejected()),    &dialog_ori, SLOT(reject()));
-	
-	// lance le dialogue
-	if (dialog_ori.exec() == QDialog::Accepted && !is_read_only) {
-		OrientationSet new_ori = ori_widget -> orientationSet();
-		if (new_ori != ori) {
-			undoStack().push(new ChangeOrientationsCommand(this, ori, new_ori));
-		}
-		if (ic_checkbox -> isChecked() != internal_connections) {
-			undoStack().push(new AllowInternalConnectionsCommand(this, ic_checkbox -> isChecked()));
-		}
-	}
-}
-
-/**
 	Lance un dialogue pour editer les informations complementaires de cet
 	element. Concretement, ce champ libre est destine a accueillir des informations
 	sur l'auteur de l'element, sa licence, etc.
@@ -979,18 +926,7 @@
 		}
 		return(false);
 	}
-		
-	// orientations
-	internal_connections = (root.attribute("ic") == "true");
-	
-	// connexions internes
-	if (!ori.fromString(root.attribute("orientation"))) {
-		if (error_message) {
-			*error_message = tr("Les orientations ne sont pas valides.", "error message");
-		}
-		return(false);
-	}
-	
+
 	// extrait les noms de la definition XML
 	_names.fromXml(root);
 	

Modified: branches/devel/sources/editor/elementscene.h
===================================================================
--- branches/devel/sources/editor/elementscene.h	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/elementscene.h	2013-11-07 11:58:03 UTC (rev 2597)
@@ -20,7 +20,6 @@
 #include <QtGui>
 #include <QtXml>
 #include "nameslistwidget.h"
-#include "orientationsetwidget.h"
 #include "qgimanager.h"
 #include "elementcontent.h"
 class CustomElementPart;
@@ -65,10 +64,6 @@
 	private:
 	/// List of localized names
 	NamesList _names;
-	/// Set of orientations
-	OrientationSet ori;
-	/// whether internal connections (i.e. connections between terminals of a same element) are accepted
-	bool internal_connections;
 	/// Extra informations
 	QString informations_;
 	/// QGraphicsItem manager
@@ -112,8 +107,6 @@
 	public:
 	void setNames(const NamesList &);
 	NamesList names() const;
-	OrientationSet orientations();
-	void setOrientations(const OrientationSet &);
 	bool internalConnections();
 	void setInternalConnections(bool);
 	QString informations() const;
@@ -178,7 +171,6 @@
 	void slot_invertSelection();
 	void slot_delete();
 	void slot_editNames();
-	void slot_editOrientations();
 	void slot_editAuthorInformations();
 	void slot_bringForward();
 	void slot_raise();
@@ -223,34 +215,6 @@
 }
 
 /**
-	@return the orientation set of the currently edited element
-*/
-inline OrientationSet ElementScene::orientations() {
-	return(ori);
-}
-
-/**
-	@param orientation_set the new orientation set for the currently edited element
-*/
-inline void ElementScene::setOrientations(const OrientationSet &orientation_set) {
-	ori = orientation_set;
-}
-
-/**
-	@return whether internal connections are accepted
-*/
-inline bool ElementScene::internalConnections() {
-	return(internal_connections);
-}
-
-/**
-	@param ic true for internal connections to be accepted, false otherwise
-*/
-inline void ElementScene::setInternalConnections(bool ic) {
-	internal_connections = ic;
-}
-
-/**
 	@return extra informations of the currently edited element
 */
 inline QString ElementScene::informations() const {

Modified: branches/devel/sources/editor/elementview.cpp
===================================================================
--- branches/devel/sources/editor/elementview.cpp	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/elementview.cpp	2013-11-07 11:58:03 UTC (rev 2597)
@@ -322,7 +322,6 @@
 		// on applique le decalage qui convient
 		final_pasted_content_bounding_rect = applyMovement(
 			pasted_content_bounding_rect,
-			QETElementEditor::pasteMovement(),
 			QETElementEditor::pasteOffset()
 		);
 	}
@@ -483,21 +482,11 @@
 	@param movement Orientation du decalage a appliquer
 	@param offset Decalage a appliquer
 */
-QRectF ElementView::applyMovement(const QRectF &start, const QET::OrientedMovement &movement, const QPointF &offset) {
-	// calcule le decalage a appliquer a partir de l'offset indique et du mouvement
+QRectF ElementView::applyMovement(const QRectF &start, const QPointF &offset) {
+	// calcule le decalage a appliquer a partir de l'offset
 	QPointF final_offset;
-	if (movement == QET::ToNorthEast || movement == QET::ToEast || movement == QET::ToSouthEast) {
-		final_offset.rx() =  start.width() + offset.x();
-	} else if (movement == QET::ToNorthWest || movement == QET::ToWest || movement == QET::ToSouthWest) {
-		final_offset.rx() = -start.width() - offset.x();
-	}
-	
-	if (movement == QET::ToNorthWest || movement == QET::ToNorth || movement == QET::ToNorthEast) {
-		final_offset.ry() = -start.height() - offset.y();
-	} else if (movement == QET::ToSouthWest || movement == QET::ToSouth || movement == QET::ToSouthEast) {
-		final_offset.ry() =  start.height() + offset.y();
-	}
-	
+	final_offset.rx() =  start.width() + offset.x();
+
 	// applique le decalage ainsi calcule
 	return(start.translated(final_offset));
 }

Modified: branches/devel/sources/editor/elementview.h
===================================================================
--- branches/devel/sources/editor/elementview.h	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/elementview.h	2013-11-07 11:58:03 UTC (rev 2597)
@@ -19,6 +19,7 @@
 #define ELEMENT_VIEW_H
 #include <QGraphicsView>
 #include "elementscene.h"
+
 /**
 	This class provides a widget to render an ElementScene instance, i.e. the
 	edition class for electrical elements.
@@ -50,7 +51,7 @@
 	virtual void drawBackground(QPainter *, const QRectF &);
 	
 	private:
-	QRectF applyMovement(const QRectF &, const QET::OrientedMovement &, const QPointF &);
+	QRectF applyMovement(const QRectF &, const QPointF &);
 	
 	public slots:
 	void setVisualisationMode();

Modified: branches/devel/sources/editor/qetelementeditor.cpp
===================================================================
--- branches/devel/sources/editor/qetelementeditor.cpp	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/qetelementeditor.cpp	2013-11-07 11:58:03 UTC (rev 2597)
@@ -145,7 +145,6 @@
 	zoom_fit        = new QAction(QET::Icons::ZoomFitBest,          tr("Zoom adapt\351"),                            this);
 	zoom_reset      = new QAction(QET::Icons::ZoomOriginal,         tr("Pas de zoom"),                               this);
 	edit_names      = new QAction(QET::Icons::Names,                tr("\311diter les noms"),                        this);
-	edit_ori        = new QAction(QET::Icons::Orientations,         tr("\311diter les orientations"),                this);
 	edit_author     = new QAction(QET::Icons::UserInformations,     tr("\311diter les informations sur l'auteur"),   this);
 	edit_raise      = new QAction(QET::Icons::Raise,                tr("Rapprocher"),                                this);
 	edit_lower      = new QAction(QET::Icons::Lower,                tr("\311loigner"),                               this);
@@ -204,7 +203,6 @@
 	zoom_reset        -> setShortcut(QKeySequence(tr("Ctrl+0")));
 	
 	edit_names        -> setShortcut(QKeySequence(tr("Ctrl+E")));
-	edit_ori          -> setShortcut(QKeySequence(tr("Ctrl+T")));
 	edit_author       -> setShortcut(tr("Ctrl+Y"));
 	
 	edit_raise        -> setShortcut(QKeySequence(tr("Ctrl+Shift+Up")));
@@ -235,7 +233,6 @@
 	connect(zoom_reset,      SIGNAL(triggered()), ce_view,  SLOT(zoomReset()));
 	connect(edit_delete,     SIGNAL(triggered()), ce_scene, SLOT(slot_delete()));
 	connect(edit_names,      SIGNAL(triggered()), ce_scene, SLOT(slot_editNames()));
-	connect(edit_ori,        SIGNAL(triggered()), ce_scene, SLOT(slot_editOrientations()));
 	connect(edit_author,     SIGNAL(triggered()), ce_scene, SLOT(slot_editAuthorInformations()));
 	connect(edit_forward,    SIGNAL(triggered()), ce_scene, SLOT(slot_bringForward()));
 	connect(edit_raise,      SIGNAL(triggered()), ce_scene, SLOT(slot_raise()));
@@ -318,7 +315,6 @@
 	view_toolbar -> addAction(zoom_fit);
 	view_toolbar -> addAction(zoom_reset);
 	element_toolbar -> addAction(edit_names);
-	element_toolbar -> addAction(edit_ori);
 	depth_toolbar -> addAction(edit_forward);
 	depth_toolbar -> addAction(edit_raise);
 	depth_toolbar -> addAction(edit_lower);
@@ -393,7 +389,6 @@
 	edit_menu -> addAction(edit_delete);
 	edit_menu -> addSeparator();
 	edit_menu -> addAction(edit_names);
-	edit_menu -> addAction(edit_ori);
 	edit_menu -> addAction(edit_author);
 	edit_menu -> addSeparator();
 	edit_menu -> addAction(edit_forward);
@@ -1239,14 +1234,6 @@
 }
 
 /**
-	@return Le type de mouvement a effectuer lors d'un copier/coller avec
-	decalage.
-*/
-QET::OrientedMovement QETElementEditor::pasteMovement() {
-	return(QET::ToEast);
-}
-
-/**
 	Demande a l'utilisateur d'ouvrir un fichier sense etre un element.
 	@param parent QWidget parent du dialogue d'ouverture de fichier
 	@param initial_dir Repertoire a afficher initialement - si une chaine vide

Modified: branches/devel/sources/editor/qetelementeditor.h
===================================================================
--- branches/devel/sources/editor/qetelementeditor.h	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/editor/qetelementeditor.h	2013-11-07 11:58:03 UTC (rev 2597)
@@ -71,7 +71,7 @@
 	QAction *selectall, *deselectall, *inv_select;
 	QAction *cut, *copy, *paste, *paste_in_area, *paste_from_file, *paste_from_elmt;
 	QAction *undo, *redo;
-	QAction *edit_delete, *edit_size_hs, *edit_names, *edit_ori, *edit_author;
+	QAction *edit_delete, *edit_size_hs, *edit_names, *edit_author;
 	QAction *edit_raise, *edit_lower, *edit_backward, *edit_forward;
 	/// actions for the "display" menu
 	QAction *zoom_in, *zoom_out, *zoom_fit, *zoom_reset;
@@ -93,7 +93,6 @@
 	// methods
 	public:
 	void setNames(const NamesList &);
-	void setOrientations(const OrientationSet &orientation_set);
 	OrientationSet orientations() const;
 	void setLocation(const ElementsLocation &);
 	ElementsLocation location() const;
@@ -111,7 +110,6 @@
 	void readSettings();
 	void writeSettings();
 	static QPointF pasteOffset();
-	static QET::OrientedMovement pasteMovement();
 	static QString getOpenElementFileName(QWidget * = 0, const QString & = QString());
 	void contextMenu(QContextMenuEvent *event);
 
@@ -161,20 +159,6 @@
 }
 
 /**
-	@param orientation_set the new set of orientations for the currently edited element
-*/
-inline void QETElementEditor::setOrientations(const OrientationSet &orientation_set) {
-	ce_scene -> setOrientations(orientation_set);
-}
-
-/**
-	@param the set of orientations for the currently edited element
-*/
-inline OrientationSet QETElementEditor::orientations() const {
-	return(ce_scene -> orientations());
-}
-
-/**
 	@return the location of the currently edited element
 */
 inline ElementsLocation QETElementEditor::location() const {

Deleted: branches/devel/sources/orientationsetwidget.cpp
===================================================================
--- branches/devel/sources/orientationsetwidget.cpp	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/orientationsetwidget.cpp	2013-11-07 11:58:03 UTC (rev 2597)
@@ -1,171 +0,0 @@
-/*
-	Copyright 2006-2012 Xavier Guerrin
-	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 "orientationsetwidget.h"
-#include "qeticons.h"
-
-/**
-	Constructeur
-	@param parent QWidget parent
-*/
-OrientationSetWidget::OrientationSetWidget(QWidget *parent) : QWidget(parent) {
-	
-	default_radios = new QButtonGroup(this);
-	
-	#define MK_COMBO_BOX(a) a##_orientation = new QComboBox();\
-	a##_orientation -> addItem(QET::Icons::Allowed, tr("Possible"), "y");\
-	a##_orientation -> addItem(QET::Icons::Forbidden,tr("Impossible"), "n");\
-	connect(a##_orientation, SIGNAL(activated(int)), this, SLOT(updateOrientationSet()));\
-	a##_default = new QRadioButton();
-	
-	// 4 combo box, 4 boutons radios
-	MK_COMBO_BOX(north)
-	MK_COMBO_BOX(east)
-	MK_COMBO_BOX(south)
-	MK_COMBO_BOX(west)
-	
-	#undef MK_COMBO_BOX
-	
-	default_radios -> addButton(north_default, QET::North);
-	default_radios -> addButton(east_default,  QET::East);
-	default_radios -> addButton(south_default, QET::South);
-	default_radios -> addButton(west_default,  QET::West);
-	connect(default_radios, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(slot_defaultChanged(QAbstractButton *)));
-	
-	// petites icones symbolisant les orientations
-	QLabel *north_pixmap = new QLabel(tr("Nord :"));
-	north_pixmap -> setPixmap(QET::Icons::North.pixmap(16, 16));
-	QLabel *east_pixmap = new QLabel(tr("Est :"));
-	east_pixmap -> setPixmap(QET::Icons::East.pixmap(16, 16));
-	QLabel *south_pixmap = new QLabel(tr("Sud :"));
-	south_pixmap -> setPixmap(QET::Icons::South.pixmap(16, 16));
-	QLabel *west_pixmap = new QLabel(tr("Ouest :"));
-	west_pixmap -> setPixmap(QET::Icons::West.pixmap(16, 16));
-	
-	QGridLayout *qgl = new QGridLayout(this);
-	qgl -> addWidget(new QLabel(tr("Par d\351faut")),   0, 3);
-	qgl -> addWidget(north_pixmap,                      1, 0);
-	qgl -> addWidget(new QLabel(tr("Nord :")),          1, 1);
-	qgl -> addWidget(north_orientation,                 1, 2);
-	qgl -> addWidget(north_default,                     1, 3, Qt::AlignHCenter);
-	qgl -> addWidget(east_pixmap,                       2, 0);
-	qgl -> addWidget(new QLabel(tr("Est :")),           2, 1);
-	qgl -> addWidget(east_orientation,                  2, 2);
-	qgl -> addWidget(east_default,                      2, 3, Qt::AlignHCenter);
-	qgl -> addWidget(south_pixmap,                      3, 0);
-	qgl -> addWidget(new QLabel(tr("Sud :")),           3, 1);
-	qgl -> addWidget(south_orientation,                 3, 2);
-	qgl -> addWidget(south_default,                     3, 3, Qt::AlignHCenter);
-	qgl -> addWidget(west_pixmap,                       4, 0);
-	qgl -> addWidget(new QLabel(tr("Ouest :")),         4, 1);
-	qgl -> addWidget(west_orientation,                  4, 2);
-	qgl -> addWidget(west_default,                      4, 3, Qt::AlignHCenter);
-	
-	// les combobox s'etendent autant que possible
-	qgl -> setColumnStretch(2, 1);
-	
-	// l'orientation par defaut par defaut est le Nord
-	north_default -> setChecked(true);
-	slot_defaultChanged(north_default);
-}
-
-/**
-	@return l'OrientationSet
-*/
-OrientationSet OrientationSetWidget::orientationSet() const {
-	return(ori);
-}
-
-/**
-	@param os l'OrientationSet a editer
-*/
-void OrientationSetWidget::setOrientationSet(const OrientationSet &os) {
-	ori = os;
-	updateForm();
-}
-
-/**
-	@return true si ce widget est en lecture seule, false sinon
-*/
-bool OrientationSetWidget::isReadOnly() const {
-	return(!north_orientation -> isEnabled());
-}
-
-/**
-	@param ro true pour passer ce widget en lecture seule, false sinon
-*/
-void OrientationSetWidget::setReadOnly(bool ro) {
-	north_orientation -> setDisabled(ro);
-	east_orientation  -> setDisabled(ro);
-	south_orientation -> setDisabled(ro);
-	west_orientation  -> setDisabled(ro);
-	north_default     -> setDisabled(ro);
-	east_default      -> setDisabled(ro);
-	south_default     -> setDisabled(ro);
-	west_default      -> setDisabled(ro);
-}
-
-/**
-	Slot gerant le changement d'orientation par defaut.
-	L'orientation concernee affiche alors "Possible" et ce statut devient
-	impossible a modifier.
-*/
-void OrientationSetWidget::slot_defaultChanged(QAbstractButton *button) {
-	if      (button == north_default) north_orientation -> setCurrentIndex(0);
-	else if (button == east_default)  east_orientation  -> setCurrentIndex(0);
-	else if (button == south_default) south_orientation -> setCurrentIndex(0);
-	else if (button == west_default)  west_orientation  -> setCurrentIndex(0);
-	
-	north_orientation -> setEnabled(button != north_default);
-	east_orientation  -> setEnabled(button != east_default);
-	south_orientation -> setEnabled(button != south_default);
-	west_orientation  -> setEnabled(button != west_default);
-	
-	updateOrientationSet();
-}
-
-/**
-	Met a jour les donnees de la classe a partir du dialogue
-*/
-void OrientationSetWidget::updateOrientationSet() {
-	ori.setNorth(!north_orientation -> currentIndex());
-	ori.setEast (!east_orientation  -> currentIndex());
-	ori.setSouth(!south_orientation -> currentIndex());
-	ori.setWest (!west_orientation  -> currentIndex());
-	ori.setDefaultOrientation(static_cast<QET::Orientation>(default_radios -> checkedId()));
-}
-
-/**
-	Met a jour le dialogue a partir des donnees de la classe
-*/
-void OrientationSetWidget::updateForm() {
-	north_orientation -> setCurrentIndex(ori.north() ? 0 : 1);
-	east_orientation  -> setCurrentIndex(ori.east()  ? 0 : 1);
-	south_orientation -> setCurrentIndex(ori.south() ? 0 : 1);
-	west_orientation  -> setCurrentIndex(ori.west()  ? 0 : 1);
-	QRadioButton *default_button = NULL;
-	switch(ori.defaultOrientation()) {
-		case QET::North: default_button = north_default; break;
-		case QET::East : default_button = east_default ; break;
-		case QET::South: default_button = south_default; break;
-		case QET::West : default_button = west_default ; break;
-	}
-	if (default_button != NULL) {
-		default_button -> setChecked(true);
-		slot_defaultChanged(default_button);
-	}
-}

Deleted: branches/devel/sources/orientationsetwidget.h
===================================================================
--- branches/devel/sources/orientationsetwidget.h	2013-11-07 09:18:03 UTC (rev 2596)
+++ branches/devel/sources/orientationsetwidget.h	2013-11-07 11:58:03 UTC (rev 2597)
@@ -1,63 +0,0 @@
-/*
-	Copyright 2006-2012 Xavier Guerrin
-	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 ORIENTATION_SET_WIDGET_H
-#define ORIENTATION_SET_WIDGET_H
-#include <QtGui>
-#include "orientationset.h"
-/**
-	Widget to edit an OrientationSet.
-	@see OrientationSet
-*/
-class OrientationSetWidget : public QWidget {
-	Q_OBJECT
-	// constructors, destructor
-	public:
-	OrientationSetWidget(QWidget * = 0);
-	virtual ~OrientationSetWidget() {};
-	
-	private:
-	OrientationSetWidget(const OrientationSetWidget &);
-	
-	// attributes
-	private:
-	OrientationSet ori;
-	QComboBox *north_orientation;
-	QComboBox *east_orientation;
-	QComboBox *south_orientation;
-	QComboBox *west_orientation;
-	QRadioButton *north_default;
-	QRadioButton *east_default;
-	QRadioButton *south_default;
-	QRadioButton *west_default;
-	QButtonGroup *default_radios;
-	
-	// methods
-	public:
-	OrientationSet orientationSet() const;
-	void setOrientationSet(const OrientationSet &);
-	bool isReadOnly() const;
-	void setReadOnly(bool);
-	
-	private:
-	void updateForm();
-	
-	public slots:
-	void slot_defaultChanged(QAbstractButton *);
-	void updateOrientationSet();
-};
-#endif


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/