Implemented Tobias requests on presentation mode. Made them all

configurable. Presentation mode is fully configurable now (at least with
bools). We should remove some options in the future. Changed some bits in
configuration dialog's "general" page.
CCMAIL:tokoe@kde.org

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=374340
This commit is contained in:
Enrico Ros 2004-12-30 22:43:15 +00:00
parent 5e13e0a1c1
commit 2cd31678ce
6 changed files with 269 additions and 120 deletions

View file

@ -71,7 +71,7 @@ More items (first items will enter 'In progress list' first):
-> history as a toolbox child (collecting DOs's setPage calls)
-> zoom: fit text (with configurable margin)
-> open gzipped (.pdf.gz?) files
-> kttsd output with menu entries. speech{document/page/selection}. (see kdenonbeta/kttsd)
-> kttsd output with menu entries. speech{document/page/selection}. (patch available - enrico)
-> kttsd alternative (1): autodetect "/dev/speech" (speechd/festival) and provide reading
-> automatic online dictionaries / translators (BR80338)
-> add OCR for building TextPages out of pure graphical (aka scanned) pages
@ -84,6 +84,8 @@ More items (first items will enter 'In progress list' first):
-> add search on the toc widget (a prune on type lineedit like in thumbnails widget)
-> goto 'logical' page (usually differs from pdf's page) (req. by Luca Burrelli)
-> use wallet for storing passwords of encrypted files
-> use shortcuts for next and prev page even in presenatation mode (by Tobias Koenig)
-> set a marker on the pdf file to immediately start presentation when opening it (by Tobias Koenig)
Done (newest feature comes firts):
-> ADD: Asyncronous PDF Generator implementation (for the user: faster UI, preloading, etc..)

View file

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>266</width>
<height>139</height>
<width>320</width>
<height>255</height>
</rect>
</property>
<vbox>
@ -19,112 +19,230 @@
<property name="margin">
<number>0</number>
</property>
<widget class="QCheckBox">
<widget class="QGroupBox">
<property name="name">
<cstring>kcfg_ShowLeftPanel</cstring>
<cstring>groupBox2</cstring>
</property>
<property name="text">
<string>Show &amp;left panel</string>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout1</cstring>
<property name="title">
<string>Program look</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<widget class="QLayoutWidget">
<property name="name">
<cstring>spacer2</cstring>
<cstring>layout9</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QCheckBox">
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowLeftPanel</cstring>
</property>
<property name="text">
<string>Show &amp;left panel</string>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout1</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowSearchBar</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show &amp;search bar in thumbnails list</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowScrollBars</cstring>
</property>
<property name="text">
<string>Show scroll&amp;bars</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowOSD</cstring>
</property>
<property name="text">
<string>Show &amp;hints and info messages</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>kcfg_ShowSearchBar</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show &amp;search bar in thumbnails list</string>
<cstring>layout3_2</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>pixmapLabel1_2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap">
<pixmap>"kpdf", 32</pixmap>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacerV1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Minimum</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<widget class="QGroupBox">
<property name="name">
<cstring>kcfg_ShowScrollBars</cstring>
<cstring>groupBox1</cstring>
</property>
<property name="text">
<string>Show scroll&amp;bars</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_HideOSD</cstring>
</property>
<property name="text">
<string>Hide &amp;hints and info messages</string>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout2</cstring>
<property name="title">
<string>Presentation</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="QLayoutWidget">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>View Columns:</string>
<cstring>layout12</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesGlitterTrans</cstring>
</property>
<property name="text">
<string>Use 'glittering' &amp;transition</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesShowProgress</cstring>
</property>
<property name="text">
<string>Show &amp;progress indicator</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesShowGrayBack</cstring>
</property>
<property name="text">
<string>Show light &amp;gray background</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesShowSummary</cstring>
</property>
<property name="text">
<string>Show s&amp;ummary page</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QSpinBox">
<widget class="QLayoutWidget">
<property name="name">
<cstring>kcfg_ViewColumns</cstring>
</property>
<property name="enabled">
<bool>false</bool>
<cstring>layout3</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>pixmapLabel1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap">
<pixmap>"kpresenter_kpr", 32</pixmap>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacerV2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Minimum</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<spacer>
<property name="name">
<cstring>spacer3_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>51</width>
<height>21</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<spacer>
@ -156,6 +274,8 @@
</connections>
<includes>
<include location="global" impldecl="in implementation">kdialog.h</include>
<include location="global" impldecl="in implementation">kiconloader.h</include>
</includes>
<pixmapfunction>DesktopIcon</pixmapfunction>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -44,26 +44,26 @@
</entry>
</group>
<group name="General" >
<entry key="ShowScrollBars" type="Bool" >
<entry key="ShowOSD" type="Bool" >
<default>true</default>
</entry>
<entry key="ShowLeftPanel" type="Bool" >
<default>true</default>
</entry>
<entry key="ShowSearchBar" type="Bool" >
<default>true</default>
</entry>
<entry key="HideOSD" type="Bool" >
<default>false</default>
</entry>
<entry key="WatchFile" type="Bool" >
<default>true</default>
</entry>
</group>
<group name="MainView" >
<entry key="ShowLeftPanel" type="Bool" >
<default>true</default>
</entry>
<entry key="ShowSearchBar" type="Bool" >
<default>true</default>
</entry>
<entry key="SplitterSizes" type="IntList" />
</group>
<group name="PageView" >
<entry key="ShowScrollBars" type="Bool" >
<default>true</default>
</entry>
<entry key="ViewContinous" type="Bool" >
<default>true</default>
</entry>
@ -90,8 +90,22 @@
<default>false</default>
</entry>
</group>
<group name="Temp" >
<entry key="TempDrawBoundaries" type="Bool" >
<group name="Presentation" >
<entry key="SlidesGlitterTrans" type="Bool" >
<default>true</default>
</entry>
<entry key="SlidesShowProgress" type="Bool" >
<default>true</default>
</entry>
<entry key="SlidesShowGrayBack" type="Bool" >
<default>true</default>
</entry>
<entry key="SlidesShowSummary" type="Bool" >
<default>false</default>
</entry>
</group>
<group name="Debugging Options" >
<entry key="DebugDrawBoundaries" type="Bool" >
<default>false</default>
</entry>
</group>

View file

@ -241,7 +241,7 @@ void PageView::pageSetup( const QValueVector<KPDFPage*> & pageSet, bool document
d->dirtyLayout = true;
// OSD to display pages
if ( documentChanged && pageSet.count() > 0 && !Settings::hideOSD() )
if ( documentChanged && pageSet.count() > 0 && Settings::showOSD() )
d->messageWindow->display(
i18n(" Loaded a one page document.",
" Loaded a %n pages document.",
@ -406,7 +406,7 @@ void PageView::viewportPaintEvent( QPaintEvent * pe )
pixmapPainter.drawRect( selectionRect );
}
// 4) Layer 3: overlays
if ( Settings::tempDrawBoundaries() )
if ( Settings::debugDrawBoundaries() )
{
pixmapPainter.setPen( Qt::blue );
pixmapPainter.drawRect( contentsRect );
@ -429,7 +429,7 @@ void PageView::viewportPaintEvent( QPaintEvent * pe )
screenPainter.drawRect( selectionRect );
}
// 4) Layer 3: overlays
if ( Settings::tempDrawBoundaries() )
if ( Settings::debugDrawBoundaries() )
{
screenPainter.setPen( Qt::red );
screenPainter.drawRect( contentsRect );

View file

@ -33,7 +33,7 @@ PageViewMessage::PageViewMessage( QWidget * parent )
void PageViewMessage::display( const QString & message, Icon icon, int durationMs )
// give to Caesar what Caesar owns: code taken from Amarok's osd.h/.cpp
{
if ( Settings::hideOSD() )
if ( !Settings::showOSD() )
{
hide();
return;

View file

@ -27,6 +27,7 @@
#include "document.h" // for PRESENTATION_ID
#include "generator.h"
#include "page.h"
#include "settings.h"
// comment this to disable the top-right progress indicator
@ -56,12 +57,12 @@ PresentationWidget::PresentationWidget( KPDFDocument * doc )
// create top toolbar
m_topBar = new KToolBar( this, "presentationBar" );
m_topBar->setIconSize( 22 );
m_topBar->setIconSize( 32 );
m_topBar->setMovingEnabled( false );
m_topBar->insertButton( "1leftarrow", 2, SIGNAL( clicked() ), this, SLOT( slotPrevPage() ) );
m_topBar->insertButton( "1rightarrow", 3, SIGNAL( clicked() ), this, SLOT( slotNextPage() ) );
m_topBar->insertButton( "exit", 1, SIGNAL( clicked() ), this, SLOT( close() ) );
m_topBar->setGeometry( 0, 0, m_width, 22 + 10 );
m_topBar->setGeometry( 0, 0, m_width, 32 + 10 );
m_topBar->alignItemRight( 1 );
m_topBar->hide();
// change topbar background color
@ -82,7 +83,10 @@ PresentationWidget::PresentationWidget( KPDFDocument * doc )
// show widget and take control
showFullScreen();
generatePage();
if ( Settings::slidesShowSummary() )
generatePage();
else
slotNextPage();
}
PresentationWidget::~PresentationWidget()
@ -114,7 +118,8 @@ void PresentationWidget::pageSetup( const QValueVector<KPDFPage*> & pageSet, boo
{
PresentationFrame * frame = new PresentationFrame();
frame->page = *setIt;
frame->transType = NoTrans; //TODO get transition from the document
//TODO get transition from the document
frame->transType = Settings::slidesGlitterTrans() ? Glitter : NoTrans;
frame->transDir = Left;
// calculate frame geometry keeping constant aspect ratio
float pageRatio = frame->page->ratio();
@ -162,9 +167,9 @@ void PresentationWidget::notifyPixmapChanged( int pageNumber )
// <widget events>
void PresentationWidget::keyPressEvent( QKeyEvent * e )
{
if ( e->key() == Key_Left )
if ( e->key() == Key_Left || e->key() == Key_Backspace )
slotPrevPage();
else if ( e->key() == Key_Right )
else if ( e->key() == Key_Right || e->key() == Key_Space )
slotNextPage();
else if ( e->key() == Key_Escape )
{
@ -228,7 +233,7 @@ void PresentationWidget::paintEvent( QPaintEvent * pe )
{
const QRect & r = allRects[i];
#ifdef ENABLE_PROGRESS_OVERLAY
if ( r.intersects( m_overlayGeometry ) )
if ( Settings::slidesShowProgress() && r.intersects( m_overlayGeometry ) )
{
// backbuffer the overlay operation
QPixmap backPixmap( r.size() );
@ -273,7 +278,7 @@ void PresentationWidget::generatePage()
// generate the top-right corner overlay
#ifdef ENABLE_PROGRESS_OVERLAY
if ( m_frameIndex != -1 )
if ( Settings::slidesShowProgress() && m_frameIndex != -1 )
generateOverlay();
#endif
@ -358,24 +363,32 @@ void PresentationWidget::generateContentsPage( int pageNum, QPainter & p )
for ( uint i = 0; i < rects.count(); i++ )
{
const QRect & r = rects[i];
// use a vertical gray gradient background
int baseTint = Qt::gray.red(),
blendLevel = 9 * m_height / 10,
blendLeft = r.left(),
blendWidth = r.width();
float blendDiv = (m_height * m_height) / 100; // use 100 to fade to pure white
QColor baseColor( baseTint, baseTint, baseTint );
for ( int i = r.top(); i <= r.bottom(); i++ )
if ( Settings::slidesShowGrayBack() )
{
if ( i <= blendLevel )
p.fillRect( blendLeft, i, blendWidth, 1, baseColor );
else
// use a vertical gray gradient background
int baseTint = Qt::gray.red(),
blendLevel = 9 * m_height / 10,
blendLeft = r.left(),
blendWidth = r.width();
float blendDiv = (m_height * m_height) / 100; // use 100 to fade to pure white
QColor baseColor( baseTint, baseTint, baseTint );
for ( int i = r.top(); i <= r.bottom(); i++ )
{
int k = i - blendLevel;
k = baseTint + (int)( (255-baseTint) * (k * k) / blendDiv );
p.fillRect( blendLeft, i, blendWidth, 1, QColor( baseTint, baseTint, k ) );
if ( i <= blendLevel )
p.fillRect( blendLeft, i, blendWidth, 1, baseColor );
else
{
int k = i - blendLevel;
k = baseTint + (int)( (255-baseTint) * (k * k) / blendDiv );
p.fillRect( blendLeft, i, blendWidth, 1, QColor( baseTint, baseTint, k ) );
}
}
}
else
{
// use the black color that 'crops' images on beamers
p.fillRect( r, Qt::black );
}
}
}