r21043 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 29 19:03:03 UTC 2016


Author: fschmid
Date: Mon Feb 29 19:03:03 2016
New Revision: 21043

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21043
Log:
Follow up to #11544: save active tab on tabbed Dockwidgets too.

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/prefsstructs.h
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21043&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Mon Feb 29 19:03:03 2016
@@ -940,17 +940,22 @@
 			appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toLatin1());
 			appPrefs.uiPrefs.tabbedPalettes.clear();
 			PrefsTable *tabsTable = userprefsContext->getTable("tabbedPalettes");
+			PrefsTable *actTabsTable = userprefsContext->getTable("activeTabs");
 			if (tabsTable)
 			{
 				for (int r = 0; r < tabsTable->getRowCount(); r++)
 				{
-					QStringList tabs;
+					tabPrefs tabs;
 					for (int c = 0; c < tabsTable->getColCount(); c++)
 					{
 						QString tabName = tabsTable->get(r, c);
 						if (!tabName.isEmpty())
-							tabs.append(tabsTable->get(r, c));
+							tabs.palettes.append(tabsTable->get(r, c));
 					}
+					if (actTabsTable)
+						tabs.activeTab = actTabsTable->getInt(r, 0);
+					else
+						tabs.activeTab = -1;
 					appPrefs.uiPrefs.tabbedPalettes.append(tabs);
 				}
 			}
@@ -1013,17 +1018,20 @@
 				int maxCols = 0;
 				for (int a = 0; a < appPrefs.uiPrefs.tabbedPalettes.count(); a++)
 				{
-					maxCols = qMax(maxCols, appPrefs.uiPrefs.tabbedPalettes[a].count());
+					maxCols = qMax(maxCols, appPrefs.uiPrefs.tabbedPalettes[a].palettes.count());
 				}
 				PrefsTable *tabsTable = userprefsContext->getTable("tabbedPalettes");
 				tabsTable->clear();
+				PrefsTable *actTabsTable = userprefsContext->getTable("activeTabs");
+				actTabsTable->clear();
 				for (int a = 0; a < appPrefs.uiPrefs.tabbedPalettes.count(); a++)
 				{
-					QStringList actTab = appPrefs.uiPrefs.tabbedPalettes[a];
+					QStringList actTab = appPrefs.uiPrefs.tabbedPalettes[a].palettes;
 					for (int i = 0; i < actTab.count(); i++)
 					{
 						tabsTable->set(a, i, actTab[i]);
 					}
+					actTabsTable->set(a, 0, appPrefs.uiPrefs.tabbedPalettes[a].activeTab);
 					if (actTab.count() < maxCols)
 					{
 						for (int i = actTab.count(); i < maxCols; i++)

Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21043&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h	(original)
+++ trunk/Scribus/scribus/prefsstructs.h	Mon Feb 29 19:03:03 2016
@@ -111,6 +111,12 @@
 	bool maximized;
 };
 
+struct tabPrefs
+{
+	int activeTab;
+	QStringList palettes;
+};
+
 //User Interface
 struct UIPrefs
 {
@@ -145,7 +151,7 @@
 	QString iconSet; //! Icon set name
 	WindowPrefs mainWinSettings;
 	QByteArray mainWinState;
-	QList<QStringList> tabbedPalettes;
+	QList<tabPrefs> tabbedPalettes;
 };
 
 //Paths

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21043&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Mon Feb 29 19:03:03 2016
@@ -1938,14 +1938,15 @@
 	for (int i = 0; i < bars.count(); ++i)
 	{
 		QTabBar *bar = bars[i];
-		QStringList currentTab;
+		tabPrefs currentTab;
 		for (int ii = 0; ii < bar->count(); ii++)
 		{
+			currentTab.activeTab = bar->currentIndex();
 			QObject *obj = (QObject*)bar->tabData(ii).toULongLong();
 			if (obj != NULL)
-				currentTab.append(obj->objectName());
-		}
-		if (!currentTab.isEmpty())
+				currentTab.palettes.append(obj->objectName());
+		}
+		if (!currentTab.palettes.isEmpty())
 			m_prefsManager->appPrefs.uiPrefs.tabbedPalettes.append(currentTab);
 	}
 
@@ -6636,7 +6637,7 @@
 	{
 		for (int a = 0; a < m_prefsManager->appPrefs.uiPrefs.tabbedPalettes.count(); a++)
 		{
-			QStringList actTab = m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a];
+			QStringList actTab = m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].palettes;
 			QDockWidget *container = findChild<QDockWidget *>(actTab[0]);
 			if (container)
 			{
@@ -6646,6 +6647,30 @@
 					if (content)
 						tabifyDockWidget(container, content);
 				}
+			}
+			QList<QTabBar *> bars = findChildren<QTabBar *>(QString());
+			bool found = false;
+			for (int i = 0; i < bars.count(); ++i)
+			{
+				QTabBar *bar = bars[i];
+				for (int ii = 0; ii < bar->count(); ii++)
+				{
+					QObject *obj = (QObject*)bar->tabData(ii).toULongLong();
+					if (obj != NULL)
+					{
+						if (obj->objectName() == container->objectName());
+						{
+							if (m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].activeTab > -1)
+							{
+								bar->setCurrentIndex(m_prefsManager->appPrefs.uiPrefs.tabbedPalettes[a].activeTab);
+								found = true;
+								break;
+							}
+						}
+					}
+				}
+				if (found)
+					break;
 			}
 		}
 		move(m_prefsManager->appPrefs.uiPrefs.mainWinSettings.xPosition, m_prefsManager->appPrefs.uiPrefs.mainWinSettings.yPosition);




More information about the scribus-commit mailing list