Commit a7582fe700df6d6b1ffff62ce485ebef3649ca6a
1 parent
99e4d9f4
Remove some dead code from dali-demo
Change-Id: Ia265405b98d66d6c45fcff7d157a62c45b93b198
Showing
2 changed files
with
21 additions
and
69 deletions
demo/dali-table-view.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -37,15 +37,8 @@ using namespace Dali::Toolkit; | @@ -37,15 +37,8 @@ using namespace Dali::Toolkit; | ||
| 37 | namespace | 37 | namespace |
| 38 | { | 38 | { |
| 39 | 39 | ||
| 40 | -const std::string BUTTON_BACKWARD( "Backward" ); | ||
| 41 | -const std::string BUTTON_FORWARD( "Forward" ); | ||
| 42 | -const std::string BUTTON_QUIT( "Quit" ); | ||
| 43 | -const std::string BUTTON_OK( "Ok" ); | ||
| 44 | -const std::string BUTTON_CANCEL( "Cancel" ); | ||
| 45 | - | ||
| 46 | const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" ); | 40 | const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" ); |
| 47 | const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" ); | 41 | const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" ); |
| 48 | -const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png"); | ||
| 49 | const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png"); | 42 | const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png"); |
| 50 | const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.png"); | 43 | const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.png"); |
| 51 | 44 | ||
| @@ -165,18 +158,13 @@ DaliTableView::DaliTableView( Application& application ) | @@ -165,18 +158,13 @@ DaliTableView::DaliTableView( Application& application ) | ||
| 165 | mScrollViewEffect(), | 158 | mScrollViewEffect(), |
| 166 | mScrollRulerX(), | 159 | mScrollRulerX(), |
| 167 | mScrollRulerY(), | 160 | mScrollRulerY(), |
| 168 | - mButtons(), | ||
| 169 | mPressedActor(), | 161 | mPressedActor(), |
| 170 | mAnimationTimer(), | 162 | mAnimationTimer(), |
| 171 | mLogoTapDetector(), | 163 | mLogoTapDetector(), |
| 172 | mVersionPopup(), | 164 | mVersionPopup(), |
| 173 | - mButtonsPageRelativeSize(), | ||
| 174 | mPages(), | 165 | mPages(), |
| 175 | - mTableViewImages(), | ||
| 176 | - mBackgroundActors(), | ||
| 177 | mBackgroundAnimations(), | 166 | mBackgroundAnimations(), |
| 178 | mExampleList(), | 167 | mExampleList(), |
| 179 | - mExampleMap(), | ||
| 180 | mTotalPages(), | 168 | mTotalPages(), |
| 181 | mScrolling( false ), | 169 | mScrolling( false ), |
| 182 | mSortAlphabetically( false ), | 170 | mSortAlphabetically( false ), |
| @@ -192,7 +180,6 @@ DaliTableView::~DaliTableView() | @@ -192,7 +180,6 @@ DaliTableView::~DaliTableView() | ||
| 192 | void DaliTableView::AddExample( Example example ) | 180 | void DaliTableView::AddExample( Example example ) |
| 193 | { | 181 | { |
| 194 | mExampleList.push_back( example ); | 182 | mExampleList.push_back( example ); |
| 195 | - mExampleMap[ example.name ] = example; | ||
| 196 | } | 183 | } |
| 197 | 184 | ||
| 198 | void DaliTableView::SortAlphabetically( bool sortAlphabetically ) | 185 | void DaliTableView::SortAlphabetically( bool sortAlphabetically ) |
| @@ -372,8 +359,8 @@ void DaliTableView::Populate() | @@ -372,8 +359,8 @@ void DaliTableView::Populate() | ||
| 372 | 359 | ||
| 373 | for( int t = 0; t < mTotalPages; t++ ) | 360 | for( int t = 0; t < mTotalPages; t++ ) |
| 374 | { | 361 | { |
| 375 | - // Create Table. (contains up to 9 Examples) | ||
| 376 | - TableView page = TableView::New( 3, 3 ); | 362 | + // Create Table |
| 363 | + TableView page = TableView::New( ROWS_PER_PAGE, EXAMPLES_PER_ROW ); | ||
| 377 | page.SetAnchorPoint( AnchorPoint::CENTER ); | 364 | page.SetAnchorPoint( AnchorPoint::CENTER ); |
| 378 | page.SetParentOrigin( ParentOrigin::CENTER ); | 365 | page.SetParentOrigin( ParentOrigin::CENTER ); |
| 379 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 366 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| @@ -551,18 +538,19 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | @@ -551,18 +538,19 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | ||
| 551 | if( ( TouchPoint::Up == point.state ) && | 538 | if( ( TouchPoint::Up == point.state ) && |
| 552 | ( mPressedActor == actor ) ) | 539 | ( mPressedActor == actor ) ) |
| 553 | { | 540 | { |
| 554 | - std::string name = actor.GetName(); | ||
| 555 | - ExampleMapConstIter iter = mExampleMap.find( name ); | ||
| 556 | - | ||
| 557 | - AccessibilityManager accessibilityManager = AccessibilityManager::Get(); | ||
| 558 | - | ||
| 559 | - if( iter != mExampleMap.end() ) | 541 | + // ignore Example button presses when scrolling or button animating. |
| 542 | + if( ( !mScrolling ) && ( !mPressedAnimation ) ) | ||
| 560 | { | 543 | { |
| 561 | - // ignore Example button presses when scrolling or button animating. | ||
| 562 | - if( ( !mScrolling ) && ( !mPressedAnimation ) ) | 544 | + std::string name = actor.GetName(); |
| 545 | + const ExampleListIter end = mExampleList.end(); | ||
| 546 | + for( ExampleListIter iter = mExampleList.begin(); iter != end; ++iter ) | ||
| 563 | { | 547 | { |
| 564 | - // do nothing, until pressed animation finished. | ||
| 565 | - consumed = true; | 548 | + if( (*iter).name == name ) |
| 549 | + { | ||
| 550 | + // do nothing, until pressed animation finished. | ||
| 551 | + consumed = true; | ||
| 552 | + break; | ||
| 553 | + } | ||
| 566 | } | 554 | } |
| 567 | } | 555 | } |
| 568 | 556 | ||
| @@ -590,32 +578,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) | @@ -590,32 +578,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) | ||
| 590 | if( mPressedActor ) | 578 | if( mPressedActor ) |
| 591 | { | 579 | { |
| 592 | std::string name = mPressedActor.GetName(); | 580 | std::string name = mPressedActor.GetName(); |
| 593 | - ExampleMapConstIter iter = mExampleMap.find( name ); | ||
| 594 | 581 | ||
| 595 | - if( iter == mExampleMap.end() ) | 582 | + std::stringstream stream; |
| 583 | + stream << DALI_EXAMPLE_BIN << name.c_str(); | ||
| 584 | + pid_t pid = fork(); | ||
| 585 | + if( pid == 0) | ||
| 596 | { | 586 | { |
| 597 | - if( name == BUTTON_QUIT ) | ||
| 598 | - { | ||
| 599 | - // Move focus to the OK button | ||
| 600 | - AccessibilityManager accessibilityManager = AccessibilityManager::Get(); | ||
| 601 | - | ||
| 602 | - // Enable the group mode and wrap mode | ||
| 603 | - accessibilityManager.SetGroupMode( true ); | ||
| 604 | - accessibilityManager.SetWrapMode( true ); | ||
| 605 | - } | ||
| 606 | - } | ||
| 607 | - else | ||
| 608 | - { | ||
| 609 | - const Example& example( iter->second ); | ||
| 610 | - | ||
| 611 | - std::stringstream stream; | ||
| 612 | - stream << DALI_EXAMPLE_BIN << example.name.c_str(); | ||
| 613 | - pid_t pid = fork(); | ||
| 614 | - if( pid == 0) | ||
| 615 | - { | ||
| 616 | - execlp( stream.str().c_str(), example.name.c_str(), NULL ); | ||
| 617 | - DALI_ASSERT_ALWAYS(false && "exec failed!"); | ||
| 618 | - } | 587 | + execlp( stream.str().c_str(), name.c_str(), NULL ); |
| 588 | + DALI_ASSERT_ALWAYS(false && "exec failed!"); | ||
| 619 | } | 589 | } |
| 620 | mPressedActor.Reset(); | 590 | mPressedActor.Reset(); |
| 621 | } | 591 | } |
demo/dali-table-view.h
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | #define __DALI_DEMO_H__ | 2 | #define __DALI_DEMO_H__ |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 5 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. |
| 6 | * | 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. | 8 | * you may not use this file except in compliance with the License. |
| @@ -18,8 +18,6 @@ | @@ -18,8 +18,6 @@ | ||
| 18 | * | 18 | * |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -#include <map> | ||
| 22 | - | ||
| 23 | #include <dali/dali.h> | 21 | #include <dali/dali.h> |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 22 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | #include <dali-toolkit/devel-api/controls/popup/popup.h> | 23 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| @@ -27,19 +25,8 @@ | @@ -27,19 +25,8 @@ | ||
| 27 | class Example; | 25 | class Example; |
| 28 | 26 | ||
| 29 | typedef std::vector<Example> ExampleList; | 27 | typedef std::vector<Example> ExampleList; |
| 30 | -typedef std::map<std::string,Example> ExampleMap; | ||
| 31 | typedef ExampleList::iterator ExampleListIter; | 28 | typedef ExampleList::iterator ExampleListIter; |
| 32 | typedef ExampleList::const_iterator ExampleListConstIter; | 29 | typedef ExampleList::const_iterator ExampleListConstIter; |
| 33 | -typedef ExampleMap::iterator ExampleMapIter; | ||
| 34 | -typedef ExampleMap::const_iterator ExampleMapConstIter; | ||
| 35 | - | ||
| 36 | -typedef std::vector<Dali::Toolkit::TableView> TableViewList; | ||
| 37 | -typedef TableViewList::iterator TableViewListIter; | ||
| 38 | -typedef TableViewList::const_iterator TableViewListConstIter; | ||
| 39 | - | ||
| 40 | -typedef std::vector<Dali::ImageActor> ImageActorList; | ||
| 41 | -typedef ImageActorList::iterator ImageActorListIter; | ||
| 42 | -typedef ImageActorList::const_iterator ImageActorListConstIter; | ||
| 43 | 30 | ||
| 44 | typedef std::vector<Dali::Animation> AnimationList; | 31 | typedef std::vector<Dali::Animation> AnimationList; |
| 45 | typedef AnimationList::iterator AnimationListIter; | 32 | typedef AnimationList::iterator AnimationListIter; |
| @@ -384,19 +371,14 @@ private: | @@ -384,19 +371,14 @@ private: | ||
| 384 | Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view | 371 | Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view |
| 385 | Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler | 372 | Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler |
| 386 | Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler | 373 | Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler |
| 387 | - Dali::Toolkit::TableView mButtons; ///< Navigation buttons | ||
| 388 | Dali::Actor mPressedActor; ///< The currently pressed actor. | 374 | Dali::Actor mPressedActor; ///< The currently pressed actor. |
| 389 | Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period | 375 | Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period |
| 390 | Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo | 376 | Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo |
| 391 | Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information | 377 | Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information |
| 392 | - Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size | ||
| 393 | 378 | ||
| 394 | std::vector< Dali::Actor > mPages; ///< List of pages. | 379 | std::vector< Dali::Actor > mPages; ///< List of pages. |
| 395 | - std::vector< Dali::Actor > mTableViewImages; ///< Offscreen render of tableview | ||
| 396 | - std::vector< Dali::Actor > mBackgroundActors; ///< List of background actors used in the effect | ||
| 397 | AnimationList mBackgroundAnimations; ///< List of background bubble animations | 380 | AnimationList mBackgroundAnimations; ///< List of background bubble animations |
| 398 | ExampleList mExampleList; ///< List of examples. | 381 | ExampleList mExampleList; ///< List of examples. |
| 399 | - ExampleMap mExampleMap; ///< Map LUT for examples. | ||
| 400 | 382 | ||
| 401 | int mTotalPages; ///< Total pages within scrollview. | 383 | int mTotalPages; ///< Total pages within scrollview. |
| 402 | 384 |