r23924 by jghali - Refactor BookMView and rename it to BookmarkView

scribus-commit scribus-commit at lists.scribus.net
Fri Jul 17 10:21:45 UTC 2020


Author: jghali
Date: Fri Jul 17 10:21:45 2020
New Revision: 23924

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23924
Log:
Refactor BookMView and rename it to BookmarkView

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdflib_core.h
    trunk/Scribus/scribus/ui/bookmarkpalette.cpp
    trunk/Scribus/scribus/ui/bookmarkpalette.h
    trunk/Scribus/scribus/ui/bookmwin.cpp
    trunk/Scribus/scribus/ui/bookmwin.h

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Fri Jul 17 10:21:45 2020
@@ -1001,7 +1001,7 @@
 	return (succeed ? bytesWritten : 0);
 }
 
-bool PDFLibCore::PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, const QMap<QString, QMap<uint, FPointArray> >& DocFonts, BookMView* vi)
+bool PDFLibCore::PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, const QMap<QString, QMap<uint, FPointArray> >& DocFonts, BookmarkView* vi)
 {
 	if (!writer.open(fn))
 		return false;

Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h	(original)
+++ trunk/Scribus/scribus/pdflib_core.h	Fri Jul 17 10:21:45 2020
@@ -22,7 +22,7 @@
 class QTextCodec;
 class PageItem;
 class BookMItem;
-class BookMView;
+class BookmarkView;
 class ScribusDoc;
 class ScPage;
 class PDFOptions;
@@ -95,7 +95,7 @@
 	bool PDF_IsPDFX();
 	bool PDF_IsPDFX(const PDFVersion& ver);
 
-	bool PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, const QMap<QString, QMap<uint, FPointArray> >& DocFonts, BookMView* vi);
+	bool PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, const QMap<QString, QMap<uint, FPointArray> >& DocFonts, BookmarkView* vi);
 	void PDF_Begin_Catalog();
 	void PDF_Begin_MetadataAndEncrypt();
 	QMap<QString, QMap<uint, FPointArray> >
@@ -257,7 +257,7 @@
 	ScribusDoc & doc;
 	const ScPage * ActPageP;
 	const PDFOptions & Options;
-	BookMView* Bvie;
+	BookmarkView* Bvie;
 	//int Dokument;
 	QMap<QString,ShIm> SharedImages;
 	QList<PdfDest> NamedDest;

Modified: trunk/Scribus/scribus/ui/bookmarkpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/ui/bookmarkpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/bookmarkpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/bookmarkpalette.cpp	Fri Jul 17 10:21:45 2020
@@ -29,7 +29,7 @@
 {
 	setObjectName(QString::fromLocal8Bit("Books"));
 	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
-	BView = new BookMView(this);
+	BView = new BookmarkView(this);
 	BView->setMinimumSize(QSize(100,150));
 	setWidget( BView );
 	languageChange();

Modified: trunk/Scribus/scribus/ui/bookmarkpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/ui/bookmarkpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/bookmarkpalette.h	(original)
+++ trunk/Scribus/scribus/ui/bookmarkpalette.h	Fri Jul 17 10:21:45 2020
@@ -54,7 +54,7 @@
 	
 	virtual void changeEvent(QEvent *e);
 	
-	BookMView	*BView;
+	BookmarkView	*BView;
 	
 public slots:
 	void languageChange();

Modified: trunk/Scribus/scribus/ui/bookmwin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/ui/bookmwin.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/bookmwin.cpp	(original)
+++ trunk/Scribus/scribus/ui/bookmwin.cpp	Fri Jul 17 10:21:45 2020
@@ -109,7 +109,7 @@
 }
 
 
-BookMView::BookMView(QWidget* parent) : QTreeWidget(parent)
+BookmarkView::BookmarkView(QWidget* parent) : QTreeWidget(parent)
 {
 	NrItems = 0;
 	First = 1;
@@ -123,11 +123,10 @@
 	setRootIsDecorated(true);
 	header()->hide();
 
-	connect(this, SIGNAL(currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem *)),
-			this, SLOT(setPageItem(QTreeWidgetItem *, QTreeWidgetItem *)));
-}
-
-void BookMView::addPageItem(PageItem* ite)
+	connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(selectPageItem(QTreeWidgetItem *, int)));
+}
+
+void BookmarkView::addPageItem(PageItem* ite)
 {
 	QString bm, bm2;
 	getTextAndTitle(ite, bm, bm2);
@@ -135,7 +134,7 @@
 	Last = NrItems;
 }
 
-void BookMView::getTextAndTitle(PageItem* item, QString& text, QString& title)
+void BookmarkView::getTextAndTitle(PageItem* item, QString& text, QString& title)
 {
 	QChar ch;
 	QString str;
@@ -165,15 +164,15 @@
 	}
 }
 
-void BookMView::setPageItem(QTreeWidgetItem * current, QTreeWidgetItem * /*previous*/)
-{
-	BookMItem * i = dynamic_cast<BookMItem*>(current);
+void BookmarkView::selectPageItem(QTreeWidgetItem * current, int /*column*/)
+{
+	BookMItem * bookmark = dynamic_cast<BookMItem*>(current);
 	// something weird here at 1st call...
-	if (i)
-		emit selectElement(i->PageObject, false);
-}
-
-void BookMView::dropEvent(QDropEvent *e)
+	if (bookmark)
+		emit selectElement(bookmark->PageObject, false);
+}
+
+void BookmarkView::dropEvent(QDropEvent *e)
 {
 	QTreeWidget::dropEvent(e);
 //	QApplication::restoreOverrideCursor();
@@ -181,7 +180,7 @@
 }
 
 // #include <QtDebug>
-void BookMView::rebuildTree()
+void BookmarkView::rebuildTree()
 {
 	Last = 0;
 
@@ -245,7 +244,7 @@
 	emit changed();
 }
 
-void BookMView::addItem(const QString& text, const QString& Tit, PageItem *PageObject)
+void BookmarkView::addItem(const QString& text, const QString& Tit, PageItem *PageObject)
 {
 	BookMItem * ite = new BookMItem(this, NrItems+1, PageObject);
 	ite->setText(0, text);
@@ -253,7 +252,7 @@
 	rebuildTree();
 }
 
-void BookMView::deleteItem(PageItem *pObject)
+void BookmarkView::deleteItem(PageItem *pObject)
 {
 	QTreeWidgetItemIterator it(this);
 	BookMItem * item;
@@ -270,7 +269,7 @@
 	rebuildTree();
 }
 
-void BookMView::setAction(PageItem *currItem, const QString& Act)
+void BookmarkView::setAction(PageItem *currItem, const QString& Act)
 {
 	BookMItem *ite;
 	QTreeWidgetItemIterator it(this);
@@ -286,7 +285,7 @@
 	}
 }
 
-void BookMView::changeText(PageItem *currItem)
+void BookmarkView::changeText(PageItem *currItem)
 {
 	BookMItem *ite;
 	QString bm, bm2;

Modified: trunk/Scribus/scribus/ui/bookmwin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23924&path=/trunk/Scribus/scribus/ui/bookmwin.h
==============================================================================
--- trunk/Scribus/scribus/ui/bookmwin.h	(original)
+++ trunk/Scribus/scribus/ui/bookmwin.h	Fri Jul 17 10:21:45 2020
@@ -33,7 +33,7 @@
 /*! \brief Tree widget item for PDF Bookmarks.
 Secret items like Pare, First, Last etc. are PDF Outlines
 attributes. See PDF specification for more info.
-These attrs are recomputed in the BookMView::rebuildTree()
+These attrs are recomputed in the BookmarkView::rebuildTree()
 method.
 @author Franz Schmid
 */
@@ -72,13 +72,13 @@
 @author Franz Schmid
 \author Petr Vanek <petr at scribus.info>
 */
-class SCRIBUS_API BookMView : public QTreeWidget
+class SCRIBUS_API BookmarkView : public QTreeWidget
 {
 	Q_OBJECT
 
 public:
-	BookMView(QWidget* parent);
-	~BookMView() {};
+	BookmarkView(QWidget* parent);
+	~BookmarkView() {};
 
 	void addItem(const QString& text, const QString& Tit, PageItem *PageObject);
 	void deleteItem(PageItem *PageObject);
@@ -109,7 +109,7 @@
 	void getTextAndTitle(PageItem* item, QString& text, QString& title);
 
 private slots:
-	void setPageItem(QTreeWidgetItem * current, QTreeWidgetItem * previous);
+	void selectPageItem(QTreeWidgetItem * current, int column);
 };
 
 #endif




More information about the scribus-commit mailing list