[qet] [1505] QETElementEditor now inherits from QETMainWindow.

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


Revision: 1505
Author:   xavier
Date:     2012-02-13 23:13:19 +0100 (Mon, 13 Feb 2012)
Log Message:
-----------
QETElementEditor now inherits from QETMainWindow.

Modified Paths:
--------------
    branches/0.3/sources/editor/qetelementeditor.cpp
    branches/0.3/sources/editor/qetelementeditor.h

Modified: branches/0.3/sources/editor/qetelementeditor.cpp
===================================================================
--- branches/0.3/sources/editor/qetelementeditor.cpp	2012-02-13 22:12:37 UTC (rev 1504)
+++ branches/0.3/sources/editor/qetelementeditor.cpp	2012-02-13 22:13:19 UTC (rev 1505)
@@ -52,7 +52,7 @@
 	@param parent QWidget parent
 */
 QETElementEditor::QETElementEditor(QWidget *parent) :
-	QMainWindow(parent),
+	QETMainWindow(parent),
 	read_only(false),
 	min_title(tr("QElectroTech - \311diteur d'\351l\351ment", "window title")),
 	opened_from_file(false)
@@ -162,11 +162,6 @@
 	add_arc         = new QAction(QET::Icons::PartArc,              tr("Ajouter un arc de cercle"),                  this);
 	add_terminal    = new QAction(QET::Icons::Terminal,             tr("Ajouter une borne"),                         this);
 	add_textfield   = new QAction(QET::Icons::PartTextField,        tr("Ajouter un champ de texte"),                 this);
-	fullscreen      = new QAction(this);
-	slot_updateFullScreenAction();
-	configure       = new QAction(QET::Icons::Configure,            tr("&Configurer QElectroTech"),                  this);
-	about_qet       = new QAction(QET::Icons::QETLogo,              tr("\300 &propos de QElectroTech"),              this);
-	about_qt        = new QAction(QET::Icons::QtLogo,               tr("\300 propos de &Qt"),                        this);
 	
 	QString add_status_tip = tr("Maintenez la touche Shift enfonc\351e pour effectuer plusieurs ajouts d'affil\351e");
 	add_line      -> setStatusTip(add_status_tip);
@@ -178,9 +173,6 @@
 	add_terminal  -> setStatusTip(add_status_tip);
 	add_textfield -> setStatusTip(add_status_tip);
 	add_polygon   -> setStatusTip(tr("Utilisez le bouton droit de la souris pour poser le dernier point du polygone"));
-	configure     -> setStatusTip(tr("Permet de r\351gler diff\351rents param\350tres de QElectroTech", "status bar tip"));
-	about_qet     -> setStatusTip(tr("Affiche des informations sur QElectroTech",                       "status bar tip"));
-	about_qt      -> setStatusTip(tr("Affiche des informations sur la biblioth\350que Qt",              "status bar tip"));
 	
 	undo = ce_scene -> undoStack().createUndoAction(this, tr("Annuler"));
 	redo = ce_scene -> undoStack().createRedoAction(this, tr("Refaire"));
@@ -214,8 +206,6 @@
 	zoom_fit          -> setShortcut(QKeySequence(tr("Ctrl+9")));
 	zoom_reset        -> setShortcut(QKeySequence(tr("Ctrl+0")));
 	
-	fullscreen        -> setShortcut(QKeySequence(tr("Ctrl+Shift+F")));
-	
 	edit_names        -> setShortcut(QKeySequence(tr("Ctrl+E")));
 	edit_size_hs      -> setShortcut(QKeySequence(tr("Ctrl+R")));
 	edit_ori          -> setShortcut(QKeySequence(tr("Ctrl+T")));
@@ -226,8 +216,6 @@
 	edit_backward     -> setShortcut(QKeySequence(tr("Ctrl+Shift+End")));
 	edit_forward      -> setShortcut(QKeySequence(tr("Ctrl+Shift+Home")));
 	
-	QETApp *qet_app = QETApp::instance();
-	
 	connect(new_element,     SIGNAL(triggered()), this,     SLOT(slot_new()));
 	connect(open,            SIGNAL(triggered()), this,     SLOT(slot_open()));
 	connect(open_file,       SIGNAL(triggered()), this,     SLOT(slot_openFile()));
@@ -252,8 +240,6 @@
 	connect(edit_delete,     SIGNAL(triggered()), ce_scene, SLOT(slot_delete()));
 	connect(edit_size_hs,    SIGNAL(triggered()), ce_scene, SLOT(slot_editSizeHotSpot()));
 	connect(edit_names,      SIGNAL(triggered()), ce_scene, SLOT(slot_editNames()));
-	connect(fullscreen,      SIGNAL(triggered()), this,     SLOT(toggleFullScreen()));
-	connect(configure,       SIGNAL(triggered()), qet_app,  SLOT(configureQET()));
 	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()));
@@ -282,9 +268,6 @@
 	connect(add_terminal,    SIGNAL(triggered()), this,     SLOT(slot_setNoDragToView()));
 	connect(add_textfield,   SIGNAL(triggered()), this,     SLOT(slot_setNoDragToView()));
 	
-	connect(about_qet,       SIGNAL(triggered()), qet_app,  SLOT(aboutQET()));
-	connect(about_qt,        SIGNAL(triggered()), qet_app,  SLOT(aboutQt()));
-	
 	connect(ce_scene,        SIGNAL(needNormalMode()), this, SLOT(slot_setNormalMode()));
 	
 	move          -> setCheckable(true);
@@ -383,15 +366,11 @@
 	edit_menu    = new QMenu(tr("&\311dition"),    this);
 	display_menu = new QMenu(tr("Afficha&ge"),     this);
 	tools_menu   = new QMenu(tr("O&utils"),        this);
-	config_menu  = new QMenu(tr("&Configuration"), this);
-	help_menu    = new QMenu(tr("&Aide"),          this);
 	
 	file_menu    -> setTearOffEnabled(true);
 	edit_menu    -> setTearOffEnabled(true);
 	display_menu -> setTearOffEnabled(true);
 	tools_menu   -> setTearOffEnabled(true);
-	config_menu  -> setTearOffEnabled(true);
-	help_menu    -> setTearOffEnabled(true);
 	
 	file_menu    -> addAction(new_element);
 	file_menu    -> addAction(open);
@@ -441,24 +420,9 @@
 	display_menu -> addAction(zoom_fit);
 	display_menu -> addAction(zoom_reset);
 	
-	// menu Configurer > Afficher
-	QMenu *display_toolbars = createPopupMenu();
-	display_toolbars -> setTearOffEnabled(true);
-	display_toolbars -> setTitle(tr("Afficher"));
-	
-	config_menu -> addMenu(display_toolbars);
-	config_menu -> addAction(fullscreen);
-	config_menu -> addAction(configure);
-	
-	help_menu -> addAction(about_qet);
-	help_menu -> addAction(about_qt);
-	
-	menuBar() -> addMenu(file_menu);
-	menuBar() -> addMenu(edit_menu);
-	menuBar() -> addMenu(display_menu);
-	//menuBar() -> addMenu(tools_menu);
-	menuBar() -> addMenu(config_menu);
-	menuBar() -> addMenu(help_menu);
+	insertMenu(settings_menu_, file_menu);
+	insertMenu(settings_menu_, edit_menu);
+	insertMenu(settings_menu_, display_menu);
 }
 
 /**
@@ -496,26 +460,9 @@
 	save            -> setEnabled(!read_only && !ce_scene -> undoStack().isClean());
 	undo            -> setEnabled(!read_only && ce_scene -> undoStack().canUndo());
 	redo            -> setEnabled(!read_only && ce_scene -> undoStack().canRedo());
-	
-	slot_updateFullScreenAction();
 }
 
 /**
-	Gere l'action permettant de passer en plein ecran ou d'en sortir
-*/
-void QETElementEditor::slot_updateFullScreenAction() {
-	if (windowState() & Qt::WindowFullScreen) {
-		fullscreen -> setText(tr("Sortir du &mode plein \351cran"));
-		fullscreen -> setIcon(QET::Icons::FullScreenExit);
-		fullscreen -> setStatusTip(tr("Affiche QElectroTech en mode fen\352tr\351", "status bar tip"));
-	} else {
-		fullscreen -> setText(tr("Passer en &mode plein \351cran"));
-		fullscreen -> setIcon(QET::Icons::FullScreenEnter);
-		fullscreen -> setStatusTip(tr("Affiche QElectroTech en mode plein \351cran", "status bar tip"));
-	}
-}
-
-/**
 	Met a jour le titre de la fenetre
 */
 void QETElementEditor::slot_updateTitle() {
@@ -1170,19 +1117,6 @@
 }
 
 /**
-	Gere les evenements du l'editeur d'element
-	Reimplemente ici pour :
-	  * mettre a jour l'action permettant d'entrer en mode plein ecran ou d'en sortir
-	@param e Evenement
-*/
-bool QETElementEditor::event(QEvent *e) {
-	if (e -> type() == QEvent::WindowStateChange) {
-		slot_updateFullScreenAction();
-	}
-	return(QMainWindow::event(e));
-}
-
-/**
 	Remplit la liste des parties
 */
 void QETElementEditor::slot_createPartsList() {
@@ -1253,13 +1187,6 @@
 	slot_updateMenus();
 }
 
-/**
-	Fait passer la fenetre du mode plein ecran au mode normal et vice-versa
-*/
-void QETElementEditor::toggleFullScreen() {
-	setWindowState(windowState() ^ Qt::WindowFullScreen);
-}
-
 /// Lit les parametres de l'editeur d'element
 void QETElementEditor::readSettings() {
 	QSettings &settings = QETApp::settings();

Modified: branches/0.3/sources/editor/qetelementeditor.h
===================================================================
--- branches/0.3/sources/editor/qetelementeditor.h	2012-02-13 22:12:37 UTC (rev 1504)
+++ branches/0.3/sources/editor/qetelementeditor.h	2012-02-13 22:13:19 UTC (rev 1505)
@@ -18,6 +18,7 @@
 #ifndef CUSTOM_ELEMENT_EDITOR_H
 #define CUSTOM_ELEMENT_EDITOR_H
 #include <QtGui>
+#include "qetmainwindow.h"
 #include "qet.h"
 #include "elementscene.h"
 #include "orientationset.h"
@@ -29,7 +30,7 @@
 	de dessiner, modifier et parametrer un element electrique. Le dessin se
 	fait par ajout de parties (Part).
 */
-class QETElementEditor : public QMainWindow {
+class QETElementEditor : public QETMainWindow {
 	Q_OBJECT
 	
 	// constructeur, destructeur
@@ -44,7 +45,7 @@
 	/// booleen indiquant si l'editeur est en mode "lecture seule" ou non
 	bool read_only;
 	/// menus
-	QMenu *file_menu, *edit_menu, *paste_from_menu, *display_menu, *tools_menu, *config_menu, *help_menu;
+	QMenu *file_menu, *edit_menu, *paste_from_menu, *display_menu, *tools_menu;
 	/// vue sur la scene d'edition
 	ElementView *ce_view;
 	/// scene d'edition
@@ -75,12 +76,6 @@
 	QAction *edit_raise, *edit_lower, *edit_backward, *edit_forward;
 	/// actions du menu affichage
 	QAction *zoom_in, *zoom_out, *zoom_fit, *zoom_reset;
-	/// actions du menu configurer
-	QAction *fullscreen;         ///< Passe en mode plein ecran ou en sort
-	QAction *configure;          ///< Lance le dialogue de configuration de QElectroTech
-	/// actions du menu aide
-	QAction *about_qet;          ///< Lance le dialogue "A propos de QElectroTech"
-	QAction *about_qt;           ///< Lance le dialogue "A propos de Qt"
 	/// barres d'outils
 	QToolBar *parts_toolbar, *main_toolbar, *view_toolbar, *depth_toolbar, *element_toolbar;
 	/// actions de la barre d'outils
@@ -126,7 +121,6 @@
 	
 	protected:
 	void closeEvent(QCloseEvent *);
-	virtual bool event(QEvent *);
 	
 	private:
 	void setupActions();
@@ -151,12 +145,10 @@
 	void slot_setNormalMode();
 	void slot_updateInformations();
 	void slot_updateMenus();
-	void slot_updateFullScreenAction();
 	void slot_updateTitle();
 	void slot_createPartsList();
 	void slot_updatePartsList();
 	void slot_updateSelectionFromPartsList();
-	void toggleFullScreen();
 	void xmlPreview();
 	bool checkElement();
 	void pasteFromFile();


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