2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file splash_screen_support.cpp
18 * @author Andrzej Surdej (a.surdej@samsung.com)
19 * @brief Implementation file for splash screen support
22 #include "splash_screen_support.h"
23 #include <dpl/log/log.h>
24 #include <Elementary.h>
26 SplashScreenSupport::SplashScreenSupport(Evas_Object* parent)
29 Evas_Coord x, y, w, h;
30 evas_object_geometry_get(parent, &x, &y, &w, &h);
32 m_splashScreen = elm_icon_add(parent);
34 evas_object_resize(m_splashScreen, w, h);
35 evas_object_image_fill_set(m_splashScreen, 0, 0, w, h);
38 SplashScreenSupport::~SplashScreenSupport()
43 bool SplashScreenSupport::createSplashScreen(
44 const DPL::OptionalString imagePath)
46 LogDebug("initializing splash screen");
49 if (!imagePath.IsNull()) {
50 setSplashImagePath((DPL::ToUTF8String(*imagePath)).c_str());
58 void SplashScreenSupport::startSplashScreen()
61 LogInfo("splashImageOn");
62 if (elm_image_animated_get(m_splashScreen) == EINA_TRUE) {
63 elm_image_animated_play_set(m_splashScreen, EINA_TRUE);
65 evas_object_show(m_splashScreen);
69 void SplashScreenSupport::stopSplashScreen()
71 LogDebug("splash screen stop");
73 LogInfo("splashImageOff");
74 if (elm_image_animated_get(m_splashScreen) == EINA_TRUE) {
75 elm_image_animated_play_set(m_splashScreen, EINA_FALSE);
77 evas_object_hide(m_splashScreen);
81 void SplashScreenSupport::setSplashImagePath(const char * image_path)
84 LogInfo("splash screen image path : " << image_path);
86 if (elm_image_file_set(m_splashScreen, image_path, NULL)) {
87 if (elm_image_animated_available_get(m_splashScreen)) {
88 elm_image_animated_set(m_splashScreen, EINA_TRUE);
89 elm_image_animated_play_set(m_splashScreen, EINA_FALSE);
91 elm_image_animated_set(m_splashScreen, EINA_FALSE);
94 LogError("loading splash image has been failed");