diff options
author | Sergey Pisarchik <pisarchik@mapswithme.com> | 2014-05-30 18:45:03 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:16:25 +0300 |
commit | 38eca1c3179b738c72c9957b67389e2fd564384e (patch) | |
tree | 2c56486ce9b6e5347c609030e08db38d34ea7b0e /tizen/MapsWithMe | |
parent | d7922621ffc6ebbdd8ea0e0e203111fc558c88c0 (diff) |
[Tizen] Resolve error with double signals.
Diffstat (limited to 'tizen/MapsWithMe')
-rw-r--r-- | tizen/MapsWithMe/inc/DownloadCountryForm.hpp | 2 | ||||
-rw-r--r-- | tizen/MapsWithMe/src/DownloadCountryForm.cpp | 47 | ||||
-rw-r--r-- | tizen/MapsWithMe/src/MapsWithMeForm.cpp | 1 |
3 files changed, 21 insertions, 29 deletions
diff --git a/tizen/MapsWithMe/inc/DownloadCountryForm.hpp b/tizen/MapsWithMe/inc/DownloadCountryForm.hpp index fb7cd12958..9f4d3c26b8 100644 --- a/tizen/MapsWithMe/inc/DownloadCountryForm.hpp +++ b/tizen/MapsWithMe/inc/DownloadCountryForm.hpp @@ -65,7 +65,7 @@ private: Tizen::Graphics::Bitmap const * m_updateBitmap; storage::TIndex m_group_index; - int m_valid_values_in_gp_index; + Tizen::Base::String m_form_id; int m_DowloadStatusSlot; map<storage::TIndex, pair<int64_t, int64_t> > m_lastDownload_value; }; diff --git a/tizen/MapsWithMe/src/DownloadCountryForm.cpp b/tizen/MapsWithMe/src/DownloadCountryForm.cpp index d72defd760..059ba2247c 100644 --- a/tizen/MapsWithMe/src/DownloadCountryForm.cpp +++ b/tizen/MapsWithMe/src/DownloadCountryForm.cpp @@ -4,6 +4,7 @@ #include "AppResourceId.h" #include "Framework.hpp" #include "Utils.hpp" +#include "FormFactory.hpp" #include "../../../std/bind.hpp" #include "../../../base/logging.hpp" #include "../../../platform/settings.hpp" @@ -24,7 +25,8 @@ using namespace Tizen::Graphics; using namespace storage; DownloadCountryForm::DownloadCountryForm() -: m_downloadedBitmap(0), m_updateBitmap(0) +: m_downloadedBitmap(0), + m_updateBitmap(0) { m_DowloadStatusSlot = Storage().Subscribe(bind(&DownloadCountryForm::OnCountryDownloaded, this, _1), bind(&DownloadCountryForm::OnCountryDowloadProgres, this, _1, _2)); @@ -168,17 +170,16 @@ int DownloadCountryForm::GetItemCount(void) void DownloadCountryForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) { + m_form_id = SceneManager::GetInstance()->GetCurrentScene()->GetFormId(); if (pArgs != null) { - if (pArgs->GetCount() == 3) + if (pArgs->GetCount() == 2) { - Integer * pLevel = dynamic_cast<Integer *>(pArgs->GetAt(0)); - Integer * pGroup = dynamic_cast<Integer *>(pArgs->GetAt(1)); - Integer * pCountry = dynamic_cast<Integer *>(pArgs->GetAt(2)); + Integer * pGroup = dynamic_cast<Integer *>(pArgs->GetAt(0)); + Integer * pCountry = dynamic_cast<Integer *>(pArgs->GetAt(1)); m_group_index.m_group = pGroup->value; m_group_index.m_country = pCountry->value; m_group_index.m_region = TIndex::INVALID; - m_valid_values_in_gp_index = pLevel->value; } ListView * __pList = static_cast<ListView *>(GetControl(IDC_DOWNLOAD_LISTVIEW)); __pList->SetItemProvider(*this); @@ -203,37 +204,30 @@ bool DownloadCountryForm::IsGroup(storage::TIndex const & index) const TIndex DownloadCountryForm::GetIndex(int const ind) const { TIndex res = m_group_index; - if (m_valid_values_in_gp_index == 0) + if (m_form_id == FORM_DOWNLOAD_GROUP) res.m_group = ind; - if (m_valid_values_in_gp_index == 1) + if (m_form_id == FORM_DOWNLOAD_COUNTRY) res.m_country = ind; - else if (m_valid_values_in_gp_index == 2) + else if (m_form_id == FORM_DOWNLOAD_REGION) res.m_region = ind; return res; } wchar_t const * DownloadCountryForm::GetNextScene() const { - switch (m_valid_values_in_gp_index) - { - case 0: - return SCENE_DOWNLOAD_COUNTRY; - case 1: - return SCENE_DOWNLOAD_REGION; - default: - return SCENE_DOWNLOAD_REGION; - } + if (m_form_id == FORM_DOWNLOAD_GROUP) + return SCENE_DOWNLOAD_COUNTRY; + return SCENE_DOWNLOAD_REGION; } void DownloadCountryForm::OnListViewItemStateChanged(ListView & listView, int index, int elementId, ListItemStatus status) { - TIndex country = GetIndex(index); + TIndex country = GetIndex(index); if (IsGroup(country)) { ArrayList * pList = new (std::nothrow) ArrayList; pList->Construct(); - pList->Add(*(new (std::nothrow) Integer(m_valid_values_in_gp_index + 1))); pList->Add(*(new (std::nothrow) Integer(country.m_group))); pList->Add(*(new (std::nothrow) Integer(country.m_country))); @@ -287,21 +281,20 @@ void DownloadCountryForm::UpdateList() void DownloadCountryForm::OnCountryDownloaded(TIndex const & country) { + if (m_form_id != SceneManager::GetInstance()->GetCurrentScene()->GetFormId()) + return; if (Storage().CountryStatusEx(country) == EDownloadFailed) { - bool static bOddEnterHack = true; // message about download fail comes twice. Hack for showing only one of them - bOddEnterHack = !bOddEnterHack; - if (bOddEnterHack) - { - String sName = Storage().CountryName(country).c_str(); - MessageBoxOk(sName, FormatString1(IDS_DOWNLOAD_COUNTRY_FAILED, sName)); - } + String sName = Storage().CountryName(country).c_str(); + MessageBoxOk(sName, FormatString1(IDS_DOWNLOAD_COUNTRY_FAILED, sName)); } UpdateList(); } void DownloadCountryForm::OnCountryDowloadProgres(TIndex const & index, pair<int64_t, int64_t> const & p) { + if (m_form_id != SceneManager::GetInstance()->GetCurrentScene()->GetFormId()) + return; m_lastDownload_value[index] = p; UpdateList(); } diff --git a/tizen/MapsWithMe/src/MapsWithMeForm.cpp b/tizen/MapsWithMe/src/MapsWithMeForm.cpp index 194515b35c..d6e58393d8 100644 --- a/tizen/MapsWithMe/src/MapsWithMeForm.cpp +++ b/tizen/MapsWithMe/src/MapsWithMeForm.cpp @@ -160,7 +160,6 @@ void MapsWithMeForm::OnActionPerformed(Tizen::Ui::Control const & source, int ac { ArrayList * pList = new (std::nothrow) ArrayList; pList->Construct(); - pList->Add(*(new (std::nothrow) Integer(0))); pList->Add(*(new (std::nothrow) Integer(storage::TIndex::INVALID))); pList->Add(*(new (std::nothrow) Integer(storage::TIndex::INVALID))); |