annotate Applications/Samples/SampleApplicationBase.h @ 1290:7def6ab2929f bugs/2020-02-invisible-slice

Removal of debugging logs
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 21 Feb 2020 15:20:29 +0100
parents 2d8ab34c8c91
children 7ec8fea061b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
16 *
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
24 #include "../../Applications/IStoneApplication.h"
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
25 #include "../../Framework/Deprecated/Widgets/WorldSceneWidget.h"
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
26
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
27 #if ORTHANC_ENABLE_WASM==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
28 #include "../../Platforms/Wasm/WasmPlatformApplicationAdapter.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
29 #include "../../Platforms/Wasm/Defaults.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
30 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
31
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
32 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
33 #include "Qt/SampleMainWindow.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
34 #include "Qt/SampleMainWindowWithButtons.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
35 #endif
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 namespace OrthancStone
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Samples
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
41 class SampleApplicationBase : public IStoneApplication
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 295
diff changeset
43 protected:
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
44 // ownership is transferred to the application context
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
45 Deprecated::WorldSceneWidget* mainWidget_;
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
46
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 public:
288
8c8da145fefa renamings and doc
am@osimis.io
parents: 285
diff changeset
48 virtual void Initialize(StoneApplicationContext* context,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
49 Deprecated::IStatusBar& statusBar,
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
50 const boost::program_options::variables_map& parameters) ORTHANC_OVERRIDE
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
51 {
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
52 }
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
53
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
54 virtual std::string GetTitle() const ORTHANC_OVERRIDE
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return "Stone of Orthanc - Sample";
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
58
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
59 /**
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
60 * In the basic samples, the commands are handled by the platform adapter and NOT
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
61 * by the application handler
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
62 */
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
63 virtual void HandleSerializedMessage(const char* data) ORTHANC_OVERRIDE {};
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
64
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
65
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
66 virtual void Finalize() ORTHANC_OVERRIDE {}
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 535
diff changeset
67 virtual Deprecated::IWidget* GetCentralWidget() ORTHANC_OVERRIDE {return mainWidget_;}
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
68
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
69 #if ORTHANC_ENABLE_WASM==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
70 // default implementations for a single canvas named "canvas" in the HTML and an emtpy WasmApplicationAdapter
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
71
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
72 virtual void InitializeWasm() ORTHANC_OVERRIDE
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
73 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
74 AttachWidgetToWasmViewport("canvas", mainWidget_);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
75 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
76
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
77 virtual WasmPlatformApplicationAdapter* CreateWasmApplicationAdapter(MessageBroker& broker)
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
78 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
79 return new WasmPlatformApplicationAdapter(broker, *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
80 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
81 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
82
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
83 };
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
84
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
85 // this application actually works in Qt and WASM
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
86 class SampleSingleCanvasWithButtonsApplicationBase : public SampleApplicationBase
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
87 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
88 public:
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
89 virtual void OnPushButton1Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
90 virtual void OnPushButton2Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
91 virtual void OnTool1Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
92 virtual void OnTool2Clicked() {}
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
93
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
94 virtual void GetButtonNames(std::string& pushButton1,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
95 std::string& pushButton2,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
96 std::string& tool1,
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
97 std::string& tool2
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents: 288
diff changeset
98 ) {
285
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
99 pushButton1 = "action1";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
100 pushButton2 = "action2";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
101 tool1 = "tool1";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
102 tool2 = "tool2";
3c190e2bb3af refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents: 274
diff changeset
103 }
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
104
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
105 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
106 virtual QStoneMainWindow* CreateQtMainWindow() {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
107 return new SampleMainWindowWithButtons(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
108 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
109 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
110
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
111 };
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 295
diff changeset
112
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
113 // this application actually works in SDL and WASM
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
114 class SampleSingleCanvasApplicationBase : public SampleApplicationBase
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
115 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
116 public:
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
117
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
118 #if ORTHANC_ENABLE_QT==1
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
119 virtual QStoneMainWindow* CreateQtMainWindow() {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
120 return new SampleMainWindow(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
121 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 307
diff changeset
122 #endif
221
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents: 134
diff changeset
123 };
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }