2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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
8 // http://floralicense.org/license/
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.
18 * @file GlProgressBar.cpp
19 * @brief This is the implementation file for GlProgressBar class.
25 #include "GlProgressBar.h"
26 #include "GlResourceManager.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Runtime;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
36 GlProgressBar::GlProgressBar(IActionEventListener* listener)
39 , __pFileProgressingPopup(null)
40 , __pFileProgressingProgress(null)
41 , __pFileProgressingHeaderLabel(null)
42 , __pFileProgressingLabel(null)
43 , __pFileCounterLabel(null)
44 , __pFileProgressingCancelButton(null)
45 , __pActionListener(listener)
48 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
51 GlProgressBar::~GlProgressBar(void)
54 if (__pFileProgressingPopup != null)
56 delete __pFileProgressingPopup;
58 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
62 GlProgressBar::HideFileProgressingPopup(void)
65 if (__pFileProgressingPopup != null && __pFileProgressingPopup->IsVisible())
67 __pFileProgressingPopup->SetShowState(false);
69 delete __pFileProgressingPopup;
70 __pFileProgressingPopup = null;
72 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
76 GlProgressBar::CreateFileProgressingPopup(void)
79 __pFileProgressingPopup = new (std::nothrow) Popup();
80 result r = __pFileProgressingPopup->Construct(L"IDL_DEL_PROGRESSING_POPUP");
82 if (__pFileProgressingPopup != null && r == E_SUCCESS)
84 __pFileProgressingCancelButton = static_cast<Button*>(__pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
86 if (__pFileProgressingCancelButton != null)
88 __pFileProgressingCancelButton->SetActionId(IDA_PROGRESSBAR_CANCEL);
89 __pFileProgressingCancelButton->AddActionEventListener(*__pActionListener);
90 __pFileProgressingCancelButton->SetShowState(true);
93 __pFileProgressingProgress = static_cast<Progress*>(__pFileProgressingPopup->GetControl(L"IDC_PROGRESS_BAR", true));
95 if (__pFileProgressingProgress != null)
97 __pFileProgressingProgress->SetName(L"IDC_ANIMATION_PROGRESS");
98 __pFileProgressingProgress->SetValue(0);
101 __pFileProgressingHeaderLabel = static_cast<Label*>(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_HEADER", true));
103 if (__pFileProgressingHeaderLabel != null)
105 __pFileProgressingHeaderLabel->SetName(L"IDC_ANIMATION_HEADER");
106 __pFileProgressingHeaderLabel->SetShowState(true);
109 __pFileProgressingLabel = static_cast<Label*>(__pFileProgressingPopup->GetControl(L"IDC_ANIMATION_LABEL", true));
111 if (__pFileProgressingLabel != null)
113 __pFileProgressingLabel->SetName(L"IDC_FILE_COUNT_LABEL");
114 __pFileProgressingLabel->SetShowState(true);
117 __pFileCounterLabel = static_cast<Label*>(__pFileProgressingPopup->GetControl(L"IDC_COUNTER_LABEL", true));
119 if (__pFileCounterLabel != null)
121 __pFileCounterLabel->SetText(L"");
122 __pFileCounterLabel->SetTextColor(CUSTOM_COLOR_GREY);
123 __pFileCounterLabel->SetShowState(true);
127 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
132 GlProgressBar::ShowFileProgressingPopup(const int val, enum FileActionMode action)
134 AppLogDebug("ENTER");
135 CreateFileProgressingPopup();
145 __pFileProgressingProgress->SetRange(1, val);
147 if (__pFileProgressingPopup != null)
149 if (__pFileProgressingHeaderLabel != null)
153 case FILE_ACTION_MOVE:
154 __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_MOVING"));
157 case FILE_ACTION_DELETE:
158 __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_DELETING"));
161 case FILE_ACTION_COPY:
162 __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_COPYING_ING"));
165 case FILE_ACTION_ROTATE:
166 __pFileProgressingHeaderLabel->SetText(ResourceManager::GetString(L"IDS_COM_POP_PROCESSING"));
173 __pFileProgressingHeaderLabel->Invalidate(true);
176 __pFileProgressingPopup->SetShowState(true);
177 __pFileProgressingPopup->Show();
179 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
183 GlProgressBar::IncProgress(const int count)
185 AppLogDebug("ENTER");
188 __pFileProgressingProgress->SetValue(count);
190 counter.Append(count);
191 counter.Append(L"/");
192 counter.Append(__totalVal);
194 if( __pFileCounterLabel != null )
196 __pFileCounterLabel->SetText(counter);
197 __pFileCounterLabel->Invalidate(true);
200 __pFileProgressingPopup->SetShowState(true);
201 __pFileProgressingPopup->Show();
202 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));