[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/plugins/pdf
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2005-12-04 12:24:12
Message-ID: 1133699052.051932.9204.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 485442 by whuss:

Port of commit 485441

Add list of fonts the the document properties dialog.

Needs libpoppler CVS from 10 minutes ago.

 M  +3 -3      pdfRenderer.cpp  
 M  +52 -9     propertiesdialog.cpp  
 M  +8 -1      propertiesdialog.h  


--- trunk/KDE/kdegraphics/kviewshell/plugins/pdf/pdfRenderer.cpp #485441:485442
@@ -119,8 +119,8 @@
     Poppler::Page* pdfPage = document->page(pageNumber);
     if (page)
     {
-      //      pdfPage->renderToPixmap(&pixmap, 0, 0, 0, 0, res, res);
-      pdfPage->splashRenderToPixmap(&pixmap, 0, 0, 0, 0, res, res );
+      //pixmap = pdfPage->renderToPixmap(0, 0, 0, 0, res, res);
+      pixmap = pdfPage->splashRenderToPixmap(0, 0, 0, 0, res, res );
       kdError() << "PDF PAGE RENDERING WITH SPLASH - ARTHUR RENDERING NOT \
IMPLEMENTED YET" << endl;  
       // Create Text information
@@ -793,7 +793,7 @@
   if (infoDialog)
     delete infoDialog;
 
-  infoDialog = new PropertiesDialog(parentWidget, &docInfo);
+  infoDialog = new PropertiesDialog(parentWidget, &docInfo, document->fonts());
   infoDialog->show();
 
   kdDebug() << "show info" << endl;
--- trunk/KDE/kdegraphics/kviewshell/plugins/pdf/propertiesdialog.cpp #485441:485442
@@ -17,7 +17,7 @@
 #include "propertiesdialog.h"
 #include "pdfInfo.h"
 
-PropertiesDialog::PropertiesDialog(QWidget *parent, PdfInfo* info)
+PropertiesDialog::PropertiesDialog(QWidget *parent, PdfInfo* info, \
QList<Poppler::FontInfo> fontList)  : KDialogBase( Tabbed, i18n( "Unknown File" ), \
Ok, Ok, parent, 0, true, true )  {
   // Properties
@@ -69,14 +69,11 @@
 
   // Fonts
   QVBoxLayout *page2Layout = 0;
-  //if (doc->hasFonts())
-  //{
-  //  QFrame *page2 = addPage(i18n("Fonts"));
-  //  page2Layout = new QVBoxLayout(page2, 0, KDialog::spacingHint());
-  //  KListView *lv = new KListView(page2);
-  //  page2Layout->add(lv);
-  //  doc->putFontInfo(lv);
-  //}
+  QFrame *page2 = addPage(i18n("Fonts"));
+  page2Layout = new QVBoxLayout(page2, 0, KDialog::spacingHint());
+  KListView *lv = new KListView(page2);
+  page2Layout->add(lv);
+  putFontInfo(lv, fontList);
 
   // current width: left column + right column + dialog borders
   int width = layout->minimumSize().width() + valMaxWidth + marginHint() + \
spacingHint() + marginHint() + 30; @@ -89,3 +86,49 @@
   width = QMIN( width, 2*screenContainer.width()/3 );
   resize(width, 1);
 }
+
+
+void PropertiesDialog::putFontInfo(KListView* list, QList<Poppler::FontInfo> \
fontList) +{
+  list->addColumn(i18n("Name"));
+  list->addColumn(i18n("Type"));
+  list->addColumn(i18n("Embedded"));
+  list->addColumn(i18n("Subset"));
+
+  QString fontTypeNames[8] =
+  {
+    i18n("unknown"),
+    i18n("Type 1"),
+    i18n("Type 1C"),
+    i18n("Type 3"),
+    i18n("TrueType"),
+    i18n("CID Type 0"),
+    i18n("CID Type 0C"),
+    i18n("CID TrueType")
+  };
+
+  for (int i = 0; i < fontList.count(); i++)
+  {
+    Q3ListViewItem* item = new Q3ListViewItem(list);
+    item->setText(0, fontList[i].name());
+    item->setText(1, fontTypeNames[fontList[i].type()]);
+
+    if (fontList[i].isEmbedded())
+    {
+      item->setText(2, i18n("Yes"));
+
+      if (fontList[i].isSubset())
+      {
+        item->setText(3, i18n("Yes"));
+      }
+      else
+      {
+        item->setText(3, i18n("No"));
+      }
+    }
+    else
+    {
+      item->setText(2, i18n("No"));
+    }
+  }
+}
--- trunk/KDE/kdegraphics/kviewshell/plugins/pdf/propertiesdialog.h #485441:485442
@@ -14,12 +14,19 @@
 
 #include <kdialogbase.h>
 
+#define UNSTABLE_POPPLER_QT4
+#include <poppler-qt4.h>
+
 class PdfInfo;
+class KListView;
 
 class PropertiesDialog : public KDialogBase
 {
 public:
-  PropertiesDialog(QWidget* parent, PdfInfo* info);
+  PropertiesDialog(QWidget* parent, PdfInfo* info, QList<Poppler::FontInfo> \
fontList); +
+private:
+  void putFontInfo(KListView* list, QList<Poppler::FontInfo> fontList);
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic