From: Igor Nazarov Date: Mon, 12 Jun 2017 14:04:10 +0000 (+0300) Subject: TizenRefApp-8668 [Gallery] Replace using namespace directives with X-Git-Tag: submit/tizen/20170703.071445~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7875216811a25c150b6a9ca3071ea87980c51e07;p=profile%2Fwearable%2Fapps%2Fnative%2Fgallery.git TizenRefApp-8668 [Gallery] Replace using namespace directives with declarations Change-Id: I0fe7a8585867239e83a3607b5067677a111a56a3 --- diff --git a/src/common.h b/src/common.h index 696be60..57d60ad 100644 --- a/src/common.h +++ b/src/common.h @@ -28,4 +28,36 @@ #include "internal.h" +namespace gallery { + + using ucl::UInt; + + using ucl::Result; + using ucl::RES_OK; + using ucl::RES_FALSE; + using ucl::RES_FAIL; + using ucl::RES_INVALID_ARGUMENTS; + using ucl::RES_ILLEGAL_STATE; + using ucl::RES_NOT_SUPPORTED; + using ucl::RES_INVALID_DATA; + using ucl::RES_FATAL; + + using ucl::isEmpty; + using ucl::isNotEmpty; + using ucl::toEina; + + using ucl::RefCountObj; + using ucl::RefCountObjBase; + using ucl::SharedRef; + using ucl::WeakRef; + + using ucl::makeShared; + using ucl::dynamicRefCast; + + namespace util { + + using ucl::util::makeUnique; + } +} + #endif // __GALLERY_COMMON_H__ diff --git a/src/main.cpp b/src/main.cpp index e548152..0165f6f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,8 +20,8 @@ #include "common.h" -using namespace ucl; -using namespace gallery; +using ucl::UIApp; +using gallery::InstanceManager; int main(int argc, char *argv[]) { diff --git a/src/model/BaseJob.cpp b/src/model/BaseJob.cpp index fb61c32..1a358fb 100644 --- a/src/model/BaseJob.cpp +++ b/src/model/BaseJob.cpp @@ -22,8 +22,6 @@ namespace gallery { - using namespace ucl; - BaseJob::BaseJob(const NotiHandler &onComplete, const bool isCancelable) : m_onComplete(onComplete), diff --git a/src/model/Gallery.cpp b/src/model/Gallery.cpp index 73c804d..9e4fae8 100644 --- a/src/model/Gallery.cpp +++ b/src/model/Gallery.cpp @@ -22,8 +22,6 @@ namespace gallery { - using namespace ucl; - Gallery::Gallery() : m_isMediaDbConnected(false) { diff --git a/src/model/GalleryAlbum.cpp b/src/model/GalleryAlbum.cpp index a560e63..fbe2ad6 100644 --- a/src/model/GalleryAlbum.cpp +++ b/src/model/GalleryAlbum.cpp @@ -25,7 +25,7 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; + using ucl::TString; const auto CONDITION = TString("%s=%d").format( MEDIA_TYPE, MEDIA_CONTENT_TYPE_IMAGE); @@ -35,7 +35,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::MutexLock; GalleryAlbum::GalleryAlbum() : m_pid(getpid()), diff --git a/src/model/MediaItem.cpp b/src/model/MediaItem.cpp index e089515..6a95ac1 100644 --- a/src/model/MediaItem.cpp +++ b/src/model/MediaItem.cpp @@ -26,7 +26,7 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; + using ucl::AutoHandle; const std::string MIME_PREFIX_IMAGE {"image/"}; const std::string MIME_PREFIX_VIDEO {"video/"}; @@ -56,7 +56,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::MutexLock; // MediaItem::Remover // @@ -420,7 +420,7 @@ namespace gallery { return RES_FALSE; } - auto cbProxy = ucl::util::makeUnique(new ThumbCbProxy{this, cb}); + auto cbProxy = util::makeUnique(new ThumbCbProxy{this, cb}); { MutexLock lock(getMediaMutex()); diff --git a/src/model/SoundManager.cpp b/src/model/SoundManager.cpp index b540d79..efdf651 100644 --- a/src/model/SoundManager.cpp +++ b/src/model/SoundManager.cpp @@ -20,8 +20,6 @@ namespace gallery { - using namespace ucl; - SoundManagerSRef SoundManager::newInstance() { auto result = makeShared(); diff --git a/src/model/internal.cpp b/src/model/internal.cpp index de6f9a2..9f0e5cf 100644 --- a/src/model/internal.cpp +++ b/src/model/internal.cpp @@ -28,7 +28,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Mutex; Mutex &getMediaMutex() { diff --git a/src/presenters/AlertDialog.cpp b/src/presenters/AlertDialog.cpp index 0a23f48..85ec84b 100644 --- a/src/presenters/AlertDialog.cpp +++ b/src/presenters/AlertDialog.cpp @@ -21,8 +21,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr EoDataKey BTN_EVENT_DATA {"gallery,btn,event,data"}; constexpr ElmStyle POPUP_STYLE {"circle"}; @@ -54,7 +52,9 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Layout; + + using ucl::PART_TITLE; // AlertDialog::Builder // diff --git a/src/presenters/AtspiHighlightHelper.cpp b/src/presenters/AtspiHighlightHelper.cpp index feac2d2..8e6ae07 100644 --- a/src/presenters/AtspiHighlightHelper.cpp +++ b/src/presenters/AtspiHighlightHelper.cpp @@ -20,14 +20,14 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr EoDataKey ATSPI_HELPER_DATA {"gallery,atspi,highlight,helper"}; }}} namespace gallery { - using namespace ucl; + using ucl::AtspiGestureEventInfo; + + using ucl::ATSPI_ON_GESTURE; AtspiHighlightHelperSRef AtspiHighlightHelper::newInstance( ElmWidget &rootWidget) diff --git a/src/presenters/Instance.cpp b/src/presenters/Instance.cpp index f060c0f..636bfc4 100644 --- a/src/presenters/Instance.cpp +++ b/src/presenters/Instance.cpp @@ -36,7 +36,13 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::SysEvent; + using ucl::SysEventProvider; + using ucl::IInstanceContext; + using ucl::getResPath; + + using ucl::Theme; + using ucl::Naviframe; Instance::Instance(RefCountObjBase &rc, SysEventProvider &sysEventProvider) : diff --git a/src/presenters/InstanceManager.cpp b/src/presenters/InstanceManager.cpp index 6aabaef..826362e 100644 --- a/src/presenters/InstanceManager.cpp +++ b/src/presenters/InstanceManager.cpp @@ -18,9 +18,13 @@ #include "presenters/Instance.h" +#include "common.h" + namespace gallery { - using namespace ucl; + using ucl::AppParam; + using ucl::AppParams; + using ucl::IInstanceSRef; InstanceManager::InstanceManager() : InstanceManagerBase(AppParams(). diff --git a/src/presenters/MoreOptionsPresenter.cpp b/src/presenters/MoreOptionsPresenter.cpp index 067753a..c718ff9 100644 --- a/src/presenters/MoreOptionsPresenter.cpp +++ b/src/presenters/MoreOptionsPresenter.cpp @@ -22,8 +22,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr SmartEvent MORE_OPENED {"more,option,opened"}; constexpr SmartEvent MORE_CLOSED {"more,option,closed"}; constexpr SmartEvent MORE_ITEM_CLICKED {"item,clicked"}; @@ -49,7 +47,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Layout; // MoreOptionsPresenter::Builder // diff --git a/src/presenters/NoContentPage.cpp b/src/presenters/NoContentPage.cpp index 5b6c9c7..9a57ee6 100644 --- a/src/presenters/NoContentPage.cpp +++ b/src/presenters/NoContentPage.cpp @@ -23,7 +23,11 @@ namespace gallery { - using namespace ucl; + using ucl::Layout; + using ucl::NaviframeSRef; + + using ucl::LAYOUT_NO_CONTENTS; + using ucl::PART_TITLE; // NoContentPage::Builder // diff --git a/src/presenters/Page.cpp b/src/presenters/Page.cpp index 24c6bbd..787eb6f 100644 --- a/src/presenters/Page.cpp +++ b/src/presenters/Page.cpp @@ -20,14 +20,16 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr SmartEvent TOP_PAGE_CHANGED {"ucl,top,page,changed"}; }}} namespace gallery { - using namespace ucl; + using ucl::NaviItem; + using ucl::NaviframeSRef; + + using ucl::NAVI_TRANSITION_STARTED; + using ucl::NAVI_TRANSITION_FINISHED; Page::Page(RefCountObjBase &rc, const NaviframeSRef &navi, const ExitRequestHandler onExitRequest) : diff --git a/src/presenters/Presenter.cpp b/src/presenters/Presenter.cpp index 814c4ac..7d86b06 100644 --- a/src/presenters/Presenter.cpp +++ b/src/presenters/Presenter.cpp @@ -20,15 +20,13 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr SmartEvent ACTIVATE_BY {"gallery,activate,by"}; constexpr SmartEvent DEACTIVATE_BY {"gallery,deactivate,by"}; }}} namespace gallery { - using namespace ucl; + using ucl::Window; Presenter::Presenter(RefCountObjBase &rc) : RefCountAware(&rc), diff --git a/src/presenters/PreviewPage.cpp b/src/presenters/PreviewPage.cpp index 13f96ae..c582d54 100644 --- a/src/presenters/PreviewPage.cpp +++ b/src/presenters/PreviewPage.cpp @@ -35,7 +35,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::NaviframeSRef; // PreviewPage::Builder // diff --git a/src/presenters/ProcessingPresenter.cpp b/src/presenters/ProcessingPresenter.cpp index 390b484..4eea1d4 100644 --- a/src/presenters/ProcessingPresenter.cpp +++ b/src/presenters/ProcessingPresenter.cpp @@ -20,8 +20,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr auto IDLE_WAIT_TIME_SEC = 0.2; constexpr auto PROCESSING_MIN_TIME_SEC = 0.5; @@ -49,7 +47,9 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Layout; + + using ucl::PART_TEXT; // ProcessingPresenter::Builder // diff --git a/src/presenters/SelectModePresenter.cpp b/src/presenters/SelectModePresenter.cpp index c6a72f7..7b2e02f 100644 --- a/src/presenters/SelectModePresenter.cpp +++ b/src/presenters/SelectModePresenter.cpp @@ -23,8 +23,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - const TString SELECT_BTN_TEXT_FMT {"%d"}; constexpr ElmStyle SELECT_POPUP_STYLE {"select_mode"}; @@ -37,7 +35,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::WidgetItem; // SelectModePresenter::Builder // diff --git a/src/presenters/ThumbnailPage.cpp b/src/presenters/ThumbnailPage.cpp index 9cb4eb5..b3a392c 100644 --- a/src/presenters/ThumbnailPage.cpp +++ b/src/presenters/ThumbnailPage.cpp @@ -35,7 +35,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::NaviframeSRef; // ThumbnailPage::Builder // diff --git a/src/presenters/VideoPlayerPage.cpp b/src/presenters/VideoPlayerPage.cpp index bd4a8c9..bab03b6 100644 --- a/src/presenters/VideoPlayerPage.cpp +++ b/src/presenters/VideoPlayerPage.cpp @@ -25,8 +25,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr auto AUTO_START_TIMEOUT_SEC = 0.3; constexpr auto CONTROLS_PLAYBACK_HIDE_TIMEOUT_SEC = 3.0; constexpr auto CONTROLS_PAUSE_HIDE_TIMEOUT_SEC = 6.0; @@ -76,7 +74,12 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::AutoAppCtrl; + + using ucl::Layout; + using ucl::NaviframeSRef; + using ucl::StyledWidgetSRef; + using ucl::WidgetEventHandler; // VideoPlayerPage::Builder // diff --git a/src/presenters/ViewerPage.cpp b/src/presenters/ViewerPage.cpp index 5dcd31d..047de81 100644 --- a/src/presenters/ViewerPage.cpp +++ b/src/presenters/ViewerPage.cpp @@ -28,7 +28,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::NaviframeSRef; // ViewerPage::Builder // @@ -226,7 +226,7 @@ namespace gallery { m_imageViewer->setLowResImagePath(path); } - void ViewerPage::onZoomEnd(ucl::Widget &widget, void *eventInfo) + void ViewerPage::onZoomEnd(Widget &widget, void *eventInfo) { if (m_exitOnZoomOut && m_imageViewer->isZoomedOut()) { requestExit(); diff --git a/src/presenters/internal.cpp b/src/presenters/internal.cpp index 33cf63f..207fdb1 100644 --- a/src/presenters/internal.cpp +++ b/src/presenters/internal.cpp @@ -20,22 +20,20 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr EoDataKey INSTANCE_PTR {"gallery,instance,data,ptr"}; }}} namespace gallery { - using namespace ucl; + using ucl::Window; - void setInstancePaused(ucl::Window &win, const bool value) + void setInstancePaused(Window &win, const bool value) { win.setData(impl::INSTANCE_PTR, reinterpret_cast(value)); win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr); } - bool isInstancePaused(const ucl::Window &win) + bool isInstancePaused(const Window &win) { return (reinterpret_cast( win.getData(impl::INSTANCE_PTR)) != 0); diff --git a/src/resources.cpp b/src/resources.cpp index d3af53b..83291cd 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -18,20 +18,22 @@ namespace gallery { + using ucl::TString; + // TODO replace with IDS in the future - const ucl::TString STR_APP_NAME {"Gallery"}; - const ucl::TString STR_NO_PHOTOS {"No photos"}; - const ucl::TString STR_SELECT_ALL {"Select all"}; - const ucl::TString STR_DESELECT_ALL {"Deselect all"}; - const ucl::TString STR_DELETE {"Delete"}; - const ucl::TString STR_DELETE_CAPS {"DELETE"}; - const ucl::TString STR_DELETE_1_PHOTO {"Delete 1 photo?"}; - const ucl::TString STR_DELETE_N_PHOTO {"Delete %d photo?"}; - const ucl::TString STR_DELETING {"Deleting..."}; - const ucl::TString STR_DELETED {"Deleted."}; - const ucl::TString STR_FAILED {"Failed."}; - const ucl::TString STR_SAVE_TO_GEAR {"Save to Gear"}; - const ucl::TString STR_SAVING {"Saving..."}; - const ucl::TString STR_SAVED {"Saved."}; + const TString STR_APP_NAME {"Gallery"}; + const TString STR_NO_PHOTOS {"No photos"}; + const TString STR_SELECT_ALL {"Select all"}; + const TString STR_DESELECT_ALL {"Deselect all"}; + const TString STR_DELETE {"Delete"}; + const TString STR_DELETE_CAPS {"DELETE"}; + const TString STR_DELETE_1_PHOTO {"Delete 1 photo?"}; + const TString STR_DELETE_N_PHOTO {"Delete %d photo?"}; + const TString STR_DELETING {"Deleting..."}; + const TString STR_DELETED {"Deleted."}; + const TString STR_FAILED {"Failed."}; + const TString STR_SAVE_TO_GEAR {"Save to Gear"}; + const TString STR_SAVING {"Saving..."}; + const TString STR_SAVED {"Saved."}; } diff --git a/src/view/ImageGrid.cpp b/src/view/ImageGrid.cpp index e7aa054..9b24547 100644 --- a/src/view/ImageGrid.cpp +++ b/src/view/ImageGrid.cpp @@ -28,8 +28,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - // Related to ImageGrid // const TString SLOT_PART_FMT {"swallow.cell_%d"}; @@ -76,7 +74,10 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Layout; + + using ucl::Timeout; + using ucl::ceilDiv; // ImageGrid::Builder // @@ -1428,7 +1429,7 @@ namespace gallery { for (int i = m_slotCount; i < newSlotCount; ++i) { const bool isOdd = ((m_beginSlotIndex + i) & 1); - auto slot = ucl::util::makeUnique(new Slot(*this, isOdd)); + auto slot = util::makeUnique(new Slot(*this, isOdd)); if (m_slotSize == 0) { UCL_ASSERT(!isOdd, "Must be even!"); diff --git a/src/view/ImageViewer.cpp b/src/view/ImageViewer.cpp index 6d5e0d6..5e90e41 100644 --- a/src/view/ImageViewer.cpp +++ b/src/view/ImageViewer.cpp @@ -27,7 +27,7 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::LAYOUT_DEFAULT; // ImageViewer::Builder // diff --git a/src/view/PageContent.cpp b/src/view/PageContent.cpp index 6d9f43e..39c2505 100644 --- a/src/view/PageContent.cpp +++ b/src/view/PageContent.cpp @@ -20,8 +20,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr LayoutTheme LAYOUT_MORE_OPTIONS {"layout", "gallery", "more_options"}; @@ -54,7 +52,12 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; + using ucl::Layout; + using ucl::LayoutSRef; + + using ucl::PART_BUTTON; + using ucl::PART_CONTENT; + using ucl::PART_ICON; // PageContent::Builder // @@ -89,7 +92,7 @@ namespace gallery { // PageContent // PageContent::PageContent(RefCountObjBase &rc, - const ucl::LayoutSRef &layout, const int flags) : + const LayoutSRef &layout, const int flags) : ElmWidget(&rc, *layout, true), m_moreOptions(layout) { diff --git a/src/view/TouchParser.cpp b/src/view/TouchParser.cpp index 119a7eb..ecda732 100644 --- a/src/view/TouchParser.cpp +++ b/src/view/TouchParser.cpp @@ -28,8 +28,6 @@ namespace gallery { namespace { namespace impl { namespace gallery { - using namespace ucl; - TouchParser::TouchParser(RefCountObjBase &rc, Widget &eventSource) : RefCountAware(&rc), m_holdTimer(nullptr), diff --git a/src/view/common.h b/src/view/common.h index b6bcb12..d56f144 100644 --- a/src/view/common.h +++ b/src/view/common.h @@ -17,6 +17,7 @@ #ifndef __GALLERY_VIEW_COMMON_H__ #define __GALLERY_VIEW_COMMON_H__ +#include "ucl/gui/StyledWidget.h" #include "ucl/gui/stdTheme.h" #include "ucl/gui/helpers.h" @@ -26,6 +27,24 @@ namespace gallery { + using ucl::EdjePart; + using ucl::EdjeDataKey; + using ucl::EdjeSignal; + using ucl::EdjeSignalSrc; + using ucl::ElmStyle; + using ucl::SmartEvent; + using ucl::EoDataKey; + using ucl::LayoutTheme; + using ucl::WidgetEvent; + using ucl::WidgetARHint; + + using ucl::TString; + + UCL_USING_REF_ALIASES(ucl::Widget); + UCL_USING_REF_ALIASES(ucl::ElmWidget); + UCL_USING_REF_ALIASES(ucl::EdjeWidget); + UCL_USING_REF_ALIASES(ucl::StyledWidget); + constexpr ucl::SmartEvent BTN_CLICKED {"clicked"}; constexpr ucl::SmartEvent POPUP_DISMISSED {"dismissed"}; diff --git a/src/view/helpers.cpp b/src/view/helpers.cpp index 9add4e7..2a9fe7f 100644 --- a/src/view/helpers.cpp +++ b/src/view/helpers.cpp @@ -25,8 +25,6 @@ namespace gallery { namespace { namespace impl { - using namespace ucl; - constexpr EoDataKey CIRCLE_SURFACE {"gallery,eext,circle,surface"}; constexpr LayoutTheme LAYOUT_FAKE_ACCESS_OBJECT @@ -35,7 +33,8 @@ namespace gallery { namespace { namespace impl { namespace gallery { namespace util { - using namespace ucl; + using ucl::Layout; + using ucl::Naviframe; Result createCircleSurface(Naviframe &navi) { @@ -106,8 +105,6 @@ namespace gallery { namespace util { namespace gallery { - using namespace ucl; - void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data) { eext_rotary_event_handler_add(func, data); diff --git a/ucl/inc/ucl/util/memory/macro.h b/ucl/inc/ucl/util/memory/macro.h index 6818ef9..b97175a 100644 --- a/ucl/inc/ucl/util/memory/macro.h +++ b/ucl/inc/ucl/util/memory/macro.h @@ -24,4 +24,11 @@ using CLASS_NAME##SCRef = ::ucl::SharedRef; \ using CLASS_NAME##WCRef = ::ucl::WeakRef +#define UCL_USING_REF_ALIASES(CLASS_NAME) \ + using CLASS_NAME; \ + using CLASS_NAME##SRef; \ + using CLASS_NAME##WRef; \ + using CLASS_NAME##SCRef; \ + using CLASS_NAME##WCRef; \ + #endif // __UCL_UTIL_MEMORY_MACRO_H__