equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include <QObject> |
18 #include <QString> |
19 #include <QString> |
19 #include <QGraphicsPixmapItem> |
20 #include <QGraphicsPixmapItem> |
20 #include <QGraphicsLinearLayout> |
21 #include <QGraphicsLinearLayout> |
21 |
22 |
22 #include <hbaction.h> |
23 #include <hbaction.h> |
79 if(mainWindow()->orientation() == Qt::Horizontal) { |
80 if(mainWindow()->orientation() == Qt::Horizontal) { |
80 mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); |
81 mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon(), this); |
81 } |
82 } |
82 else { |
83 else { |
83 mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); |
84 mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon(), this); |
84 } |
85 //set to ignore aspect ratio so the layout would rezise the icon correctly. |
85 |
86 mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio); |
86 //set to ignore aspect ratio so the layout would rezise the icon correctly. |
87 |
87 mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio); |
88 } |
|
89 // set an object name for preview icon to make it testable for automation testing |
|
90 mPreviewIcon->setObjectName(QString("themePreviewIcon")); |
|
91 |
88 |
92 |
89 bottomLayout->addItem(mPreviewIcon); |
93 bottomLayout->addItem(mPreviewIcon); |
90 containerLayout->addItem(bottomLayout); |
94 containerLayout->addItem(bottomLayout); |
91 |
95 |
92 setLayout(containerLayout); |
96 setLayout(containerLayout); |
156 /*! |
160 /*! |
157 Slot to handle when the user selects a theme. |
161 Slot to handle when the user selects a theme. |
158 */ |
162 */ |
159 void CpThemePreview::themeSelected() |
163 void CpThemePreview::themeSelected() |
160 { |
164 { |
161 emit applyTheme(mTheme.name()); |
165 emit applyTheme(mTheme); |
162 } |
166 } |
163 |
167 |
164 /*! |
168 /*! |
165 * Slot to handle landscape/portrait orientation change to use the |
169 * Slot to handle landscape/portrait orientation change to use the |
166 * right graphics. |
170 * right graphics. |
179 //Remove preview icon. |
183 //Remove preview icon. |
180 previewLayout->removeAt(0); |
184 previewLayout->removeAt(0); |
181 |
185 |
182 if(orientation == Qt::Horizontal) { |
186 if(orientation == Qt::Horizontal) { |
183 mPreviewIcon->setIcon(mTheme.landscapePreviewIcon()); |
187 mPreviewIcon->setIcon(mTheme.landscapePreviewIcon()); |
|
188 mPreviewIcon->setAspectRatioMode(Qt::KeepAspectRatio); |
|
189 |
184 } |
190 } |
185 else { |
191 else { |
186 mPreviewIcon->setIcon(mTheme.portraitPreviewIcon()); |
192 mPreviewIcon->setIcon(mTheme.portraitPreviewIcon()); |
|
193 mPreviewIcon->setAspectRatioMode(Qt::IgnoreAspectRatio); |
187 } |
194 } |
188 |
195 |
189 previewLayout->addItem(mPreviewIcon); |
196 previewLayout->addItem(mPreviewIcon); |
190 } |
197 } |
191 |
198 |