From e5134b59bb48d7f1bebe3b831490eee95741baca Mon Sep 17 00:00:00 2001 From: Andrey Klimenko Date: Mon, 21 Nov 2016 15:53:34 +0200 Subject: [PATCH] TizenRefApp-7696 fixing Viewer/* codestyle Change-Id: I943980fd82dad8723353a805ac961ae7fa0b95ec Signed-off-by: Andrey Klimenko --- src/Viewer/Controller/src/SmilPage.cpp | 46 +++++----- src/Viewer/Controller/src/SmilPlayer.cpp | 83 +++++++++---------- src/Viewer/Controller/src/Viewer.cpp | 48 +++++------ src/Viewer/Utils/src/MediaPlayer.cpp | 32 ++++--- src/Viewer/View/src/PlayerControl.cpp | 11 ++- .../View/src/SmilAttachmentItemView.cpp | 19 ++--- src/Viewer/View/src/SmilImageItemView.cpp | 7 +- src/Viewer/View/src/SmilPageLayout.cpp | 1 - src/Viewer/View/src/SmilPlayerView.cpp | 3 +- src/Viewer/View/src/SmilTextItemView.cpp | 2 +- src/Viewer/View/src/SmilVideoItemView.cpp | 13 ++- src/Viewer/View/src/SubjectLayout.cpp | 1 - src/Viewer/View/src/ViewerLayout.cpp | 6 +- 13 files changed, 125 insertions(+), 147 deletions(-) diff --git a/src/Viewer/Controller/src/SmilPage.cpp b/src/Viewer/Controller/src/SmilPage.cpp index db90c0d9..53b66cc5 100644 --- a/src/Viewer/Controller/src/SmilPage.cpp +++ b/src/Viewer/Controller/src/SmilPage.cpp @@ -104,16 +104,16 @@ bool SmilPage::hasAnimation() const void SmilPage::playAnimation(bool play) { - if(m_pImageItem && m_pImageItem->hasAnimation()) + if (m_pImageItem && m_pImageItem->hasAnimation()) m_pImageItem->playAnimation(play); } const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) const { const MsgMediaList &list = page.getMediaList(); - for(int i = 0; i < list.getLength(); ++i) + for (int i = 0; i < list.getLength(); ++i) { - if(list[i].getType() == type) + if (list[i].getType() == type) return &list[i]; } return nullptr; @@ -122,11 +122,11 @@ const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) con bool SmilPage::isEmpty(const MsgPage &page) { const MsgMediaList &list = page.getMediaList(); - for(int i = 0; i < list.getLength(); ++i) + for (int i = 0; i < list.getLength(); ++i) { const MsgMedia &media = list[i]; std::string filePath = media.getFilePath(); - if(media.getType() != MsgMedia::UnknownType && FileUtils::getFileSize(filePath) > 0) + if (media.getType() != MsgMedia::UnknownType && FileUtils::getFileSize(filePath) > 0) return false; } return true; @@ -137,33 +137,33 @@ void SmilPage::build(const MsgPage &page) m_Duration = page.getPageDuration() / 1000.0 + 0.5; const MsgMediaList &list = page.getMediaList(); - for(int i = 0; i < list.getLength(); ++i) + for (int i = 0; i < list.getLength(); ++i) { m_Attachments.push_back(list[i].getFilePath()); } const MsgMedia *video = getMedia(page, MsgMedia::VideoType); - if(video) + if (video) buildVideo(*video); else { const MsgMedia *image = getMedia(page, MsgMedia::ImageType); - if(image) + if (image) buildImage(*image); } const MsgMedia *text = getMedia(page, MsgMedia::TextType); - if(text) + if (text) buildText(*text); - if(!video) + if (!video) { const MsgMedia *audio = getMedia(page, MsgMedia::AudioType); - if(audio) + if (audio) buildAudio(*audio); } - if(m_Duration <= 0) + if (m_Duration <= 0) m_Duration = defaultPageDuration; MSG_LOG("Page duration: ", m_Duration); @@ -173,17 +173,17 @@ void SmilPage::build(const MsgAttachmentList &list) { m_Duration = defaultPageDuration; - for(int i = 0; i < list.getLength(); ++i) + for (int i = 0; i < list.getLength(); ++i) { m_Attachments.push_back(list[i].getFilePath()); } - if(list.isEmpty()) + if (list.isEmpty()) return; buildAttachmentInfo(list.getLength()); buildSaveAllItem(list.getLength()); - for(int i = 0; i < list.getLength(); ++i) + for (int i = 0; i < list.getLength(); ++i) { buildAttachment(list[i]); } @@ -200,7 +200,7 @@ void SmilPage::buildImage(const MsgMedia &media) void SmilPage::buildText(const MsgMedia& media) { std::string text = FileUtils::readTextFile(media.getFilePath()); - if(!text.empty()) + if (!text.empty()) { SmilTextItemView *item = new SmilTextItemView(getBox(), text); item->show(); @@ -214,13 +214,13 @@ void SmilPage::buildAudio(const MsgMedia& media) m_HasAudio = true; int duration = MediaUtils::getDurationSec(m_MediaPath); - if(duration == 0) + if (duration == 0) { m_HasInvalidFiles = true; return; } - if(m_Duration == 0) + if (m_Duration == 0) m_Duration = duration; SmilAudioItemView *item = new SmilAudioItemView(getBox(), media.getFileName()); @@ -234,19 +234,19 @@ void SmilPage::buildVideo(const MsgMedia& media) m_MediaPath = media.getFilePath(); int duration = MediaUtils::getDurationSec(m_MediaPath); - if(duration == 0) + if (duration == 0) { m_HasInvalidFiles = true; return; } - if(m_Duration == 0) + if (m_Duration == 0) m_Duration = duration; int width = 0; int height = 0; MediaUtils::getFrameSize(m_MediaPath, width, height); - if(width * height == 0) + if (width * height == 0) { MSG_LOG_ERROR("Wrong video dimension"); m_HasInvalidFiles = true; @@ -291,13 +291,13 @@ void SmilPage::onItemClicked(SmilAttachmentItemView &item) void SmilPage::onSaveButtonClicked(SmilAttachmentItemView &item) { MSG_LOG(""); - if(FileUtils::saveFileToStorage(item.getFilePath())) + if (FileUtils::saveFileToStorage(item.getFilePath())) notification_status_message_post(msg("IDS_MSGF_POP_SAVED_IN_MY_FILES").cStr()); } void SmilPage::onItemClicked(SmilSaveAllItemView &item) { MSG_LOG(""); - if(!m_Attachments.empty() && FileUtils::saveFilesToStorage(m_Attachments)) + if (!m_Attachments.empty() && FileUtils::saveFilesToStorage(m_Attachments)) notification_status_message_post(msg("IDS_MSGF_POP_SAVED_IN_MY_FILES").cStr()); } diff --git a/src/Viewer/Controller/src/SmilPlayer.cpp b/src/Viewer/Controller/src/SmilPlayer.cpp index 2b1a73fc..a001b5f4 100644 --- a/src/Viewer/Controller/src/SmilPlayer.cpp +++ b/src/Viewer/Controller/src/SmilPlayer.cpp @@ -37,17 +37,16 @@ SmilPlayer::SmilPlayer(Evas_Object *parent, const MessageMms &mms) SmilPlayer::~SmilPlayer() { - } void SmilPlayer::create(const MessageMms &mms) { // Pages: const MsgPageList &pages = mms.getPageList(); - for(int i = 0; i < pages.getLength(); ++i) + for (int i = 0; i < pages.getLength(); ++i) { const MsgPage &page = pages[i]; - if(!SmilPage::isEmpty(page)) + if (!SmilPage::isEmpty(page)) { SmilPage *smilPage = new SmilPage(getEo(), page); m_Duration += smilPage->getDuration(); @@ -56,14 +55,14 @@ void SmilPlayer::create(const MessageMms &mms) } // Attachment: - if(!mms.getAttachmentList().isEmpty()) + if (!mms.getAttachmentList().isEmpty()) { SmilPage *smilPage = new SmilPage(getEo(), mms.getAttachmentList()); m_Duration += smilPage->getDuration(); m_PageList.push_back(smilPage); } - if(!m_PageList.empty()) + if (!m_PageList.empty()) displayPage(**m_PageList.begin()); } @@ -74,7 +73,7 @@ void SmilPlayer::setListener(ISmilPlayerListener *l) void SmilPlayer::startTimer(int sec) { - if(m_pTimer) + if (m_pTimer) { ecore_timer_del(m_pTimer); m_pTimer = nullptr; @@ -85,13 +84,13 @@ void SmilPlayer::startTimer(int sec) void SmilPlayer::pauseTimer() { - if(m_pTimer) + if (m_pTimer) ecore_timer_freeze(m_pTimer); } void SmilPlayer::continueTimer() { - if(m_pTimer) + if (m_pTimer) ecore_timer_thaw(m_pTimer); } @@ -100,14 +99,14 @@ Eina_Bool SmilPlayer::onTick() MSG_LOG(""); ++m_PageTickCounter; - if(m_pListener) + if (m_pListener) m_pListener->onSmilPlayerTick(); - if(m_PageTickCounter >= getCurrentPage()->getDuration()) + if (m_PageTickCounter >= getCurrentPage()->getDuration()) { m_pTimer = nullptr; - if(!nextPage()) + if (!nextPage()) stop(); return false; } @@ -116,10 +115,10 @@ Eina_Bool SmilPlayer::onTick() void SmilPlayer::setState(State state) { - if(m_State != state) + if (m_State != state) { m_State = state; - if(m_pListener) + if (m_pListener) m_pListener->onSmilPlayerStateChanged(); } } @@ -131,21 +130,19 @@ SmilPlayer::State SmilPlayer::getState() const void SmilPlayer::start() { - if(m_pTimer) + if (m_pTimer) { - if(canPlay(getCurrentPage())) + if (canPlay(getCurrentPage())) { MSG_LOG("Continue"); setState(PlayState); continueTimer(); startMedia(); } - } - else - { + } else { MSG_LOG("Restart"); reset(); - if(canPlay(getCurrentPage())) + if (canPlay(getCurrentPage())) { setState(PlayState); playPage(); @@ -170,16 +167,16 @@ void SmilPlayer::reset() bool SmilPlayer::playPage() { SmilPage *page = getCurrentPage(); - if(!page) + if (!page) return false; SmilPlayerView::displayPage(*page); startTimer(page->getDuration()); - if(page->hasMedia()) + if (page->hasMedia()) { prepareMedia(); - if(!canPlay(page)) + if (!canPlay(page)) { stop(); showUnableToPlayNotif(*page); @@ -188,10 +185,10 @@ bool SmilPlayer::playPage() startMedia(); } - if(page->hasInvalidFiles()) + if (page->hasInvalidFiles()) showNotSupportedFileNotif(); - if(m_pListener) + if (m_pListener) m_pListener->onSmilPlayerPageChanged(); return true; @@ -199,16 +196,16 @@ bool SmilPlayer::playPage() void SmilPlayer::prepareMedia() { - if(m_MediaPlayer) + if (m_MediaPlayer) { m_MediaPlayer->stop(); m_MediaPlayer->setPosition(0); } SmilPage *page = getCurrentPage(); - if(page->hasMedia()) + if (page->hasMedia()) { - if(!m_MediaPlayer) + if (!m_MediaPlayer) { m_MediaPlayer.reset(new MediaPlayer); m_MediaPlayer->setListener(this); @@ -222,19 +219,19 @@ void SmilPlayer::prepareMedia() void SmilPlayer::stopMedia() { - if(m_MediaPlayer) + if (m_MediaPlayer) m_MediaPlayer->pause(); SmilPage *page = getCurrentPage(); - if(page) + if (page) page->playAnimation(false); } bool SmilPlayer::canPlay(SmilPage *page) { - if(!page) + if (!page) return false; - if(page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus()) + if (page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus()) { showUnableToPlayNotif(*page); return false; @@ -245,10 +242,10 @@ bool SmilPlayer::canPlay(SmilPage *page) void SmilPlayer::startMedia() { SmilPage *page = getCurrentPage(); - if(!page) + if (!page) return; - if(page->hasMedia() && m_MediaPlayer) + if (page->hasMedia() && m_MediaPlayer) m_MediaPlayer->start(); page->playAnimation(true); } @@ -256,7 +253,7 @@ void SmilPlayer::startMedia() double SmilPlayer::getPosition() const { unsigned pos = 0; - for(unsigned i = 0; i < m_CurrentPageIndex; ++i) + for (unsigned i = 0; i < m_CurrentPageIndex; ++i) { pos += m_PageList[i]->getDuration(); } @@ -283,7 +280,7 @@ int SmilPlayer::getDuration() const bool SmilPlayer::nextPage() { - if(probeNextPage()) + if (probeNextPage()) { stopMedia(); ++m_CurrentPageIndex; @@ -295,7 +292,7 @@ bool SmilPlayer::nextPage() bool SmilPlayer::prevPage() { - if(probePrevPage()) + if (probePrevPage()) { stopMedia(); --m_CurrentPageIndex; @@ -337,9 +334,9 @@ void SmilPlayer::showNotSupportedFileNotif() void SmilPlayer::showUnableToPlayNotif(SmilPage &page) { - if(page.hasVideo()) + if (page.hasVideo()) showUnableToPlayVideoNotif(); - else if(page.hasAudio()) + else if (page.hasAudio()) showUnableToPlayAudioNotif(); } @@ -350,12 +347,12 @@ void SmilPlayer::onBeforeDelete(View &view) m_pListener = nullptr; stop(); - for(SmilPage *page : m_PageList) + for (SmilPage *page : m_PageList) { page->destroy(); } - if(m_pTimer) + if (m_pTimer) { ecore_timer_del(m_pTimer); m_pTimer = nullptr; @@ -364,12 +361,12 @@ void SmilPlayer::onBeforeDelete(View &view) void SmilPlayer::onMediaPlayerSoundFocusChanged() { - if(m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus()) + if (m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus()) { SmilPage *page = getCurrentPage(); - if(page) + if (page) { - if(page->hasMedia()) + if (page->hasMedia()) { showUnableToPlayNotif(*page); stop(); diff --git a/src/Viewer/Controller/src/Viewer.cpp b/src/Viewer/Controller/src/Viewer.cpp index 3af28c67..265b40d5 100644 --- a/src/Viewer/Controller/src/Viewer.cpp +++ b/src/Viewer/Controller/src/Viewer.cpp @@ -78,21 +78,21 @@ void Viewer::updateNavibar() getNaviBar().clear(); getNaviBar().setColor(NaviBar::NaviBlueColorId); getNaviBar().showButton(NaviPrevButtonId, true); - if(m_Msg->getAddressList().getLength() > 1) + if (m_Msg->getAddressList().getLength() > 1) getNaviBar().showButton(NaviExpandButtonId, true); FrameController::setNaviBarTitle(m_Msg->getAddressList()); } void Viewer::updateRecipPanel() { - if(m_pRecipPanel) + if (m_pRecipPanel) m_pRecipPanel->update(m_Msg->getAddressList()); } void Viewer::create(MsgId id) { m_Msg = std::dynamic_pointer_cast(getMsgEngine().getStorage().getMessage(id)); - if(!m_Msg) + if (!m_Msg) { MSG_LOG_ERROR("Can't get message by id"); // Create empty message: @@ -118,7 +118,7 @@ void Viewer::create(MsgId id) void Viewer::createLayout() { - if(!m_pLayout) + if (!m_pLayout) { m_pLayout = new ViewerLayout(getParent()); m_pLayout->setListener(this); @@ -128,7 +128,7 @@ void Viewer::createLayout() void Viewer::createSubjectLayout() { - if(!m_pSubjectLayout) + if (!m_pSubjectLayout) { int numberOfPages = m_pSmilPlayer ? m_pSmilPlayer->getPages().size() : 0; m_pSubjectLayout = new SubjectLayout(*m_pLayout); @@ -141,7 +141,7 @@ void Viewer::createSubjectLayout() void Viewer::createPlayerControl() { - if(!m_pPlayerControl) + if (!m_pPlayerControl) { m_pPlayerControl = new PlayerControl(*m_pLayout); @@ -158,7 +158,7 @@ void Viewer::createPlayerControl() void Viewer::createRecipPanel() { - if(!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1) + if (!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1) { m_pRecipPanel = new MbeRecipients(*m_pLayout, getApp()); m_pRecipPanel->addSmartCb("item,clicked", SMART_CALLBACK(Viewer, onRecipItemClicked), this); @@ -170,7 +170,7 @@ void Viewer::createRecipPanel() void Viewer::createSmilPlayer() { - if(!m_pSmilPlayer) + if (!m_pSmilPlayer) { m_pSmilPlayer = new SmilPlayer(*m_pLayout, *m_Msg); m_pSmilPlayer->setListener(this); @@ -182,7 +182,7 @@ void Viewer::createSmilPlayer() void Viewer::naviExpandButtonHandler() { MSG_LOG(""); - if(m_pRecipPanel) + if (m_pRecipPanel) { bool isRecipInvisible = !m_pLayout->isRecipientsVisible(); m_pLayout->showRecipients(isRecipInvisible); @@ -193,14 +193,12 @@ void Viewer::naviExpandButtonHandler() void Viewer::naviCenterButtonHandler() { MSG_LOG(""); - if(m_pRecipPanel) + if (m_pRecipPanel) { naviExpandButtonHandler(); - } - else - { + } else { const MsgAddressList &addressList = m_Msg->getAddressList(); - if(!addressList.isEmpty()) + if (!addressList.isEmpty()) recipientClickHandler(addressList[0].getAddress()); } } @@ -214,7 +212,7 @@ void Viewer::showRecipPopup(const std::string &address) { PopupList &popup = getApp().getPopupManager().getPopupList(); popup.setTitle(address); - if(MsgUtils::isValidNumber(address)) + if (MsgUtils::isValidNumber(address)) popup.appendItem(msg("IDS_MSG_OPT_MAKE_VOICE_CALL"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onMakeVoiceItemPressed), this); popup.appendItem(msg("IDS_MSG_OPT_CREATE_CONTACT_ABB"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onCreateContactItemPressed), this); popup.appendItem(msg("IDS_MSG_OPT_UPDATE_CONTACT"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onUpdateContactItemPressed), this); @@ -226,7 +224,7 @@ void Viewer::recipientClickHandler(const std::string &address) MSG_LOG(""); m_SelectedAddress = address; ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(address); - if(contactAddress) + if (contactAddress) ContactViewer::getInst().launch(*contactAddress); else showRecipPopup(address); @@ -242,10 +240,10 @@ void Viewer::updatePlayPos() void Viewer::updateSubject() { - if(m_pSubjectLayout) + if (m_pSubjectLayout) { std::string subject = m_Msg->getSubject(); - if(subject.empty()) + if (subject.empty()) subject = msg("IDS_MSGF_BODY_NO_SUBJECT"); m_pSubjectLayout->setSubjectText(subject); } @@ -256,7 +254,7 @@ void Viewer::updateButtonState() auto playPauseState = PlayerControl::PauseState; bool isPlaying = m_pSmilPlayer->getState() == SmilPlayer::PlayState; - if(m_pSmilPlayer->getState() == SmilPlayer::StopState) + if (m_pSmilPlayer->getState() == SmilPlayer::StopState) playPauseState = PlayerControl::PlayState; m_pPlayerControl->setPlayState(playPauseState); @@ -276,13 +274,13 @@ void Viewer::onHwMoreButtonClicked() PopupList &popup = getApp().getPopupManager().getMorePopup(); popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onDeleteItemPressed), this); - if(!m_Msg->getText().empty()) + if (!m_Msg->getText().empty()) popup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onCopyTextItemPressed), this); popup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onForwardItemPressed), this); bool hasAttachment = !m_Msg->getAttachmentList().isEmpty() || m_Msg->getMediaCount() > 0; - if(hasAttachment) + if (hasAttachment) popup.appendItem(msg("IDS_MSG_OPT_SAVE_ATTACHMENTS_ABB"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onSaveAttachmentsItemPressed), this); popup.show(); @@ -291,7 +289,7 @@ void Viewer::onHwMoreButtonClicked() void Viewer::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) { MSG_LOG(""); - switch(buttonId) + switch (buttonId) { case NaviCenterButtonId: naviCenterButtonHandler(); @@ -455,10 +453,10 @@ void Viewer::onLanguageChanged() void Viewer::onMsgStorageDelete(const MsgIdList &msgIdList) { MSG_LOG(""); - if(m_Msg) + if (m_Msg) { MsgId id = m_Msg->getId(); - if(std::find(msgIdList.begin(), msgIdList.end(), id) != msgIdList.end()) + if (std::find(msgIdList.begin(), msgIdList.end(), id) != msgIdList.end()) pop(); } } @@ -466,6 +464,6 @@ void Viewer::onMsgStorageDelete(const MsgIdList &msgIdList) void Viewer::onPause() { MSG_LOG(""); - if(m_pSmilPlayer) + if (m_pSmilPlayer) m_pSmilPlayer->stop(); } diff --git a/src/Viewer/Utils/src/MediaPlayer.cpp b/src/Viewer/Utils/src/MediaPlayer.cpp index 3f23a0e5..2aaf31f9 100644 --- a/src/Viewer/Utils/src/MediaPlayer.cpp +++ b/src/Viewer/Utils/src/MediaPlayer.cpp @@ -28,10 +28,10 @@ MediaPlayer::MediaPlayer() , m_StreamInfo() { sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, on_sound_stream_focus_state_changed_cb, this, &m_StreamInfo); - if(m_StreamInfo) + if (m_StreamInfo) { player_create(&m_Player); - if(m_Player) + if (m_Player) { player_set_sound_type(m_Player, SOUND_TYPE_MEDIA); player_set_volume(m_Player, 1.0, 1.0); @@ -47,10 +47,10 @@ MediaPlayer::~MediaPlayer() m_pListener = nullptr; stop(); - if(m_StreamInfo) + if (m_StreamInfo) sound_manager_destroy_stream_information(m_StreamInfo); - if(m_Player) + if (m_Player) { player_unprepare(m_Player); player_destroy(m_Player); @@ -77,7 +77,7 @@ bool MediaPlayer::getFocus() const int flags = 0; char *extraInfo = nullptr; - if(sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE) + if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE) { free(extraInfo); return acquiredBy != SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE && @@ -91,10 +91,10 @@ bool MediaPlayer::getFocus() const void MediaPlayer::start() { sound_manager_acquire_focus(m_StreamInfo, SOUND_STREAM_FOCUS_FOR_PLAYBACK, nullptr); - if(getState() == PLAYER_STATE_IDLE) + if (getState() == PLAYER_STATE_IDLE) player_prepare(m_Player); - if(getState() != PLAYER_STATE_PLAYING) + if (getState() != PLAYER_STATE_PLAYING) player_start(m_Player); } @@ -102,13 +102,13 @@ void MediaPlayer::stop() { sound_manager_release_focus(m_StreamInfo, SOUND_STREAM_FOCUS_FOR_PLAYBACK, nullptr); player_state_e state = getState(); - if(state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_PAUSED) + if (state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_PAUSED) player_stop(m_Player); } void MediaPlayer::pause() { - if(getState() == PLAYER_STATE_PLAYING) + if (getState() == PLAYER_STATE_PLAYING) player_pause(m_Player); } @@ -139,18 +139,18 @@ int MediaPlayer::getDuration() const void MediaPlayer::setPosition(int msec) { player_state_e state = getState(); - if(state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_PAUSED || state == PLAYER_STATE_READY) + if (state == PLAYER_STATE_PLAYING || state == PLAYER_STATE_PAUSED || state == PLAYER_STATE_READY) player_set_play_position(m_Player, msec, true, on_seek_cb, this); } int MediaPlayer::getDuration(const std::string &uri) { int msec = 0; - if(!uri.empty()) + if (!uri.empty()) { player_h player = {}; player_create(&player); - if(player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE) + if (player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE) { player_prepare(player); player_get_duration(player, &msec); @@ -164,7 +164,7 @@ int MediaPlayer::getDuration(const std::string &uri) void MediaPlayer::on_completed_cb(void *user_data) { IMediaPlayerListener *l = static_cast(user_data)->m_pListener; - if(l) + if (l) l->onMediaPlayerCompleted(); } @@ -185,10 +185,8 @@ void MediaPlayer::on_sound_stream_focus_state_changed_cb(sound_stream_info_h str [](void *data) { auto *self = (MediaPlayer*)data; - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onMediaPlayerSoundFocusChanged(); }, - self - ); - + self); } diff --git a/src/Viewer/View/src/PlayerControl.cpp b/src/Viewer/View/src/PlayerControl.cpp index 2bfd7bdb..2793969f 100644 --- a/src/Viewer/View/src/PlayerControl.cpp +++ b/src/Viewer/View/src/PlayerControl.cpp @@ -24,7 +24,7 @@ namespace { const char *groupName = "player"; const char *prevCb = "prev_clicked"; - const char *playCb= "play_clicked"; + const char *playCb = "play_clicked"; const char *pauseCb = "pause_clicked"; const char *nextCb = "next_clicked"; const char *progressSwl = "progress_area"; @@ -49,7 +49,6 @@ PlayerControl::PlayerControl(Evas_Object *parent) PlayerControl::~PlayerControl() { - } void PlayerControl::setListener(IPlayerControlListener *l) @@ -115,25 +114,25 @@ void PlayerControl::setEndTime(const std::string &time) void PlayerControl::onPlay(Evas_Object *obj, const char *emission, const char *source) { - if(m_pListener) + if (m_pListener) m_pListener->onPlayClicked(); } void PlayerControl::onPause(Evas_Object *obj, const char *emission, const char *source) { - if(m_pListener) + if (m_pListener) m_pListener->onPauseClicked(); } void PlayerControl::onNext(Evas_Object *obj, const char *emission, const char *source) { - if(m_pListener) + if (m_pListener) m_pListener->onNextClicked(); } void PlayerControl::onPrev(Evas_Object *obj, const char *emission, const char *source) { - if(m_pListener) + if (m_pListener) m_pListener->onPrevClicked(); } diff --git a/src/Viewer/View/src/SmilAttachmentItemView.cpp b/src/Viewer/View/src/SmilAttachmentItemView.cpp index 10b23dba..9de1368e 100644 --- a/src/Viewer/View/src/SmilAttachmentItemView.cpp +++ b/src/Viewer/View/src/SmilAttachmentItemView.cpp @@ -58,11 +58,10 @@ SmilAttachmentItemView::SmilAttachmentItemView(Evas_Object *parent) [] (void *data, Evas_Object *obj, void *event_info) { auto *self = (SmilAttachmentItemView*)data; - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onItemClicked(*self); }, - this - ); + this); evas_object_show(m_pFileButton); // Save button: @@ -77,11 +76,10 @@ SmilAttachmentItemView::SmilAttachmentItemView(Evas_Object *parent) [] (void *data, Evas_Object *obj, void *event_info) { auto *self = (SmilAttachmentItemView*)data; - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onSaveButtonClicked(*self); }, - this - ); + this); evas_object_show(m_pSaveButton); elm_box_pack_end(box, m_pFileButton); @@ -90,7 +88,6 @@ SmilAttachmentItemView::SmilAttachmentItemView(Evas_Object *parent) SmilAttachmentItemView::~SmilAttachmentItemView() { - } void SmilAttachmentItemView::setListener(ISmilAttachmentItemViewListener *l) @@ -124,7 +121,7 @@ SmilAttachmentInfoItemView::SmilAttachmentInfoItemView(Evas_Object *parent, bool setContent(entry, layoutSwallowContent); - if(manyAttachments) + if (manyAttachments) setText(entry, msgt("IDS_MSGF_POP_HELP_PAGE_MESSAGE")); else setText(entry, msgt("IDS_MSGF_POP_HELP_PAGE_MESSAGE_FOR_ONE_FILE")); @@ -151,18 +148,16 @@ SmilSaveAllItemView::SmilSaveAllItemView(Evas_Object *parent, int count) [] (void *data, Evas_Object *obj, void *event_info) { auto *self = (SmilSaveAllItemView*)data; - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onItemClicked(*self); }, - this - ); + this); evas_object_show(m_pButton); setContent(m_pButton, layoutSwallowContent); } SmilSaveAllItemView::~SmilSaveAllItemView() { - } void SmilSaveAllItemView::setListener(ISmilSaveAllItemViewListener *l) diff --git a/src/Viewer/View/src/SmilImageItemView.cpp b/src/Viewer/View/src/SmilImageItemView.cpp index 8fd43da0..a2ccd639 100644 --- a/src/Viewer/View/src/SmilImageItemView.cpp +++ b/src/Viewer/View/src/SmilImageItemView.cpp @@ -30,7 +30,6 @@ SmilImageItemView::SmilImageItemView(Evas_Object *parent, const std::string &ima SmilImageItemView::~SmilImageItemView() { - } Evas_Object *SmilImageItemView::getImage() const @@ -40,7 +39,7 @@ Evas_Object *SmilImageItemView::getImage() const void SmilImageItemView::playAnimation(bool play) { - if(hasAnimation()) + if (hasAnimation()) elm_image_animated_play_set(m_pImage, play); } @@ -52,7 +51,7 @@ bool SmilImageItemView::hasAnimation() const Evas_Object *SmilImageItemView::createImage(Evas_Object *parent, const std::string &imagePath) { m_pImage = elm_image_add(parent); - if(!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr)) + if (!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr)) { evas_object_del(m_pImage); m_pImage = nullptr; @@ -69,7 +68,7 @@ Evas_Object *SmilImageItemView::createImage(Evas_Object *parent, const std::stri evas_object_size_hint_min_set(m_pImage, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); evas_object_size_hint_max_set(m_pImage, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); - if(elm_image_animated_available_get(m_pImage)) + if (elm_image_animated_available_get(m_pImage)) elm_image_animated_set(m_pImage, true); return m_pImage; diff --git a/src/Viewer/View/src/SmilPageLayout.cpp b/src/Viewer/View/src/SmilPageLayout.cpp index 0b9dfbd9..8e91eb4f 100644 --- a/src/Viewer/View/src/SmilPageLayout.cpp +++ b/src/Viewer/View/src/SmilPageLayout.cpp @@ -28,7 +28,6 @@ SmilPageLayout::SmilPageLayout(Evas_Object *parent) SmilPageLayout::~SmilPageLayout() { - } Evas_Object *SmilPageLayout::getBox() const diff --git a/src/Viewer/View/src/SmilPlayerView.cpp b/src/Viewer/View/src/SmilPlayerView.cpp index 3faa8253..97eda153 100644 --- a/src/Viewer/View/src/SmilPlayerView.cpp +++ b/src/Viewer/View/src/SmilPlayerView.cpp @@ -25,13 +25,12 @@ SmilPlayerView::SmilPlayerView(Evas_Object *parent) SmilPlayerView::~SmilPlayerView() { - } void SmilPlayerView::displayPage(Evas_Object *page) { Eina_List *list = elm_box_children_get(getEo()); - if(list) + if (list) { Eina_List *l = nullptr; void *obj = nullptr; diff --git a/src/Viewer/View/src/SmilTextItemView.cpp b/src/Viewer/View/src/SmilTextItemView.cpp index 319ef1b8..76f8a5b6 100644 --- a/src/Viewer/View/src/SmilTextItemView.cpp +++ b/src/Viewer/View/src/SmilTextItemView.cpp @@ -38,7 +38,7 @@ Evas_Object *SmilTextItemView::createEntry(Evas_Object *parent, const std::strin evas_object_show(entry); char *markupText = elm_entry_utf8_to_markup(text.c_str()); - if(markupText) + if (markupText) { elm_entry_entry_set(entry, markupText); free(markupText); diff --git a/src/Viewer/View/src/SmilVideoItemView.cpp b/src/Viewer/View/src/SmilVideoItemView.cpp index b4c3c3d2..c7648a57 100644 --- a/src/Viewer/View/src/SmilVideoItemView.cpp +++ b/src/Viewer/View/src/SmilVideoItemView.cpp @@ -28,21 +28,19 @@ namespace { bool isLandscape = contentW > contentH; - if(isLandscape) + if (isLandscape) { w = viewerMaxWidth; h = viewerMaxWidth * contentH / contentW; - if(h > viewerMaxHeight) + if (h > viewerMaxHeight) { w = viewerMaxHeight * contentW / contentH; h = viewerMaxHeight; } - } - else - { + } else { w = viewerMaxHeight * contentH / contentW; h = viewerMaxHeight; - if(w > viewerMaxWidth) + if (w > viewerMaxWidth) { w = viewerMaxWidth; h = viewerMaxWidth * contentW / contentH; @@ -57,7 +55,7 @@ SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int vi int w = 0; int h = 0; - if(videoWidth > 0 && videoHeight > 0) + if (videoWidth > 0 && videoHeight > 0) getResizedSize(videoWidth, videoHeight, w, h); setEo(addLayout(parent, SMIL_ITEM_EDJ_PATH, "smil_video_item")); @@ -67,7 +65,6 @@ SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int vi SmilVideoItemView::~SmilVideoItemView() { - } Evas_Object *SmilVideoItemView::getVideoSink() const diff --git a/src/Viewer/View/src/SubjectLayout.cpp b/src/Viewer/View/src/SubjectLayout.cpp index 684aa30f..e2b7f129 100644 --- a/src/Viewer/View/src/SubjectLayout.cpp +++ b/src/Viewer/View/src/SubjectLayout.cpp @@ -35,7 +35,6 @@ SubjectLayout::SubjectLayout(Evas_Object *parent) SubjectLayout::~SubjectLayout() { - } Evas_Object *SubjectLayout::createLayout(Evas_Object *parent) diff --git a/src/Viewer/View/src/ViewerLayout.cpp b/src/Viewer/View/src/ViewerLayout.cpp index ab761950..4b50a3f1 100644 --- a/src/Viewer/View/src/ViewerLayout.cpp +++ b/src/Viewer/View/src/ViewerLayout.cpp @@ -56,19 +56,17 @@ ViewerLayout::ViewerLayout(Evas_Object *parent) [](void *data, void *event_info)->Evas_Event_Flags { ViewerLayout *self = static_cast(data); - if(self->m_pListener) + if (self->m_pListener) self->m_pListener->onLayoutTap(); return EVAS_EVENT_FLAG_NONE; }, - this - ); + this); setContent(button, touchAreaPart); } ViewerLayout::~ViewerLayout() { - } void ViewerLayout::setListener(IViewerLayoutListener *l) -- 2.34.1