[qet] [1562] Minor refactoring within TBT commands.

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


Revision: 1562
Author:   xavier
Date:     2012-03-11 17:06:46 +0100 (Sun, 11 Mar 2012)
Log Message:
-----------
Minor refactoring within TBT commands.

Modified Paths:
--------------
    branches/0.3/sources/titleblock/templatecommands.cpp
    branches/0.3/sources/titleblock/templatecommands.h

Modified: branches/0.3/sources/titleblock/templatecommands.cpp
===================================================================
--- branches/0.3/sources/titleblock/templatecommands.cpp	2012-03-11 16:06:43 UTC (rev 1561)
+++ branches/0.3/sources/titleblock/templatecommands.cpp	2012-03-11 16:06:46 UTC (rev 1562)
@@ -201,6 +201,14 @@
 }
 
 /**
+	Refresh the view, if any.
+*/
+void TitleBlockTemplateCommand::refreshView() {
+	if (!view_) return;
+	view_ -> refresh();
+}
+
+/**
 	This static method is a convenience to create a ModifyTemplateGridCommand
 	that adds a row to \a tbtemplate at \a index.
 	@param tbtemplate Modified title block template
@@ -870,9 +878,7 @@
 	foreach (TitleBlockCell *cell, cut_cells_.keys()) {
 		cell -> cell_type = cut_cells_.value(cell);
 	}
-	if (view_) {
-		view_ -> refresh();
-	}
+	refreshView();
 }
 
 /**
@@ -882,9 +888,7 @@
 	foreach (TitleBlockCell *cell, cut_cells_.keys()) {
 		cell -> cell_type = TitleBlockCell::EmptyCell;
 	}
-	if (view_) {
-		view_ -> refresh();
-	}
+	refreshView();
 }
 
 void CutTemplateCellsCommand::setCutCells(const QList<TitleBlockCell *> &cells) {
@@ -932,9 +936,7 @@
 	foreach (TitleBlockCell *cell, erased_cells_.keys()) {
 		cell -> loadContentFromCell(erased_cells_.value(cell));
 	}
-	if (view_) {
-		view_ -> refresh();
-	}
+	refreshView();
 }
 
 /**
@@ -945,9 +947,7 @@
 	foreach (TitleBlockCell *cell, erased_cells_.keys()) {
 		cell -> loadContentFromCell(pasted_cells_.value(cell));
 	}
-	if (view_) {
-		view_ -> refresh();
-	}
+	refreshView();
 }
 
 /**

Modified: branches/0.3/sources/titleblock/templatecommands.h
===================================================================
--- branches/0.3/sources/titleblock/templatecommands.h	2012-03-11 16:06:43 UTC (rev 1561)
+++ branches/0.3/sources/titleblock/templatecommands.h	2012-03-11 16:06:46 UTC (rev 1562)
@@ -77,6 +77,7 @@
 	void setTitleBlockTemplate(TitleBlockTemplate *);
 	TitleBlockTemplateView *view() const;
 	void setView(TitleBlockTemplateView *);
+	void refreshView();
 	
 	// attributes
 	protected:


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