Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/Applications/Generic/NativeStoneApplicationRunner.cpp Mon Nov 05 13:25:03 2018 +0100 +++ b/Applications/Generic/NativeStoneApplicationRunner.cpp Mon Nov 05 16:18:27 2018 +0100 @@ -184,34 +184,43 @@ LogStatusBar statusBar; NativeStoneApplicationContext context; - Oracle oracle(4); // use 4 threads to download content - OracleWebService webService(broker_, oracle, webServiceParameters, context); - context.SetWebService(webService); - - application_.Initialize(&context, statusBar, parameters); { - NativeStoneApplicationContext::GlobalMutexLocker locker(context); - context.SetCentralWidget(application_.GetCentralWidget()); - context.GetCentralViewport().SetStatusBar(statusBar); - } + Oracle oracle(4); // use 4 threads to download content + oracle.Start(); + + { + OracleWebService webService(broker_, oracle, webServiceParameters, context); + context.SetWebService(webService); + + application_.Initialize(&context, statusBar, parameters); + + { + NativeStoneApplicationContext::GlobalMutexLocker locker(context); + context.SetCentralWidget(application_.GetCentralWidget()); + context.GetCentralViewport().SetStatusBar(statusBar); + } - std::string title = application_.GetTitle(); - if (title.empty()) - { - title = "Stone of Orthanc"; + std::string title = application_.GetTitle(); + if (title.empty()) + { + title = "Stone of Orthanc"; + } + + /**************************************************************** + * Run the application + ****************************************************************/ + + Run(context, title, argc, argv); + + /**************************************************************** + * Finalize the application + ****************************************************************/ + + oracle.Stop(); + } } - /**************************************************************** - * Run the application - ****************************************************************/ - - Run(context, title, argc, argv); - - /**************************************************************** - * Finalize the application - ****************************************************************/ - LOG(WARNING) << "The application is stopping"; application_.Finalize(); }