r19996 by craig - #12977: Properly disconnect and reconnect signals for zoom and layer control so each open doc keeps its own values

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 11 23:04:59 UTC 2015


Author: craig
Date: Sat Apr 11 23:04:59 2015
New Revision: 19996

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19996
Log:
#12977: Properly disconnect and reconnect signals for zoom and layer control so each open doc keeps its own values

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19996&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Apr 11 23:04:59 2015
@@ -2420,7 +2420,6 @@
 	ActWin = scw;
 	if (ActWin->doc() == NULL)
 		return;
-
 	if (doc != NULL)
 	{
 		if (doc->appMode == modeEditClip)
@@ -2429,7 +2428,6 @@
 			outlinePalette->buildReopenVals();
 	}
 	docCheckerPalette->clearErrorList();
-
 	if (HaveDoc && (doc != NULL) && doc->hasGUI())
 	{
 		disconnect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
@@ -2437,21 +2435,19 @@
 		disconnect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew()));
 		disconnect(doc, SIGNAL(addBookmark(PageItem *)), this, SLOT(AddBookMark(PageItem *)));
 		disconnect(doc, SIGNAL(deleteBookmark(PageItem *)), this, SLOT(DelBookMark(PageItem *)));
-		disconnect(unitSwitcher, SIGNAL(activated(int)), doc->view(), SLOT(ChgUnit(int)));
-		disconnect(zoomSpinBox, SIGNAL(valueChanged(double)), doc->view(), SLOT(setZoom()));
-		disconnect(zoomDefaultToolbarButton, SIGNAL(clicked()), doc->view(), SLOT(slotZoom100()));
-		disconnect(zoomOutToolbarButton, SIGNAL(clicked()), doc->view(), SLOT(slotZoomOut()));
-		disconnect(zoomInToolbarButton, SIGNAL(clicked()), doc->view(), SLOT(slotZoomIn()));
-		disconnect(layerMenu, SIGNAL(activated(int)), doc->view(), SLOT(GotoLa(int)));
+		unitSwitcher->disconnect();
+		zoomSpinBox->disconnect();
+		zoomDefaultToolbarButton->disconnect();
+		zoomOutToolbarButton->disconnect();
+		zoomInToolbarButton->disconnect();
+		layerMenu->disconnect();
 		disconnect(viewToolBar->previewQualitySwitcher, SIGNAL(activated(int)), this, SLOT(changePreviewQuality(int)));
 		disconnect(viewToolBar->visualMenu, SIGNAL(activated(int)), doc->view(), SLOT(switchPreviewVisual(int)));
-		disconnect(pageSelector, 0, 0, 0);
+		pageSelector->disconnect();
 		pageSelector->setEnabled(false);
 	}
-
 	doc = ActWin->doc();
 	undoManager->switchStack(doc->DocName);
-
 	if ((doc != NULL) && doc->hasGUI())
 	{
 		connect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
@@ -2483,7 +2479,6 @@
 		connect(pageSelector, SIGNAL(GotoPage(int)), this, SLOT(setCurrentPage(int)));
 		pageSelector->setEnabled(true);
 	}
-
 	if (view!=NULL)
 	{
 		actionManager->disconnectNewViewActions();
@@ -2491,11 +2486,10 @@
 		if (ScCore->usingGUI())
 			disconnect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), 0, 0);
 	}
-
 	view = ActWin->view();
-
+	bool b = zoomSpinBox->blockSignals(true);
 	zoomSpinBox->setValue(view->scale() * 100.0 / PrefsManager::instance()->appPrefs.displayPrefs.displayScale);
-	connect(zoomSpinBox, SIGNAL(valueChanged(double)), doc->view(), SLOT(setZoom()));
+	zoomSpinBox->blockSignals(b);
 	actionManager->connectNewViewActions(view);
 	actionManager->disconnectNewDocActions();
 	actionManager->connectNewDocActions(doc);
@@ -2506,7 +2500,6 @@
 		connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), actionManager, SLOT( handleMultipleSelections(bool)));
 		//connect(doc->m_Selection, SIGNAL(empty()), propertiesPalette, SLOT( unsetItem()));
 	}
-
 	pagePalette->setView(view);
 	alignDistributePalette->setDoc(doc);
 	if (!doc->isLoading())
@@ -2627,6 +2620,7 @@
 	updateActiveWindowCaption(doc->DocName);
 	propertiesPalette->setDoc(doc);
 	nsEditor->setDoc(doc);
+
 	marksManager->setDoc(doc);
 	symbolPalette->setDoc(doc);
 	inlinePalette->setDoc(doc);
@@ -3421,7 +3415,6 @@
 			return true;
 		}
 	}
-
 	UndoBlocker undoBlocker;
 	if (!fileName.isEmpty())
 	{
@@ -3448,7 +3441,6 @@
 			//Scribus 1.3.x warning, remove at a later stage
 			is12doc=true;
 		}
-
 		QDir docProfileDir(fi.absolutePath() + "/profiles");
 		ScCore->getCMSProfilesDir(fi.absolutePath()+"/", false, false);
 		if (docProfileDir.exists())
@@ -3526,7 +3518,9 @@
 		outlinePalette->setDoc(doc);
 		fileLoader->informReplacementFonts();
 		setCurrentComboItem(unitSwitcher, unitGetStrFromIndex(doc->unitIndex()));
+		bool b = zoomSpinBox->blockSignals(true);
 		zoomSpinBox->setValue(view->scale());
+		zoomSpinBox->blockSignals(b);
 		view->unitChange();
 		setScriptRunning(false);
 		view->Deselect(true);
@@ -3552,7 +3546,6 @@
 			lpo.Angle = 45;
 			doc->pdfOptions().LPISettings.insert("Black", lpo);
 		}
-
 		if (!doc->cmsSettings().CMSinUse)
 			doc->HasCMS = false;
 		if ((ScCore->haveCMS()) && (doc->cmsSettings().CMSinUse))
@@ -3789,6 +3782,7 @@
 	{
 		pagePalette->setView(0);
 	}
+
 	undoManager->switchStack(doc->DocName);
 	pagePalette->Rebuild();
 	qApp->restoreOverrideCursor();
@@ -7244,7 +7238,7 @@
 
 void ScribusMainWindow::updateLayerMenu()
 {
-	disconnect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+	bool b = layerMenu->blockSignals(true);
 	layerMenu->clear();
 	if (doc==NULL)
 		return;
@@ -7256,7 +7250,7 @@
 		pm.fill(doc->Layers.layerByName(*it)->markerColor);
 		layerMenu->addItem(pm, *it);
 	}
-	connect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+	layerMenu->blockSignals(b);
 }
 
 
@@ -7328,7 +7322,6 @@
 	{
 		qApp->setStyleSheet(QString(stylesheet));
 	}
-
 	doc->setUnitIndex(unitIndex);
 	setCurrentComboItem(unitSwitcher, unitGetStrFromIndex(doc->unitIndex()));
 	view->unitChange();
@@ -8055,10 +8048,10 @@
 
 void ScribusMainWindow::setLayerMenuText(const QString &layerName)
 {
-	disconnect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+	bool b = layerMenu->blockSignals(true);
 	if (layerMenu->count() != 0)
 		setCurrentComboItem(layerMenu, layerName);
-	connect(layerMenu, SIGNAL(activated(int)), this, SLOT(GotoLa(int)));
+	layerMenu->blockSignals(b);
 }
 
 void ScribusMainWindow::showLayer()

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19996&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sat Apr 11 23:04:59 2015
@@ -608,7 +608,6 @@
 
 	void updateColorMenu(QProgressBar* progressBar=NULL);
 
-
 	int ScriptRunning;
 
 	QLabel* mainWindowStatusLabel;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19996&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sat Apr 11 23:04:59 2015
@@ -2440,9 +2440,9 @@
 	updateContents();
 	setRulerPos(contentsX(), contentsY());
 	m_ScMW->slotSetCurrentPage(Doc->currentPage()->pageNr());
-	disconnect(m_ScMW->zoomSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZoom()));
-	m_ScMW->zoomSpinBox->setValue(m_canvas->scale()/Prefs->displayPrefs.displayScale*100);
-	connect(m_ScMW->zoomSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZoom()));
+//	disconnect(m_ScMW->zoomSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZoom()));
+//	m_ScMW->zoomSpinBox->setValue(m_canvas->scale()/Prefs->displayPrefs.displayScale*100);
+//	connect(m_ScMW->zoomSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZoom()));
 }
 
 void ScribusView::SetCCPo(double x, double y)




More information about the scribus-commit mailing list