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

List:       koffice
Subject:    Re: Patch for KPresenter (Presentation Time)
From:       Toshitaka Fujioka <toshitaka () kde ! gr ! jp>
Date:       2001-04-19 16:45:26
[Download RAW message or body]

Hi,
 
Patch was completed. (CVS of 13/04)
Screen shot
http://www.kde.gr.jp/~toshitaka/Kde/KOffice/KPresenter/kpresenter_newfeature.png
  
Please review. :-)
  
Thank you.
["koffice-kpresenter-newfeature1-20010420.diff" (text/x-c++)]

diff -ur koffice.orig/kpresenter/kpresenter_view.cc koffice/kpresenter/kpresenter_view.cc
--- koffice.orig/kpresenter/kpresenter_view.cc	Wed Apr 18 01:46:47 2001
+++ koffice/kpresenter/kpresenter_view.cc	Fri Apr 20 00:53:26 2001
@@ -213,6 +213,7 @@
     pageBase = 0;
     sticky = FALSE;
     page = 0L;
+    presentationDurationString = "00:00:00";
 
     m_pKPresenterDoc = _doc;
 
@@ -1071,6 +1072,10 @@
 	page->showFullScreen();
 	page->setFocusPolicy( QWidget::StrongFocus );
 	//page->setFocus(); done in gotoPage
+
+	// Start presentation
+	presentationDuration.start();
+
 	page->startScreenPresentation( _presFakt, pgNum );
 
 	actionScreenStart->setEnabled( false );
@@ -1096,7 +1101,14 @@
         page->lower();
 	xOffset = xOffsetSaved;
 	yOffset = yOffsetSaved;
+
+	// End presentation time
+	int time = presentationDuration.elapsed();
+
 	page->stopScreenPresentation();
+
+	presentationDurationDataFormatChange( time );
+
 	presStarted = false;
 	vert->setEnabled( true );
 	horz->setEnabled( true );
@@ -1115,6 +1127,9 @@
 	actionScreenStart->setEnabled( true );
 	actionScreenViewPage->setEnabled( true );
 	pageBase->resizeEvent( 0 );
+
+	statusBar()->changeItem( QString(" ")+i18n("Last presentation duration: %1")
+				 .arg(presentationDurationString)+' ', statusPreDuration );
     }
 }
 
@@ -1676,12 +1691,23 @@
     actionEditUndo->setEnabled( false );
     actionEditRedo->setEnabled( false );
     actionEditDelPage->setEnabled( m_pKPresenterDoc->getPageNums() > 1 );
+
+    statusBar()->insertItem( QString(" ")+i18n("Slide %1/%2").arg(1).arg(1)+' ', statusSlide );
+    statusBar()->insertItem( QString(" ")+i18n("Last presentation duration: %1")
+			     .arg(presentationDurationString)+' ', statusPreDuration );
+    statusBar()->show();
 }
 
 void KPresenterView::guiActivateEvent( KParts::GUIActivateEvent *ev )
 {
     if ( ev->activated() )
         initGui();
+    else {
+        //remove item when you desactivate gui
+        statusBar()->removeItem(statusSlide);
+        statusBar()->removeItem(statusPreDuration);
+    }
+
 
     KoView::guiActivateEvent( ev );
 }
@@ -2278,6 +2304,8 @@
 /*================================================================*/
 unsigned int KPresenterView::getCurrPgNum()
 {
+    statusBar()->changeItem( QString(" ")+i18n("Slide %1/%2").arg( currPg + 1 )
+			     .arg( m_pKPresenterDoc->getPageNums() )+' ', statusSlide );
     return currPg + 1;
 }
 
@@ -2969,3 +2997,36 @@
     else
         sidebar->show();
 }
+
+// change from milliseconds to hh:mm:ss
+void KPresenterView::presentationDurationDataFormatChange( int time )
+{
+    int hours, minutes, seconds;
+
+    time = time /1000;
+    if ( time >= 60 ) {
+        seconds = time % 60;
+        time = time - seconds;
+        time = time / 60;
+
+        if ( time >= 60 ) {
+            minutes = time % 60;
+            time = time - minutes;
+            hours = time / 60;
+        }
+        else {
+            hours = 0;
+            minutes = time;
+        }
+    }
+    else {
+        hours = 0;
+        minutes = 0;
+        seconds = time;
+    }
+
+    presentationDurationString = "";
+    presentationDurationString.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
+}
+
+
diff -ur koffice.orig/kpresenter/kpresenter_view.h koffice/kpresenter/kpresenter_view.h
--- koffice.orig/kpresenter/kpresenter_view.h	Wed Apr 18 01:46:47 2001
+++ koffice/kpresenter/kpresenter_view.h	Fri Apr 20 00:50:55 2001
@@ -555,6 +555,20 @@
     QSplitter *splitter;
     PageBase *pageBase;
 
+private:
+    QTime presentationDuration;
+    QString presentationDurationString;
+
+    void presentationDurationDataFormatChange( int time );
+
+    // Statusbar items
+    enum StatusBarIds {
+        statusSlide = 1,
+        statusPreDuration = 2
+        // More to be added
+    };
+
 };
 
 #endif
+
diff -ur koffice.orig/kpresenter/sidebar.cc koffice/kpresenter/sidebar.cc
--- koffice.orig/kpresenter/sidebar.cc	Wed Apr 18 01:46:48 2001
+++ koffice/kpresenter/sidebar.cc	Fri Apr 20 00:52:58 2001
@@ -61,6 +61,8 @@
 
 void SideBar::updateItem( int pagenr /* 0-based */)
 {
+    view->getCurrPgNum(); // Update slide number and total slide number of status bar
+
     // Find item
     QListViewItemIterator it( this );
     for ( ; it.current(); ++it )

["koffice-lib-20010420.diff" (text/plain)]

diff -ur koffice.orig/lib/kofficecore/koMainWindow.cc koffice/lib/kofficecore/koMainWindow.cc
--- koffice.orig/lib/kofficecore/koMainWindow.cc	Wed Apr 18 01:46:57 2001
+++ koffice/lib/kofficecore/koMainWindow.cc	Fri Apr 20 00:57:48 2001
@@ -295,6 +295,7 @@
     d->m_rootViews.current()->setPartManager( d->m_manager );
 
     d->m_rootViews.current()->show();
+    kapp->processOneEvent();
     d->m_rootDoc->addShell( this );
     d->m_removeView->setEnabled(false);
     d->m_orientation->setEnabled(false);


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

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