[qet] [1650] The title block template editor now save its geometry and state when closing .

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


Revision: 1650
Author:   xavier
Date:     2012-04-09 20:56:17 +0200 (Mon, 09 Apr 2012)
Log Message:
-----------
The title block template editor now save its geometry and state when closing.

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

Modified: branches/0.3/sources/qetapp.cpp
===================================================================
--- branches/0.3/sources/qetapp.cpp	2012-04-09 18:23:34 UTC (rev 1649)
+++ branches/0.3/sources/qetapp.cpp	2012-04-09 18:56:17 UTC (rev 1650)
@@ -1050,7 +1050,7 @@
 	QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
 	qet_template_editor -> setOpenForDuplication(duplicate);
 	qet_template_editor -> edit(location);
-	qet_template_editor -> showMaximized();
+	qet_template_editor -> show();
 }
 
 /**
@@ -1060,7 +1060,7 @@
 void QETApp::openTitleBlockTemplate(const QString &filepath) {
 	QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
 	qet_template_editor -> edit(filepath);
-	qet_template_editor -> showMaximized();
+	qet_template_editor -> show();
 }
 
 /**

Modified: branches/0.3/sources/titleblock/qettemplateeditor.cpp
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.cpp	2012-04-09 18:23:34 UTC (rev 1649)
+++ branches/0.3/sources/titleblock/qettemplateeditor.cpp	2012-04-09 18:56:17 UTC (rev 1650)
@@ -45,6 +45,7 @@
 	initActions();
 	initMenus();
 	initToolbars();
+	readSettings();
 }
 
 /**
@@ -142,6 +143,7 @@
 */
 void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) {
 	if (canClose()) {
+		writeSettings();
 		setAttribute(Qt::WA_DeleteOnClose);
 		qce -> accept();
 	} else qce -> ignore();
@@ -301,7 +303,7 @@
 void QETTitleBlockTemplateEditor::newTemplate() {
 	QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
 	qet_template_editor -> edit(TitleBlockTemplateLocation());
-	qet_template_editor -> showMaximized();
+	qet_template_editor -> show();
 }
 
 /**
@@ -426,6 +428,7 @@
 	addToolBar(Qt::TopToolBarArea, main_toolbar);
 	
 	QToolBar *edit_toolbar = new QToolBar(tr("\311dition", "toolbar title"), this);
+	edit_toolbar -> setObjectName("tbt_edit_toolbar");
 	edit_toolbar -> addAction(undo_);
 	edit_toolbar -> addAction(redo_);
 	edit_toolbar -> addSeparator();
@@ -454,6 +457,7 @@
 	undo_view_ -> setEmptyLabel(tr("Aucune modification", "label displayed in the undo list when empty"));
 	
 	undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title"));
+	undo_dock_widget_ -> setObjectName("tbt_undo_dock");
 	undo_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
 	undo_dock_widget_ -> setWidget(undo_view_);
 	undo_dock_widget_ -> setMinimumWidth(290);
@@ -472,6 +476,7 @@
 	// cell edition widget at the bottom
 	template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_);
 	template_cell_editor_dock_widget_ = new QDockWidget(tr("Propri\351t\351s de la cellule", "dock title"), this);
+	template_cell_editor_dock_widget_ -> setObjectName("tbt_celleditor_dock");
 	template_cell_editor_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
 	template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_);
 	template_cell_editor_dock_widget_ -> setMinimumWidth(180);
@@ -555,6 +560,30 @@
 }
 
 /**
+	Load template editor-related parameters.
+*/
+void QETTitleBlockTemplateEditor::readSettings() {
+	QSettings &settings = QETApp::settings();
+	
+	// window size and position
+	QVariant geometry = settings.value("titleblocktemplateeditor/geometry");
+	if (geometry.isValid()) restoreGeometry(geometry.toByteArray());
+	
+	// window state (toolbars, docks...)
+	QVariant state = settings.value("titleblocktemplateeditor/state");
+	if (state.isValid()) restoreState(state.toByteArray());
+}
+
+/**
+	Save template editor-related parameters.
+*/
+void QETTitleBlockTemplateEditor::writeSettings() {
+	QSettings &settings = QETApp::settings();
+	settings.setValue("titleblocktemplateeditor/geometry", saveGeometry());
+	settings.setValue("titleblocktemplateeditor/state", saveState());
+}
+
+/**
 	Update various things when user changes the selected cells.
 	@param selected_cells List of selected cells.
 */

Modified: branches/0.3/sources/titleblock/qettemplateeditor.h
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.h	2012-04-09 18:23:34 UTC (rev 1649)
+++ branches/0.3/sources/titleblock/qettemplateeditor.h	2012-04-09 18:56:17 UTC (rev 1650)
@@ -102,6 +102,8 @@
 	QString currentlyEditedTitle() const;
 	
 	public slots:
+	void readSettings();
+	void writeSettings();
 	void selectedCellsChanged(QList<TitleBlockCell *>);
 	void duplicateCurrentLocation();
 	bool edit(const TitleBlockTemplateLocation &);


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