Commit 805eddb2272e1de3090cc1bef1fb61548b5f45b4

Authored by David Steele
Committed by Adeel Kazmi
1 parent 918bdcfc

Added command line handling to pass URL to demo

Change-Id: I40f9d020a7907f61ab1ce8d8334cbd984ba6a671
Signed-off-by: David Steele <david.steele@samsung.com>
examples/image-view-url/image-view-url-example.cpp
... ... @@ -57,8 +57,9 @@ const Vector2 TARGET_SIZE(800.f, 800.f);
57 57 class ImageViewUrlApp : public ConnectionTracker
58 58 {
59 59 public:
60   - ImageViewUrlApp( Application& application )
  60 + ImageViewUrlApp( Application& application, std::string url )
61 61 : mApplication( application ),
  62 + mUrl( url ),
62 63 mDeltaPropertyIndex( Property::INVALID_INDEX )
63 64 {
64 65 // Connect to the Application's Init signal
... ... @@ -95,11 +96,17 @@ private:
95 96 Toolkit::Alignment::HorizontalRight,
96 97 DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
97 98  
98   - CreateRenderTask( );
  99 + std::string url = mUrl;
  100 + if( url.empty() )
  101 + {
  102 + url = BIG_TEST_IMAGE;
  103 + }
  104 +
  105 + CreateRenderTask( url );
99 106 CreateScene( );
100 107 }
101 108  
102   - void CreateRenderTask()
  109 + void CreateRenderTask( const std::string& url )
103 110 {
104 111 auto rootActor = Stage::GetCurrent().GetRootLayer();
105 112  
... ... @@ -110,7 +117,7 @@ private:
110 117  
111 118 {
112 119 // create actor to render input with applied shader
113   - mActorForInput = Toolkit::ImageView::New(BIG_TEST_IMAGE);
  120 + mActorForInput = Toolkit::ImageView::New( url );
114 121 mActorForInput.SetParentOrigin(ParentOrigin::CENTER);
115 122 mActorForInput.SetSize(TARGET_SIZE);
116 123 Property::Map customShader;
... ... @@ -191,6 +198,7 @@ private:
191 198  
192 199 private:
193 200 Application& mApplication;
  201 + std::string mUrl;
194 202 Layer mContent;
195 203 Toolkit::ImageView mImageView;
196 204 Animation mAnimation;
... ... @@ -202,7 +210,14 @@ private:
202 210 int DALI_EXPORT_API main( int argc, char **argv )
203 211 {
204 212 Application application = Application::New( &argc, &argv );
205   - ImageViewUrlApp test( application );
  213 +
  214 + std::string url;
  215 + if( argc > 1 )
  216 + {
  217 + url = argv[1];
  218 + }
  219 +
  220 + ImageViewUrlApp test( application, url );
206 221 application.MainLoop();
207 222 return 0;
208 223 }
... ...