r20205 by craig - #13114: Add tooltips of original page sizes to page size lists

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 24 22:25:36 UTC 2015


Author: craig
Date: Wed Jun 24 22:25:36 2015
New Revision: 20205

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20205
Log:
#13114: Add tooltips of original page sizes to page size lists

Modified:
    trunk/Scribus/scribus/pagesize.h
    trunk/Scribus/scribus/ui/prefs_pagesizes.cpp

Modified: trunk/Scribus/scribus/pagesize.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20205&path=/trunk/Scribus/scribus/pagesize.h
==============================================================================
--- trunk/Scribus/scribus/pagesize.h (original)
+++ trunk/Scribus/scribus/pagesize.h Wed Jun 24 22:25:36 2015
@@ -49,6 +49,7 @@
 	double height() const { return m_height; }
 	double originalWidth() const { return m_width*unitGetRatioFromIndex(m_pageUnitIndex); }
 	double originalHeight() const { return m_height*unitGetRatioFromIndex(m_pageUnitIndex); }
+	QString originalUnit() const { return unitGetSuffixFromIndex(m_pageUnitIndex); }
 	QStringList sizeList() const;
 	QStringList sizeTRList() const;
 	QStringList activeSizeList() const;

Modified: trunk/Scribus/scribus/ui/prefs_pagesizes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20205&path=/trunk/Scribus/scribus/ui/prefs_pagesizes.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_pagesizes.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_pagesizes.cpp Wed Jun 24 22:25:36 2015
@@ -38,15 +38,30 @@
 void Prefs_PageSizes::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
 	PageSize ps(prefsData->docSetupPrefs.pageSize);
-	QStringList sl(ps.sizeTRList());
+	QStringList sizeList(ps.sizeList());
+	QStringList activeSizeList(ps.activeSizeList());
 	activeSizesListWidget->clear();
-	activeSizesListWidget->addItems(ps.activeSizeTRList());
-	
 	availableSizesListWidget->clear();
-	for (int i = 0; i < sl.count(); ++i)
+
+	for (int i = 0; i < activeSizeList.count(); ++i)
 	{
-		if (activeSizesListWidget->findItems(sl.at(i), Qt::MatchExactly).isEmpty())
-			availableSizesListWidget->addItem(sl.at(i));
+		QListWidgetItem* lwi=new QListWidgetItem();
+		PageSize ps2(activeSizeList.at(i));
+		lwi->setText(ps2.nameTR());
+		lwi->setToolTip(QString("%1 x %2 %3").arg(ps2.originalWidth()).arg(ps2.originalHeight()).arg(ps2.originalUnit()));
+		activeSizesListWidget->addItem(lwi);
+	}
+
+	for (int i = 0; i < sizeList.count(); ++i)
+	{
+		if (!activeSizeList.contains(sizeList.at(i)))
+		{
+			QListWidgetItem* lwi=new QListWidgetItem();
+			PageSize ps2(sizeList.at(i));
+			lwi->setText(ps2.nameTR());
+			lwi->setToolTip(QString("%1 x %2 %3").arg(ps2.originalWidth()).arg(ps2.originalHeight()).arg(ps2.originalUnit()));
+			availableSizesListWidget->addItem(lwi);
+		}
 	}
 }
 




More information about the scribus-commit mailing list