Mercurial > hg > orthanc-stone
comparison Applications/Generic/NativeStoneApplicationRunner.cpp @ 377:8eb4fe74000f
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 05 Nov 2018 16:18:27 +0100 |
parents | ac9fd144feae |
children | 6cc3ce74dc05 |
comparison
equal
deleted
inserted
replaced
376:70256a53ff21 | 377:8eb4fe74000f |
---|---|
182 LOG(WARNING) << "Creating the widgets of the application"; | 182 LOG(WARNING) << "Creating the widgets of the application"; |
183 | 183 |
184 LogStatusBar statusBar; | 184 LogStatusBar statusBar; |
185 | 185 |
186 NativeStoneApplicationContext context; | 186 NativeStoneApplicationContext context; |
187 Oracle oracle(4); // use 4 threads to download content | 187 |
188 OracleWebService webService(broker_, oracle, webServiceParameters, context); | 188 { |
189 context.SetWebService(webService); | 189 Oracle oracle(4); // use 4 threads to download content |
190 | 190 oracle.Start(); |
191 application_.Initialize(&context, statusBar, parameters); | 191 |
192 | 192 { |
193 { | 193 OracleWebService webService(broker_, oracle, webServiceParameters, context); |
194 NativeStoneApplicationContext::GlobalMutexLocker locker(context); | 194 context.SetWebService(webService); |
195 context.SetCentralWidget(application_.GetCentralWidget()); | 195 |
196 context.GetCentralViewport().SetStatusBar(statusBar); | 196 application_.Initialize(&context, statusBar, parameters); |
197 } | 197 |
198 | 198 { |
199 std::string title = application_.GetTitle(); | 199 NativeStoneApplicationContext::GlobalMutexLocker locker(context); |
200 if (title.empty()) | 200 context.SetCentralWidget(application_.GetCentralWidget()); |
201 { | 201 context.GetCentralViewport().SetStatusBar(statusBar); |
202 title = "Stone of Orthanc"; | 202 } |
203 } | 203 |
204 | 204 std::string title = application_.GetTitle(); |
205 /**************************************************************** | 205 if (title.empty()) |
206 * Run the application | 206 { |
207 ****************************************************************/ | 207 title = "Stone of Orthanc"; |
208 | 208 } |
209 Run(context, title, argc, argv); | 209 |
210 | 210 /**************************************************************** |
211 /**************************************************************** | 211 * Run the application |
212 * Finalize the application | 212 ****************************************************************/ |
213 ****************************************************************/ | 213 |
214 Run(context, title, argc, argv); | |
215 | |
216 /**************************************************************** | |
217 * Finalize the application | |
218 ****************************************************************/ | |
219 | |
220 oracle.Stop(); | |
221 } | |
222 } | |
214 | 223 |
215 LOG(WARNING) << "The application is stopping"; | 224 LOG(WARNING) << "The application is stopping"; |
216 application_.Finalize(); | 225 application_.Finalize(); |
217 } | 226 } |
218 catch (Orthanc::OrthancException& e) | 227 catch (Orthanc::OrthancException& e) |