r23268 by jghali - Remove Selection's selectionIsMultiple(bool) signal and use selectionChanged() instead

scribus-commit scribus-commit at lists.scribus.net
Sat Oct 19 05:40:35 UTC 2019


Author: jghali
Date: Sat Oct 19 05:40:34 2019
New Revision: 23268

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23268
Log:
Remove Selection's selectionIsMultiple(bool) signal and use selectionChanged() instead

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/actionmanager.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/selection.cpp
    trunk/Scribus/scribus/selection.h

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23268&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp	(original)
+++ trunk/Scribus/scribus/actionmanager.cpp	Sat Oct 19 05:40:34 2019
@@ -2528,8 +2528,11 @@
 	itnmenua->second << "unicodeLigature_st";
 }
 
-void ActionManager::handleMultipleSelections(bool isMultiple)
-{
+void ActionManager::handleMultipleSelections()
+{
+	bool isMultiple = true;
+	if (mainWindow->HaveDoc && (mainWindow->doc->m_Selection->count() <= 1))
+		isMultiple = false;
 	(*scrActions)["itemAttributes"]->setEnabled(!isMultiple);
 }
 

Modified: trunk/Scribus/scribus/actionmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23268&path=/trunk/Scribus/scribus/actionmanager.h
==============================================================================
--- trunk/Scribus/scribus/actionmanager.h	(original)
+++ trunk/Scribus/scribus/actionmanager.h	Sat Oct 19 05:40:34 2019
@@ -89,7 +89,7 @@
 		
 	public slots:
 		void languageChange();
-		void handleMultipleSelections(bool isMultiple);
+		void handleMultipleSelections();
 		
 	protected:
 		void initFileMenuActions();

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23268&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat Oct 19 05:40:34 2019
@@ -2569,11 +2569,11 @@
 		connect(pageSelector, SIGNAL(GotoPage(int)), this, SLOT(setCurrentPage(int)));
 		pageSelector->setEnabled(true);
 	}
-	if (view!=nullptr)
+	if (view != nullptr)
 	{
 		actionManager->disconnectNewViewActions();
 		if (ScCore->usingGUI())
-			doc->m_Selection->disconnect(SIGNAL(selectionIsMultiple(bool)));
+			doc->m_Selection->disconnect(SIGNAL(selectionChanged()));
 	}
 	view = ActWin->view();
 	bool b = zoomSpinBox->blockSignals(true);
@@ -2583,7 +2583,7 @@
 	actionManager->disconnectNewDocActions();
 	actionManager->connectNewDocActions(doc);
 	if (ScCore->usingGUI())
-		connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), actionManager, SLOT( handleMultipleSelections(bool)));
+		connect(doc->m_Selection, SIGNAL(selectionChanged()), actionManager, SLOT(handleMultipleSelections()));
 	pagePalette->setView(view);
 	alignDistributePalette->setDoc(doc);
 	if (!doc->isLoading())

Modified: trunk/Scribus/scribus/selection.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23268&path=/trunk/Scribus/scribus/selection.cpp
==============================================================================
--- trunk/Scribus/scribus/selection.cpp	(original)
+++ trunk/Scribus/scribus/selection.cpp	Sat Oct 19 05:40:34 2019
@@ -27,8 +27,7 @@
 	QObject(parent),
 	m_isGUISelection(false),
 	m_delaySignals(0),
-	m_sigSelectionChanged(false),
-	m_sigSelectionIsMultiple(false)
+	m_sigSelectionChanged(false)
 {
 	m_groupX   = m_groupY   = m_groupW   = m_groupH   = 0;
 	m_visualGX = m_visualGY = m_visualGW = m_visualGH = 0;
@@ -38,8 +37,7 @@
 	QObject(parent),
 	m_isGUISelection(guiSelection),
 	m_delaySignals(0),
-	m_sigSelectionChanged(false),
-	m_sigSelectionIsMultiple(false)
+	m_sigSelectionChanged(false)
 {
 	m_groupX   = m_groupY   = m_groupW   = m_groupH   = 0;
 	m_visualGX = m_visualGY = m_visualGW = m_visualGH = 0;
@@ -55,15 +53,14 @@
 	// We do not copy m_delaySignals as that can potentially
 	// cause much trouble balancing delaySignalOff/On right
 	m_delaySignals(0), 
-	m_sigSelectionChanged(other.m_sigSelectionChanged),
-	m_sigSelectionIsMultiple(other.m_sigSelectionIsMultiple)
+	m_sigSelectionChanged(other.m_sigSelectionChanged)
 {
 	if (m_isGUISelection && !m_SelList.isEmpty())
 	{
 		m_SelList[0]->connectToGUI();
 		m_SelList[0]->emitAllToGUI();
 		m_SelList[0]->setSelected(true);
-		emit selectionIsMultiple(m_SelList.count() > 1);
+		emit selectionChanged();
 	}
 	m_groupX = other.m_groupX;
 	m_groupY = other.m_groupY;
@@ -85,19 +82,18 @@
 		for (SelectionList::Iterator it = m_SelList.begin(); it != itend; ++it)
 			(*it)->setSelected(false);
 	}
-	m_SelList=other.m_SelList;
+	m_SelList = other.m_SelList;
 	// Do not copy m_isGUISelection for consistency with cpy ctor
 	/* m_isGUISelection = other.m_isGUISelection; */
 	// We do not copy m_delaySignals as that can potentially
 	// cause much trouble balancing delaySignalOff/On right
 	m_sigSelectionChanged = other.m_sigSelectionChanged;
-	m_sigSelectionIsMultiple = other.m_sigSelectionIsMultiple;
 	if (m_isGUISelection && !m_SelList.isEmpty())
 	{
 		m_SelList[0]->connectToGUI();
 		m_SelList[0]->emitAllToGUI();
 		m_SelList[0]->setSelected(true);
-		emit selectionIsMultiple(m_SelList.count() > 1);
+		emit selectionChanged();
 	}
 	return *this;
 }
@@ -114,7 +110,7 @@
 	}
 	m_SelList = other.m_SelList;
 	if (m_isGUISelection && !m_SelList.isEmpty())
-		m_sigSelectionIsMultiple = true;
+		m_sigSelectionChanged = true;
 	if (emptyOther)
 		other.clear();
 	sendSignals();
@@ -128,9 +124,9 @@
 {
 	if (!m_SelList.isEmpty())
 	{
-		SelectionList::Iterator itend=m_SelList.end();
-		SelectionList::Iterator it=m_SelList.begin();
-		while (it!=itend)
+		SelectionList::Iterator itend = m_SelList.end();
+		SelectionList::Iterator it = m_SelList.begin();
+		while (it != itend)
 		{
 			(*it)->isSingleSel=false;
 			if (m_isGUISelection)
@@ -170,7 +166,6 @@
 		ret = m_SelList.first()->connectToGUI();
 		m_SelList.first()->emitAllToGUI();
 		m_sigSelectionChanged  = true;
-		m_sigSelectionIsMultiple = true;
 	}
 	sendSignals(false);
 	return ret;
@@ -202,7 +197,6 @@
 		{
 			item->setSelected(true);
 			m_sigSelectionChanged = true;
-			m_sigSelectionIsMultiple = true;
 		}
 		sendSignals();
 		return true;
@@ -231,10 +225,7 @@
 
 	m_SelList.append(toAdd);
 	if (m_isGUISelection)
-	{
 		m_sigSelectionChanged = true;
-		m_sigSelectionIsMultiple = true;
-	}
 	sendSignals();
 	return true;
 }
@@ -252,7 +243,6 @@
 		{
 			item->setSelected(true);
 			m_sigSelectionChanged = true;
-			m_sigSelectionIsMultiple = true;
 		}	
 		sendSignals();
 		return true;
@@ -262,7 +252,7 @@
 
 PageItem *Selection::itemAt_(int index)
 {
-	if (!m_SelList.isEmpty() && index<m_SelList.count())
+	if (!m_SelList.isEmpty() && index < m_SelList.count())
 	{
 		QPointer<PageItem> pi = m_SelList[index];
 		//If not nullptr return it, otherwise remove from the list and return nullptr
@@ -654,11 +644,8 @@
 			connectItemToGUI();
 		if (m_sigSelectionChanged)
 			emit selectionChanged();
-		if (m_sigSelectionIsMultiple)
-			emit selectionIsMultiple(m_SelList.count() > 1);
 		m_sigSelectionChanged = false;
-		m_sigSelectionIsMultiple = false;
-	}
-}
-
-
+	}
+}
+
+

Modified: trunk/Scribus/scribus/selection.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23268&path=/trunk/Scribus/scribus/selection.h
==============================================================================
--- trunk/Scribus/scribus/selection.h	(original)
+++ trunk/Scribus/scribus/selection.h	Sat Oct 19 05:40:34 2019
@@ -203,12 +203,10 @@
 
 		int  m_delaySignals;
 		bool m_sigSelectionChanged;
-		bool m_sigSelectionIsMultiple;
 
 		void sendSignals(bool guiConnect = true);
 		
 	signals:
-		void selectionIsMultiple(bool);
 		void selectionChanged();
 };
 




More information about the scribus-commit mailing list