Arrange code
[apps/osp/Gallery.git] / src / GlProgressBar.cpp
index 426d2ab..0e40399 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -33,15 +33,17 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 
-GlProgressBar::GlProgressBar(IActionEventListener* listener)
+GlProgressBar::GlProgressBar(IActionEventListener* listener, IPropagatedKeyEventListener* propagatedListener)
        : __totalVal(1)
        , __curVal(1)
        , __pFileProgressingPopup(null)
        , __pFileProgressingProgress(null)
        , __pFileProgressingHeaderLabel(null)
        , __pFileProgressingLabel(null)
+       , __pFileCounterLabel(null)
        , __pFileProgressingCancelButton(null)
        , __pActionListener(listener)
+       , __pPropagatedListener(propagatedListener)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -80,6 +82,9 @@ GlProgressBar::CreateFileProgressingPopup(void)
 
        if (__pFileProgressingPopup != null && r == E_SUCCESS)
        {
+
+               __pFileProgressingPopup->SetPropagatedKeyEventListener(__pPropagatedListener);
+
                __pFileProgressingCancelButton = static_cast<Button*>(__pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
 
                if (__pFileProgressingCancelButton != null)
@@ -112,6 +117,16 @@ GlProgressBar::CreateFileProgressingPopup(void)
                        __pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
                        __pFileProgressingLabel->SetShowState(true);
                }
+
+               __pFileCounterLabel = static_cast<Label*>(__pFileProgressingPopup->GetControl(L"IDC_COUNTER_LABEL", true));
+
+               if (__pFileCounterLabel != null)
+               {
+                       __pFileCounterLabel->SetText(L"");
+                       __pFileCounterLabel->SetTextColor(CUSTOM_COLOR_GREY);
+                       __pFileCounterLabel->SetShowState(true);
+               }
+
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
        return r;
@@ -172,8 +187,20 @@ void
 GlProgressBar::IncProgress(const int count)
 {
        AppLogDebug("ENTER");
+       String counter;
        __curVal = count;
        __pFileProgressingProgress->SetValue(count);
+
+       counter.Append(count);
+       counter.Append(L"/");
+       counter.Append(__totalVal);
+
+       if (__pFileCounterLabel != null)
+       {
+               __pFileCounterLabel->SetText(counter);
+               __pFileCounterLabel->Invalidate(true);
+       }
+
        __pFileProgressingPopup->SetShowState(true);
        __pFileProgressingPopup->Show();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));