From a7582fe700df6d6b1ffff62ce485ebef3649ca6a Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Mon, 12 Oct 2015 13:26:19 +0100 Subject: [PATCH] Remove some dead code from dali-demo --- demo/dali-table-view.cpp | 70 ++++++++++++++++++++-------------------------------------------------- demo/dali-table-view.h | 20 +------------------- 2 files changed, 21 insertions(+), 69 deletions(-) diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 13c895e..92f75e9 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,15 +37,8 @@ using namespace Dali::Toolkit; namespace { -const std::string BUTTON_BACKWARD( "Backward" ); -const std::string BUTTON_FORWARD( "Forward" ); -const std::string BUTTON_QUIT( "Quit" ); -const std::string BUTTON_OK( "Ok" ); -const std::string BUTTON_CANCEL( "Cancel" ); - const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" ); const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" ); -const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png"); const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png"); const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.png"); @@ -165,18 +158,13 @@ DaliTableView::DaliTableView( Application& application ) mScrollViewEffect(), mScrollRulerX(), mScrollRulerY(), - mButtons(), mPressedActor(), mAnimationTimer(), mLogoTapDetector(), mVersionPopup(), - mButtonsPageRelativeSize(), mPages(), - mTableViewImages(), - mBackgroundActors(), mBackgroundAnimations(), mExampleList(), - mExampleMap(), mTotalPages(), mScrolling( false ), mSortAlphabetically( false ), @@ -192,7 +180,6 @@ DaliTableView::~DaliTableView() void DaliTableView::AddExample( Example example ) { mExampleList.push_back( example ); - mExampleMap[ example.name ] = example; } void DaliTableView::SortAlphabetically( bool sortAlphabetically ) @@ -372,8 +359,8 @@ void DaliTableView::Populate() for( int t = 0; t < mTotalPages; t++ ) { - // Create Table. (contains up to 9 Examples) - TableView page = TableView::New( 3, 3 ); + // Create Table + TableView page = TableView::New( ROWS_PER_PAGE, EXAMPLES_PER_ROW ); page.SetAnchorPoint( AnchorPoint::CENTER ); page.SetParentOrigin( ParentOrigin::CENTER ); page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); @@ -551,18 +538,19 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) if( ( TouchPoint::Up == point.state ) && ( mPressedActor == actor ) ) { - std::string name = actor.GetName(); - ExampleMapConstIter iter = mExampleMap.find( name ); - - AccessibilityManager accessibilityManager = AccessibilityManager::Get(); - - if( iter != mExampleMap.end() ) + // ignore Example button presses when scrolling or button animating. + if( ( !mScrolling ) && ( !mPressedAnimation ) ) { - // ignore Example button presses when scrolling or button animating. - if( ( !mScrolling ) && ( !mPressedAnimation ) ) + std::string name = actor.GetName(); + const ExampleListIter end = mExampleList.end(); + for( ExampleListIter iter = mExampleList.begin(); iter != end; ++iter ) { - // do nothing, until pressed animation finished. - consumed = true; + if( (*iter).name == name ) + { + // do nothing, until pressed animation finished. + consumed = true; + break; + } } } @@ -590,32 +578,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) if( mPressedActor ) { std::string name = mPressedActor.GetName(); - ExampleMapConstIter iter = mExampleMap.find( name ); - if( iter == mExampleMap.end() ) + std::stringstream stream; + stream << DALI_EXAMPLE_BIN << name.c_str(); + pid_t pid = fork(); + if( pid == 0) { - if( name == BUTTON_QUIT ) - { - // Move focus to the OK button - AccessibilityManager accessibilityManager = AccessibilityManager::Get(); - - // Enable the group mode and wrap mode - accessibilityManager.SetGroupMode( true ); - accessibilityManager.SetWrapMode( true ); - } - } - else - { - const Example& example( iter->second ); - - std::stringstream stream; - stream << DALI_EXAMPLE_BIN << example.name.c_str(); - pid_t pid = fork(); - if( pid == 0) - { - execlp( stream.str().c_str(), example.name.c_str(), NULL ); - DALI_ASSERT_ALWAYS(false && "exec failed!"); - } + execlp( stream.str().c_str(), name.c_str(), NULL ); + DALI_ASSERT_ALWAYS(false && "exec failed!"); } mPressedActor.Reset(); } diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 9db332d..33c0e9b 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -2,7 +2,7 @@ #define __DALI_DEMO_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,6 @@ * */ -#include - #include #include #include @@ -27,19 +25,8 @@ class Example; typedef std::vector ExampleList; -typedef std::map ExampleMap; typedef ExampleList::iterator ExampleListIter; typedef ExampleList::const_iterator ExampleListConstIter; -typedef ExampleMap::iterator ExampleMapIter; -typedef ExampleMap::const_iterator ExampleMapConstIter; - -typedef std::vector TableViewList; -typedef TableViewList::iterator TableViewListIter; -typedef TableViewList::const_iterator TableViewListConstIter; - -typedef std::vector ImageActorList; -typedef ImageActorList::iterator ImageActorListIter; -typedef ImageActorList::const_iterator ImageActorListConstIter; typedef std::vector AnimationList; typedef AnimationList::iterator AnimationListIter; @@ -384,19 +371,14 @@ private: Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler - Dali::Toolkit::TableView mButtons; ///< Navigation buttons Dali::Actor mPressedActor; ///< The currently pressed actor. Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information - Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size std::vector< Dali::Actor > mPages; ///< List of pages. - std::vector< Dali::Actor > mTableViewImages; ///< Offscreen render of tableview - std::vector< Dali::Actor > mBackgroundActors; ///< List of background actors used in the effect AnimationList mBackgroundAnimations; ///< List of background bubble animations ExampleList mExampleList; ///< List of examples. - ExampleMap mExampleMap; ///< Map LUT for examples. int mTotalPages; ///< Total pages within scrollview. -- libgit2 0.21.4