mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
Add thumbnails to kpdf
svn path=/trunk/kdegraphics/kpdf/; revision=304042
This commit is contained in:
parent
c7b1a19c0b
commit
26712f5c0e
|
@ -42,7 +42,7 @@ shellrc_DATA = kpdf_shell.rc
|
|||
kde_module_LTLIBRARIES = libkpdfpart.la
|
||||
|
||||
# the Part's source, library search path, and link libraries
|
||||
libkpdfpart_la_SOURCES = QOutputDev.cpp QOutputDevPixmap.cpp QOutputDevKPrinter.cpp kpdf_canvas.cpp kpdf_part.cpp kpdf_pagewidget.cc part.ui
|
||||
libkpdfpart_la_SOURCES = QOutputDev.cpp QOutputDevPixmap.cpp QOutputDevKPrinter.cpp kpdf_canvas.cpp kpdf_part.cpp kpdf_pagewidget.cc part.cpp thumbnail.cpp thumbnaillist.cpp
|
||||
libkpdfpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
|
||||
libkpdfpart_la_LIBADD = ../xpdf/libxpdf.la $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KDEPRINT)
|
||||
libkpdfpart_la_COMPILE_FIRST = ../aconf.h
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "PDFDoc.h"
|
||||
#include "XOutputDev.h"
|
||||
#include "QOutputDevKPrinter.h"
|
||||
#include "QOutputDevPixmap.h"
|
||||
|
||||
// #include "kpdf_canvas.h"
|
||||
#include "kpdf_pagewidget.h"
|
||||
|
@ -53,8 +54,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
|
||||
pdfpartview = new PDFPartView(parentWidget, widgetName);
|
||||
|
||||
connect(pdfpartview->pagesListBox, SIGNAL( clicked ( QListBoxItem * ) ),
|
||||
this, SLOT( pageClicked ( QListBoxItem * ) ));
|
||||
connect(pdfpartview, SIGNAL( clicked ( int ) ), this, SLOT( pageClicked ( int ) ));
|
||||
|
||||
m_outputDev = pdfpartview->outputdev;
|
||||
m_outputDev->setAcceptDrops( true );
|
||||
|
@ -166,7 +166,7 @@ void Part::slotGoToPage()
|
|||
if ( m_doc )
|
||||
{
|
||||
bool ok = false;
|
||||
int num = KInputDialog::getInteger(i18n("Go to Page"), i18n("Page:"), m_currentPage,
|
||||
int num = KInputDialog::getInteger(i18n("Go to Page"), i18n("Page:"), m_currentPage+1,
|
||||
1, m_doc->getNumPages(), 1, 10, &ok/*, _part->widget()*/);
|
||||
if (ok)
|
||||
goToPage( num );
|
||||
|
@ -175,9 +175,9 @@ void Part::slotGoToPage()
|
|||
|
||||
void Part::goToPage( int page )
|
||||
{
|
||||
m_currentPage = page;
|
||||
pdfpartview->pagesListBox->setCurrentItem(m_currentPage-1);
|
||||
m_outputDev->setPage(m_currentPage);
|
||||
m_currentPage = page-1;
|
||||
pdfpartview->setCurrentItem(m_currentPage);
|
||||
m_outputDev->setPage(m_currentPage+1);
|
||||
updateActionPage();
|
||||
}
|
||||
|
||||
|
@ -188,10 +188,7 @@ void Part::slotOpenUrlDropped( const KURL &url )
|
|||
|
||||
void Part::setFullScreen( bool fs )
|
||||
{
|
||||
if ( !fs )
|
||||
pdfpartview->pagesListBox->show();
|
||||
else
|
||||
pdfpartview->pagesListBox->hide();
|
||||
pdfpartview->showPageList(!fs);
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,9 +197,9 @@ void Part::updateActionPage()
|
|||
if ( m_doc )
|
||||
{
|
||||
m_firstPage->setEnabled(m_currentPage!=0);
|
||||
m_lastPage->setEnabled(m_currentPage<m_doc->getNumPages());
|
||||
m_lastPage->setEnabled(m_currentPage<m_doc->getNumPages()-1);
|
||||
m_prevPage->setEnabled(m_currentPage!=0);
|
||||
m_nextPage->setEnabled(m_currentPage<m_doc->getNumPages());
|
||||
m_nextPage->setEnabled(m_currentPage<m_doc->getNumPages()-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -259,19 +256,16 @@ void Part::showScrollBars( bool show )
|
|||
|
||||
void Part::showMarkList( bool show )
|
||||
{
|
||||
if ( show )
|
||||
pdfpartview->pagesListBox->show();
|
||||
else
|
||||
pdfpartview->pagesListBox->hide();
|
||||
pdfpartview->showPageList(show);
|
||||
}
|
||||
|
||||
void Part::slotGotoEnd()
|
||||
{
|
||||
if ( m_doc && m_doc->getNumPages() > 0 );
|
||||
{
|
||||
m_currentPage = m_doc->getNumPages();
|
||||
m_outputDev->setPage(m_currentPage);
|
||||
pdfpartview->pagesListBox->setCurrentItem(m_currentPage-1);
|
||||
m_currentPage = m_doc->getNumPages()-1;
|
||||
m_outputDev->setPage(m_currentPage+1);
|
||||
pdfpartview->setCurrentItem(m_currentPage);
|
||||
updateActionPage();
|
||||
}
|
||||
}
|
||||
|
@ -283,18 +277,18 @@ void Part::slotGotoStart()
|
|||
m_currentPage = 0;
|
||||
|
||||
m_outputDev->setPage(m_currentPage+1);
|
||||
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
|
||||
pdfpartview->setCurrentItem(m_currentPage);
|
||||
updateActionPage();
|
||||
}
|
||||
}
|
||||
|
||||
bool Part::nextPage()
|
||||
{
|
||||
m_currentPage = pdfpartview->pagesListBox->currentItem() + 1;
|
||||
m_currentPage = pdfpartview->getCurrentItem() + 1;
|
||||
if ( m_doc && m_currentPage >= m_doc->getNumPages())
|
||||
return false;
|
||||
|
||||
pdfpartview->pagesListBox->setCurrentItem(m_currentPage);
|
||||
pdfpartview->setCurrentItem(m_currentPage);
|
||||
m_outputDev->nextPage();
|
||||
updateActionPage();
|
||||
return true;
|
||||
|
@ -312,11 +306,11 @@ void Part::slotPreviousPage()
|
|||
|
||||
bool Part::previousPage()
|
||||
{
|
||||
m_currentPage = pdfpartview->pagesListBox->currentItem() - 1;
|
||||
if ( m_currentPage < 0)
|
||||
m_currentPage = pdfpartview->getCurrentItem() - 1;
|
||||
if (m_currentPage < 0)
|
||||
return false;
|
||||
|
||||
pdfpartview->pagesListBox->setCurrentItem(m_currentPage );
|
||||
pdfpartview->setCurrentItem(m_currentPage);
|
||||
m_outputDev->previousPage();
|
||||
updateActionPage();
|
||||
return true;
|
||||
|
@ -359,21 +353,37 @@ Part::openFile()
|
|||
// just for fun, set the status bar
|
||||
// emit setStatusBarText( QString::number( m_doc->getNumPages() ) );
|
||||
|
||||
// fill the listbox with entries for every page
|
||||
pdfpartview->pagesListBox->setUpdatesEnabled(false);
|
||||
pdfpartview->pagesListBox->clear();
|
||||
for (int i = 1; i <= m_doc->getNumPages(); i++)
|
||||
{
|
||||
pdfpartview->pagesListBox->insertItem(QString::number(i));
|
||||
}
|
||||
pdfpartview->pagesListBox->setUpdatesEnabled(true);
|
||||
pdfpartview->pagesListBox->update();
|
||||
// TODO use a qvaluelist<int> to pass aspect ratio?
|
||||
pdfpartview->setPages(m_doc->getNumPages(), m_doc->getPageHeight(1)/m_doc->getPageWidth(1));
|
||||
|
||||
displayPage(1);
|
||||
pdfpartview->setCurrentItem(0);
|
||||
m_outputDev->setPDFDocument(m_doc);
|
||||
|
||||
m_nextThumbnail=1;
|
||||
QTimer::singleShot(10, this, SLOT(nextThumbnail()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Part::nextThumbnail()
|
||||
{
|
||||
// check the user did not change the document and we are trying to render somethiung that
|
||||
// does not exist
|
||||
if (m_nextThumbnail > m_doc->getNumPages()) return;
|
||||
// Pixels per point when the zoomFactor is 1.
|
||||
const float basePpp = QPaintDevice::x11AppDpiX() / 72.0;
|
||||
const float ppp = basePpp * m_zoomFactor; // pixels per point
|
||||
QOutputDevPixmap odev;
|
||||
|
||||
m_doc->displayPage(&odev, m_nextThumbnail, int(ppp * 72.0), 0, true);
|
||||
pdfpartview->setThumbnail(m_nextThumbnail, odev.getPixmap());
|
||||
|
||||
m_nextThumbnail++;
|
||||
if (m_nextThumbnail <= m_doc->getNumPages())
|
||||
QTimer::singleShot(10, this, SLOT(nextThumbnail()));
|
||||
}
|
||||
|
||||
void
|
||||
Part::displayPage(int pageNumber, float /*zoomFactor*/)
|
||||
{
|
||||
|
@ -633,12 +643,10 @@ Part::redrawPage()
|
|||
displayPage(m_currentPage);
|
||||
}
|
||||
|
||||
void Part::pageClicked ( QListBoxItem * qbi )
|
||||
void Part::pageClicked ( int i )
|
||||
{
|
||||
if ( !qbi )
|
||||
return;
|
||||
m_currentPage = pdfpartview->pagesListBox->index(qbi)+1;
|
||||
m_outputDev->setPage(m_currentPage);
|
||||
m_currentPage = i;
|
||||
m_outputDev->setPage(m_currentPage+1);
|
||||
updateActionPage();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
class QPainter;
|
||||
class QPixmap;
|
||||
class QWidget;
|
||||
class QListBoxItem;
|
||||
|
||||
class KAboutData;
|
||||
class KAction;
|
||||
|
@ -135,11 +134,13 @@ namespace KPDF
|
|||
|
||||
ZoomMode m_zoomMode;
|
||||
float m_zoomFactor;
|
||||
int m_nextThumbnail;
|
||||
|
||||
private slots:
|
||||
void slotFitToWidthToggled();
|
||||
void redrawPage();
|
||||
void pageClicked ( QListBoxItem * );
|
||||
void pageClicked ( int );
|
||||
void nextThumbnail();
|
||||
};
|
||||
|
||||
class BrowserExtension : public KParts::BrowserExtension
|
||||
|
|
65
kpdf/part.cpp
Normal file
65
kpdf/part.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include "part.h"
|
||||
|
||||
#include <qlayout.h>
|
||||
#include <qtable.h>
|
||||
|
||||
#include "kpdf_pagewidget.h"
|
||||
#include "thumbnaillist.h"
|
||||
|
||||
/*
|
||||
* Constructs a PDFPartView as a child of 'parent', with the
|
||||
* name 'name'
|
||||
*/
|
||||
PDFPartView::PDFPartView(QWidget* parent, const char* name) : QWidget(parent, name)
|
||||
{
|
||||
PDFPartViewLayout = new QHBoxLayout( this, 11, 6, "PDFPartViewLayout");
|
||||
|
||||
pagesList = new ThumbnailList(this);
|
||||
pagesList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)7, 0, 0, pagesList->sizePolicy().hasHeightForWidth() ) );
|
||||
pagesList->setMaximumSize( QSize( 75, 32767 ) );
|
||||
pagesList->setColumnWidth(0, 75);
|
||||
PDFPartViewLayout->addWidget( pagesList );
|
||||
|
||||
outputdev = new KPDF::PageWidget( this, "outputdev" );
|
||||
PDFPartViewLayout->addWidget( outputdev );
|
||||
resize( QSize(623, 381).expandedTo(minimumSizeHint()) );
|
||||
clearWState( WState_Polished );
|
||||
|
||||
connect(pagesList, SIGNAL(clicked(int)), this, SIGNAL(clicked(int)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
PDFPartView::~PDFPartView()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
void PDFPartView::setCurrentItem(int i)
|
||||
{
|
||||
pagesList->setCurrentItem(i);
|
||||
}
|
||||
|
||||
int PDFPartView::getCurrentItem() const
|
||||
{
|
||||
return pagesList->getCurrentItem();
|
||||
}
|
||||
|
||||
void PDFPartView::setPages(int i, double ar)
|
||||
{
|
||||
pagesList->setPages(i, ar);
|
||||
}
|
||||
|
||||
void PDFPartView::setThumbnail(int i, const QPixmap *thumbnail)
|
||||
{
|
||||
pagesList->setThumbnail(i, thumbnail);
|
||||
}
|
||||
|
||||
void PDFPartView::showPageList(bool show)
|
||||
{
|
||||
if (show) pagesList->show();
|
||||
else pagesList->hide();
|
||||
}
|
||||
|
||||
#include "part.moc"
|
45
kpdf/part.h
Normal file
45
kpdf/part.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef PDFPARTVIEW_H
|
||||
#define PDFPARTVIEW_H
|
||||
|
||||
#include <qpixmap.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
class QHBoxLayout;
|
||||
class QPixmap;
|
||||
|
||||
namespace KPDF {
|
||||
class PageWidget;
|
||||
}
|
||||
|
||||
class ThumbnailList;
|
||||
|
||||
class PDFPartView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PDFPartView(QWidget* parent, const char* name);
|
||||
~PDFPartView();
|
||||
|
||||
void setCurrentItem(int i);
|
||||
int getCurrentItem() const;
|
||||
|
||||
void setPages(int i, double ar);
|
||||
void setThumbnail(int i, const QPixmap *thumbnail);
|
||||
|
||||
void showPageList(bool show);
|
||||
|
||||
// TODO make private
|
||||
KPDF::PageWidget* outputdev;
|
||||
|
||||
signals:
|
||||
void clicked(int);
|
||||
|
||||
protected:
|
||||
QHBoxLayout* PDFPartViewLayout;
|
||||
|
||||
private:
|
||||
ThumbnailList* pagesList;
|
||||
};
|
||||
|
||||
#endif // PDFPARTVIEW_H
|
67
kpdf/thumbnail.cpp
Normal file
67
kpdf/thumbnail.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2004 by Albert Astals Cid *
|
||||
* tsdgeos@terra.es *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qimage.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include "thumbnail.h"
|
||||
|
||||
Thumbnail::Thumbnail(QWidget *parent, const QString &text, const QColor &color, int height, int width) : QVBox(parent), m_backgroundColor(color)
|
||||
{
|
||||
m_thumbnailW = new QWidget(this);
|
||||
m_thumbnailW->setFixedHeight(height);
|
||||
m_thumbnailW->setFixedWidth(width);
|
||||
m_label = new QLabel(text, this);
|
||||
m_label->setAlignment(AlignCenter);
|
||||
setPaletteBackgroundColor(m_backgroundColor);
|
||||
}
|
||||
|
||||
void Thumbnail::setPixmap(const QPixmap *thumbnail)
|
||||
{
|
||||
m_original = thumbnail->convertToImage().smoothScale(m_thumbnailW->size());
|
||||
m_thumbnailW->setPaletteBackgroundPixmap(m_original);
|
||||
}
|
||||
|
||||
void Thumbnail::setPixmapSize(int height, int width)
|
||||
{
|
||||
m_thumbnailW->setFixedHeight(height);
|
||||
m_thumbnailW->setFixedWidth(width);
|
||||
}
|
||||
|
||||
int Thumbnail::getPixmapHeight() const
|
||||
{
|
||||
return m_thumbnailW->size().height();
|
||||
}
|
||||
|
||||
void Thumbnail::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
QImage im;
|
||||
if (!m_original.isNull())
|
||||
{
|
||||
im = m_original.smoothScale(m_thumbnailW->size());
|
||||
m_thumbnailW->setPaletteBackgroundPixmap(im);
|
||||
}
|
||||
}
|
||||
|
||||
void Thumbnail::setSelected(bool selected)
|
||||
{
|
||||
if (selected) setPaletteBackgroundColor(QApplication::palette().active().highlight());
|
||||
else setPaletteBackgroundColor(m_backgroundColor);
|
||||
}
|
||||
|
||||
int Thumbnail::labelSizeHintHeight()
|
||||
{
|
||||
return m_label->sizeHint().height();
|
||||
}
|
||||
|
||||
|
||||
#include "thumbnail.moc"
|
42
kpdf/thumbnail.h
Normal file
42
kpdf/thumbnail.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2004 by Albert Astals Cid *
|
||||
* tsdgeos@terra.es *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef THUMBNAIL_H
|
||||
#define THUMBNAIL_H
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qvbox.h>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class Thumbnail : public QVBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Thumbnail(QWidget *parent, const QString &text, const QColor &color, int height, int width);
|
||||
|
||||
public slots:
|
||||
void setPixmap(const QPixmap *thumbnail);
|
||||
void setPixmapSize(int height, int width);
|
||||
int getPixmapHeight() const;
|
||||
void setSelected(bool selected);
|
||||
int labelSizeHintHeight();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
QWidget *m_thumbnailW;
|
||||
QLabel *m_label;
|
||||
QColor m_backgroundColor;
|
||||
QImage m_original;
|
||||
};
|
||||
|
||||
#endif
|
109
kpdf/thumbnaillist.cpp
Normal file
109
kpdf/thumbnaillist.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2004 by Albert Astals Cid *
|
||||
* tsdgeos@terra.es *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "thumbnaillist.h"
|
||||
#include "thumbnail.h"
|
||||
|
||||
ThumbnailList::ThumbnailList(QWidget *parent) : QTable(parent)
|
||||
{
|
||||
setNumCols(1);
|
||||
setLeftMargin(0);
|
||||
setTopMargin(0);
|
||||
setHScrollBarMode(QScrollView::AlwaysOff);
|
||||
m_selected = 0;
|
||||
|
||||
connect(this, SIGNAL(pressed(int, int, int, const QPoint&)), this, SIGNAL(clicked(int)));
|
||||
connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(changeSelected(int)));
|
||||
}
|
||||
|
||||
void ThumbnailList::setCurrentItem(int i)
|
||||
{
|
||||
setCurrentCell(i, 0);
|
||||
changeSelected(i);
|
||||
}
|
||||
|
||||
void ThumbnailList::changeSelected(int i)
|
||||
{
|
||||
Thumbnail *t;
|
||||
t = dynamic_cast<Thumbnail *>(cellWidget(m_selected, 0));
|
||||
if (t) t -> setSelected(false);
|
||||
m_selected = i;
|
||||
t = dynamic_cast<Thumbnail *>(cellWidget(m_selected, 0));
|
||||
if (t) t -> setSelected(true);
|
||||
}
|
||||
|
||||
int ThumbnailList::getCurrentItem() const
|
||||
{
|
||||
return currentRow();
|
||||
}
|
||||
|
||||
void ThumbnailList::setPages(int i, double ar)
|
||||
{
|
||||
Thumbnail *t;
|
||||
m_ar = ar;
|
||||
setNumRows(i);
|
||||
for(int j=1; j <= i; j++)
|
||||
{
|
||||
t = new Thumbnail(this, QString::number(j), viewport()->paletteBackgroundColor(), (int)(visibleWidth()*ar), visibleWidth());
|
||||
setCellWidget(j-1, 0, t);
|
||||
setRowHeight(j-1, t->sizeHint().height());
|
||||
}
|
||||
m_heightLimit = 0;
|
||||
}
|
||||
|
||||
void ThumbnailList::setThumbnail(int i, const QPixmap *thumbnail)
|
||||
{
|
||||
Thumbnail *t;
|
||||
t = dynamic_cast<Thumbnail *>(cellWidget(i-1, 0));
|
||||
t->setPixmap(thumbnail);
|
||||
}
|
||||
|
||||
void ThumbnailList::viewportResizeEvent(QResizeEvent *)
|
||||
{
|
||||
// that if are here to avoid recursive resizing of death
|
||||
// where the user makes the window smaller, that makes appear
|
||||
// the vertical scrollbar, that makes thumbnails smaller, and
|
||||
// while they get smaller the vertical scrollbar is not needed
|
||||
// and....
|
||||
Thumbnail *t;
|
||||
if (numRows() == 0) return;
|
||||
if (size().height() <= m_heightLimit)
|
||||
{
|
||||
t = dynamic_cast<Thumbnail *>(cellWidget(0, 0));
|
||||
if (t->getPixmapHeight() > (int)(visibleWidth()*m_ar))
|
||||
{
|
||||
setColumnWidth(0, visibleWidth());
|
||||
resizeThumbnails();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (visibleWidth() != columnWidth(0))
|
||||
{
|
||||
setColumnWidth(0, visibleWidth());
|
||||
resizeThumbnails();
|
||||
if (m_heightLimit == 0 && verticalScrollBar() -> isVisible())
|
||||
m_heightLimit = size().height();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbnailList::resizeThumbnails()
|
||||
{
|
||||
Thumbnail *t;
|
||||
for(int i = 0; i < numRows(); ++i)
|
||||
{
|
||||
t = dynamic_cast<Thumbnail *>(cellWidget(i, 0));
|
||||
t->setPixmapSize((int)(visibleWidth()*m_ar), visibleWidth());
|
||||
setRowHeight(i, (int)(visibleWidth()*m_ar) + t->labelSizeHintHeight());
|
||||
}
|
||||
}
|
||||
|
||||
#include "thumbnaillist.moc"
|
46
kpdf/thumbnaillist.h
Normal file
46
kpdf/thumbnaillist.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2004 by Albert Astals Cid *
|
||||
* tsdgeos@terra.es *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef THUMBNAILLIST_H
|
||||
#define THUMBNAILLIST_H
|
||||
|
||||
#include <qimage.h>
|
||||
#include <qtable.h>
|
||||
|
||||
class ThumbnailList : public QTable
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThumbnailList(QWidget *parent);
|
||||
|
||||
int getCurrentItem() const;
|
||||
void setCurrentItem(int i);
|
||||
|
||||
void setPages(int i, double ar);
|
||||
void setThumbnail(int i, const QPixmap *thumbnail);
|
||||
|
||||
private slots:
|
||||
void changeSelected(int i);
|
||||
|
||||
signals:
|
||||
void clicked(int);
|
||||
|
||||
protected:
|
||||
void viewportResizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
void resizeThumbnails();
|
||||
|
||||
double m_ar;
|
||||
int m_selected;
|
||||
int m_heightLimit;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue