2 * This file is part of QMAFW
4 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights
7 * Contact: Visa Smolander <visa.smolander@nokia.com>
9 * This software, including documentation, is protected by copyright controlled
10 * by Nokia Corporation. All rights are reserved. Copying, including
11 * reproducing, storing, adapting or translating, any or all of this material
12 * requires the prior written consent of Nokia Corporation. This material also
13 * contains confidential information which may not be disclosed to others
14 * without the prior written consent of Nokia.
18 #include "MafwGstRendererDolby.h"
22 const int DEFAULT_COLOR = 2;
23 const int DEFAULT_ROOM_SIZE = 2;
24 const int MAX_VALUE = 4;
33 MafwGstRendererDolby::MafwGstRendererDolby( QObject* parent ):
36 m_dolbyConfMusicRoom(0),
37 m_dolbyConfMusicColor(0),
39 m_dolbyConfVideoRoom(0),
40 m_dolbyConfVideoColor(0)
42 qDebug() << __PRETTY_FUNCTION__;
43 m_currentMusicDolbyState = MafwDolbyOff;
44 m_currentMusicDolbyRoom = DEFAULT_ROOM_SIZE;
45 m_currentMusicDolbyColor = DEFAULT_COLOR;
46 m_currentVideoDolbyState = MafwDolbyOff;
47 m_currentVideoDolbyRoom = DEFAULT_ROOM_SIZE;
48 m_currentVideoDolbyColor = DEFAULT_COLOR;
51 void MafwGstRendererDolby::initialize()
53 if (!m_dolbyConfMusic)
55 m_dolbyConfMusic = new GConfItem("/apps/Multimedia/music/dolbyConf", this);
57 if (!m_dolbyConfMusicRoom)
59 m_dolbyConfMusicRoom = new GConfItem("/apps/Multimedia/music/dolbyConfRoom", this);
61 if (!m_dolbyConfMusicColor)
63 m_dolbyConfMusicColor = new GConfItem("/apps/Multimedia/music/dolbyConfColor", this);
65 if (!m_dolbyConfVideo)
67 m_dolbyConfVideo = new GConfItem("/apps/Multimedia/video/dolbyConf", this);
69 if (!m_dolbyConfVideoRoom)
71 m_dolbyConfVideoRoom = new GConfItem("/apps/Multimedia/video/dolbyConfRoom", this);
73 if (!m_dolbyConfVideoColor)
75 m_dolbyConfVideoColor = new GConfItem("/apps/Multimedia/video/dolbyConfColor", this);
77 if (!m_dolbyConfMusic->value().toString().isEmpty())
80 connect(m_dolbyConfMusic, SIGNAL(valueChanged()), this, SLOT(valueMusicChanged()));
81 connect(m_dolbyConfMusicRoom, SIGNAL(valueChanged()), this, SLOT(valueMusicChanged()));
82 connect(m_dolbyConfMusicColor, SIGNAL(valueChanged()), this, SLOT(valueMusicChanged()));
84 if (!m_dolbyConfVideo->value().toString().isEmpty())
87 connect(m_dolbyConfVideo, SIGNAL(valueChanged()), this, SLOT(valueVideoChanged()));
88 connect(m_dolbyConfVideoRoom, SIGNAL(valueChanged()), this, SLOT(valueVideoChanged()));
89 connect(m_dolbyConfVideoColor, SIGNAL(valueChanged()), this, SLOT(valueVideoChanged()));
93 MafwGstRendererDolby::~MafwGstRendererDolby()
95 qDebug() << __PRETTY_FUNCTION__;
98 bool MafwGstRendererDolby::setMusicDolbyState (uint value)
100 qDebug() << __PRETTY_FUNCTION__ << value;
101 if ( value <= MafwDolbyAuto)
103 m_currentMusicDolbyState = value;
104 m_dolbyConfMusic->set(m_currentMusicDolbyState);
109 m_currentMusicDolbyState = MafwDolbyOff;
110 m_dolbyConfMusic->set(m_currentMusicDolbyState);
115 bool MafwGstRendererDolby::setMusicDolbyRoom (int value)
117 qDebug() << __PRETTY_FUNCTION__ << value;
120 m_currentMusicDolbyRoom = 0;
121 m_dolbyConfMusicRoom->set(m_currentMusicDolbyRoom);
123 else if ( value > MAX_VALUE)
125 m_currentMusicDolbyRoom = MAX_VALUE;
126 m_dolbyConfMusicRoom->set(m_currentMusicDolbyRoom);
130 m_currentMusicDolbyRoom = value;
131 m_dolbyConfMusicRoom->set(m_currentMusicDolbyRoom);
136 bool MafwGstRendererDolby::setMusicDolbyColor (int value)
138 qDebug() << __PRETTY_FUNCTION__ << value;
141 m_currentMusicDolbyColor = 0;
142 m_dolbyConfMusicColor->set(m_currentMusicDolbyColor);
144 else if ( value > MAX_VALUE)
146 m_currentMusicDolbyColor = MAX_VALUE;
147 m_dolbyConfMusicColor->set(m_currentMusicDolbyColor);
151 m_currentMusicDolbyColor = value;
152 m_dolbyConfMusicColor->set(m_currentMusicDolbyColor);
157 bool MafwGstRendererDolby::setVideoDolbyState (uint value)
159 qDebug() << __PRETTY_FUNCTION__ << value;
160 if ( value <= MafwDolbyAuto)
162 m_currentVideoDolbyState = value;
163 m_dolbyConfVideo->set(int(m_currentVideoDolbyState));
168 m_currentVideoDolbyState = MafwDolbyOff;
169 m_dolbyConfVideo->set(int(m_currentVideoDolbyState));
174 bool MafwGstRendererDolby::setVideoDolbyRoom (int value)
176 qDebug() << __PRETTY_FUNCTION__ << value;
179 m_currentVideoDolbyRoom = 0;
180 m_dolbyConfVideoRoom->set(m_currentVideoDolbyRoom);
182 else if ( value > MAX_VALUE)
184 m_currentVideoDolbyRoom = MAX_VALUE;
185 m_dolbyConfVideoRoom->set(m_currentVideoDolbyRoom);
189 m_currentVideoDolbyRoom = value;
190 m_dolbyConfVideoRoom->set(m_currentVideoDolbyRoom);
195 bool MafwGstRendererDolby::setVideoDolbyColor (int value)
197 qDebug() << __PRETTY_FUNCTION__ << value;
200 m_currentVideoDolbyColor = 0;
201 m_dolbyConfVideoColor->set(m_currentVideoDolbyColor);
203 else if ( value > MAX_VALUE)
205 m_currentVideoDolbyColor = MAX_VALUE;
206 m_dolbyConfVideoColor->set(m_currentVideoDolbyColor);
210 m_currentVideoDolbyColor = value;
211 m_dolbyConfVideoColor->set(m_currentVideoDolbyColor);
216 void MafwGstRendererDolby::valueMusicChanged()
218 m_currentMusicDolbyState = m_dolbyConfMusic->value().toUInt();
219 if (!(m_currentMusicDolbyState <= MafwDolbyAuto))
221 m_currentMusicDolbyState = MafwDolbyOff;
222 m_currentMusicDolbyRoom = m_dolbyConfMusicRoom->value().toInt();
223 if (m_currentMusicDolbyRoom < 0)
225 m_currentMusicDolbyRoom = 0;
227 if (m_currentMusicDolbyRoom > MAX_VALUE)
229 m_currentMusicDolbyRoom = MAX_VALUE;
231 m_currentMusicDolbyColor = m_dolbyConfMusicColor->value().toInt();
232 if (m_currentMusicDolbyColor < 0)
234 m_currentMusicDolbyColor = 0;
236 if (m_currentMusicDolbyColor > MAX_VALUE)
238 m_currentMusicDolbyColor = MAX_VALUE;
241 qDebug() << __PRETTY_FUNCTION__ << "state" << m_currentMusicDolbyState;
242 qDebug() << __PRETTY_FUNCTION__ << "room" << m_currentMusicDolbyRoom;
243 qDebug() << __PRETTY_FUNCTION__ << "color" << m_currentMusicDolbyColor;
244 Q_EMIT mafwDHMMusicPropertyChanged();
247 void MafwGstRendererDolby::valueVideoChanged()
249 m_currentVideoDolbyState = m_dolbyConfVideo->value().toUInt();
250 if (!(m_currentVideoDolbyState <= MafwDolbyAuto))
252 m_currentVideoDolbyState = MafwDolbyOff;
253 m_currentVideoDolbyRoom = m_dolbyConfVideoRoom->value().toInt();
254 if (m_currentVideoDolbyRoom < 0)
256 m_currentVideoDolbyRoom = 0;
258 if (m_currentVideoDolbyRoom > MAX_VALUE)
260 m_currentVideoDolbyRoom = MAX_VALUE;
262 m_currentVideoDolbyColor = m_dolbyConfVideoColor->value().toInt();
263 if (m_currentVideoDolbyColor < 0)
265 m_currentVideoDolbyColor = 0;
267 if (m_currentVideoDolbyColor > MAX_VALUE)
269 m_currentVideoDolbyColor = MAX_VALUE;
272 qDebug() << __PRETTY_FUNCTION__ << "state" << m_currentVideoDolbyState;
273 qDebug() << __PRETTY_FUNCTION__ << "room" << m_currentVideoDolbyRoom;
274 qDebug() << __PRETTY_FUNCTION__ << "color" << m_currentVideoDolbyColor;
275 Q_EMIT mafwDHMVideoPropertyChanged();
278 uint MafwGstRendererDolby::getMusicDolbyState ()
280 qDebug() << __PRETTY_FUNCTION__ << m_currentMusicDolbyState;
281 return m_currentMusicDolbyState;
284 int MafwGstRendererDolby::getMusicDolbyRoom ()
286 qDebug() << __PRETTY_FUNCTION__ << m_currentMusicDolbyRoom;
287 return m_currentMusicDolbyRoom;
290 int MafwGstRendererDolby::getMusicDolbyColor ()
292 qDebug() << __PRETTY_FUNCTION__ << m_currentMusicDolbyColor;
293 return m_currentMusicDolbyColor;
296 uint MafwGstRendererDolby::getVideoDolbyState ()
298 qDebug() << __PRETTY_FUNCTION__ << m_currentVideoDolbyState;
299 return m_currentVideoDolbyState;
302 int MafwGstRendererDolby::getVideoDolbyRoom ()
304 qDebug() << __PRETTY_FUNCTION__ << m_currentVideoDolbyRoom;
305 return m_currentVideoDolbyRoom;
308 int MafwGstRendererDolby::getVideoDolbyColor ()
310 qDebug() << __PRETTY_FUNCTION__ << m_currentVideoDolbyColor;
311 return m_currentVideoDolbyColor;