comparison Applications/Sdl/BasicSdlApplicationContext.cpp @ 233:68856534f005 am

added layout to VSOL, SDL & wasm working
author am@osimis.io
date Fri, 15 Jun 2018 14:29:25 +0200
parents 84844649a8fd
children 092db46c6291
comparison
equal deleted inserted replaced
232:7d3b2c4f9ba1 233:68856534f005
23 23
24 namespace OrthancStone 24 namespace OrthancStone
25 { 25 {
26 IWidget& BasicSdlApplicationContext::SetCentralWidget(IWidget* widget) // Takes ownership 26 IWidget& BasicSdlApplicationContext::SetCentralWidget(IWidget* widget) // Takes ownership
27 { 27 {
28 centralViewport_.SetCentralWidget(widget); 28 centralViewport_->SetCentralWidget(widget);
29 return *widget; 29 return *widget;
30 } 30 }
31 31
32 32
33 void BasicSdlApplicationContext::UpdateThread(BasicSdlApplicationContext* that) 33 void BasicSdlApplicationContext::UpdateThread(BasicSdlApplicationContext* that)
42 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_)); 42 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_));
43 } 43 }
44 } 44 }
45 45
46 46
47 BasicSdlApplicationContext::BasicSdlApplicationContext(Orthanc::WebServiceParameters& orthanc) : 47 BasicSdlApplicationContext::BasicSdlApplicationContext(Orthanc::WebServiceParameters& orthanc, WidgetViewport* centralViewport) :
48 oracle_(viewportMutex_, 4), // Use 4 threads to download 48 oracle_(viewportMutex_, 4), // Use 4 threads to download
49 //oracle_(viewportMutex_, 1), // Disable threading to be reproducible 49 //oracle_(viewportMutex_, 1), // Disable threading to be reproducible
50 webService_(oracle_, orthanc), 50 webService_(oracle_, orthanc),
51 centralViewport_(centralViewport),
51 stopped_(true), 52 stopped_(true),
52 updateDelay_(100) // By default, 100ms between each refresh of the content 53 updateDelay_(100) // By default, 100ms between each refresh of the content
53 { 54 {
54 srand(time(NULL)); 55 srand(time(NULL));
55 } 56 }
57 58
58 void BasicSdlApplicationContext::Start() 59 void BasicSdlApplicationContext::Start()
59 { 60 {
60 oracle_.Start(); 61 oracle_.Start();
61 62
62 if (centralViewport_.HasUpdateContent()) 63 if (centralViewport_->HasUpdateContent())
63 { 64 {
64 stopped_ = false; 65 stopped_ = false;
65 updateThread_ = boost::thread(UpdateThread, this); 66 updateThread_ = boost::thread(UpdateThread, this);
66 } 67 }
67 } 68 }