Mercurial > hg > orthanc-stone
comparison Applications/Generic/NativeStoneApplicationRunner.cpp @ 1068:04a95ee91327 broker
recovery of OrthancStoneSingleFrame
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 15 Oct 2019 19:36:57 +0200 |
parents | b537002f83a9 |
children | 8d3936f06541 |
comparison
equal
deleted
inserted
replaced
1067:05b2e71ed145 | 1068:04a95ee91327 |
---|---|
34 #include <Core/HttpClient.h> | 34 #include <Core/HttpClient.h> |
35 #include <Core/Toolbox.h> | 35 #include <Core/Toolbox.h> |
36 #include <Core/OrthancException.h> | 36 #include <Core/OrthancException.h> |
37 #include <Plugins/Samples/Common/OrthancHttpConnection.h> | 37 #include <Plugins/Samples/Common/OrthancHttpConnection.h> |
38 | 38 |
39 #include <boost/make_shared.hpp> | |
39 #include <boost/program_options.hpp> | 40 #include <boost/program_options.hpp> |
40 | 41 |
41 namespace OrthancStone | 42 namespace OrthancStone |
42 { | 43 { |
43 // Anonymous namespace to avoid clashes against other compilation modules | 44 // Anonymous namespace to avoid clashes against other compilation modules |
95 | 96 |
96 // platform specific options | 97 // platform specific options |
97 DeclareCommandLineOptions(options); | 98 DeclareCommandLineOptions(options); |
98 | 99 |
99 // application specific options | 100 // application specific options |
100 application_.DeclareStartupOptions(options); | 101 application_->DeclareStartupOptions(options); |
101 | 102 |
102 boost::program_options::variables_map parameters; | 103 boost::program_options::variables_map parameters; |
103 bool error = false; | 104 bool error = false; |
104 | 105 |
105 try | 106 try |
204 // download content | 205 // download content |
205 Deprecated::Oracle oracle(6); | 206 Deprecated::Oracle oracle(6); |
206 oracle.Start(); | 207 oracle.Start(); |
207 | 208 |
208 { | 209 { |
209 Deprecated::OracleWebService webService(oracle, webServiceParameters, context); | 210 context.SetWebService(boost::make_shared<Deprecated::OracleWebService>(oracle, webServiceParameters, context)); |
210 | |
211 context.SetWebService(webService); | |
212 context.SetOrthancBaseUrl(webServiceParameters.GetUrl()); | 211 context.SetOrthancBaseUrl(webServiceParameters.GetUrl()); |
213 | 212 |
214 Deprecated::OracleDelayedCallExecutor delayedExecutor(oracle, context); | 213 Deprecated::OracleDelayedCallExecutor delayedExecutor(oracle, context); |
215 context.SetDelayedCallExecutor(delayedExecutor); | 214 context.SetDelayedCallExecutor(delayedExecutor); |
216 | 215 |
217 application_.Initialize(&context, statusBar, parameters); | 216 application_->Initialize(&context, statusBar, parameters); |
218 | 217 |
219 { | 218 { |
220 NativeStoneApplicationContext::GlobalMutexLocker locker(context); | 219 NativeStoneApplicationContext::GlobalMutexLocker locker(context); |
221 locker.SetCentralWidget(application_.GetCentralWidget()); | 220 locker.SetCentralWidget(application_->GetCentralWidget()); |
222 locker.GetCentralViewport().SetStatusBar(statusBar); | 221 locker.GetCentralViewport().SetStatusBar(statusBar); |
223 } | 222 } |
224 | 223 |
225 std::string title = application_.GetTitle(); | 224 std::string title = application_->GetTitle(); |
226 if (title.empty()) | 225 if (title.empty()) |
227 { | 226 { |
228 title = "Stone of Orthanc"; | 227 title = "Stone of Orthanc"; |
229 } | 228 } |
230 | 229 |
241 oracle.Stop(); | 240 oracle.Stop(); |
242 } | 241 } |
243 } | 242 } |
244 | 243 |
245 LOG(WARNING) << "The application is stopping"; | 244 LOG(WARNING) << "The application is stopping"; |
246 application_.Finalize(); | 245 application_->Finalize(); |
247 } | 246 } |
248 catch (Orthanc::OrthancException& e) | 247 catch (Orthanc::OrthancException& e) |
249 { | 248 { |
250 LOG(ERROR) << "EXCEPTION: " << e.What(); | 249 LOG(ERROR) << "EXCEPTION: " << e.What(); |
251 success = false; | 250 success = false; |