diff Applications/BasicApplicationContext.cpp @ 222:84844649a8fd am

continued: reusable applications
author am@osimis.io
date Tue, 12 Jun 2018 17:21:15 +0200
parents d7b2590744f8
children
line wrap: on
line diff
--- a/Applications/BasicApplicationContext.cpp	Mon Jun 11 14:01:02 2018 +0200
+++ b/Applications/BasicApplicationContext.cpp	Tue Jun 12 17:21:15 2018 +0200
@@ -23,59 +23,4 @@
 
 namespace OrthancStone
 {
-  void BasicApplicationContext::UpdateThread(BasicApplicationContext* that)
-  {
-    while (!that->stopped_)
-    {
-      {
-        ViewportLocker locker(*that);
-        locker.GetViewport().UpdateContent();
-      }
-      
-      boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_));
-    }
-  }
-  
-
-  BasicApplicationContext::BasicApplicationContext(Orthanc::WebServiceParameters& orthanc) :
-    oracle_(viewportMutex_, 4),  // Use 4 threads to download
-    //oracle_(viewportMutex_, 1),  // Disable threading to be reproducible
-    webService_(oracle_, orthanc),
-    stopped_(true),
-    updateDelay_(100)   // By default, 100ms between each refresh of the content
-  {
-    srand(time(NULL)); 
-  }
-
-
-  IWidget& BasicApplicationContext::SetCentralWidget(IWidget* widget)   // Takes ownership
-  {
-    centralViewport_.SetCentralWidget(widget);
-    return *widget;
-  }
-
-
-  void BasicApplicationContext::Start()
-  {
-    oracle_.Start();
-
-    if (centralViewport_.HasUpdateContent())
-    {
-      stopped_ = false;
-      updateThread_ = boost::thread(UpdateThread, this);
-    }
-  }
-
-
-  void BasicApplicationContext::Stop()
-  {
-    stopped_ = true;
-    
-    if (updateThread_.joinable())
-    {
-      updateThread_.join();
-    }
-    
-    oracle_.Stop();
-  }
 }