1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
11 * |
8 * |
12 * Contributors: |
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
13 * |
13 * |
14 * Description: |
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
21 |
18 |
|
19 #include "NativeChromeItem.h" |
22 #include "NativeChromeItem.h" |
|
23 #include "ChromeItem.h" |
20 #include "ChromeSnippet.h" |
24 #include "ChromeSnippet.h" |
21 |
25 |
22 namespace GVA { |
26 namespace GVA { |
23 |
27 |
24 NativeChromeItem::NativeChromeItem(ChromeSnippet * snippet, QGraphicsItem* parent) |
28 NativeChromeItem::NativeChromeItem(ChromeSnippet * snippet, QGraphicsItem* parent) |
25 : QGraphicsWidget(parent), |
29 : ChromeItem(snippet, parent) |
26 m_snippet(snippet) |
|
27 { |
30 { |
28 //Set opacity from element CSS |
31 //Set opacity from element CSS |
29 QString CSSOpacity = m_snippet->element().styleProperty("opacity", QWebElement::ComputedStyle); |
32 QString CSSOpacity = m_snippet->element().styleProperty("opacity", QWebElement::ComputedStyle); |
30 setOpacity(CSSOpacity.toFloat()); |
33 setOpacity(CSSOpacity.toFloat()); |
31 } |
34 } |
35 } |
38 } |
36 |
39 |
37 void NativeChromeItem::CSSToQColor(QString cssColor, QColor & color){ |
40 void NativeChromeItem::CSSToQColor(QString cssColor, QColor & color){ |
38 QStringList vals = cssColor.remove("rgb(").remove(")").split(", "); |
41 QStringList vals = cssColor.remove("rgb(").remove(")").split(", "); |
39 //qDebug() << vals[0] << ":" << vals[1] << ":" << vals[2]; |
42 //qDebug() << vals[0] << ":" << vals[1] << ":" << vals[2]; |
40 color.setRgb(vals[0].toInt(), vals[1].toInt(), vals[2].toInt()); |
43 if (vals.size() == 4) { |
|
44 color.setRgb(vals[0].toInt(), vals[1].toInt(), vals[2].toInt(), vals[3].toInt()); |
|
45 } else { |
|
46 color.setRgb(vals[0].toInt(), vals[1].toInt(), vals[2].toInt()); |
|
47 } |
41 } |
48 } |
42 |
49 |
43 } // end of namespace GVA |
50 } // end of namespace GVA |