r18503 by craig - #10702: Show master page naming in Page Palette, thanks pygmee

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 25 21:26:19 UTC 2013


Author: craig
Date: Wed Sep 25 21:26:19 2013
New Revision: 18503

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18503
Log:
#10702: Show master page naming in Page Palette, thanks pygmee

Modified:
    trunk/Scribus/scribus/ui/pagepalette_pages.cpp
    trunk/Scribus/scribus/ui/pagepalette_pages.h

Modified: trunk/Scribus/scribus/ui/pagepalette_pages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18503&path=/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.cpp Wed Sep 25 21:26:19 2013
@@ -263,7 +263,10 @@
 	for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
 	{
 		str = currView->Doc->DocPages.at(a)->MPageNam;
-		SeItem *it = new SeItem(str, a, CreateIcon(a, pix));
+		QRegExp Exp ("([A-Z]*[0-9]*)( *[\\.|\\-|_] *)(.*)");
+		if (Exp.indexIn(str) != -1)
+			str = Exp.cap(1);
+		SeItem *it = new SeItem(str, a, CreateIcon(a, str, pix));
 		pageList.append(it);
 		pageView->setItem(rowcounter*rowmult+rowadd, counter*colmult+coladd, (QTableWidgetItem *)it);
 		pageView->setColumnWidth(counter*colmult+coladd, pix.width());
@@ -340,7 +343,7 @@
 		emit gotoMasterPage(masterPageList->CurItem->text());
 }
 
-QPixmap PagePalette_Pages::CreateIcon(int nr, QPixmap pixin)
+QPixmap PagePalette_Pages::CreateIcon(int nr, QString mp, QPixmap pixin)
 {
 	QPainter p;
 	// Necessary on windows to ensure the pixmap is drawable
@@ -353,18 +356,19 @@
 		p.setBrush(Qt::white);
 		p.setBackground(Qt::white);
 		p.setBackgroundMode(Qt::OpaqueMode);
-		p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
-		p.setFont(QFont("Helvetica", 12, QFont::Bold));
+		p.setPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+		//p.setFont(QFont("Helvetica", 12, QFont::Bold));
 		//QString tmp = tmp.setNum(nr+1);
 		QString tmp(currView->Doc->getSectionPageNumberForPageIndex(nr));
 		if (tmp.isEmpty())
 			tmp = tmp.setNum(nr+1);
-		QRect b = p.fontMetrics().boundingRect(tmp);
-		QRect c = QRect((ret.width() / 2 - b.width() / 2)-2, (ret.height() / 2 - b.height() / 2)-2, b.width()+4, b.height()+4);
-		p.drawRect(c);
-		QRect d = QRect((ret.width() / 2 - b.width() / 2), (ret.height() / 2 - b.height() / 2), b.width(), b.height());
-		p.setFont(QFont("Helvetica", 10, QFont::Normal));
-		p.drawText(d, Qt::AlignCenter, tmp);
+		//QRect b = p.fontMetrics().boundingRect(tmp);
+		//QRect c = QRect((ret.width() / 2 - b.width() / 2)-2, (ret.height() / 2 - b.height() / 2)-2, b.width()+4, b.height()+4);
+		//p.drawRect(c);
+		//QRect d = QRect((ret.width() / 2 - b.width() / 2), (ret.height() / 2 - b.height() / 2), b.width(), b.height());
+		QRect d = QRect(0, 0, ret.width(), ret.height());
+		p.setFont(QFont("Helvetica", 7, QFont::Normal));
+		p.drawText(d, Qt::AlignCenter, tmp+"\n"+mp);
 		p.end();
 		if( !pixin.mask().isNull() )
 			ret.setMask( pixin.mask() );

Modified: trunk/Scribus/scribus/ui/pagepalette_pages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18503&path=/trunk/Scribus/scribus/ui/pagepalette_pages.h
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.h (original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.h Wed Sep 25 21:26:19 2013
@@ -51,7 +51,7 @@
 	void Rebuild();
 	void markPage(uint nr);
 	void selMasterPage();
-	QPixmap CreateIcon(int nr, QPixmap pixin);
+	QPixmap CreateIcon(int nr, QString mp, QPixmap pixin);
 	void languageChange();
 
 signals:




More information about the scribus-commit mailing list