[qet] [1873] Elements panel: added a "switch to this project" action to the context menu

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


Revision: 1873
Author:   xavier
Date:     2012-06-25 08:27:24 +0200 (Mon, 25 Jun 2012)
Log Message:
-----------
Elements panel: added a "switch to this project" action to the context menu

Modified Paths:
--------------
    trunk/sources/elementspanelwidget.cpp
    trunk/sources/elementspanelwidget.h
    trunk/sources/qetdiagrameditor.cpp

Modified: trunk/sources/elementspanelwidget.cpp
===================================================================
--- trunk/sources/elementspanelwidget.cpp	2012-06-19 05:48:44 UTC (rev 1872)
+++ trunk/sources/elementspanelwidget.cpp	2012-06-25 06:27:24 UTC (rev 1873)
@@ -62,6 +62,7 @@
 	edit_element          = new QAction(QET::Icons::ElementEdit,               tr("\311diter l'\351l\351ment"),           this);
 	delete_element        = new QAction(QET::Icons::ElementDelete,             tr("Supprimer l'\351l\351ment"),           this);
 	open_element          = new QAction(QET::Icons::DocumentImport,            tr("Ouvrir un fichier \351l\351ment"),     this);
+	prj_activate          = new QAction(QET::Icons::ProjectFile,               tr("Basculer vers ce projet"),             this);
 	prj_close             = new QAction(QET::Icons::DocumentClose,             tr("Fermer ce projet"),                    this);
 	prj_edit_prop         = new QAction(QET::Icons::DialogInformation,         tr("Propri\351t\351s du projet"),          this);
 	prj_prop_diagram      = new QAction(QET::Icons::DialogInformation,         tr("Propri\351t\351s du sch\351ma"),       this);
@@ -103,6 +104,7 @@
 	connect(edit_element,          SIGNAL(triggered()), this,           SLOT(editElement()));
 	connect(delete_element,        SIGNAL(triggered()), this,           SLOT(deleteElement()));
 	connect(open_element,          SIGNAL(triggered()), this,           SLOT(openElementFromFile()));
+	connect(prj_activate,          SIGNAL(triggered()), this,           SLOT(activateProject()));
 	connect(prj_close,             SIGNAL(triggered()), this,           SLOT(closeProject()));
 	connect(prj_edit_prop,         SIGNAL(triggered()), this,           SLOT(editProjectProperties()));
 	connect(prj_prop_diagram,      SIGNAL(triggered()), this,           SLOT(editDiagramProperties()));
@@ -121,6 +123,7 @@
 	
 	connect(elements_panel,        SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons()));
 	connect(elements_panel,        SIGNAL(customContextMenuRequested(const QPoint &)),               this, SLOT(handleContextMenu(const QPoint &)));
+	connect(elements_panel,        SIGNAL(requestForDiagram(Diagram*)),                              this, SIGNAL(requestForDiagram(Diagram*)));
 	connect(elements_panel,        SIGNAL(requestForCollectionItem(const ElementsLocation &)),       this, SLOT(handleCollectionRequest(const ElementsLocation &)));
 	connect(
 		elements_panel,
@@ -196,6 +199,15 @@
 }
 
 /**
+	* Emit the requestForProject signal with te selected project
+*/
+void ElementsPanelWidget::activateProject() {
+	if (QETProject *selected_project = elements_panel -> selectedProject()) {
+		emit(requestForProject(selected_project));
+	}
+}
+
+/**
 	Emet le signal requestForProjectClosing avec le projet selectionne
 */
 void ElementsPanelWidget::closeProject() {
@@ -465,6 +477,7 @@
 			context_menu -> addAction(new_element);
 			break;
 		case QET::Project:
+			context_menu -> addAction(prj_activate);
 			context_menu -> addAction(prj_edit_prop);
 			context_menu -> addAction(prj_add_diagram);
 			context_menu -> addAction(prj_close);

Modified: trunk/sources/elementspanelwidget.h
===================================================================
--- trunk/sources/elementspanelwidget.h	2012-06-19 05:48:44 UTC (rev 1872)
+++ trunk/sources/elementspanelwidget.h	2012-06-25 06:27:24 UTC (rev 1873)
@@ -42,7 +42,7 @@
 	QAction *new_category, *edit_category, *delete_category;
 	QAction *delete_collection;
 	QAction *new_element, *edit_element, *delete_element, *open_element;
-	QAction *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down;
+	QAction *prj_activate, *prj_close, *prj_edit_prop, *prj_prop_diagram, *prj_add_diagram, *prj_del_diagram, *prj_move_diagram_up, *prj_move_diagram_down;
 	QAction *tbt_add, *tbt_edit, *tbt_remove;
 	QAction *copy_elements_, *move_elements_, *cancel_elements_;
 	QMenu *context_menu;
@@ -56,6 +56,8 @@
 	inline ElementsPanel &elementsPanel() const;
 	
 	signals:
+	void requestForDiagram(Diagram *);
+	void requestForProject(QETProject *);
 	void requestForNewDiagram(QETProject *);
 	void requestForProjectClosing(QETProject *);
 	void requestForProjectPropertiesEdition(QETProject *);
@@ -67,6 +69,7 @@
 	public slots:
 	void clearFilterTextField();
 	void reloadAndFilter();
+	void activateProject();
 	void closeProject();
 	void editProjectProperties();
 	void editDiagramProperties();

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2012-06-19 05:48:44 UTC (rev 1872)
+++ trunk/sources/qetdiagrameditor.cpp	2012-06-25 06:27:24 UTC (rev 1873)
@@ -65,9 +65,9 @@
 	qdw_pa -> setFeatures(QDockWidget::AllDockWidgetFeatures);
 	qdw_pa -> setMinimumWidth(160);
 	qdw_pa -> setWidget(pa = new ElementsPanelWidget(qdw_pa));
-	connect(&(pa -> elementsPanel()), SIGNAL(requestForDiagram(Diagram *)),    this, SLOT(activateDiagram(Diagram *)));
-	connect(&(pa -> elementsPanel()), SIGNAL(requestForProject(QETProject *)), this, SLOT(activateProject(QETProject *)));
 	
+	connect(pa, SIGNAL(requestForDiagram(Diagram *)),                     this, SLOT(activateDiagram(Diagram *)));
+	connect(pa, SIGNAL(requestForProject(QETProject *)),                  this, SLOT(activateProject(QETProject *)));
 	connect(pa, SIGNAL(requestForProjectClosing(QETProject *)),           this, SLOT(closeProject(QETProject *)));
 	connect(pa, SIGNAL(requestForProjectPropertiesEdition(QETProject *)), this, SLOT(editProjectProperties(QETProject *)));
 	connect(pa, SIGNAL(requestForDiagramPropertiesEdition(Diagram *)),    this, SLOT(editDiagramProperties(Diagram *)));


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