LayerManagerCommands: added RemoveSynchronizedsurface command
[profile/ivi/layer-management.git] / LayerManagerCommands / src / RemoveSynchronizedSurfacesCommand.cpp
1 /***************************************************************************
2  *
3  * Copyright 2010,2011 BMW Car IT GmbH
4  *
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  ****************************************************************************/
19 #include "RemoveSynchronizedSurfacesCommand.h"
20 #include "ICommandExecutor.h"
21 #include "Scene.h"
22 #include "Log.h"
23
24 ExecutionResult RemoveSynchronizedSurfacesCommand::execute(ICommandExecutor* executor)
25 {
26     Scene& scene = *(executor->getScene());
27     ExecutionResult result = ExecutionFailed;
28
29     LOG_DEBUG("RemoveSynchronizedSurfacesCommand", "Length to set: " << m_length);
30
31     // First of all get all surfaces which are in the current render order.
32     for (unsigned int i = 0; i < m_length; i++)
33     {
34         Surface* surface = scene.getSurface(m_array[i]);
35         if (surface)
36         {
37             surface->setSynchronized(false);
38             LOG_DEBUG("RemoveSynchronizedSurfacesCommand", "Unsetting synchronized Surface : " << m_array[i]);
39             result = ExecutionSuccess;
40         }
41     }
42     return result;
43 }
44
45 const std::string RemoveSynchronizedSurfacesCommand::getString()
46 {
47     std::stringstream description;
48     description << "RemoveSynchronizedSurfacesCommand("
49                 << "m_array=[";
50
51     for (unsigned int i = 0; i < m_length; ++i)
52     {
53         description << m_array[i] << ",";
54     }
55     description << "], m_length=" << m_length
56                 << ")";
57     return description.str();
58 }