hi,

i saw, that a black screen mode was added to okular.
I thought it is also usefull if there is a white screen mode.
So I made a path.

If you press 'w' in presentation view, the screen gets white.

Greets
Uwe Kaiser 
Index: kdegraphics/okular/part.cpp
===================================================================
--- kdegraphics/okular/part.cpp	(revision 875982)
+++ kdegraphics/okular/part.cpp	(working copy)
@@ -534,6 +534,11 @@
     blackscreenAction->setShortcut( QKeySequence( Qt::Key_B ) );
     blackscreenAction->setIcon( KIcon( "view-presentation" ) );
 
+    KToggleAction *whitescreenAction = new KToggleAction( i18n( "Switch Whitescreen Mode" ), ac );
+    ac->addAction( "switch_whitescreen_mode", whitescreenAction );
+    whitescreenAction->setShortcut( QKeySequence( Qt::Key_W ) );
+    whitescreenAction->setIcon( KIcon( "view-presentation" ) );
+
     // document watcher and reloader
     m_watcher = new KDirWatch( this );
     connect( m_watcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) );
Index: kdegraphics/okular/ui/presentationwidget.h
===================================================================
--- kdegraphics/okular/ui/presentationwidget.h	(revision 875982)
+++ kdegraphics/okular/ui/presentationwidget.h	(working copy)
@@ -123,6 +123,7 @@
         KSelectAction * m_screenSelect;
         bool m_blockNotifications;
         bool m_inBlackScreenMode;
+        bool m_inWhiteScreenMode;
 
     private slots:
         void slotNextPage();
@@ -138,6 +139,7 @@
         void screenResized( int );
         void chooseScreen( QAction * );
         void toggleBlackScreenMode( bool );
+        void toggleWhiteScreenMode( bool );
 };
 
 #endif
Index: kdegraphics/okular/ui/presentationwidget.cpp
===================================================================
--- kdegraphics/okular/ui/presentationwidget.cpp	(revision 875982)
+++ kdegraphics/okular/ui/presentationwidget.cpp	(working copy)
@@ -128,7 +128,8 @@
     : QWidget( 0 /* must be null, to have an independent widget */, Qt::FramelessWindowHint ),
     m_pressedLink( 0 ), m_handCursor( false ), m_drawingEngine( 0 ), m_screenSaverCookie( -1 ),
     m_document( doc ), m_frameIndex( -1 ), m_topBar( 0 ), m_pagesEdit( 0 ), m_searchBar( 0 ),
-    m_screenSelect( 0 ), m_blockNotifications( false ), m_inBlackScreenMode( false )
+    m_screenSelect( 0 ), m_blockNotifications( false ), m_inBlackScreenMode( false ),
+    m_inWhiteScreenMode( false )
 {
     Q_UNUSED( parent )
     setAttribute( Qt::WA_DeleteOnClose );
@@ -354,9 +355,14 @@
     addAction( m_ac->action( "first_page" ) );
     addAction( m_ac->action( "last_page" ) );
 
-    QAction *action = m_ac->action( "switch_blackscreen_mode" );
-    connect( action, SIGNAL( toggled( bool ) ), SLOT( toggleBlackScreenMode( bool ) ) );
-    addAction( action );
+    QAction *blackscreenAction = m_ac->action( "switch_blackscreen_mode" );
+    connect( blackscreenAction, SIGNAL( toggled( bool ) ), SLOT( toggleBlackScreenMode( bool ) ) );
+    addAction( blackscreenAction );
+
+    QAction *whitescreenAction = m_ac->action( "switch_whitescreen_mode" );
+    connect( whitescreenAction, SIGNAL( toggled( bool ) ), SLOT( toggleWhiteScreenMode( bool ) ) );
+    addAction( whitescreenAction );
+
 }
 
 
@@ -541,6 +547,13 @@
         return;
     }
 
+    if ( m_inWhiteScreenMode )
+    {
+        QPainter painter( this );
+        painter.fillRect( pe->rect(), Qt::white );
+        return;
+    }
+
     if (m_width == -1)
     {
         m_width = width();
@@ -1286,10 +1299,19 @@
 void PresentationWidget::toggleBlackScreenMode( bool )
 {
     m_inBlackScreenMode = !m_inBlackScreenMode;
+    m_inWhiteScreenMode = false;
 
     update();
 }
 
+void PresentationWidget::toggleWhiteScreenMode( bool )
+{
+    m_inWhiteScreenMode = !m_inWhiteScreenMode;
+    m_inBlackScreenMode = false;
+
+    update();
+}
+
 void PresentationWidget::setScreen( int newScreen )
 {
     const QRect screenGeom = QApplication::desktop()->screenGeometry( newScreen );
_______________________________________________
Okular-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/okular-devel

Reply via email to