diff options
author | Pino Toscano <pino@kde.org> | 2008-02-21 01:23:07 +0100 |
---|---|---|
committer | Pino Toscano <pino@kde.org> | 2008-02-21 01:23:07 +0100 |
commit | bf6dd890994150406b4464e45355a4a99870fc60 (patch) | |
tree | d27c6d9fe408ab94f2df946bff93988bba48b9a5 | |
parent | b6f0c8f83924c08be20b602b128651bf018172a3 (diff) |
Add a dock for showing the document metadata.
-rw-r--r-- | qt4/demos/CMakeLists.txt | 1 | ||||
-rw-r--r-- | qt4/demos/Makefile.am | 3 | ||||
-rw-r--r-- | qt4/demos/metadata.cpp | 50 | ||||
-rw-r--r-- | qt4/demos/metadata.h | 43 | ||||
-rw-r--r-- | qt4/demos/viewer.cpp | 7 |
5 files changed, 104 insertions, 0 deletions
diff --git a/qt4/demos/CMakeLists.txt b/qt4/demos/CMakeLists.txt index 2c7b3709..4fe984fe 100644 --- a/qt4/demos/CMakeLists.txt +++ b/qt4/demos/CMakeLists.txt @@ -15,6 +15,7 @@ set(poppler_qt4viewer_SRCS fonts.cpp info.cpp main_viewer.cpp + metadata.cpp navigationtoolbar.cpp pageview.cpp permissions.cpp diff --git a/qt4/demos/Makefile.am b/qt4/demos/Makefile.am index 0592dd76..b0cd8384 100644 --- a/qt4/demos/Makefile.am +++ b/qt4/demos/Makefile.am @@ -32,6 +32,8 @@ poppler_qt4viewer_SOURCES = \ info.cpp \ info.h \ main_viewer.cpp \ + metadata.cpp \ + metadata.h \ navigationtoolbar.cpp \ navigationtoolbar.h \ pageview.cpp \ @@ -47,6 +49,7 @@ abstractinfodock.$(OBJEXT): abstractinfodock.moc embeddedfiles.cpp.$(OBJEXT): embeddedfiles.moc fonts.$(OBJEXT): fonts.moc info.$(OBJEXT): info.moc +metadata.$(OBJEXT): metadata.moc navigationtoolbar.$(OBJEXT): navigationtoolbar.moc pageview.$(OBJEXT): pageview.moc permissions.$(OBJEXT): permissions.moc diff --git a/qt4/demos/metadata.cpp b/qt4/demos/metadata.cpp new file mode 100644 index 00000000..e5c7111d --- /dev/null +++ b/qt4/demos/metadata.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2008, Pino Toscano <pino@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "metadata.h" + +#include <poppler-qt4.h> + +#include <QtGui/QTextEdit> + +MetadataDock::MetadataDock(QWidget *parent) + : AbstractInfoDock(parent) +{ + m_edit = new QTextEdit(this); + setWidget(m_edit); + setWindowTitle(tr("Metadata")); + m_edit->setAcceptRichText(false); + m_edit->setReadOnly(true); +} + +MetadataDock::~MetadataDock() +{ +} + +void MetadataDock::fillInfo() +{ + m_edit->setPlainText(document()->metadata()); +} + +void MetadataDock::documentClosed() +{ + m_edit->clear(); + AbstractInfoDock::documentClosed(); +} + +#include "metadata.moc" diff --git a/qt4/demos/metadata.h b/qt4/demos/metadata.h new file mode 100644 index 00000000..6f1507a6 --- /dev/null +++ b/qt4/demos/metadata.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2008, Pino Toscano <pino@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef METADATA_H +#define METADATA_H + +#include "abstractinfodock.h" + +class QTextEdit; + +class MetadataDock : public AbstractInfoDock +{ + Q_OBJECT + +public: + MetadataDock(QWidget *parent = 0); + ~MetadataDock(); + + /*virtual*/ void documentClosed(); + +protected: + /*virtual*/ void fillInfo(); + +private: + QTextEdit *m_edit; +}; + +#endif diff --git a/qt4/demos/viewer.cpp b/qt4/demos/viewer.cpp index b8c69c44..7d55e0de 100644 --- a/qt4/demos/viewer.cpp +++ b/qt4/demos/viewer.cpp @@ -21,6 +21,7 @@ #include "embeddedfiles.h" #include "fonts.h" #include "info.h" +#include "metadata.h" #include "navigationtoolbar.h" #include "pageview.h" #include "permissions.h" @@ -120,6 +121,12 @@ PdfViewer::PdfViewer() viewMenu->addAction(embfilesDock->toggleViewAction()); m_observers.append(embfilesDock); + MetadataDock *metadataDock = new MetadataDock(this); + addDockWidget(Qt::BottomDockWidgetArea, metadataDock); + metadataDock->hide(); + viewMenu->addAction(metadataDock->toggleViewAction()); + m_observers.append(metadataDock); + Q_FOREACH(DocumentObserver *obs, m_observers) { obs->m_viewer = this; } |