Kaydet (Commit) f384496d authored tarafından Tobias Madl's avatar Tobias Madl

Timer to idle

Change-Id: Iaac3618501b4e382afe8d183836a370eea699af4
üst f33d6800
...@@ -41,44 +41,44 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ...@@ -41,44 +41,44 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc
mbStartIdleTimer( false ), mbStartIdleTimer( false ),
mIdleBlockCount( 0 ) mIdleBlockCount( 0 )
{ {
maIdleTimer.SetTimeout( 600 ); maIdle.SetPriority( SchedulerPriority::LOWEST );
maIdleTimer.SetTimeoutHdl( LINK( this, DocumentTimerManager, DoIdleJobs) ); maIdle.SetIdleHdl( LINK( this, DocumentTimerManager, DoIdleJobs) );
} }
void DocumentTimerManager::StartIdling() void DocumentTimerManager::StartIdling()
{ {
mbStartIdleTimer = true; mbStartIdleTimer = true;
if( !mIdleBlockCount ) if( !mIdleBlockCount )
maIdleTimer.Start(); maIdle.Start();
} }
void DocumentTimerManager::StopIdling() void DocumentTimerManager::StopIdling()
{ {
mbStartIdleTimer = false; mbStartIdleTimer = false;
maIdleTimer.Stop(); maIdle.Stop();
} }
void DocumentTimerManager::BlockIdling() void DocumentTimerManager::BlockIdling()
{ {
maIdleTimer.Stop(); maIdle.Stop();
++mIdleBlockCount; ++mIdleBlockCount;
} }
void DocumentTimerManager::UnblockIdling() void DocumentTimerManager::UnblockIdling()
{ {
--mIdleBlockCount; --mIdleBlockCount;
if( !mIdleBlockCount && mbStartIdleTimer && !maIdleTimer.IsActive() ) if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() )
maIdleTimer.Start(); maIdle.Start();
} }
void DocumentTimerManager::StartBackgroundJobs() void DocumentTimerManager::StartBackgroundJobs()
{ {
// Trigger DoIdleJobs(), asynchronously. // Trigger DoIdleJobs(), asynchronously.
if (!maIdleTimer.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 if (!maIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0
maIdleTimer.Start(); maIdle.Start();
} }
IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer ) IMPL_LINK( DocumentTimerManager, DoIdleJobs, Idle*, pIdle )
{ {
#ifdef TIMELOG #ifdef TIMELOG
static ::rtl::Logfile* pModLogFile = 0; static ::rtl::Logfile* pModLogFile = 0;
...@@ -95,7 +95,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer ) ...@@ -95,7 +95,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer )
{ {
if( rSh.ActionPend() ) if( rSh.ActionPend() )
{ {
pTimer->Start(); pIdle->Start();
return 0; return 0;
} }
} }
...@@ -119,7 +119,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer ) ...@@ -119,7 +119,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer )
(*pLayIter)->GetCurrShell()->LayoutIdle(); (*pLayIter)->GetCurrShell()->LayoutIdle();
// Defer the remaining work. // Defer the remaining work.
pTimer->Start(); pIdle->Start();
return 0; return 0;
} }
} }
...@@ -135,7 +135,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer ) ...@@ -135,7 +135,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer )
if ( m_rDoc.getIDocumentFieldsAccess().GetUpdtFlds().IsInUpdateFlds() || if ( m_rDoc.getIDocumentFieldsAccess().GetUpdtFlds().IsInUpdateFlds() ||
m_rDoc.getIDocumentFieldsAccess().IsExpFldsLocked() ) m_rDoc.getIDocumentFieldsAccess().IsExpFldsLocked() )
{ {
pTimer->Start(); pIdle->Start();
return 0; return 0;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <IDocumentTimerAccess.hxx> #include <IDocumentTimerAccess.hxx>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <vcl/timer.hxx> #include <vcl/idle.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <tools/link.hxx> #include <tools/link.hxx>
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
void StartBackgroundJobs() SAL_OVERRIDE; void StartBackgroundJobs() SAL_OVERRIDE;
// Our own 'IdleTimer' calls the following method // Our own 'IdleTimer' calls the following method
DECL_LINK( DoIdleJobs, Timer * ); DECL_LINK( DoIdleJobs, Idle * );
virtual ~DocumentTimerManager(); virtual ~DocumentTimerManager();
...@@ -60,7 +60,7 @@ private: ...@@ -60,7 +60,7 @@ private:
bool mbStartIdleTimer; //< idle timer mode start/stop bool mbStartIdleTimer; //< idle timer mode start/stop
sal_Int32 mIdleBlockCount; sal_Int32 mIdleBlockCount;
Timer maIdleTimer; Idle maIdle;
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment