[Tizen] Add deprecated logs to Adaptor and Application
[platform/core/uifw/dali-adaptor-legacy.git] / dali / public-api / adaptor-framework / application.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/adaptor-framework/application.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/adaptor/common/application-impl.h>
26
27 namespace Dali
28 {
29
30 Application Application::New()
31 {
32   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
33   return New( NULL, NULL );
34 }
35
36 Application Application::New( int* argc, char **argv[] )
37 {
38   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
39   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
40   if( internal )
41   {
42     // pre-initialized application
43     internal->SetCommandLineOptions( argc, argv );
44     if( argc && ( *argc > 0 ) )
45     {
46       internal->GetWindow().SetClass( (*argv)[0], "" );
47     }
48
49     return Application( internal.Get() );
50   }
51   else
52   {
53     internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
54       Internal::Adaptor::Framework::NORMAL);
55     return Application(internal.Get());
56   }
57 }
58
59 Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
60 {
61   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
62   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
63   if( internal )
64   {
65     // pre-initialized application
66     internal->SetCommandLineOptions( argc, argv );
67     if( argc && ( *argc > 0 ) )
68     {
69       internal->GetWindow().SetClass( (*argv)[0], "" );
70     }
71     internal->SetStyleSheet( stylesheet );
72
73     return Application( internal.Get() );
74   }
75   else
76   {
77     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
78       Internal::Adaptor::Framework::NORMAL);
79     return Application(internal.Get());
80   }
81 }
82
83 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
84 {
85   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
86   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
87   if( internal )
88   {
89     // pre-initialized application
90     internal->SetCommandLineOptions( argc, argv );
91     if( argc && ( *argc > 0 ) )
92     {
93       internal->GetWindow().SetClass( (*argv)[0], "" );
94     }
95     internal->SetStyleSheet( stylesheet );
96
97     internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
98
99     return Application( internal.Get() );
100   }
101   else
102   {
103     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
104       Internal::Adaptor::Framework::NORMAL);
105     return Application(internal.Get());
106   }
107 }
108
109 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
110 {
111   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
112   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
113   if( internal )
114   {
115     // pre-initialized application
116     internal->SetCommandLineOptions( argc, argv );
117     if( argc && ( *argc > 0 ) )
118     {
119       internal->GetWindow().SetClass( (*argv)[0], "" );
120     }
121     internal->SetStyleSheet( stylesheet );
122
123     internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
124     internal->GetWindow().SetSize( Window::WindowSize( positionSize.width, positionSize.height ) );
125     internal->GetWindow().SetPosition( Window::WindowPosition( positionSize.x, positionSize.y ) );
126
127     return Application( internal.Get() );
128   }
129   else
130   {
131     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
132     return Application( internal.Get() );
133   }
134 }
135
136 Application::~Application()
137 {
138 }
139
140 Application::Application()
141 {
142 }
143
144 Application::Application(const Application& application)
145 : BaseHandle(application)
146 {
147 }
148
149 Application& Application::operator=(const Application& application)
150 {
151   if( *this != application )
152   {
153     BaseHandle::operator=( application );
154   }
155   return *this;
156 }
157
158 void Application::MainLoop()
159 {
160   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
161   Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
162 }
163
164 void Application::MainLoop(Configuration::ContextLoss configuration)
165 {
166   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
167   Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
168 }
169
170 void Application::Lower()
171 {
172   Internal::Adaptor::GetImplementation(*this).Lower();
173 }
174
175 void Application::Quit()
176 {
177   Internal::Adaptor::GetImplementation(*this).Quit();
178 }
179
180 bool Application::AddIdle( CallbackBase* callback )
181 {
182   return Internal::Adaptor::GetImplementation(*this).AddIdle( callback, false );
183 }
184
185 Window Application::GetWindow()
186 {
187   return Internal::Adaptor::GetImplementation(*this).GetWindow();
188 }
189
190 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
191 {
192   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ReplaceWindow is deprecated and will be removed from next release.\n" );
193
194   Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
195 }
196
197 std::string Application::GetResourcePath()
198 {
199   return Internal::Adaptor::Application::GetResourcePath();
200 }
201
202 std::string Application::GetRegion() const
203 {
204   return Internal::Adaptor::GetImplementation(*this).GetRegion();
205 }
206
207 std::string Application::GetLanguage() const
208 {
209   return Internal::Adaptor::GetImplementation(*this).GetLanguage();
210 }
211
212 void Application::SetViewMode( ViewMode viewMode )
213 {
214   Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
215 }
216
217 ViewMode Application::GetViewMode() const
218 {
219   return Internal::Adaptor::GetImplementation(*this).GetViewMode();
220 }
221
222 void Application::SetStereoBase( float stereoBase )
223 {
224   Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
225 }
226
227 float Application::GetStereoBase() const
228 {
229   return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
230 }
231
232 Application::AppSignalType& Application::InitSignal()
233 {
234   return Internal::Adaptor::GetImplementation(*this).InitSignal();
235 }
236
237 Application::AppSignalType& Application::TerminateSignal()
238 {
239   return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
240 }
241
242 Application::AppSignalType& Application::PauseSignal()
243 {
244   return Internal::Adaptor::GetImplementation(*this).PauseSignal();
245 }
246
247 Application::AppSignalType& Application::ResumeSignal()
248 {
249   return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
250 }
251
252 Application::AppSignalType& Application::ResetSignal()
253 {
254   return Internal::Adaptor::GetImplementation(*this).ResetSignal();
255 }
256
257 Application::AppSignalType& Application::ResizeSignal()
258 {
259   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
260
261   return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
262 }
263
264 Application::AppControlSignalType & Application::AppControlSignal()
265 {
266   return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
267 }
268
269 Application::AppSignalType& Application::LanguageChangedSignal()
270 {
271   return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
272 }
273
274 Application::AppSignalType& Application::RegionChangedSignal()
275 {
276   return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
277 }
278
279 Application::AppSignalType& Application::BatteryLowSignal()
280 {
281   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" );
282   return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
283 }
284
285 Application::AppSignalType& Application::MemoryLowSignal()
286 {
287   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" );
288   return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
289 }
290
291 Application::LowBatterySignalType& Application::LowBatterySignal()
292 {
293   return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
294 }
295
296 Application::LowMemorySignalType& Application::LowMemorySignal()
297 {
298   return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
299 }
300
301 Application::Application(Internal::Adaptor::Application* application)
302 : BaseHandle(application)
303 {
304 }
305
306
307 } // namespace Dali