Commit 211ae49ff61640da730ce5ef2424149a5e631094
[dali_1.0.22] Merge branch 'tizen'
Change-Id: I1552f52a541f64b090a274794ab4352eef347d32
Showing
6 changed files
with
794 additions
and
12 deletions
build/tizen/examples/Makefile.am
| @@ -35,7 +35,8 @@ bin_PROGRAMS = \ | @@ -35,7 +35,8 @@ bin_PROGRAMS = \ | ||
| 35 | builder.example \ | 35 | builder.example \ |
| 36 | image-scaling-irregular-grid.example \ | 36 | image-scaling-irregular-grid.example \ |
| 37 | buttons.example \ | 37 | buttons.example \ |
| 38 | - text-view.example | 38 | + text-view.example \ |
| 39 | + logging.example | ||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | daliimagedir = $(appdatadir)/images/ | 42 | daliimagedir = $(appdatadir)/images/ |
| @@ -164,3 +165,8 @@ text_view_example_SOURCES = $(examples_src_dir)/text-view/text-view-example.cpp | @@ -164,3 +165,8 @@ text_view_example_SOURCES = $(examples_src_dir)/text-view/text-view-example.cpp | ||
| 164 | text_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) | 165 | text_view_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) |
| 165 | text_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) | 166 | text_view_example_DEPENDENCIES = $(EXAMPLE_DEPS) |
| 166 | text_view_example_LDADD = $(EXAMPLE_LDADD) | 167 | text_view_example_LDADD = $(EXAMPLE_LDADD) |
| 168 | + | ||
| 169 | +logging_example_SOURCES = $(examples_src_dir)/logging/logging-example.cpp | ||
| 170 | +logging_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS) | ||
| 171 | +logging_example_DEPENDENCIES = $(EXAMPLE_DEPS) | ||
| 172 | +logging_example_LDADD = $(EXAMPLE_LDADD) |
com.samsung.dali-demo.xml
| @@ -70,4 +70,7 @@ | @@ -70,4 +70,7 @@ | ||
| 70 | <ui-application appid="text-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 70 | <ui-application appid="text-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 71 | <label>Text View</label> | 71 | <label>Text View</label> |
| 72 | </ui-application> | 72 | </ui-application> |
| 73 | + <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 74 | + <label>Logging</label> | ||
| 75 | + </ui-application> | ||
| 73 | </manifest> | 76 | </manifest> |
examples/builder/examples.cpp
| @@ -280,6 +280,9 @@ public: | @@ -280,6 +280,9 @@ public: | ||
| 280 | { | 280 | { |
| 281 | Stage stage = Stage::GetCurrent(); | 281 | Stage stage = Stage::GetCurrent(); |
| 282 | 282 | ||
| 283 | + mTapDetector = TapGestureDetector::New(); | ||
| 284 | + mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); | ||
| 285 | + | ||
| 283 | if( mItemView ) | 286 | if( mItemView ) |
| 284 | { | 287 | { |
| 285 | stage.Remove( mItemView ); | 288 | stage.Remove( mItemView ); |
| @@ -361,15 +364,6 @@ public: | @@ -361,15 +364,6 @@ public: | ||
| 361 | } | 364 | } |
| 362 | } | 365 | } |
| 363 | 366 | ||
| 364 | - mTapDetector = TapGestureDetector::New(); | ||
| 365 | - | ||
| 366 | - for( unsigned int i = 0u; i < mItemView.GetChildCount(); ++i ) | ||
| 367 | - { | ||
| 368 | - mTapDetector.Attach( mItemView.GetChildAt(i) ); | ||
| 369 | - } | ||
| 370 | - | ||
| 371 | - mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); | ||
| 372 | - | ||
| 373 | // Display item view on the stage | 367 | // Display item view on the stage |
| 374 | stage.Add( mItemView ); | 368 | stage.Add( mItemView ); |
| 375 | 369 | ||
| @@ -413,6 +407,10 @@ public: | @@ -413,6 +407,10 @@ public: | ||
| 413 | t.SetText( fontString.str() ); | 407 | t.SetText( fontString.str() ); |
| 414 | 408 | ||
| 415 | t.SetTextAlignment( Alignment::HorizontalLeft ); | 409 | t.SetTextAlignment( Alignment::HorizontalLeft ); |
| 410 | + | ||
| 411 | + // Hook up tap detector | ||
| 412 | + mTapDetector.Attach( t ); | ||
| 413 | + | ||
| 416 | return t; | 414 | return t; |
| 417 | } | 415 | } |
| 418 | 416 |
examples/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -60,7 +60,7 @@ namespace | @@ -60,7 +60,7 @@ namespace | ||
| 60 | /** Controls the output of application logging. */ | 60 | /** Controls the output of application logging. */ |
| 61 | //#define DEBUG_PRINT_DIAGNOSTICS; | 61 | //#define DEBUG_PRINT_DIAGNOSTICS; |
| 62 | 62 | ||
| 63 | -const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-4.jpg" ); | 63 | +const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" ); |
| 64 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | 64 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 65 | const char* APPLICATION_TITLE( "Image Scaling Modes" ); | 65 | const char* APPLICATION_TITLE( "Image Scaling Modes" ); |
| 66 | const char* TOGGLE_SCALING_IMAGE( DALI_IMAGE_DIR "icon-change.png" ); | 66 | const char* TOGGLE_SCALING_IMAGE( DALI_IMAGE_DIR "icon-change.png" ); |
examples/logging/logging-example.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2014 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 | +#include "../shared/view.h" | ||
| 19 | +#include <dali/dali.h> | ||
| 20 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 21 | + | ||
| 22 | +#include <sstream> | ||
| 23 | + | ||
| 24 | +using namespace Dali; | ||
| 25 | + | ||
| 26 | +namespace | ||
| 27 | +{ | ||
| 28 | +// Used to produce visually same dimensions on desktop and device builds | ||
| 29 | +float ScalePointSize( int pointSize ) | ||
| 30 | +{ | ||
| 31 | + Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); | ||
| 32 | + float meanDpi = (dpi.height + dpi.width) * 0.5f; | ||
| 33 | + return pointSize * meanDpi / 220.0f; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +} // namespace | ||
| 37 | + | ||
| 38 | +// Define this so that it is interchangeable | ||
| 39 | +// "DP" stands for Device independent Pixels | ||
| 40 | +#define DP(x) ScalePointSize(x) | ||
| 41 | + | ||
| 42 | +//enum ButtonType | ||
| 43 | +//{ | ||
| 44 | +// PUSH_BUTTON, | ||
| 45 | +// TOGGLE_BUTTON | ||
| 46 | +//}; | ||
| 47 | +// | ||
| 48 | +//struct ButtonItem | ||
| 49 | +//{ | ||
| 50 | +// ButtonType type; | ||
| 51 | +// const char* name; | ||
| 52 | +// const char* text; | ||
| 53 | +// const char* altText; | ||
| 54 | +//}; | ||
| 55 | + | ||
| 56 | +namespace | ||
| 57 | +{ | ||
| 58 | + | ||
| 59 | +const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg"; | ||
| 60 | +const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png"; | ||
| 61 | + | ||
| 62 | +const char* const TOOLBAR_TITLE = "Logging"; | ||
| 63 | +//const int TOOLBAR_HEIGHT = 62; | ||
| 64 | + | ||
| 65 | +const int MARGIN_SIZE = 10; | ||
| 66 | +const int TOP_MARGIN = 85; | ||
| 67 | + | ||
| 68 | +const int LOGGER_GROUP_HEIGHT = 84; | ||
| 69 | +const int LOGGER_RADIO_GROUP_HEIGHT = 200; | ||
| 70 | + | ||
| 71 | +const int LOGGER_RADIO_SPACING = 48; | ||
| 72 | + | ||
| 73 | +const int CONSOLE_HEIGHT = 84; | ||
| 74 | + | ||
| 75 | +const int BUTTON_WIDTH = 200; | ||
| 76 | +const int BUTTON_HEIGHT = LOGGER_GROUP_HEIGHT - MARGIN_SIZE * 2; | ||
| 77 | + | ||
| 78 | +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); | ||
| 79 | + | ||
| 80 | +const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png"; | ||
| 81 | +const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png"; | ||
| 82 | +const char* const PUSHBUTTON_DIM_IMAGE = DALI_IMAGE_DIR "button-disabled.9.png"; | ||
| 83 | + | ||
| 84 | +// Button IDs | ||
| 85 | +const char* const LOGGER_1_RADIO_ID = "LOGGER_1_RADIO"; | ||
| 86 | +const char* const LOGGER_2_RADIO_ID = "LOGGER_2_RADIO"; | ||
| 87 | +const char* const LOGGER_3_RADIO_ID = "LOGGER_3_RADIO"; | ||
| 88 | + | ||
| 89 | +const char* const FREQUENCY_1_RADIO_ID = "FREQUENCY_1_RADIO"; | ||
| 90 | +const char* const FREQUENCY_2_RADIO_ID = "FREQUENCY_2_RADIO"; | ||
| 91 | +const char* const FREQUENCY_3_RADIO_ID = "FREQUENCY_3_RADIO"; | ||
| 92 | + | ||
| 93 | +const char* const CREATE_BUTTON_ID = "CREATE_BUTTON"; | ||
| 94 | +const char* const DELETE_BUTTON_ID = "DELETE_BUTTON"; | ||
| 95 | +const char* const START_BUTTON_ID = "START_BUTTON"; | ||
| 96 | +const char* const STOP_BUTTON_ID = "STOP_BUTTON"; | ||
| 97 | +const char* const HIGH_FREQ_BUTTON_ID = "INC_FREQ_BUTTON"; | ||
| 98 | +const char* const LOW_FREQ_BUTTON_ID = "DEC_FREQ_BUTTON"; | ||
| 99 | +const char* const ENABLE_BUTTON_ID = "ENABLE_BUTTON"; | ||
| 100 | +const char* const DISABLE_BUTTON_ID = "DISABLE_BUTTON"; | ||
| 101 | +const char* const VSYNC_BUTTON_ID = "VSYNC_BUTTON"; | ||
| 102 | + | ||
| 103 | +const char* const CREATE_BUTTON_TEXT = "Create"; | ||
| 104 | +const char* const DELETE_BUTTON_TEXT = "Delete"; | ||
| 105 | +const char* const START_BUTTON_TEXT = "Start"; | ||
| 106 | +const char* const STOP_BUTTON_TEXT = "Stop"; | ||
| 107 | +const char* const ENABLE_BUTTON_TEXT = "Enable"; | ||
| 108 | +const char* const DISABLE_BUTTON_TEXT = "Disable"; | ||
| 109 | +const char* const VSYNC_BUTTON_TEXT = "Vsync"; | ||
| 110 | + | ||
| 111 | +const char* const FREQUENCY_1_RADIO_TEXT = "1"; | ||
| 112 | +const char* const FREQUENCY_2_RADIO_TEXT = "2"; | ||
| 113 | +const char* const FREQUENCY_3_RADIO_TEXT = "10"; | ||
| 114 | + | ||
| 115 | +const char* const LOGGER_TEXT = "Logger:"; | ||
| 116 | +const char* const FREQUENCY_TEXT = "Frequency (sec):"; | ||
| 117 | + | ||
| 118 | +const unsigned int NUM_LOGGERS = 3; | ||
| 119 | + | ||
| 120 | +const unsigned int HIGH_FREQUENCY = 1; // Seconds | ||
| 121 | +const unsigned int MEDIUM_FREQUENCY = 2; // Seconds | ||
| 122 | +const unsigned int LOW_FREQUENCY = 10; // Seconds | ||
| 123 | +const unsigned int NUM_FREQUENCIES = 3; | ||
| 124 | + | ||
| 125 | +} // namespace | ||
| 126 | + | ||
| 127 | +/** | ||
| 128 | + * This example is a test harness for performance loggers. | ||
| 129 | + * | ||
| 130 | + * Press one of the create buttons to create a logger. This will output on vsync at the default frequency (2 seconds). | ||
| 131 | + * In case nothing appears in the log, force a vsync by touching anywhere on the screen. Loggers can be deleted | ||
| 132 | + * with the delete buttons. They can be enabled or disabled in which case logging will appear or disappear in the console | ||
| 133 | + * respectively. To record information in a logger press the start and then stop button in succession quickly in between | ||
| 134 | + * the time period when it would print to the console. This is necessary as the logger is cleared of information when | ||
| 135 | + * it prints. The output will contain the smallest and largest times between start and stop recorded (minimum and maximum), | ||
| 136 | + * the total time recorded by the logger as well as the average and standard deviation of all the times recorded. The | ||
| 137 | + * frequency of log output can be set to high frequency (every 1 second) or low frequency (every 10 seconds). | ||
| 138 | + */ | ||
| 139 | +class LoggingController: public ConnectionTracker | ||
| 140 | +{ | ||
| 141 | + public: | ||
| 142 | + | ||
| 143 | + LoggingController( Application& application ) | ||
| 144 | + : mApplication( application ) | ||
| 145 | + { | ||
| 146 | + // Connect to the Application's Init signal | ||
| 147 | + mApplication.InitSignal().Connect( this, &LoggingController::Create ); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + ~LoggingController() | ||
| 151 | + { | ||
| 152 | + // Nothing to do here | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + void Create( Application& application ) | ||
| 156 | + { | ||
| 157 | + // The Init signal is received once (only) during the Application lifetime | ||
| 158 | + | ||
| 159 | + mCurrentLogger = 0; | ||
| 160 | + mPerformanceLoggers.reserve( NUM_LOGGERS ); | ||
| 161 | + mPerformanceLoggers.resize( NUM_LOGGERS ); | ||
| 162 | + | ||
| 163 | + mPerformanceLoggerNames.reserve( NUM_LOGGERS ); | ||
| 164 | + mPerformanceLoggerNames.resize( NUM_LOGGERS ); | ||
| 165 | + | ||
| 166 | + mLoggerStates.reserve( NUM_LOGGERS ); | ||
| 167 | + mLoggerStates.resize( NUM_LOGGERS ); | ||
| 168 | + | ||
| 169 | + mLogRadioButtons.reserve( NUM_LOGGERS ); | ||
| 170 | + mLogRadioButtons.resize( NUM_LOGGERS ); | ||
| 171 | + | ||
| 172 | + mFrequencyRadioButtons.reserve( NUM_FREQUENCIES ); | ||
| 173 | + mFrequencyRadioButtons.resize( NUM_FREQUENCIES ); | ||
| 174 | + | ||
| 175 | + // Respond to key events | ||
| 176 | + Stage::GetCurrent().KeyEventSignal().Connect(this, &LoggingController::OnKeyEvent); | ||
| 177 | + | ||
| 178 | + // Creates a default view with a default tool bar. | ||
| 179 | + // The view is added to the stage. | ||
| 180 | + mContentLayer = DemoHelper::CreateView( application, | ||
| 181 | + mView, | ||
| 182 | + mToolBar, | ||
| 183 | + BACKGROUND_IMAGE, | ||
| 184 | + TOOLBAR_IMAGE, | ||
| 185 | + TOOLBAR_TITLE ); | ||
| 186 | + | ||
| 187 | + Vector2 stageSize = Stage::GetCurrent().GetSize(); | ||
| 188 | + | ||
| 189 | + int yPos = TOP_MARGIN + MARGIN_SIZE; | ||
| 190 | + | ||
| 191 | + // Logger selector radio group | ||
| 192 | + Actor radioGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 193 | + radioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 194 | + radioGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 195 | + radioGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 196 | + radioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_RADIO_GROUP_HEIGHT) ); | ||
| 197 | + mContentLayer.Add( radioGroupBackground ); | ||
| 198 | + | ||
| 199 | + // Label | ||
| 200 | + { | ||
| 201 | + Toolkit::TextView label = Toolkit::TextView::New( LOGGER_TEXT ); | ||
| 202 | + label.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 203 | + label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 204 | + label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); | ||
| 205 | + | ||
| 206 | + radioGroupBackground.Add( label ); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + // Radio group | ||
| 210 | + Actor radioButtonsGroup = Actor::New(); | ||
| 211 | + radioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 212 | + radioButtonsGroup.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 213 | + radioButtonsGroup.SetPosition( DP(MARGIN_SIZE), 0 ); | ||
| 214 | + | ||
| 215 | + radioGroupBackground.Add( radioButtonsGroup ); | ||
| 216 | + | ||
| 217 | + int radioX = 0; | ||
| 218 | + int radioY = MARGIN_SIZE + 28; | ||
| 219 | + | ||
| 220 | + // Radio 1 | ||
| 221 | + { | ||
| 222 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New(); | ||
| 223 | + radioButton.SetName( LOGGER_1_RADIO_ID ); | ||
| 224 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 225 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 226 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 227 | + radioButton.SetActive( true ); | ||
| 228 | + | ||
| 229 | + radioButton.ToggledSignal().Connect( this, &LoggingController::LoggingRadioSelect ); | ||
| 230 | + | ||
| 231 | + radioButtonsGroup.Add( radioButton ); | ||
| 232 | + mLogRadioButtons[0] = radioButton; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + // Radio 2 | ||
| 236 | + { | ||
| 237 | + radioY += LOGGER_RADIO_SPACING; | ||
| 238 | + | ||
| 239 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New(); | ||
| 240 | + radioButton.SetName( LOGGER_2_RADIO_ID ); | ||
| 241 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 242 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 243 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 244 | + | ||
| 245 | + radioButton.ToggledSignal().Connect( this, &LoggingController::LoggingRadioSelect ); | ||
| 246 | + | ||
| 247 | + radioButtonsGroup.Add( radioButton ); | ||
| 248 | + mLogRadioButtons[1] = radioButton; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + // Radio 3 | ||
| 252 | + { | ||
| 253 | + radioY += LOGGER_RADIO_SPACING; | ||
| 254 | + | ||
| 255 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New(); | ||
| 256 | + radioButton.SetName( LOGGER_3_RADIO_ID ); | ||
| 257 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 258 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 259 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 260 | + | ||
| 261 | + radioButton.ToggledSignal().Connect( this, &LoggingController::LoggingRadioSelect ); | ||
| 262 | + | ||
| 263 | + radioButtonsGroup.Add( radioButton ); | ||
| 264 | + mLogRadioButtons[2] = radioButton; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + // Create/delete/disable group | ||
| 268 | + yPos += LOGGER_RADIO_GROUP_HEIGHT + MARGIN_SIZE; | ||
| 269 | + | ||
| 270 | + Actor createGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 271 | + createGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 272 | + createGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 273 | + createGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 274 | + createGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); | ||
| 275 | + mContentLayer.Add( createGroupBackground ); | ||
| 276 | + | ||
| 277 | + int buttonXDP = DP(MARGIN_SIZE); | ||
| 278 | + int buttonWidthDP = (createGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | ||
| 279 | + | ||
| 280 | + { | ||
| 281 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 282 | + button.SetName( CREATE_BUTTON_ID ); | ||
| 283 | + button.SetLabelText( CREATE_BUTTON_TEXT ); | ||
| 284 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 285 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 286 | + button.SetPosition( buttonXDP, 0 ); | ||
| 287 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 288 | + | ||
| 289 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 290 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 291 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 292 | + | ||
| 293 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 294 | + | ||
| 295 | + createGroupBackground.Add( button ); | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + { | ||
| 299 | + buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; | ||
| 300 | + | ||
| 301 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 302 | + button.SetName( DELETE_BUTTON_ID ); | ||
| 303 | + button.SetLabelText( DELETE_BUTTON_TEXT ); | ||
| 304 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 305 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 306 | + button.SetPosition( buttonXDP, 0 ); | ||
| 307 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 308 | + | ||
| 309 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 310 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 311 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 312 | + | ||
| 313 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 314 | + | ||
| 315 | + createGroupBackground.Add( button ); | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + // Start/stop group | ||
| 319 | + yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; | ||
| 320 | + | ||
| 321 | + Actor timingGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 322 | + timingGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 323 | + timingGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 324 | + timingGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 325 | + timingGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); | ||
| 326 | + mContentLayer.Add( timingGroupBackground ); | ||
| 327 | + | ||
| 328 | + buttonXDP = DP(MARGIN_SIZE); | ||
| 329 | + buttonWidthDP = (timingGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | ||
| 330 | + | ||
| 331 | + { | ||
| 332 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 333 | + button.SetName( START_BUTTON_ID ); | ||
| 334 | + button.SetLabelText( START_BUTTON_TEXT ); | ||
| 335 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 336 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 337 | + button.SetPosition( buttonXDP, 0 ); | ||
| 338 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 339 | + | ||
| 340 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 341 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 342 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 343 | + | ||
| 344 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 345 | + | ||
| 346 | + timingGroupBackground.Add( button ); | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + { | ||
| 350 | + buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; | ||
| 351 | + | ||
| 352 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 353 | + button.SetName( STOP_BUTTON_ID ); | ||
| 354 | + button.SetLabelText( STOP_BUTTON_TEXT ); | ||
| 355 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 356 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 357 | + button.SetPosition( buttonXDP, 0 ); | ||
| 358 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 359 | + | ||
| 360 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 361 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 362 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 363 | + | ||
| 364 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 365 | + | ||
| 366 | + timingGroupBackground.Add( button ); | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + // Enable/disable group | ||
| 370 | + yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; | ||
| 371 | + | ||
| 372 | + Actor enableGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 373 | + enableGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 374 | + enableGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 375 | + enableGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 376 | + enableGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); | ||
| 377 | + mContentLayer.Add( enableGroupBackground ); | ||
| 378 | + | ||
| 379 | + buttonXDP = DP(MARGIN_SIZE); | ||
| 380 | + buttonWidthDP = (enableGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | ||
| 381 | + | ||
| 382 | + { | ||
| 383 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 384 | + button.SetName( ENABLE_BUTTON_ID ); | ||
| 385 | + button.SetLabelText( ENABLE_BUTTON_TEXT ); | ||
| 386 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 387 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 388 | + button.SetPosition( buttonXDP, 0 ); | ||
| 389 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 390 | + | ||
| 391 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 392 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 393 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 394 | + | ||
| 395 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 396 | + | ||
| 397 | + enableGroupBackground.Add( button ); | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + { | ||
| 401 | + buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; | ||
| 402 | + | ||
| 403 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 404 | + button.SetName( DISABLE_BUTTON_ID ); | ||
| 405 | + button.SetLabelText( DISABLE_BUTTON_TEXT ); | ||
| 406 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 407 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 408 | + button.SetPosition( buttonXDP, 0 ); | ||
| 409 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 410 | + | ||
| 411 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 412 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 413 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 414 | + | ||
| 415 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 416 | + | ||
| 417 | + enableGroupBackground.Add( button ); | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; | ||
| 421 | + | ||
| 422 | + // Logger selector radio group | ||
| 423 | + unsigned int groupHeight = LOGGER_GROUP_HEIGHT + 30; | ||
| 424 | + | ||
| 425 | + Actor frequencyRadioGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 426 | + frequencyRadioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 427 | + frequencyRadioGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 428 | + frequencyRadioGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 429 | + frequencyRadioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(groupHeight) ); | ||
| 430 | + mContentLayer.Add( frequencyRadioGroupBackground ); | ||
| 431 | + | ||
| 432 | + // Label | ||
| 433 | + { | ||
| 434 | + Toolkit::TextView label = Toolkit::TextView::New( FREQUENCY_TEXT ); | ||
| 435 | + label.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 436 | + label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 437 | + label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); | ||
| 438 | + | ||
| 439 | + frequencyRadioGroupBackground.Add( label ); | ||
| 440 | + } | ||
| 441 | + | ||
| 442 | + // Radio group | ||
| 443 | + Actor frequencyRadioButtonsGroup = Actor::New(); | ||
| 444 | + frequencyRadioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 445 | + frequencyRadioButtonsGroup.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 446 | + frequencyRadioButtonsGroup.SetPosition( DP(MARGIN_SIZE), DP(40) ); | ||
| 447 | + | ||
| 448 | + frequencyRadioGroupBackground.Add( frequencyRadioButtonsGroup ); | ||
| 449 | + | ||
| 450 | + radioX = 0; | ||
| 451 | + radioY = 0; | ||
| 452 | + const int frequencyRadioWidth = 100; | ||
| 453 | + | ||
| 454 | + // Radio 1 | ||
| 455 | + { | ||
| 456 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_1_RADIO_TEXT ); | ||
| 457 | + radioButton.SetName( FREQUENCY_1_RADIO_ID ); | ||
| 458 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 459 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 460 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 461 | + | ||
| 462 | + radioButton.ToggledSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); | ||
| 463 | + | ||
| 464 | + frequencyRadioButtonsGroup.Add( radioButton ); | ||
| 465 | + mFrequencyRadioButtons[0] = radioButton; | ||
| 466 | + } | ||
| 467 | + | ||
| 468 | + // Radio 2 | ||
| 469 | + { | ||
| 470 | + radioX += frequencyRadioWidth; | ||
| 471 | + | ||
| 472 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT ); | ||
| 473 | + radioButton.SetName( FREQUENCY_2_RADIO_ID ); | ||
| 474 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 475 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 476 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 477 | + radioButton.SetActive( true ); | ||
| 478 | + | ||
| 479 | + radioButton.ToggledSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); | ||
| 480 | + | ||
| 481 | + frequencyRadioButtonsGroup.Add( radioButton ); | ||
| 482 | + mFrequencyRadioButtons[1] = radioButton; | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + // Radio 3 | ||
| 486 | + { | ||
| 487 | + radioX += frequencyRadioWidth; | ||
| 488 | + | ||
| 489 | + Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_3_RADIO_TEXT ); | ||
| 490 | + radioButton.SetName( FREQUENCY_3_RADIO_ID ); | ||
| 491 | + radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 492 | + radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 493 | + radioButton.SetPosition( DP(radioX), DP(radioY) ); | ||
| 494 | + | ||
| 495 | + radioButton.ToggledSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); | ||
| 496 | + | ||
| 497 | + frequencyRadioButtonsGroup.Add( radioButton ); | ||
| 498 | + mFrequencyRadioButtons[2] = radioButton; | ||
| 499 | + } | ||
| 500 | + | ||
| 501 | + // Vsync group | ||
| 502 | + yPos += groupHeight + MARGIN_SIZE; | ||
| 503 | + | ||
| 504 | + Actor vsyncGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); | ||
| 505 | + vsyncGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 506 | + vsyncGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 507 | + vsyncGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | ||
| 508 | + vsyncGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); | ||
| 509 | + mContentLayer.Add( vsyncGroupBackground ); | ||
| 510 | + | ||
| 511 | + buttonXDP = DP(MARGIN_SIZE); | ||
| 512 | + buttonWidthDP = vsyncGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 2; | ||
| 513 | + | ||
| 514 | + { | ||
| 515 | + Toolkit::PushButton button = Toolkit::PushButton::New(); | ||
| 516 | + button.SetName( VSYNC_BUTTON_ID ); | ||
| 517 | + button.SetLabelText( VSYNC_BUTTON_TEXT ); | ||
| 518 | + button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 519 | + button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 520 | + button.SetPosition( buttonXDP, 0 ); | ||
| 521 | + button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); | ||
| 522 | + | ||
| 523 | + button.SetPressedImage( Dali::Image::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 524 | + button.SetButtonImage( Dali::Image::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 525 | + button.SetDimmedImage( Dali::Image::New( PUSHBUTTON_DIM_IMAGE ) ); | ||
| 526 | + | ||
| 527 | + button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); | ||
| 528 | + | ||
| 529 | + vsyncGroupBackground.Add( button ); | ||
| 530 | + } | ||
| 531 | + | ||
| 532 | + WriteConsole(); | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + void WriteConsole() | ||
| 536 | + { | ||
| 537 | + for( unsigned int i = 0; i < NUM_LOGGERS; ++i) | ||
| 538 | + { | ||
| 539 | + std::stringstream ss; | ||
| 540 | + ss << (i + 1) << ") " << ((mPerformanceLoggers[i]) ? "Created" : "Deleted") | ||
| 541 | + << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped") | ||
| 542 | + << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled"); | ||
| 543 | + | ||
| 544 | + Dali::TextStyle textStyle; | ||
| 545 | + textStyle.SetFontName( "HelveticaNue" ); | ||
| 546 | + textStyle.SetFontStyle( "Regular" ); | ||
| 547 | + textStyle.SetFontPointSize( Dali::PointSize( DemoHelper::ScalePointSize( 7.0f ) ) ); | ||
| 548 | + textStyle.SetWeight( Dali::TextStyle::REGULAR ); | ||
| 549 | + | ||
| 550 | + Toolkit::TextView textView = Toolkit::TextView::New( ss.str() ); | ||
| 551 | + textView.SetStyleToCurrentText( textStyle ); | ||
| 552 | + | ||
| 553 | + mLogRadioButtons[i].SetLabel( textView ); | ||
| 554 | + } | ||
| 555 | + } | ||
| 556 | + | ||
| 557 | + bool LoggingRadioSelect( Toolkit::Button button, bool state ) | ||
| 558 | + { | ||
| 559 | + if( button.GetName() == LOGGER_1_RADIO_ID && state == true ) | ||
| 560 | + { | ||
| 561 | + mCurrentLogger = 0; | ||
| 562 | + } | ||
| 563 | + else if( button.GetName() == LOGGER_2_RADIO_ID && state == true ) | ||
| 564 | + { | ||
| 565 | + mCurrentLogger = 1; | ||
| 566 | + } | ||
| 567 | + else if( button.GetName() == LOGGER_3_RADIO_ID && state == true ) | ||
| 568 | + { | ||
| 569 | + mCurrentLogger = 2; | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + UpdateState(); | ||
| 573 | + | ||
| 574 | + return true; | ||
| 575 | + } | ||
| 576 | + | ||
| 577 | + void UpdateState() | ||
| 578 | + { | ||
| 579 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 580 | + const unsigned int frequency = mLoggerStates[mCurrentLogger].frequency; | ||
| 581 | + if( frequency == HIGH_FREQUENCY ) | ||
| 582 | + { | ||
| 583 | + mFrequencyRadioButtons[0].SetActive( true ); | ||
| 584 | + } | ||
| 585 | + else if( frequency == MEDIUM_FREQUENCY ) | ||
| 586 | + { | ||
| 587 | + mFrequencyRadioButtons[1].SetActive( true ); | ||
| 588 | + } | ||
| 589 | + else if( frequency == LOW_FREQUENCY ) | ||
| 590 | + { | ||
| 591 | + mFrequencyRadioButtons[2].SetActive( true ); | ||
| 592 | + } | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + bool FrequencyRadioSelect( Toolkit::Button button, bool state ) | ||
| 596 | + { | ||
| 597 | + if( button.GetName() == FREQUENCY_1_RADIO_ID && state == true ) | ||
| 598 | + { | ||
| 599 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 600 | + { | ||
| 601 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 602 | + mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( HIGH_FREQUENCY ); | ||
| 603 | + | ||
| 604 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 605 | + mLoggerStates[mCurrentLogger].frequency = HIGH_FREQUENCY; | ||
| 606 | + } | ||
| 607 | + } | ||
| 608 | + else if( button.GetName() == FREQUENCY_2_RADIO_ID && state == true ) | ||
| 609 | + { | ||
| 610 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 611 | + { | ||
| 612 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 613 | + mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( MEDIUM_FREQUENCY ); | ||
| 614 | + | ||
| 615 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 616 | + mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY; | ||
| 617 | + } | ||
| 618 | + } | ||
| 619 | + else if( button.GetName() == FREQUENCY_3_RADIO_ID && state == true ) | ||
| 620 | + { | ||
| 621 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 622 | + { | ||
| 623 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 624 | + mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( LOW_FREQUENCY ); | ||
| 625 | + | ||
| 626 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 627 | + mLoggerStates[mCurrentLogger].frequency = LOW_FREQUENCY; | ||
| 628 | + } | ||
| 629 | + } | ||
| 630 | + | ||
| 631 | + return true; | ||
| 632 | + } | ||
| 633 | + | ||
| 634 | + void OnKeyEvent( const KeyEvent& event ) | ||
| 635 | + { | ||
| 636 | + if( event.state == KeyEvent::Down ) | ||
| 637 | + { | ||
| 638 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | ||
| 639 | + { | ||
| 640 | + // Exit application when click back or escape. | ||
| 641 | + mApplication.Quit(); | ||
| 642 | + } | ||
| 643 | + } | ||
| 644 | + } | ||
| 645 | + | ||
| 646 | + bool OnButtonClicked(Toolkit::Button button) | ||
| 647 | + { | ||
| 648 | + if( button.GetName() == CREATE_BUTTON_ID ) | ||
| 649 | + { | ||
| 650 | + std::stringstream ss; | ||
| 651 | + ss << "Test logger " << (mCurrentLogger + 1); | ||
| 652 | + | ||
| 653 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggerNames.size() ); | ||
| 654 | + mPerformanceLoggerNames[mCurrentLogger] = ss.str(); | ||
| 655 | + | ||
| 656 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 657 | + mPerformanceLoggers[mCurrentLogger] = Dali::PerformanceLogger::New( mPerformanceLoggerNames[mCurrentLogger].c_str() ); | ||
| 658 | + | ||
| 659 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 660 | + mLoggerStates[mCurrentLogger].isTiming = false; | ||
| 661 | + mLoggerStates[mCurrentLogger].isEnabled = true; | ||
| 662 | + mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY; | ||
| 663 | + | ||
| 664 | + UpdateState(); | ||
| 665 | + } | ||
| 666 | + else if ( button.GetName() == DELETE_BUTTON_ID ) | ||
| 667 | + { | ||
| 668 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 669 | + mPerformanceLoggers[mCurrentLogger].Reset(); | ||
| 670 | + | ||
| 671 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 672 | + mLoggerStates[mCurrentLogger].isTiming = false; | ||
| 673 | + mLoggerStates[mCurrentLogger].isEnabled = true; | ||
| 674 | + mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY; | ||
| 675 | + | ||
| 676 | + UpdateState(); | ||
| 677 | + } | ||
| 678 | + else if ( button.GetName() == START_BUTTON_ID ) | ||
| 679 | + { | ||
| 680 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 681 | + { | ||
| 682 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 683 | + mPerformanceLoggers[mCurrentLogger].AddMarker( Dali::PerformanceLogger::START_EVENT ); | ||
| 684 | + | ||
| 685 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 686 | + mLoggerStates[mCurrentLogger].isTiming = true; | ||
| 687 | + } | ||
| 688 | + } | ||
| 689 | + else if ( button.GetName() == STOP_BUTTON_ID ) | ||
| 690 | + { | ||
| 691 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 692 | + { | ||
| 693 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 694 | + mPerformanceLoggers[mCurrentLogger].AddMarker( Dali::PerformanceLogger::END_EVENT ); | ||
| 695 | + | ||
| 696 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 697 | + mLoggerStates[mCurrentLogger].isTiming = false; | ||
| 698 | + } | ||
| 699 | + } | ||
| 700 | + else if ( button.GetName() == ENABLE_BUTTON_ID ) | ||
| 701 | + { | ||
| 702 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 703 | + { | ||
| 704 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 705 | + mPerformanceLoggers[mCurrentLogger].EnableLogging( true ); | ||
| 706 | + | ||
| 707 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 708 | + mLoggerStates[mCurrentLogger].isEnabled = true; | ||
| 709 | + } | ||
| 710 | + } | ||
| 711 | + else if ( button.GetName() == DISABLE_BUTTON_ID ) | ||
| 712 | + { | ||
| 713 | + if( mPerformanceLoggers[mCurrentLogger] ) | ||
| 714 | + { | ||
| 715 | + DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() ); | ||
| 716 | + mPerformanceLoggers[mCurrentLogger].EnableLogging( false ); | ||
| 717 | + | ||
| 718 | + DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() ); | ||
| 719 | + mLoggerStates[mCurrentLogger].isEnabled = false; | ||
| 720 | + } | ||
| 721 | + } | ||
| 722 | + | ||
| 723 | + WriteConsole(); | ||
| 724 | + | ||
| 725 | + return true; | ||
| 726 | + } | ||
| 727 | + | ||
| 728 | + private: | ||
| 729 | + | ||
| 730 | + struct LoggerState | ||
| 731 | + { | ||
| 732 | + LoggerState() : frequency( 0 ), isTiming( false ), isEnabled( true ) {} | ||
| 733 | + | ||
| 734 | + unsigned int frequency; | ||
| 735 | + bool isTiming; | ||
| 736 | + bool isEnabled; | ||
| 737 | + }; | ||
| 738 | + | ||
| 739 | + Application& mApplication; | ||
| 740 | + Toolkit::View mView; ///< The View instance. | ||
| 741 | + Toolkit::ToolBar mToolBar; ///< The View's Toolbar. | ||
| 742 | + Layer mContentLayer; ///< Content layer | ||
| 743 | + | ||
| 744 | + typedef std::vector< std::string > Strings; | ||
| 745 | + Strings mPerformanceLoggerNames; | ||
| 746 | + | ||
| 747 | + typedef std::vector< Dali::PerformanceLogger > PerformanceLoggers; | ||
| 748 | + PerformanceLoggers mPerformanceLoggers; | ||
| 749 | + unsigned int mCurrentLogger; | ||
| 750 | + | ||
| 751 | + typedef std::vector< LoggerState > LoggerStates; | ||
| 752 | + LoggerStates mLoggerStates; | ||
| 753 | + | ||
| 754 | + typedef std::vector< Toolkit::RadioButton > RadioButtons; | ||
| 755 | + RadioButtons mLogRadioButtons; | ||
| 756 | + RadioButtons mFrequencyRadioButtons; | ||
| 757 | +}; | ||
| 758 | + | ||
| 759 | +void RunTest( Application& application ) | ||
| 760 | +{ | ||
| 761 | + LoggingController test( application ); | ||
| 762 | + | ||
| 763 | + application.MainLoop(); | ||
| 764 | +} | ||
| 765 | + | ||
| 766 | +// Entry point for Linux & SLP applications | ||
| 767 | +// | ||
| 768 | +int main( int argc, char **argv ) | ||
| 769 | +{ | ||
| 770 | + Application application = Application::New( &argc, &argv ); | ||
| 771 | + | ||
| 772 | + RunTest( application ); | ||
| 773 | + | ||
| 774 | + return 0; | ||
| 775 | +} |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.0.21 | 5 | +Version: 1.0.22 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |