|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the HbThemeChanger class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cpthemechanger.h" |
|
20 #include "cpthemechanger_p.h" |
|
21 |
|
22 /*! |
|
23 @alpha |
|
24 @hbcore |
|
25 \class CpThemeChanger |
|
26 |
|
27 \brief CpThemeChanger provides an interface for changing the current |
|
28 theme and enumerating the available themes (e.g., for the UI to provide |
|
29 a list of themes to show). |
|
30 |
|
31 This API is only for use with the control panel and its theme |
|
32 changing plugin. |
|
33 */ |
|
34 |
|
35 /*! |
|
36 Constructor. |
|
37 */ |
|
38 CpThemeChanger::CpThemeChanger(QObject* p) : |
|
39 QObject(p), |
|
40 d_ptr(new CpThemeChangerPrivate(this)) |
|
41 { |
|
42 } |
|
43 |
|
44 /*! |
|
45 Provides a list of themes as a const QAbstractItemModel*. |
|
46 */ |
|
47 QAbstractItemModel& CpThemeChanger::model() |
|
48 { |
|
49 Q_D(CpThemeChanger); |
|
50 |
|
51 return d->model; |
|
52 } |
|
53 |
|
54 /*! |
|
55 Provide a list of currently available themes. |
|
56 */ |
|
57 const QList<CpThemeChanger::ThemeInfo> CpThemeChanger::themes() const |
|
58 { |
|
59 Q_D(const CpThemeChanger); |
|
60 |
|
61 return d->themes(); |
|
62 } |
|
63 |
|
64 /*! |
|
65 Creates a connection to the theme server for the purpose of |
|
66 changing the theme. |
|
67 */ |
|
68 bool CpThemeChanger::connectToServer() |
|
69 { |
|
70 Q_D(CpThemeChanger); |
|
71 |
|
72 return d->connectToServer(); |
|
73 } |
|
74 |
|
75 /*! |
|
76 Indicates if the client is connected to the theme server. |
|
77 */ |
|
78 bool CpThemeChanger::isConnected() const |
|
79 { |
|
80 Q_D(const CpThemeChanger); |
|
81 |
|
82 return d->isConnected(); |
|
83 } |
|
84 |
|
85 |
|
86 /*! |
|
87 Returns a ThemeInfo struct containing the current theme name and |
|
88 a repersentative HbIcon. |
|
89 |
|
90 If no repersentative icon exists, the HbIcon returned will be |
|
91 uninitialized. |
|
92 */ |
|
93 const CpThemeChanger::ThemeInfo& CpThemeChanger::currentTheme() const |
|
94 { |
|
95 Q_D(const CpThemeChanger); |
|
96 |
|
97 return d->currentTheme(); |
|
98 } |
|
99 |
|
100 /*! |
|
101 Change a theme. Returns true on success, false otherwise. |
|
102 */ |
|
103 bool CpThemeChanger::changeTheme(const QString& newtheme) |
|
104 { |
|
105 Q_D(CpThemeChanger); |
|
106 |
|
107 return d->changeTheme(newtheme); |
|
108 } |
|
109 |
|
110 /*! |
|
111 Destructor |
|
112 */ |
|
113 CpThemeChanger::~CpThemeChanger() |
|
114 { |
|
115 delete d_ptr; |
|
116 d_ptr = 0; |
|
117 } |
|
118 |
|
119 #include "moc_cpthemechanger.cpp" |
|
120 |
|
121 // End of file |
|
122 |