--- a/controlpanelplugins/themeplugin/image/qgn_menu_note.svg Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg width="100%" height="100%" viewBox="0 0 88 88">
-<linearGradient id="_20" gradientUnits="userSpaceOnUse" x1="46.99" y1="48.62" x2="57.59" y2="67.17">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_20)" d="M37.755,14.563c-0.625-0.15-3.215-0.771-3.215-0.771l-6.344,9.318 C14.325,41.71,3.561,47.928,2.801,48.401l6.468,2.128l-1.694,2.4l1.111,3.48l41.153,18.198l14.238-26.409l16.804-2.157l2.899-4.356 l-1.079-7.683l-3.737-4.507l-5.312,0.944l0.463-0.857l0.251-6.262c0,0-4.423-1.069-4.374-1.063 c-0.755-3.548-4.226-3.896-6.26-1.475c-0.013-0.005-2.825-0.708-2.818-0.712c-0.742-3.492-4.2-3.939-6.269-1.469 c-0.004-0.012-2.582-0.668-2.595-0.661c-0.749-3.501-4.18-3.806-6.163-1.437c-0.027,0.008-2.09-0.508-2.088-0.523 C43.063,12.593,39.706,12.258,37.755,14.563z"/>
-<polygon fill="#FFFFFF" points="35.11,15.12 8.336,53.049 48.798,69.047 72.646,28.459 73.573,25.04 "/>
-<linearGradient id="_21" gradientUnits="userSpaceOnUse" x1="30.63" y1="59.56" x2="27.89" y2="65.83">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_21)" points="8.45,52.959 48.528,68.704 49.52,73.706 9.246,55.897 "/>
-<linearGradient id="_22" gradientUnits="userSpaceOnUse" x1="56.86" y1="45.11" x2="69.16" y2="54.68">
-<stop stop-color="#DEE9F3" offset="0"/>
-<stop stop-color="#235487" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_22)" points="48.528,68.704 73.633,23.86 73.411,29.393 49.52,73.706 "/>
-<linearGradient id="_23" gradientUnits="userSpaceOnUse" x1="4.44" y1="38.62" x2="45.79" y2="38.62">
-<stop stop-color="#CADCEC" offset="0"/>
-<stop stop-color="#87A8CB" offset="1"/>
-</linearGradient>
-<path fill="url(#_23)" d="M34.894,14.715C18.737,39.471,4.443,48.209,4.443,48.209 c7.75,2.391,41.35,14.314,41.35,14.314L34.894,14.715z"/>
-<linearGradient id="_24" gradientUnits="userSpaceOnUse" x1="15.64" y1="58.6" x2="44.93" y2="34.82">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<path fill="url(#_24)" d="M10.557,50.247c11.41,4.494,35.236,12.277,35.236,12.277 c15.358-11.682,27.74-38.658,27.74-38.658l-38.697-9.279L10.557,50.247z"/>
-<linearGradient id="_25" gradientUnits="userSpaceOnUse" x1="68.03" y1="52.73" x2="41.63" y2="18.62">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_25)" points="33.619,23.77 33.263,24.6 64.586,33.327 64.445,31.303 "/>
-<polygon fill="url(#_25)" points="30.349,28.944 29.959,29.764 60.965,39.577 60.895,37.549 "/>
-<polygon fill="url(#_25)" points="26.981,34.229 26.567,35.036 57.195,45.958 57.195,43.926 "/>
-<polyline fill="url(#_25)" points="37.03,44.815 23.809,40.569 23.396,41.375 34.393,45.297 37.03,44.815 "/>
-<path fill="#3F5AA6" d="M37.265,17.37c-1.227,0.744-1.05,2.494,0.11,3.184c1.821,1.088,4.019-0.83,2.968-2.572 c0.449-1.01,1.511-1.695,1.794-1.643l1.055,0.223C42.339,13.018,37.265,17.37,37.265,17.37z"/>
-<linearGradient id="_29" gradientUnits="userSpaceOnUse" x1="39.83" y1="18.64" x2="40.83" y2="14.3">
-<stop stop-color="#87A8CB" offset="0"/>
-<stop stop-color="#CADCEC" offset="0.5"/>
-<stop stop-color="#87A8CB" offset="1"/>
-</linearGradient>
-<path fill="url(#_29)" d="M38.914,19.569c-0.589,0.107-1.317-0.102-1.613-0.867c-0.736-5.027,5.301-6.996,5.913-2.141 C42.121,14.176,39.059,15.401,38.914,19.569z"/>
-<path fill="#3F5AA6" d="M45.395,19.34c-1.25,0.758-1.071,2.543,0.112,3.248c1.859,1.107,4.099-0.848,3.027-2.625 c0.458-1.031,1.542-1.729,1.83-1.676l1.076,0.227C50.57,14.901,45.395,19.34,45.395,19.34z"/>
-<path fill="url(#_29)" d="M47.076,21.584c-0.601,0.107-1.342-0.105-1.645-0.887c-0.75-5.129,5.407-7.137,6.031-2.184 C50.348,16.081,47.225,17.331,47.076,21.584z"/>
-<path fill="#3F5AA6" d="M54.135,21.483c-1.274,0.775-1.092,2.594,0.114,3.314c1.897,1.129,4.181-0.863,3.088-2.678 c0.468-1.051,1.574-1.762,1.867-1.709l1.099,0.232C59.414,16.956,54.135,21.483,54.135,21.483z"/>
-<path fill="url(#_29)" d="M55.85,23.772c-0.611,0.111-1.367-0.107-1.676-0.902c-0.767-5.232,5.515-7.281,6.151-2.227 C59.188,18.161,56.002,19.436,55.85,23.772z"/>
-<path fill="#3F5AA6" d="M63.214,23.67c-1.275,0.775-1.093,2.596,0.114,3.314c1.897,1.131,4.181-0.863,3.088-2.678 c0.467-1.051,1.573-1.762,1.867-1.709l1.098,0.23C68.493,19.143,63.214,23.67,63.214,23.67z"/>
-<path fill="url(#_29)" d="M64.929,25.959c-0.612,0.111-1.368-0.105-1.677-0.902c-0.766-5.23,5.515-7.279,6.151-2.229 C68.267,20.348,65.081,21.624,64.929,25.959z"/>
-<linearGradient id="_33" gradientUnits="userSpaceOnUse" x1="39.98" y1="48.02" x2="38.35" y2="40.21">
-<stop stop-color="#81C7C8" offset="0"/>
-<stop stop-color="#BFDAE1" offset="0.01"/>
-<stop stop-color="#FFFFFF" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_33)" points="44.766,36.286 32.146,45.174 47.337,49.641 "/>
-<linearGradient id="_34" gradientUnits="userSpaceOnUse" x1="76.2" y1="30.96" x2="76.09" y2="43.23">
-<stop stop-color="#D6E6EC" offset="0"/>
-<stop stop-color="#298595" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_34)" points="78.675,30.256 82.024,34.297 83.039,41.52 80.464,45.389 69.202,39.09 "/>
-<linearGradient id="_35" gradientUnits="userSpaceOnUse" x1="32.44" y1="33.5" x2="65.81" y2="41.63">
-<stop stop-color="#D6E6EC" offset="0"/>
-<stop stop-color="#298595" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_35)" points="76.59,34.737 77.632,41.426 45.104,46.104 44.105,39.893 "/>
-<linearGradient id="_36" gradientUnits="userSpaceOnUse" x1="30.73" y1="46.42" x2="88.73" y2="44.8">
-<stop stop-color="#E6EEF4" offset="0"/>
-<stop stop-color="#2F8E9A" offset="0.44"/>
-<stop stop-color="#003D6D" offset="0.94"/>
-</linearGradient>
-<polygon fill="url(#_36)" points="77.632,41.426 80.464,45.389 47.337,49.641 45.104,46.104 "/>
-<linearGradient id="_37" gradientUnits="userSpaceOnUse" x1="45.63" y1="37.46" x2="101.75" y2="28.96">
-<stop stop-color="#D6E6EC" offset="0"/>
-<stop stop-color="#298595" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_37)" points="76.59,34.737 78.675,30.256 44.766,36.286 44.105,39.893 "/>
-<linearGradient id="_38" gradientUnits="userSpaceOnUse" x1="35.44" y1="45.89" x2="34.76" y2="40.93">
-<stop stop-color="#235487" offset="0"/>
-<stop stop-color="#496DA2" offset="0.5"/>
-<stop stop-color="#235487" offset="1"/>
-</linearGradient>
-<path fill="url(#_38)" d="M38.261,40.885l-6.462,4.201l7.347,2.1C38.319,46.098,37.854,42.79,38.261,40.885z"/>
-<rect fill="none" height="88" width="88"/>
-</svg>
\ No newline at end of file
Binary file controlpanelplugins/themeplugin/image/themePreview.nvg has changed
Binary file controlpanelplugins/themeplugin/image/themePreview.png has changed
--- a/controlpanelplugins/themeplugin/image/themePreview.svg Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg width="84" height="72" viewBox="0 0 84 72">
-<linearGradient id="_78" gradientUnits="userSpaceOnUse" x1="30.87" y1="28.75" x2="37.09" y2="60.51">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_78)" d="M23.531,11.281L5.719,42.5l1.328,2.391l24.031,6.734l17.641-13.141c0,0-0.158-2.493-0.162-2.503 c0,0-3.672-8.489-3.9-9.028c0.514-0.3,11.891-6.938,11.891-6.938l-0.109-2.859L23.531,11.281z"/>
-<path fill="url(#_78)" d="M52.281,29.016c0,0,2.75,11.217,2.875,11.734c-0.483,0.248-19.281,9.906-19.281,9.906l0.594,2.781 L59.5,63.391l19.641-32.897L78.938,27l-11.516-3.859L52.281,29.016z"/>
-<linearGradient id="_80" gradientUnits="userSpaceOnUse" x1="21.51" y1="35.87" x2="18.01" y2="49.87">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_80)" points="6.549,42.57 7.615,44.447 31.021,50.963 30.717,48.865 "/>
-<linearGradient id="_81" gradientUnits="userSpaceOnUse" x1="13.09" y1="-0.2" x2="49.83" y2="61.22">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_81)" points="43.439,25.218 55.939,17.628 23.871,12.013 6.518,42.631 30.486,48.939 33.328,46.857 "/>
-<linearGradient id="_82" gradientUnits="userSpaceOnUse" x1="47.19" y1="50.73" x2="23.44" y2="19.48">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_82)" points="43.42,24.953 53.211,19.302 24.766,14.07 10.072,41.236 33.07,47.236 48.176,36.132 "/>
-<linearGradient id="_83" gradientUnits="userSpaceOnUse" x1="23.7" y1="56.84" x2="22.11" y2="42.87">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_83)" d="M12.896,36.508l-2.679,4.568l22.774,6.088c0.578-0.389,0.99-0.688,1.199-0.844 C33.67,46.248,17.619,40.061,12.896,36.508z"/>
-<polygon fill="#115B7E" points="23.068,37.926 26.33,41.092 37.918,43.674 42.563,40.258 "/>
-<polygon fill="#BFDAE1" points="30.498,39.459 33.217,39.76 36.553,43.365 33.635,43.055 "/>
-<polygon fill="#2F8E9A" points="30.498,39.459 30.383,39.869 33.033,42.955 33.57,42.961 "/>
-<path fill="#298595" d="M25.684,41.143c-0.34,0.478-3.08,1.111-3.701,0.918c0.584,1.197,8.281,3.697,12.223,4.34 c1.152-0.844,2.383-1.745,3.625-2.655C37.682,43.734,29.107,42.438,25.684,41.143z"/>
-<linearGradient id="_84" gradientUnits="userSpaceOnUse" x1="21.12" y1="39.41" x2="24.58" y2="41.68">
-<stop stop-color="#D6E6EC" offset="0"/>
-<stop stop-color="#298595" offset="1"/>
-</linearGradient>
-<path fill="url(#_84)" d="M21.859,37.691c0,0,3.859,3.41,3.824,3.451c-0.486,0.532-1.895,1.582-3.225,1.356 c-1.406-0.969-1.516-2.535-1.516-2.535S21.143,38.691,21.859,37.691z"/>
-<path fill="#BFDAE1" d="M37.176,43.164c-3.891-0.346-8.678-1.727-10.75-2.424l-2.869-2.592 c2.453-0.051,12.23,1.278,18.695,2.393c0.133-0.098,0.266-0.193,0.395-0.287c-7.146-1.283-17.438-2.85-20.735-2.557 l3.785,3.512c2.773,1.098,7.793,2.355,11.797,2.68c0.063,0.006,0.117,0.006,0.178,0.01c0.293-0.215,0.588-0.428,0.879-0.643 C38.096,43.232,37.639,43.203,37.176,43.164z"/>
-<path fill="#FFFFFF" d="M43.801,25.99c-1.008,1.018-2.887,1.582-5.258,0.744c-3.121,0.617-14.422-1.703-18.314-4.434 l1.998-3.733c1.73-0.021,3.557,0.43,4.418,0.979c0.021-1.244,4.799-3.408,6.994-0.418c2.146-1.813,8.777-2.26,8.297,2.594 c1.927,0.375,2.727,1.459,2.671,2.562l-1.198,0.656L43.801,25.99z"/>
-<linearGradient id="_85" gradientUnits="userSpaceOnUse" x1="41.69" y1="29.27" x2="17.36" y2="33.57">
-<stop stop-color="#2B98A0" offset="0"/>
-<stop stop-color="#0A4A60" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_85)" points="33.205,40.467 44.795,19.023 23.104,34.765 "/>
-<polygon fill="#2F8E9A" points="40.377,41.775 34.348,41.842 42.938,23.255 42.648,40.254 "/>
-<linearGradient id="_86" gradientUnits="userSpaceOnUse" x1="68.92" y1="17.39" x2="38.92" y2="25.01">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_86)" points="55.939,17.628 56.088,19.786 44.148,26.745 43.408,24.939 "/>
-<linearGradient id="_87" gradientUnits="userSpaceOnUse" x1="69.87" y1="44.4" x2="30.62" y2="43.28">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_87)" points="48.141,36.109 48.287,38.27 31.021,50.963 30.436,48.941 "/>
-<linearGradient id="_88" gradientUnits="userSpaceOnUse" x1="44.31" y1="7.26" x2="56.64" y2="37.42">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<path fill="url(#_88)" d="M78.33,27.458l-11.006-3.77c-0.477,0.186-3.596,1.404-3.596,1.404l-7.695,16.415 l-16.508,7.646l-3.176,1.65l21.958,9.551L78.33,27.458z"/>
-<linearGradient id="_89" gradientUnits="userSpaceOnUse" x1="61.03" y1="50.36" x2="53.03" y2="27.86">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polyline fill="url(#_89)" points="57.227,56.859 74.799,28.55 64.098,24.958 52.76,29.253 55.58,40.939 39.156,49.361 "/>
-<path fill="#298595" d="M51.652,44.461c-1.846,1.014-3.752,1.346-5.568,1.35l-4.371,2.238 C46.66,48.316,49.598,46.246,51.652,44.461z"/>
-<path fill="#115B7E" d="M49.533,44.045l-2.205,1.146c1.115-0.109,2.188-0.34,3.188-0.75 C50.252,44.324,49.916,44.189,49.533,44.045z"/>
-<path fill="#CFECFF" d="M50.516,44.441c-1.002,0.41-2.072,0.641-3.188,0.75l-1.244,0.619 c1.512,0.034,2.809-0.218,4.102-0.668c0.455-0.168,0.939-0.392,1.467-0.685c-0.438-0.19-1.729-0.615-1.729-0.615 l-0.387,0.199C49.916,44.189,50.252,44.324,50.516,44.441z"/>
-<linearGradient id="_90" gradientUnits="userSpaceOnUse" x1="51.3" y1="60.44" x2="47.14" y2="39.31">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_90)" d="M42.832,47.469l-3.646,1.877l18.055,7.525l2.504-3.982 C59.744,52.889,53.578,48.111,42.832,47.469z"/>
-<linearGradient id="_91" gradientUnits="userSpaceOnUse" x1="83.79" y1="20.58" x2="59.13" y2="60.86">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_91)" points="78.363,27.452 58.451,59.945 59.256,62.68 78.479,30.382 "/>
-<linearGradient id="_92" gradientUnits="userSpaceOnUse" x1="51.25" y1="49.13" x2="46.5" y2="59.63">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#496DA2" offset="0.71"/>
-<stop stop-color="#235487" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_92)" points="58.508,59.967 36.35,50.805 36.85,52.969 59.256,62.68 "/>
-</svg>
\ No newline at end of file
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -17,10 +17,10 @@
#include "cpthemechanger.h"
#include "cpthemechanger_p.h"
+#include "cpthemelistmodel.h"
/*!
@alpha
- @hbcore
\class CpThemeChanger
\brief CpThemeChanger provides an interface for changing the current
@@ -46,8 +46,8 @@
QAbstractItemModel& CpThemeChanger::model()
{
Q_D(CpThemeChanger);
-
- return d->model;
+
+ return d->mModel;
}
@@ -83,13 +83,17 @@
const CpThemeChanger::ThemeInfo& CpThemeChanger::currentTheme() const
{
Q_D(const CpThemeChanger);
-
+
return d->currentTheme();
}
+/*
+ * Returns index of theme from the theme list (not the model).
+ */
int CpThemeChanger::indexOf(const ThemeInfo& theme) const
{
Q_D(const CpThemeChanger);
+
return d->indexOf(theme);
}
--- a/controlpanelplugins/themeplugin/src/cpthemechanger.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,6 +19,7 @@
#define CPTHEMECHANGER_H
#include <QStringList>
+
#include <hbicon.h>
#include <hbglobal.h>
@@ -36,8 +37,12 @@
explicit CpThemeChanger(QObject* parent=0);
~CpThemeChanger();
- struct ThemeInfo
- {
+ enum ThemeListUserRole {
+ PortraitPreviewRole = Qt::UserRole,
+ LandscapePreviewRole
+ };
+
+ struct ThemeInfo{
QString name;
HbIcon icon;
HbIcon portraitPreviewIcon;
@@ -50,11 +55,6 @@
}
};
- enum ThemeListUserRole {
- PortraitPreviewRole = Qt::UserRole,
- LandscapePreviewRole
- };
-
QAbstractItemModel& model();
const ThemeInfo& currentTheme() const;
--- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -17,35 +17,50 @@
#include "cpthemechanger.h"
#include "cpthemechanger_p.h"
+#include "cpthemelistmodel.h"
+#include "cpthemeclient_p.h"
+#include "cpthemecommon_p.h"
+
#include <QStringList>
#include <QSettings>
#include <QFileSystemWatcher>
#include <QPixmap>
-#include <QSizeF>
+#include <QFileInfoList>
+#include <QDir>
+
#include <hbicon.h>
#include <hbinstance.h>
-#include "cpthemeclient_p.h"
-#include "cpthemecommon_p.h"
-#ifdef Q_OS_SYMBIAN
-#include "cpthemeclientsymbian_p.h"
-#else
-#include "cpthemeclientqt_p.h"
-#endif
-namespace {
+
#if !defined(Q_OS_SYMBIAN)
#include <stdio.h>
static const char* KThemePathKey = "HB_THEMES_DIR";
#endif
-
- static const QString KDefaultTheme = "hbdefault";
-}
+ static const QString KDefaultTheme = "sfblacktheme";
+ static const QString KDefaultThemeIcon = ":/image/themePreview.nvg";
+ static const QString KPreviewThumbnailNVG = "/scalable/qtg_graf_theme_preview_thumbnail.nvg";
+ static const QString KPreviewThumbnailSVG = "/scalable/qtg_graf_theme_preview_thumbnail.svg";
+
+ static const QString KPreviewPrtNVG = "/scalable/qtg_graf_theme_preview_prt.nvg";
+ static const QString KPreviewLscNVG = "/scalable/qtg_graf_theme_preview_lsc.nvg";
+ static const QString KPreviewPrtSVG = "/scalable/qtg_graf_theme_preview_prt.svg";
+ static const QString KPreviewLscSVG = "/scalable/qtg_graf_theme_preview_lsc.svg";
+
+ static const QString KBackgroundPrtNVG = "/scalable/qtg_graf_screen_bg_prt.nvg";
+ static const QString KBackgroundLscNVG = "/scalable/qtg_graf_screen_bg_lsc.nvg";
+ static const QString KBackgroundPrtSVG = "/scalable/qtg_graf_screen_bg_prt.svg";
+ static const QString KBackgroundLscSVG = "/scalable/qtg_graf_screen_bg_lsc.svg";
+
+ static const QString KBackgroundPrtPNG = "/pixmap/qtg_graf_screen_bg_prt.png";
+ static const QString KBackgroundLscPNG = "/pixmap/qtg_graf_screen_bg_lsc.png";
+
+
CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq):
q_ptr(qq),
- themeClient(CpThemeClient::global()),
- fileWatcher(new QFileSystemWatcher(qq)),
- model(this, qq)
+ mThemeClient(CpThemeClient::global()),
+ mFileWatcher(new QFileSystemWatcher(qq)),
+ mModel(this, qq)
{
Q_Q(CpThemeChanger);
@@ -53,26 +68,26 @@
// Figure out where our themes are. This is platform-dependent,
// but not worth breaking out into platform-private implementations
// at the moment. Ideally, this would be given to us by the theme server,
- #ifdef Q_OS_WIN
- static char* _path=NULL;
- static size_t _size=0;
+#ifdef Q_OS_WIN
+ static char* _path = NULL;
+ static size_t _size = 0;
_dupenv_s(&_path, &_size, KThemePathKey);
- themeRootPath = QString(_path);
- themeRootPathPostfix = QString();
+ mThemeRootPath = QString(_path);
+ mThemeRootPathPostfix = QString();
free(_path);
- #elif defined(Q_OS_SYMBIAN)
- themeRootPath = "c:\\resource\\hb";
- themeRootPathPostfix = "resource\\hb";
- #elif defined(Q_OS_UNIX)
- themeRootPath = QString(getenv(KThemePathKey));
- themeRootPathPostfix = QString();
- #elif defined(Q_OS_MACX)
- themeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
- themeRootPathPostfix = QString();
- #else
- themeRootPath = "c:\\resource\\hb";
- themeRootPathPostfix = QString();
- #endif
+#elif defined(Q_OS_SYMBIAN)
+ mThemeRootPath = "c:\\resource\\hb";
+ mThemeRootPathPostfix = "resource\\hb";
+#elif defined(Q_OS_MACX)
+ mThemeRootPath = QDir::homePath() + '/' + "Library" + QString("hb");
+ mThemeRootPathPostfix = QString();
+#elif defined(Q_OS_UNIX)
+ mThemeRootPath = QString(getenv(KThemePathKey));
+ mThemeRootPathPostfix = QString();
+#else
+ mThemeRootPath = "c:\\resource\\hb";
+ mThemeRootPathPostfix = QString();
+#endif
// Get our current state
if (HbInstance::instance()) {
@@ -81,21 +96,40 @@
mCurrentTheme.name = hbTheme->name();
}
}
- updateThemeList(mCurrentTheme.name);
-
+
// Watch for changes to the theme directory in flash.
// This may change once we start offering a model.
- fileWatcher->addPath(themeRootPath+"/themes/");
- q->connect(fileWatcher, SIGNAL(directoryChanged(const QString&)),
+#if defined(Q_OS_SYMBIAN)
+ QFileInfoList driveInfoList = QDir::drives();
+ foreach (const QFileInfo &driveInfo, driveInfoList) {
+ const QString drive = driveInfo.absolutePath();
+ mThemesPathList << drive + mThemeRootPathPostfix;
+ }
+#else
+ mThemesPathList << mThemeRootPath;
+#endif
+ foreach (const QString &path, mThemesPathList) {
+ QDir themeDir;
+ themeDir.setPath( path ) ;
+ QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
+ if(list.contains("themes", Qt::CaseSensitive )) {
+ mFileWatcher->addPath(themeDir.path() + "/themes/");
+ }
+ }
+
+ q->connect(mFileWatcher, SIGNAL(directoryChanged(const QString&)),
q, SLOT(_q_themeDirectoryChanged(const QString&)));
+ updateThemeList(mCurrentTheme.name);
+
// Connect to the theme server
connectToServer();
}
CpThemeChangerPrivate::~CpThemeChangerPrivate()
{
- themeClient->releaseInstance();
+ mThemeClient->releaseInstance();
+ mThemeClient = 0;
}
const CpThemeChanger::ThemeInfo& CpThemeChangerPrivate::currentTheme() const
@@ -110,50 +144,33 @@
int CpThemeChangerPrivate::indexOf(const CpThemeChanger::ThemeInfo& theme) const
{
- return themeList.indexOf(theme);
+ return mThemeList.indexOf(theme);
}
void CpThemeChangerPrivate::updateThemeList(const QString& newThemeName)
{
- if(!themeList.isEmpty()) {
- themeList.clear();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.clear();
}
mCurrentTheme.name = newThemeName.isEmpty() ? KDefaultTheme : newThemeName;
- // Get the list of Drives here
- QStringList themesPathList;
-
-#if defined(Q_OS_WIN32)
- themesPathList << themeRootPath;
-#elif defined(Q_OS_SYMBIAN)
- QFileInfoList driveInfoList = QDir::drives();
- foreach (const QFileInfo &driveInfo, driveInfoList) {
- const QString drive = driveInfo.absolutePath();
- themesPathList << drive + themeRootPathPostfix;
- }
-#elif defined(Q_OS_UNIX)
- themesPathList << themeRootPath;
-#elif defined(Q_OS_MACX)
- themesPathList << themeRootPath;
-#endif
-
- foreach (const QString &path, themesPathList) {
+ foreach (const QString &path, mThemesPathList) {
QDir themeDir;
themeDir.setPath( path ) ;
QStringList iconthemeslist;
QStringList list = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
CpThemeChanger::ThemeInfo nameIconPair;
- if(list.contains("themes",Qt::CaseSensitive )) {
+ if(list.contains("themes", Qt::CaseSensitive )) {
QDir root(themeDir.path());
- themeDir.setPath(root.path()+"/themes/icons/") ;
- iconthemeslist=themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
+ themeDir.setPath(root.path() + "/themes/icons/") ;
+ iconthemeslist = themeDir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
foreach(QString themefolder, iconthemeslist) {
- QDir iconThemePath(root.path()+"/themes/icons/"+themefolder);
+ QDir iconThemePath(root.path() + "/themes/icons/" + themefolder);
if(iconThemePath.exists("index.theme") &&
(iconThemePath.exists("scalable") || iconThemePath.exists("pixmap") )) {
- QSettings iniSetting(iconThemePath.path()+"/index.theme",QSettings::IniFormat);
+ QSettings iniSetting(iconThemePath.path() + "/index.theme", QSettings::IniFormat);
iniSetting.beginGroup("Icon Theme");
QString hidden = iniSetting.value("Hidden").toString();
QString name = iniSetting.value("Name").toString();
@@ -164,89 +181,90 @@
continue;
}
- QString fullPathToIcon(iconThemePath.path() + iconPath);
-
- if(iconPath.isEmpty()|| !QFileInfo(fullPathToIcon).exists()){
-
- //Set thumbnail
- if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg").exists()){
- nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg");
- }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){
- QPixmap px(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg");
- QIcon scaledIcon(px.scaled(QSize(64, 64)));
- nameIconPair.icon = HbIcon(scaledIcon);
- nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg");
-
- } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){
- QPixmap px(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png");
- QIcon scaledIcon(px.scaled(QSize(64, 64)));
- nameIconPair.icon = HbIcon(scaledIcon);
- nameIconPair.icon.setIconName(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.png");
-
- } else{
- nameIconPair.icon = HbIcon(":/image/themePreview.svg");
+ QString fullPathToIcon(iconThemePath.path());
+
+ if(iconPath.isEmpty()|| !QFileInfo(fullPathToIcon + iconPath).exists()){
+ //Set thumbnail
+ if(QFileInfo(fullPathToIcon + KPreviewThumbnailNVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KPreviewThumbnailNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewThumbnailSVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KPreviewThumbnailSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundPrtNVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtSVG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtPNG).exists()){
+ nameIconPair.icon = HbIcon(fullPathToIcon + KBackgroundPrtPNG);
+ }else{
+ nameIconPair.icon = HbIcon(KDefaultThemeIcon);
}
+
} else {
- nameIconPair.icon = HbIcon(fullPathToIcon);
+ nameIconPair.icon = HbIcon(fullPathToIcon + iconPath);
}
//Portrait preview
- QString fullPathToPreviewPrt = (iconThemePath.path() + previewPathPrt );
- if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToPreviewPrt).exists()) {
+ if(previewPathPrt.isEmpty() || !QFileInfo(fullPathToIcon + previewPathPrt).exists()) {
- if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_theme_preview_prt.svg");
- }else if(QFileInfo(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/scalable/qtg_graf_screen_bg_prt.svg");
- } else if(QFileInfo(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt + "/pixmap/qtg_graf_screen_bg_prt.png");
+ if(QFileInfo(fullPathToIcon + KPreviewPrtNVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KPreviewPrtNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewPrtSVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KPreviewPrtSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundPrtNVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtSVG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundPrtPNG).exists()){
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + KBackgroundPrtPNG);
} else{
- nameIconPair.portraitPreviewIcon = HbIcon(":/image/themePreview.svg");
+ nameIconPair.portraitPreviewIcon = HbIcon(KDefaultThemeIcon);
}
}
else {
- nameIconPair.portraitPreviewIcon = HbIcon(fullPathToPreviewPrt);
+ nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + previewPathPrt);
}
//Landscape preview
- QString fullPathToPreviewLsc = (iconThemePath.path() + previewPathLsc );
-
- if(previewPathLsc.isEmpty() || !QFileInfo(fullPathToPreviewLsc).exists()) {
-
- if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_theme_preview_lsc.svg");
- }else if(QFileInfo(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/scalable/qtg_graf_screen_bg_lsc.svg");
- } else if(QFileInfo(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png").exists()){
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc + "/pixmap/qtg_graf_screen_bg_lsc.png");
+
+ if(previewPathLsc.isEmpty() || !QFileInfo(fullPathToIcon + previewPathLsc).exists()) {
+ if(QFileInfo(fullPathToIcon + KPreviewLscNVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KPreviewLscNVG);
+ }else if(QFileInfo(fullPathToIcon + KPreviewLscSVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KPreviewLscSVG);
+ }else if(QFileInfo(fullPathToIcon + KBackgroundLscNVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscNVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundLscSVG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscSVG);
+ } else if(QFileInfo(fullPathToIcon + KBackgroundLscPNG).exists()){
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + KBackgroundLscPNG);
} else{
- nameIconPair.landscapePreviewIcon = HbIcon(":/image/themePreview.svg");
+ nameIconPair.landscapePreviewIcon = HbIcon(KDefaultThemeIcon);
}
}
else {
- nameIconPair.landscapePreviewIcon = HbIcon(fullPathToPreviewLsc);
+ nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + previewPathLsc);
}
nameIconPair.name = name;
- themeList.append(nameIconPair);
+ mThemeList.append(nameIconPair);
if (name == mCurrentTheme.name) {
mCurrentTheme = nameIconPair;
}
iniSetting.endGroup();
- if((hidden == "true") ||( hidden == "")||(name!=themefolder) ) {
+ if((hidden == "true") ||( hidden == "")||(name != themefolder) ) {
iconthemeslist.removeOne(themefolder);
- if(!themeList.isEmpty()) {
- themeList.removeLast();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.removeLast();
}
}
} else {
iconthemeslist.removeOne(themefolder);
- if(!themeList.isEmpty()) {
- themeList.removeLast();
+ if(!mThemeList.isEmpty()) {
+ mThemeList.removeLast();
}
}
}
@@ -258,8 +276,8 @@
// Include default
CpThemeChanger::ThemeInfo def;
def.name = KDefaultTheme;
- def.icon = HbIcon(":/image/themePreview.svg");
- themeList.append(def);
+ def.icon = HbIcon(KDefaultThemeIcon);
+ mThemeList.append(def);
mCurrentTheme = def;
}
@@ -268,12 +286,12 @@
const QList<CpThemeChanger::ThemeInfo>& CpThemeChangerPrivate::themes() const
{
- return themeList;
+ return mThemeList;
}
bool CpThemeChangerPrivate::connectToServer()
{
- return themeClient->connectToServer();
+ return mThemeClient->connectToServer();
}
/**
@@ -281,7 +299,7 @@
*/
bool CpThemeChangerPrivate::isConnected() const
{
- return themeClient->isConnected();
+ return mThemeClient->isConnected();
}
/**
@@ -291,13 +309,14 @@
{
bool result = false;
// Skip doing this if the request is for the current theme
- if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) return result;
+ if (newTheme.isEmpty() || newTheme == mCurrentTheme.name) {
+ return result;
+ }
- // Make sure it's a valid theme name
+ // Make sure it's a valid theme name and set the current theme.
bool exists = false;
- QList<CpThemeChanger::ThemeInfo> themeList = themes();
QList<CpThemeChanger::ThemeInfo>::const_iterator i;
- for (i = themeList.constBegin(); i != themeList.constEnd(); ++i) {
+ for (i = mThemeList.constBegin(); i != mThemeList.constEnd(); ++i) {
if ( newTheme == i->name) {
exists = true;
break;
@@ -305,8 +324,10 @@
}
if (exists) {
- result = themeClient->changeTheme(newTheme);
- updateThemeList(newTheme);
+ result = mThemeClient->changeTheme(newTheme);
+ if(result) {
+ mCurrentTheme = *i;
+ }
}
return result;
}
@@ -316,88 +337,6 @@
updateThemeList();
}
-/*
- HbThemeChangerModel provides an interface to the data contained in the
- HbThemeChanger using QAbstractListModel.
-*/
-/*
- Constructor
-*/
-HbThemeListModel::HbThemeListModel(CpThemeChangerPrivate *dd, QObject* parent)
- : QAbstractListModel(parent)
- , mThemeChangerPrivate(dd)
-{
- connect(dd->fileWatcher, SIGNAL(directoryChanged(const QString&)),
- this, SLOT(themeListChanged()));
-}
-
-/*
- Destructor
-*/
-HbThemeListModel::~HbThemeListModel()
-{
-
-}
-
-/*
- Reimplemented from QAbstractListModel.
-*/
-int HbThemeListModel::rowCount(const QModelIndex&) const
-{
- return mThemeChangerPrivate->themeList.size();
-}
-
-/*
- Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and
- Qt::DecorationRole.
-*/
-QVariant HbThemeListModel::data(const QModelIndex& index, int role) const
-{
- QVariant retVal = QVariant();
-
- if (index.isValid()) {
- switch (role) {
- case Qt::DisplayRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).name;
- break;
-
- case Qt::DecorationRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).icon;
- break;
-
- case Qt::SizeHintRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).icon.size();
- break;
- case CpThemeChanger::PortraitPreviewRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).portraitPreviewIcon;
- break;
- case CpThemeChanger::LandscapePreviewRole:
- retVal = mThemeChangerPrivate->themeList.at(index.row()).landscapePreviewIcon;
-
- default:
- // do nothing
- qt_noop();
- }
- }
-
- return retVal;
-}
-
-/*
- Responds appropriately when the underlying data in the theme changer is modified.
-
- Unfortunately the directory watcher from QFileWatcher only says when something changed
- not what changed. Therefore the model is considered reset rather than having rows
- with dataChanged.
-*/
-void HbThemeListModel::themeListChanged()
-{
- beginResetModel();
-
- mThemeChangerPrivate->themes();
-
- endResetModel();
-}
// End of file
--- a/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemechanger_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -22,39 +22,17 @@
#include <QObject>
-#include <QAbstractListModel>
-#include <QDir>
-#include <QModelIndex>
-#include <QString>
-#include <QStringList>
-
#include "cpthemechanger.h"
+#include "cpthemelistmodel.h"
QT_BEGIN_NAMESPACE
+class QString;
+class QStringList;
class QFileSystemWatcher;
QT_END_NAMESPACE
class CpThemeClient;
-class HbThemeListModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
-
- HbThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0);
- virtual ~HbThemeListModel();
-
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-
-public slots:
- void themeListChanged();
-
-private:
- CpThemeChangerPrivate *mThemeChangerPrivate;
-};
-
class CpThemeChangerPrivate
{
CpThemeChanger* q_ptr;
@@ -80,14 +58,15 @@
CpThemeChanger::ThemeInfo mCurrentTheme;
- QString themeRootPath;
- QString themeRootPathPostfix;
+ QString mThemeRootPath;
+ QString mThemeRootPathPostfix;
+ QStringList mThemesPathList;
- CpThemeClient* themeClient;
- QFileSystemWatcher* fileWatcher;
- QList<CpThemeChanger::ThemeInfo> themeList;
- HbThemeListModel model;
- friend class HbThemeChangerModel;
+ CpThemeClient* mThemeClient;
+ QFileSystemWatcher* mFileWatcher;
+ QList<CpThemeChanger::ThemeInfo> mThemeList;
+ CpThemeListModel mModel;
+ friend class CpThemeListModel;
};
#endif /* HBTHEMECHANGER_P_H */
--- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -16,12 +16,7 @@
*/
#include "cpthemeclient_p.h"
-
-#ifdef Q_OS_SYMBIAN
-#include "cpthemeclientsymbian_p.h"
-#else
-#include "cpthemeclientqt_p.h"
-#endif
+#include "cpthemeclient_p_p.h"
static CpThemeClient *clientInst=0;
@@ -39,12 +34,14 @@
bool CpThemeClient::connectToServer()
{
Q_D(CpThemeClient);
+
return d->connectToServer();
}
bool CpThemeClient::isConnected()
{
- Q_D(CpThemeClient);
+ Q_D(const CpThemeClient);
+
return d->isConnected();
}
@@ -54,22 +51,20 @@
bool CpThemeClient::changeTheme(const QString& newtheme)
{
Q_D(CpThemeClient);
+
return d->changeTheme(newtheme);
}
-
-
/**
* CpThemeClient::~CpThemeClient()
*/
CpThemeClient::~CpThemeClient()
{
Q_D(CpThemeClient);
+
delete d;
}
-
-
/**
* CpThemeClient::global()
*/
--- a/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,8 +19,6 @@
#define CPTHEMECLIENT_P_H
#include <qglobal.h>
-#include <QByteArray>
-
class CpThemeClientPrivate;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemeclient_p_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CPTHEMECLIENT_P_P_H
+#define CPTHEMECLIENT_P_P_H
+
+#include <QIcon>
+#include "cpthemecommon_p.h"
+
+#ifdef Q_OS_SYMBIAN
+#include <e32base.h>
+#endif
+
+class QSizeF;
+#ifndef Q_OS_SYMBIAN
+class QLocalSocket;
+#endif
+
+class CpThemeClientPrivate :
+#ifdef Q_OS_SYMBIAN
+public RSessionBase
+#else
+public QObject
+#endif
+{
+#ifndef Q_OS_SYMBIAN
+ Q_OBJECT
+#endif
+
+public:
+ CpThemeClientPrivate();
+ bool connectToServer();
+ bool isConnected() const;
+ bool changeTheme(const QString& newTheme);
+ ~CpThemeClientPrivate();
+
+#ifndef Q_OS_SYMBIAN
+public slots:
+ void changeTheme();
+#endif
+
+public:
+ bool clientConnected;
+
+private:
+#ifdef Q_OS_SYMBIAN
+ TVersion Version() const;
+ TInt StartServer();
+ TInt CreateServerProcess();
+#endif
+
+private:
+#ifdef Q_OS_SYMBIAN
+ friend class CThemeListenerPrivate;
+#else
+ QLocalSocket* localSocket;
+#endif
+};
+
+#endif // HBTHEMECLIENT_P_P_H
--- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -15,7 +15,7 @@
*
*/
-#include "cpthemeclientqt_p.h"
+#include "cpthemeclient_p_p.h"
#include <QLocalSocket>
#include <QProcess>
#include <QFile>
@@ -28,8 +28,6 @@
#define WAIT_TIME_TO_CONNECT_TO_SERVER 500
#define WAIT_TIME_TO_START_SERVER 5000
-//static const QString SERVERFILEPATH = QLatin1String(HB_BIN_DIR) + QDir::separator() + QLatin1String("hbthemeserver");
-
/**
* Constructor
*/
@@ -87,7 +85,7 @@
/**
* isConnected
*/
-bool CpThemeClientPrivate::isConnected()
+bool CpThemeClientPrivate::isConnected() const
{
return clientConnected;
}
--- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.h Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0""
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CPTHEMECLIENTQT_P_H
-#define CPTHEMECLIENTQT_P_H
-
-#include <QIcon>
-#include "cpthemecommon_p.h"
-
-class QString;
-class QSizeF;
-class QLocalSocket;
-
-class CpThemeClientPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- CpThemeClientPrivate();
- bool connectToServer();
- bool isConnected();
-
- bool changeTheme(const QString& newtheme);
-
- ~CpThemeClientPrivate();
-
-public slots:
- void themeChanged();
-
-public:
- bool clientConnected;
-
-private:
- void handleThemeChangeRequest(QDataStream &dataStream);
-
-private:
- QLocalSocket* localSocket;
- QString themeName;
-};
-
-#endif // HBTHEMECLIENTQT_P_H
--- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -15,7 +15,7 @@
*
*/
-#include "cpthemeclientsymbian_p.h"
+#include "cpthemeclient_p_p.h"
#include "cpthemesymbiancommon_p.h"
#include <e32property.h>
@@ -40,7 +40,7 @@
/**
Indicates a connection to the server
*/
-bool CpThemeClientPrivate::isConnected()
+bool CpThemeClientPrivate::isConnected() const
{
return true;
}
--- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.h Tue May 25 04:10:19 2010 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0""
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#ifndef CPTHEMECLIENTSYMBIAN_P_H
-#define CPTHEMECLIENTSYMBIAN_P_H
-
-#include <QString>
-#if !defined(__E32BASE_H__)
-#include <e32base.h>
-#endif
-
-class CpThemeClientPrivate
-{
-public:
- CpThemeClientPrivate();
-
- bool connectToServer();
-
- bool changeTheme(const QString& newtheme);
-
- bool isConnected();
-
- ~CpThemeClientPrivate();
-};
-
-#endif /* CPTHEMECLIENTSYMBIAN_P_H */
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -30,12 +30,10 @@
#include <QString>
#include <QModelIndex>
-#include <QStandardItemModel>
-#include <QStandardItem>
#include <QTranslator>
#include <QSortFilterProxyModel>
-#include <QDebug>
#include <QThread>
+#include <QTimer>
#include <hbmainwindow.h>
#include <hbinstance.h>
@@ -45,7 +43,9 @@
#include "cpthemelistview.h"
#include "cpthemepreview.h"
-static const QString KPlaceholderPreview = ":/image/themePreview.svg";
+#include <hbdialog.h>
+#include <hblabel.h>
+
/*!
Helper function to fetch the main window.
@@ -68,10 +68,10 @@
mThemeChanger(0),
mListModel(0),
mSortModel(0),
- mIdleTimer(0)
+ mThemeChangeFinished(false),
+ mWaitDialog(0)
{
mThemeChanger = new CpThemeChanger();
-
QTranslator *translator = new QTranslator(this);
QString lang = QLocale::system().name();
@@ -79,14 +79,11 @@
translator->load("control_panel_" + lang, path);
qApp->installTranslator(translator);
- mIdleTimer = new QTimer(this);
- connect(mIdleTimer, SIGNAL(timeout()), this, SLOT(themeChangeTimeout()));
connect(hbInstance->theme(),SIGNAL(changeFinished()), this, SLOT(themeChangeFinished()));
}
-
/*!
destorys the list view, preview and theme changer objects.
*/
@@ -100,6 +97,9 @@
delete mThemePreview;
mThemePreview = 0;
+
+ delete mWaitDialog;
+ mWaitDialog = 0;
}
/*!
@@ -142,8 +142,9 @@
CpBaseSettingView* CpThemeControl::themeListView()
{
//If the view was removed before by control panel app, create it again.
- if(!mThemeListView)
+ if(!mThemeListView) {
createThemeList();
+ }
return mThemeListView;
}
@@ -219,8 +220,7 @@
} else {
mThemePreview->setThemeInfo(themeInfo);
}
- //TODO: use qtTrId(text_id).
- mThemePreview->setTitle(tr("Control Panel"));
+ mThemePreview->setTitle(hbTrId("txt_cp_title_control_panel"));
mWindow->setCurrentView(mThemePreview);
@@ -240,14 +240,16 @@
mThemeChanger->changeTheme(theme);
emit themeUpdated(mThemeChanger->currentTheme().name, mThemeChanger->currentTheme().icon);
}
+
+ //Start a timer. If theme change takes more than 1 seconds,
+ //we will show a dialog (mWaitDialog) until theme change
+ //is done (themeChangeFinished is called).
+ QTimer::singleShot(1000, this, SLOT(themeWaitTimeout()));
+
+ mThemeChangeFinished = false;
+
+}
- //Go back to control panel view. Close theme preview.
- previewClosed();
- //ask the themelistview to close. Control Panel will
- //take care of removing it from window.
- triggerThemeListClose();
-
-}
/*!
Slot called when the theme preview view is closed.
*/
@@ -289,16 +291,49 @@
void CpThemeControl::themeChangeTimeout()
{
- //qDebug() << "ThemeChangeTimeout " ;
- mIdleTimer->stop();
- QThread::currentThread()->setPriority(QThread::NormalPriority);
-
+ //Theme change is finished and idle timer has timed out,
+ //so revert back the application priority to normal
+ //and go back to control panel view.
+ if(mWaitDialog && mWaitDialog->isVisible()) {
+ mWaitDialog->hide();
+ }
+
+ previewClosed();
+ //ask the themelistview to close. Control Panel will
+ //take care of removing it from window.
+ triggerThemeListClose();
+
+ QThread::currentThread()->setPriority(QThread::NormalPriority);
+}
+
+void CpThemeControl::themeWaitTimeout()
+{
+ //If after this timeOut, theme change is still in progress,
+ //show a processing dialog.
+ if(!mThemeChangeFinished)
+ {
+ if(!mWaitDialog) {
+ mWaitDialog = new HbDialog();
+ mWaitDialog->setModal(false);
+ mWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
+ //TODO: need localized text for Hb Dialog
+ // Create and set HbLabel as content widget.
+ HbLabel *label = new HbLabel("Processing ...");
+ label->setAlignment(Qt::AlignCenter);
+ mWaitDialog->setContentWidget(label);
+ }
+ // as we do not need any signals, calling show() instead of open()
+ mWaitDialog->show();
+ }
}
void CpThemeControl::themeChangeFinished()
{
- //qDebug() << "ThemeChangeFinished " ;
- mIdleTimer->start(0);
+ //Theme change is done. Start an idle timer to let the UI
+ //finish remaining tasks.
+ QTimer::singleShot(0, this, SLOT(themeChangeTimeout()));
+ mThemeChangeFinished = true;
+
}
/*!
--- a/controlpanelplugins/themeplugin/src/cpthemecontrol.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemecontrol.h Thu Jun 10 16:07:41 2010 +0800
@@ -20,7 +20,6 @@
#include <QObject>
#include <QList>
-#include <QTimer>
#include "cpthemechanger.h"
#include <hbicon.h>
@@ -31,6 +30,7 @@
class QSortFilterProxyModel;
QT_END_NAMESPACE
+class HbDialog;
class CpThemeListView;
class CpThemePreview;
class CpBaseSettingView;
@@ -57,6 +57,7 @@
void themeApplied(const QString& theme);
void themeListClosed();
void themeChangeTimeout();
+ void themeWaitTimeout();
void themeChangeFinished();
private:
@@ -70,7 +71,8 @@
CpThemeChanger* mThemeChanger;
QAbstractItemModel* mListModel;
QSortFilterProxyModel* mSortModel;
- QTimer* mIdleTimer;
+ bool mThemeChangeFinished;
+ HbDialog* mWaitDialog;
};
#endif //CPTHEMECONTROL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,108 @@
+/*
+ * ============================================================================
+ * Name : cpthemelistmodel_p.cpp
+ * Part of : LibHb / theme
+ * Description : Private implementation of the theme listmodel.
+ * Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+ *
+ * Copyright (c) 2008-2009 Nokia. All rights reserved.
+ * This material, including documentation and any related computer
+ * programs, is protected by copyright controlled by Nokia. All
+ * rights are reserved. Copying, including reproducing, storing,
+ * adapting or translating, any or all of this material requires the
+ * prior written consent of Nokia. This material also contains
+ * confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ * ============================================================================
+ */
+
+#include "cpthemelistmodel.h"
+#include "cpthemechanger_p.h"
+#include <QFileSystemWatcher>
+
+/*
+ CpThemeChangerModel provides an interface to the data contained in the
+ CpThemeChanger using QAbstractListModel.
+*/
+
+/*
+ Constructor
+*/
+CpThemeListModel::CpThemeListModel(CpThemeChangerPrivate *dd, QObject* parent)
+ : QAbstractListModel(parent)
+ , mThemeChangerPrivate(dd)
+{
+ connect(dd->mFileWatcher, SIGNAL(directoryChanged(const QString&)),
+ this, SLOT(themeListChanged()));
+}
+
+/*
+ Destructor
+*/
+CpThemeListModel::~CpThemeListModel()
+{
+
+}
+
+/*
+ Reimplemented from QAbstractListModel.
+*/
+int CpThemeListModel::rowCount(const QModelIndex&) const
+{
+ return mThemeChangerPrivate->mThemeList.size();
+}
+
+/*
+ Reimplemented from QAbstractListModel. Provides the data for Qt::DisplayRole and
+ Qt::DecorationRole.
+*/
+QVariant CpThemeListModel::data(const QModelIndex& index, int role) const
+{
+ QVariant retVal = QVariant();
+
+ if (index.isValid()) {
+ switch (role) {
+ case Qt::DisplayRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).name;
+ break;
+
+ case Qt::DecorationRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).icon;
+ break;
+
+ case Qt::SizeHintRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).icon.size();
+ break;
+
+ case CpThemeChanger::PortraitPreviewRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).portraitPreviewIcon;
+ break;
+
+ case CpThemeChanger::LandscapePreviewRole:
+ retVal = mThemeChangerPrivate->mThemeList.at(index.row()).landscapePreviewIcon;
+ break;
+
+ default:
+ // do nothing
+ qt_noop();
+ }
+ }
+
+ return retVal;
+}
+
+/*
+ Responds appropriately when the underlying data in the theme changer is modified.
+
+ Unfortunately the directory watcher from QFileWatcher only says when something changed
+ not what changed. Therefore the model is considered reset rather than having rows
+ with dataChanged.
+*/
+void CpThemeListModel::themeListChanged()
+{
+ beginResetModel();
+
+ mThemeChangerPrivate->themes();
+
+ endResetModel();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelplugins/themeplugin/src/cpthemelistmodel.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,46 @@
+/*
+* ============================================================================
+* Name : cpthemelistmodel_p.h
+* Part of : LibHb / theme
+* Description : CpThemeListModel class definition
+* Version : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+* Copyright (c) 2008-2009 Nokia. All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+* ============================================================================
+*/
+
+#ifndef CP_THEME_LIST_MODEL_P_H
+#define CP_THEME_LIST_MODEL_P_H
+
+#include <QAbstractListModel>
+#include <QModelIndex>
+#include <QObject>
+
+class CpThemeChangerPrivate;
+
+class CpThemeListModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ CpThemeListModel(CpThemeChangerPrivate* dd, QObject *parent = 0);
+ virtual ~CpThemeListModel();
+
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+
+public slots:
+ void themeListChanged();
+
+private:
+ CpThemeChangerPrivate *mThemeChangerPrivate;
+};
+
+#endif //CP_THEME_LIST_MODEL_P_H
--- a/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemelistview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -22,6 +22,7 @@
#include <hbview.h>
#include <hblabel.h>
#include <hblistview.h>
+#include <hblistviewitem.h>
#include "cpthemelistview.h"
@@ -45,17 +46,17 @@
//Create a layout with a heading "Select theme" at top and the list below it.
HbWidget* contentWidget = new HbWidget(this);
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
-
-
//setup the heading.
- HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);
- label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme
layout->addItem(label);
connect(mThemeList, SIGNAL(activated(const QModelIndex&)),
this, SIGNAL(newThemeSelected(const QModelIndex&)));
+ HbListViewItem* listViewItem = mThemeList->listItemPrototype();
+ listViewItem->setGraphicsSize(HbListViewItem::LargeIcon);
+
//add the list to layout.
layout->addItem(mThemeList);
--- a/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/src/cpthemepreview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -18,7 +18,7 @@
#include <QString>
#include <QGraphicsPixmapItem>
#include <QGraphicsLinearLayout>
-#include <QDebug>
+
#include <hbaction.h>
#include <hbtoolbar.h>
#include <hbicon.h>
@@ -26,6 +26,7 @@
#include <hblabel.h>
#include <hbiconitem.h>
#include <hbmainwindow.h>
+#include <HbParameterLengthLimiter>
#include "cpthemepreview.h"
@@ -51,13 +52,9 @@
//setup the heading.
- //TODO: translation of string hbTrId("txt_cp_title_preview_1")
-
- QString themeHeading = tr("Preview: ") + mTheme.name;
+ QString themeHeading = HbParameterLengthLimiter("txt_cp_title_preview_1").arg(mTheme.name);
HbLabel* label = new HbLabel(themeHeading, this);
- label->setFontSpec(HbFontSpec(HbFontSpec::Primary));
- label->setPreferredHeight(5.0);
layout->addItem(label);
layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
@@ -90,8 +87,7 @@
mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this);
}
layout->addItem(mPreviewIcon);
- layout->setAlignment(layout->itemAt(0), Qt::AlignTop);
-
+
setToolBar(mToolBar);
setLayout(layout);
@@ -101,7 +97,7 @@
QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()),
this, SIGNAL(aboutToClose()) );
- this->setNavigationAction(mSoftKeyBackAction);
+ setNavigationAction(mSoftKeyBackAction);
}
/*!
@@ -152,16 +148,14 @@
QGraphicsLinearLayout* previewLayout = dynamic_cast<QGraphicsLinearLayout*>(layout());
- if(mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(1)) ) {
+ if(mPreviewIcon && mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(1)) ) {
previewLayout->removeAt(1);
- delete mPreviewIcon;
- mPreviewIcon = 0;
if(orientation == Qt::Horizontal) {
- mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this);
+ mPreviewIcon->setIcon(mTheme.landscapePreviewIcon);
}
else {
- mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this);
+ mPreviewIcon->setIcon(mTheme.portraitPreviewIcon);
}
previewLayout->addItem(mPreviewIcon);
--- a/controlpanelplugins/themeplugin/themeplugin.pri Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.pri Thu Jun 10 16:07:41 2010 +0800
@@ -1,52 +1,41 @@
-#
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
# Initial Contributors:
# Nokia Corporation - initial contribution.
-#
# Contributors:
-#
# Description: cpthemeplugin source files
-#
-
# Input
-HEADERS += src/cpthemepreview.h \
- src/cpthemecontrol.h \
- src/cpthemeplugin.h \
- src/cpthemelistview.h \
- src/cpthemepluginentryitemdata.h
+HEADERS += src/cpthemeclient_p_p.h \
+ src/cpthemepreview.h \
+ src/cpthemecontrol.h \
+ src/cpthemeplugin.h \
+ src/cpthemelistview.h \
+ src/cpthemelistmodel.h \
+ src/cpthemechanger.h \
+ src/cpthemeclient_p.h \
+ src/cpthemecommon_p.h \
+ src/cpthemechanger_p.h \
+ src/cpthemepluginentryitemdata.h
SOURCES += src/cpthemepreview.cpp \
- src/cpthemecontrol.cpp \
- src/cpthemeplugin.cpp \
- src/cpthemelistview.cpp \
- src/cpthemepluginentryitemdata.cpp
-
-# Remove once this goes into Hb.
-HEADERS += src/cpthemechanger.h \
- src/cpthemeclient_p.h \
- src/cpthemecommon_p.h \
- src/cpthemechanger_p.h
-
-# Remove once this goes into Hb.
-SOURCES += src/cpthemechanger.cpp \
- src/cpthemechanger_p.cpp \
- src/cpthemeclient_p.cpp
-
-# Remove once this goes into Hb.
-win32|mac {
- HEADERS += src/cpthemeclientqt_p.h
+ src/cpthemecontrol.cpp \
+ src/cpthemeplugin.cpp \
+ src/cpthemelistview.cpp \
+ src/cpthemelistmodel.cpp \
+ src/cpthemepluginentryitemdata.cpp \
+ src/cpthemechanger.cpp \
+ src/cpthemechanger_p.cpp \
+ src/cpthemeclient_p.cpp
+
+win32|mac {
SOURCES += src/cpthemeclientqt_p.cpp
}
-# Remove once this goes into Hb.
-symbian {
- HEADERS += src/cpthemeclientsymbian_p.h \
- src/cpthemesymbiancommon_p.h
+symbian {
+ HEADERS += src/cpthemesymbiancommon_p.h
SOURCES += src/cpthemeclientsymbian_p.cpp
}
--- a/controlpanelplugins/themeplugin/themeplugin.qrc Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelplugins/themeplugin/themeplugin.qrc Thu Jun 10 16:07:41 2010 +0800
@@ -1,7 +1,5 @@
<RCC>
<qresource prefix="/" >
- <file>image/qgn_menu_note.svg</file>
- <file>image/themePreview.png</file>
- <file>image/themePreview.svg</file>
+ <file>image/themePreview.nvg</file>
</qresource>
</RCC>
--- a/controlpanelui/rom/controlpanelui.iby Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/rom/controlpanelui.iby Thu Jun 10 16:07:41 2010 +0800
@@ -26,11 +26,11 @@
file=ABI_DIR\BUILD_DIR\controlpanel.exe SHARED_LIB_DIR\controlpanel.exe
CP_UPGRADABLE_APP_REG_RSC(controlpanel)
+
file=ABI_DIR\BUILD_DIR\cpserviceprovider.exe SHARED_LIB_DIR\cpserviceprovider.exe
CP_UPGRADABLE_APP_REG_RSC(cpserviceprovider)
file=ABI_DIR\BUILD_DIR\cpcategorymodel.dll SHARED_LIB_DIR\cpcategorymodel.dll
-file=ABI_DIR\BUILD_DIR\seccodeui.dll SHARED_LIB_DIR\seccodeui.dll
file=ABI_DIR\BUILD_DIR\cpprofilewrapper.dll SHARED_LIB_DIR\cpprofilewrapper.dll
file=ABI_DIR\BUILD_DIR\cpringtoneview.dll SHARED_LIB_DIR\cpringtoneview.dll
@@ -41,8 +41,6 @@
file=ABI_DIR\BUILD_DIR\cpprivacyplugin.dll SHARED_LIB_DIR\cpprivacyplugin.dll
file=ABI_DIR\BUILD_DIR\cplookfeelplugin.dll SHARED_LIB_DIR\cplookfeelplugin.dll
file=ABI_DIR\BUILD_DIR\cpkeytouchfdbkplugin.dll SHARED_LIB_DIR\cpkeytouchfdbkplugin.dll
-file=ABI_DIR\BUILD_DIR\cppincodeplugin.dll SHARED_LIB_DIR\cppincodeplugin.dll
-file=ABI_DIR\BUILD_DIR\cpdevicelockplugin.dll SHARED_LIB_DIR\cpdevicelockplugin.dll
file=ABI_DIR\BUILD_DIR\cpprofileactivator.dll SHARED_LIB_DIR\cpprofileactivator.dll
file=ABI_DIR\BUILD_DIR\cpvolumeplugin.dll SHARED_LIB_DIR\cpvolumeplugin.dll
file=ABI_DIR\BUILD_DIR\cpringtoneplugin.dll SHARED_LIB_DIR\cpringtoneplugin.dll
@@ -61,8 +59,6 @@
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin resource\qt\plugins\controlpanel\cpprivacyplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin resource\qt\plugins\controlpanel\cplookfeelplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin resource\qt\plugins\controlpanel\cpkeytouchfdbkplugin.qtplugin
-data=\epoc32\data\c\resource\qt\plugins\controlpanel\cppincodeplugin.qtplugin resource\qt\plugins\controlpanel\cppincodeplugin.qtplugin
-data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpdevicelockplugin.qtplugin resource\qt\plugins\controlpanel\cpdevicelockplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin resource\qt\plugins\controlpanel\cpprofileactivator.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin resource\qt\plugins\controlpanel\cpvolumeplugin.qtplugin
data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin resource\qt\plugins\controlpanel\cpringtoneplugin.qtplugin
--- a/controlpanelui/src/cpapplication/src/cpmainview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpapplication/src/cpmainview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,8 +32,6 @@
{
//delay loading
connect(mMainWindow,SIGNAL(viewReady()),this,SLOT(initializeMainModel()));
-
- setTitle( QObject::tr("Control Panel") ); //should use qtTrId("txt_cp_title_control_panel")
}
CpMainView::~CpMainView()
--- a/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/communicationplugin.pro Thu Jun 10 16:07:41 2010 +0800
@@ -26,6 +26,7 @@
symbian {
TARGET.UID3 = 0x20025FDF
+ LIBS += -lxqsettingsmanager
}
symbian {
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -16,10 +16,16 @@
*/
#include "cpcommunicationgroupitemdata.h"
#include <QStringList>
+#include <QtAlgorithms>
+#include <settingsinternalcrkeys.h>
+#include <xqsettingsmanager.h>
+#include <cpitemdatahelper.h>
CpCommunicationGroupItemData::CpCommunicationGroupItemData(const QString &configFile,
const HbDataFormModelItem *parent):
-CpCategorySettingFormItemData(configFile,parent)
+ CpCategorySettingFormItemData(configFile,parent),
+ mAirplaneModeItem(0),
+ mSettingManager(new XQSettingsManager())
{
}
@@ -28,24 +34,65 @@
const QString &label,
const QString &configFile,
const HbDataFormModelItem *parent):
-CpCategorySettingFormItemData(type, label, configFile, parent)
+ CpCategorySettingFormItemData(type, label, configFile, parent),
+ mAirplaneModeItem(0),
+ mSettingManager(new XQSettingsManager())
{
}
+
CpCommunicationGroupItemData::~CpCommunicationGroupItemData()
{
+ delete mSettingManager;
+}
+
+void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper)
+{
+ mAirplaneModeItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem,
+ hbTrId("txt_cp_setlabel_offline_airplane_mode"));
+ mAirplaneModeItem->setDescription(hbTrId("txt_cp_info_in_offline_mode_all_wireless_communica"));
+
+ itemDataHelper.addConnection(mAirplaneModeItem,
+ SIGNAL(clicked()),
+ this,
+ SLOT(toggleAirplaneMode()));
+
+ XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode);
+ QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
+ settingValueChanged(key,airplaneMode);
+
+ mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt);
+ connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)),
+ this, SLOT(settingValueChanged(XQSettingsKey, QVariant)));
+
+ this->appendChild(mAirplaneModeItem);
}
-void CpCommunicationGroupItemData::beforeLoadingConfigPlugins(CpItemDataHelper &/*itemDataHelper*/)
+
+void CpCommunicationGroupItemData::toggleAirplaneMode()
+{
+ XQCentralRepositorySettingsKey key(KCRUidCommunicationSettings.iUid,KSettingsAirplaneMode);
+ QVariant airplaneMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
+
+ airplaneMode.setValue( static_cast<int> (!airplaneMode.toBool()) );
+
+ mSettingManager->writeItemValue(key,airplaneMode);
+}
+
+void CpCommunicationGroupItemData::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
{
- HbDataFormModelItem *airPlaneMode = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem,
- tr("Offline mode"));
- QStringList airModeList;
- airModeList << QObject::tr("On") << QObject::tr("Off");
-
- airPlaneMode->setContentWidgetData("text",airModeList.at(1));
- airPlaneMode->setContentWidgetData("additionalText",airModeList.at(0));
+ if (mAirplaneModeItem
+ && key.uid() == KCRUidCommunicationSettings.iUid
+ && key.key() == KSettingsAirplaneMode
+ && value.isValid()) {
+ QString text = hbTrId("txt_cp_setlabel_offline_mode_val_on");
+ QString additionalText = hbTrId("txt_cp_setlabel_offline_mode_val_off");
+ if (!value.toBool()) {
+ ::qSwap (text, additionalText);
+ }
+ mAirplaneModeItem->setContentWidgetData("text",text);
+ mAirplaneModeItem->setContentWidgetData("additionalText",additionalText);
+ }
+}
- this->appendChild(airPlaneMode);
-
-}
+//End of File
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationgroupitemdata.h Thu Jun 10 16:07:41 2010 +0800
@@ -19,8 +19,12 @@
#include <cpcategorysettingformitemdata.h>
class CpItemDataHelper;
+class XQSettingsManager;
+class XQSettingsKey;
+
class CpCommunicationGroupItemData: public CpCategorySettingFormItemData
{
+ Q_OBJECT
public:
explicit CpCommunicationGroupItemData(const QString &configFile = QString(),
const HbDataFormModelItem *parent = 0);
@@ -31,7 +35,13 @@
const HbDataFormModelItem *parent = 0);
~CpCommunicationGroupItemData();
+private slots:
+ void toggleAirplaneMode();
+ void settingValueChanged(const XQSettingsKey &key, const QVariant &value);
private:
virtual void beforeLoadingConfigPlugins(CpItemDataHelper &itemDataHelper);
+private:
+ HbDataFormModelItem *mAirplaneModeItem;
+ XQSettingsManager *mSettingManager;
};
#endif /* CPCOMMUNICATIONGROUPITEMDATA_H */
--- a/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/communicationplugin/src/cpcommunicationplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,7 +32,7 @@
CpCategorySettingFormItemData *itemData =
new CpCommunicationGroupItemData(
HbDataFormModelItem::GroupItem,
- QString("Connectivity"),
+ hbTrId("txt_cp_subhead_connectivity"),
QString("cpcommunicationplugin.cpcfg") );
return QList<CpSettingFormItemData*>() << itemData;
}
--- a/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/deviceplugin/src/cpdeviceplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -32,7 +32,7 @@
CpCategorySettingFormItemData *itemData =
new CpCategorySettingFormItemData(
HbDataFormModelItem::GroupItem,
- tr("Device"),
+ hbTrId("txt_cp_subhead_device"),
QString("cpdeviceplugin.cpcfg") );
return QList<CpSettingFormItemData*>() << itemData;
}
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenconstants.h Thu Jun 10 16:07:41 2010 +0800
@@ -18,16 +18,6 @@
#ifndef CPKEYSCREENCONSTANTS_H
#define CPKEYSCREENCONSTANTS_H
-enum KeyscreenLockItems{
- EKeyScreenLockItem1,
- EKeyScreenLockItem2,
- EKeyScreenLockItem3,
- EKeyScreenLockItem4,
- EKeyScreenLockItem5
-};
-
-const int KCpKeyscreenTimeCoeff = 15;
-
const int KCpKeyscreenLock15s = 15;
const int KCpKeyscreenLock30s = 30;
const int KCpKeyscreenLock45s = 45;
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -30,7 +30,7 @@
{
CpSettingFormItemData* itemData = new CpSettingFormEntryItemDataImpl<CpKeyScreenView>(
itemDataHelper,
- hbTrId("Keys & screen"));
+ hbTrId("txt_cp_list_keys_screen"));
return QList<CpSettingFormItemData*>() << itemData;
}
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -25,18 +25,27 @@
#include <hbdataformmodel.h>
#include <cpsettingformitemdata.h>
#include <hbmessagebox.h>
+#include <hbslider.h>
CpKeyScreenView::CpKeyScreenView(QGraphicsItem *parent) :
CpBaseSettingView(0,parent),
- mScreenRadioButton(0),
+ mScreenComboButton(0),
mRotateCheckbox(0),
mBrightSliderItem(0),
mCallibItem(0),
mModel(0)
-{
+{
HbDataForm *form = qobject_cast<HbDataForm*> ( widget() );
if (form) {
+ // Valid range is:
+ // 15 secs, 30 secs, 45 secs, 1 min, 2 mins
+ mScreenLockValues.insert(KCpKeyscreenLock15s,hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock30s,hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock45s,hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds"));
+ mScreenLockValues.insert(KCpKeyscreenLock60s,hbTrId("txt_cp_setlabel_keys_screen_val_1_minute"));
+ mScreenLockValues.insert(KCpKeyscreenLock120s,hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes"));
+
form->setHeading(hbTrId("txt_cp_subhead_keys_screen"));
mModel = new CpKeyScreenModel();
HbDataFormModel *model = new HbDataFormModel;
@@ -61,30 +70,36 @@
void CpKeyScreenView::makeScreenItem(HbDataFormModel& model)
{
- mScreenRadioButton = new CpSettingFormItemData(HbDataFormModelItem::RadioButtonListItem,
- hbTrId("txt_cp_setlabel_keys_screen_locked_after"));
- qobject_cast<HbDataForm*> ( widget() )->addConnection(mScreenRadioButton,SIGNAL(itemSelected(int)),this,SLOT(screenValueChanged(int)));
- model.appendDataFormItem(mScreenRadioButton, model.invisibleRootItem());
+ mScreenComboButton = new CpSettingFormItemData(HbDataFormModelItem::ComboBoxItem,
+ hbTrId("txt_cp_setlabel_keys_screen_locked_after"));
+
+ qobject_cast<HbDataForm*> ( widget() )->addConnection(
+ mScreenComboButton,SIGNAL(currentIndexChanged(QString)),
+ this,SLOT(screenValueChanged(QString)));
+
+ model.appendDataFormItem(mScreenComboButton, model.invisibleRootItem());
- // Valid range is:
- // 15 secs, 30 secs, 45 secs, 1 min, 2 mins
- QStringList sList;
- sList<< hbTrId("txt_cp_setlabel_keys_screen_val_15_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_30_seconds")
- << hbTrId("txt_cp_setlabel_keys_screen_val_45_seconds")<< hbTrId("txt_cp_setlabel_keys_screen_val_1_minute")
- << hbTrId("txt_cp_setlabel_keys_screen_val_2_minutes");
int period = mModel->keyguard();
- int selectedIndex = period/KCpKeyscreenTimeCoeff - 1;
- if ( KCpKeyscreenLock120s == period ){ // 2 minutes
- selectedIndex = EKeyScreenLockItem5;
+
+ int selectedIndex(-1);
+
+ QMap<int,QString>::iterator it = mScreenLockValues.find(period);
+ if (it == mScreenLockValues.end()) {
+ mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default
+ selectedIndex = 1;
}
- if ( (KCpKeyscreenLock15s != period) && (KCpKeyscreenLock30s != period) &&
- (KCpKeyscreenLock45s != period) && (KCpKeyscreenLock60s != period) &&
- (KCpKeyscreenLock120s != period) ){
- mModel->setKeyguard(KCpKeyscreenLockDefault30s); // Set keyguard and backlight period to default
- selectedIndex = EKeyScreenLockItem2;
+ else {
+ for (it = mScreenLockValues.begin();it != mScreenLockValues.end();++it) {
+ selectedIndex++;
+ if (it.key() == period) {
+ break;
+ }
+ }
}
- mScreenRadioButton->setContentWidgetData( QString("items"), sList );
- mScreenRadioButton->setContentWidgetData( QString("selected"), selectedIndex);
+
+ QStringList items = mScreenLockValues.values();
+ mScreenComboButton->setContentWidgetData( QString("items"), items );
+ mScreenComboButton->setContentWidgetData( QString("currentIndex"), selectedIndex);
}
void CpKeyScreenView::makeRotateItem(HbDataFormModel& model)
@@ -110,9 +125,17 @@
qobject_cast<HbDataForm*> ( widget() )->addConnection(mBrightSliderItem,SIGNAL(valueChanged(int)),this,SLOT(brightValueChanged(int)));
model.appendDataFormItem(mBrightSliderItem, model.invisibleRootItem());
+ QList<QVariant> sliderElements;
+ sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
+ << QVariant(HbSlider::DecreaseElement);
+ mBrightSliderItem->setContentWidgetData("sliderElements",sliderElements);
mBrightSliderItem->setContentWidgetData( QString("value"), mModel->brightness() );
mBrightSliderItem->setContentWidgetData( QString("minimum"), 1 );
mBrightSliderItem->setContentWidgetData( QString("maximum"), 5 );
+ QMap< QString, QVariant > iconElements;
+ iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
+ iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
+ mBrightSliderItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
}
void CpKeyScreenView::makeCallibrationItem(HbDataFormModel& model)
@@ -130,13 +153,15 @@
mModel = 0;
}
-void CpKeyScreenView::screenValueChanged(int index)
-{
- int period = (index + 1) * KCpKeyscreenTimeCoeff;
- if (EKeyScreenLockItem5 == index){
- period = KCpKeyscreenLock120s;
+void CpKeyScreenView::screenValueChanged(const QString &value)
+{
+ for (QMap<int,QString>::iterator it = mScreenLockValues.begin();
+ it != mScreenLockValues.end();++it) {
+ if (it.value() == value) {
+ mModel->setKeyguard(it.key());
+ break;
+ }
}
- mModel->setKeyguard(period);
}
void CpKeyScreenView::rotateValueChanged(int value)
--- a/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/keytouchfdbkplugin/src/cpkeyscreenview.h Thu Jun 10 16:07:41 2010 +0800
@@ -17,6 +17,7 @@
#ifndef CPKEYSCREENVIEW_H
#define CPKEYSCREENVIEW_H
+#include <QMap>
#include <cpbasesettingview.h>
#include <hbdataformmodelitem.h>
@@ -24,6 +25,8 @@
class HbDataFormModel;
class CpSettingFormItemData;
class CpKeyScreenModel;
+class QPersistentModelIndex;
+class QVariant;
class CpKeyScreenView : public CpBaseSettingView
{
@@ -39,17 +42,18 @@
void makeCallibrationItem(HbDataFormModel& model);
private slots:
- //need handling your member's value change
- void screenValueChanged(int index);
+ void screenValueChanged(const QString&);
void rotateValueChanged(int value);
void brightValueChanged(int value);
void launchCallib();
private:
- CpSettingFormItemData *mScreenRadioButton;
+ CpSettingFormItemData *mScreenComboButton;
CpSettingFormItemData *mRotateCheckbox;
CpSettingFormItemData *mBrightSliderItem;
CpSettingFormItemData *mCallibItem;
CpKeyScreenModel* mModel;
+
+ QMap<int,QString> mScreenLockValues;
};
#endif// CPKEYSCREENVIEW_H
--- a/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -188,9 +188,18 @@
//Touch Screen Vibra item
modelItem = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), parent );
//TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
+ sliderElements.clear();
+ sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
+ << QVariant(HbSlider::DecreaseElement);
+ modelItem->setContentWidgetData("sliderElements",sliderElements);
+
modelItem->setContentWidgetData( QString( "minimum" ), 0 );
modelItem->setContentWidgetData( QString( "maximum" ), 5 );
modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
+ QMap< QString, QVariant > iconElements;
+ iconElements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
+ iconElements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
+ modelItem->setContentWidgetData( QString( "elementIcons" ), iconElements );
if (profileId == EProfileWrapperGeneralId) {
addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
--- a/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/privacyplugin/src/cpprivacyplugin.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -34,7 +34,7 @@
CpCategorySettingFormItemData *itemData =
new CpCategorySettingFormItemData(
HbDataFormModelItem::GroupItem,
- tr("Security"),
+ hbTrId("txt_cp_subhead_security"),
QString("cpprivacyplugin.cpcfg") );
return QList<CpSettingFormItemData*>() << itemData;
}
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/profileactivatorplugin.pro Thu Jun 10 16:07:41 2010 +0800
@@ -27,4 +27,5 @@
TARGET.UID3 = 0X20028739
TARGET.CAPABILITY = All -TCB
TARGET.EPOCALLOWDLLDATA = 1
+ LIBS += -lprofileeng
}
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -20,7 +20,11 @@
#include <hbaction.h>
#include <hbdataformmodelitem.h>
#include <hbpopup.h>
+#include <hblabel.h>
#include "cpprofileactivatorentryitem.h"
+#include <QGraphicsLinearLayout>
+#include <QGraphicsWidget>
+
CpProfileActivatorDialog::CpProfileActivatorDialog(CpSettingFormItemData *profileActivator,
CpProfileModel &profileModel,
QGraphicsItem *parent):HbDialog(parent),
@@ -28,11 +32,19 @@
mProfileList(0),
mProfileActivator(profileActivator)
{
+ mTitleLabel = new HbLabel(this);
+ mTitleLabel->setPlainText(hbTrId("txt_cp_title_profile"));
+ mContentWidget = new QGraphicsWidget(this);
+ setContentWidget(mContentWidget);
+ mLayout = new QGraphicsLinearLayout();
+ mLayout->setOrientation( Qt::Vertical );
mProfileIds << EProfileWrapperGeneralId
<< EProfileWrapperMeetingId;
mProfileList = new HbRadioButtonList();
mProfileList->setItems(profileModel.profileNames());
-
+ mLayout->addItem(mTitleLabel);
+ mLayout->addItem(mProfileList);
+
int currentId = mProfileModel.activeProfileId();
mProfileList->setSelected(mProfileIds.indexOf(static_cast<ProfileWrapperProfileId>(currentId)));
@@ -46,12 +58,11 @@
this->addAction(mConfirmProfile);
- this->addAction(mCancelProfile);
-
- this->setContentWidget(mProfileList);
+ this->addAction(mCancelProfile);
this->setModal(true);
this->setDismissPolicy(HbPopup::NoDismiss);
this->setTimeout(HbPopup::NoTimeout);
+ mContentWidget->setLayout( mLayout );
}
CpProfileActivatorDialog::~CpProfileActivatorDialog()
@@ -61,6 +72,9 @@
void CpProfileActivatorDialog::confirmProfileSelection()
{
int currentIndex = mProfileList->selected();
+ if (currentIndex == -1) {
+ return;
+ }
// the best choice is no need to convert the index to id
mProfileModel.activateProfile(mProfileIds.at(currentIndex));
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatordialog.h Thu Jun 10 16:07:41 2010 +0800
@@ -24,6 +24,9 @@
class HbDataFormModelItem;
class CpProfileActivatorEntryItem;
class CpSettingFormItemData;
+class QGraphicsLinearLayout;
+class QGraphicsWidget;
+class HbLabel;
class CpProfileActivatorDialog: public HbDialog
{
@@ -44,5 +47,8 @@
QPointer<HbAction> mConfirmProfile;
QPointer<HbAction> mCancelProfile;
QList<ProfileWrapperProfileId> mProfileIds;
+ QGraphicsLinearLayout *mLayout;
+ QGraphicsWidget *mContentWidget;
+ HbLabel *mTitleLabel;
};
#endif
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -20,23 +20,31 @@
#include <cpitemdatahelper.h>
#include <cpprofilemodel.h>
#include <QScopedPointer>
+#include "cpprofilemonitor.h"
+
CpProfileActivatorEntryItem::CpProfileActivatorEntryItem(CpItemDataHelper &itemDataHelper,
const QString &text,
const QString &description,
const HbIcon &icon,
const HbDataFormModelItem *parent)
:CpSettingFormEntryItemData(itemDataHelper,text,description,
- icon,parent)
+ icon,parent),mProfileModel(0),mProfileMonitor(0)
{
+ mProfileMonitor = new CpProfileMonitor();
mProfileModel = new CpProfileModel();
+
int currentId = mProfileModel->activeProfileId();
QString currentName = mProfileModel->profileName(currentId);
this->setDescription(currentName);
+ connect(mProfileMonitor, SIGNAL(profileActivated(int)), this, SLOT(onProfileChanged(int)));
}
+
CpProfileActivatorEntryItem::~CpProfileActivatorEntryItem()
{
delete mProfileModel;
+ delete mProfileMonitor;
}
+
void CpProfileActivatorEntryItem::onLaunchView()
{
CpProfileActivatorDialog *dialog =
@@ -46,6 +54,12 @@
dialog->show();
}
+
+void CpProfileActivatorEntryItem::onProfileChanged(int activeProfileId)
+{
+ QString profileName = mProfileModel->profileName(activeProfileId);
+ this->setDescription(profileName);
+}
/*void CpPersonalizationEntryItemData::handleOk(const QVariant &result)
{
if (!result.canConvert<QString>())
--- a/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofileactivatorentryitem.h Thu Jun 10 16:07:41 2010 +0800
@@ -20,6 +20,8 @@
#include <cpsettingformentryitemdata.h>
class CpProfileModel;
+class CpProfileMonitor;
+
class CpProfileActivatorEntryItem : public CpSettingFormEntryItemData
{
Q_OBJECT
@@ -31,12 +33,14 @@
virtual ~CpProfileActivatorEntryItem();
private slots:
void onLaunchView();
+ void onProfileChanged(int activeProfileId);
//void handleOk(const QVariant &result);
//void handleError(int errorCode, const QString& errorMessage);
private:
virtual CpBaseSettingView *createSettingView() const;
private:
CpProfileModel *mProfileModel;
+ CpProfileMonitor *mProfileMonitor;
};
#endif // CPPROFILEACTIVATORENTRYITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include "cpprofilemonitor.h"
+
+#include <CProfileChangeNotifyHandler.h>
+
+CpProfileMonitor::CpProfileMonitor(QObject *parent)
+ :QObject(parent),mProfileNotifier(0)
+{
+ mProfileNotifier = CProfileChangeNotifyHandler::NewL(this);
+}
+
+CpProfileMonitor::~CpProfileMonitor()
+{
+ delete mProfileNotifier;
+}
+
+void CpProfileMonitor::HandleActiveProfileEventL(TProfileEvent aProfileEvent, TInt aProfileId)
+{
+ if (EProfileNewActiveProfile == aProfileEvent) {
+ emit profileActivated(aProfileId);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/controlpanelui/src/cpplugins/profileactivatorplugin/src/cpprofilemonitor.h Thu Jun 10 16:07:41 2010 +0800
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CPPROFILEMONITOR_H_
+#define CPPROFILEMONITOR_H_
+
+#include <QObject>
+#include <MProfileChangeObserver.h>
+
+class CProfileChangeNotifyHandler;
+
+class CpProfileMonitor: public QObject,public MProfileChangeObserver
+{
+ Q_OBJECT
+public:
+ explicit CpProfileMonitor(QObject *parent = 0);
+ ~CpProfileMonitor();
+signals:
+ void profileActivated(int activeProfileId);
+private:
+ virtual void HandleActiveProfileEventL(
+ TProfileEvent aProfileEvent, TInt aProfileId );
+
+private:
+ CProfileChangeNotifyHandler* mProfileNotifier;
+};
+
+#endif /* CPPROFILEMONITOR_H_ */
--- a/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpplugins/volumeplugin/src/cpvolumegroupitemdata.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -28,7 +28,7 @@
#include <hbslider.h>
CpVolumeGroupItemData::CpVolumeGroupItemData(CpItemDataHelper &itemDataHelper)
-: CpSettingFormItemData(HbDataFormModelItem::GroupItem,tr("txt_cp_subhead_volume")),//mSilenceIndicator(0),
+: CpSettingFormItemData(HbDataFormModelItem::GroupItem,hbTrId("txt_cp_subhead_volume")),//mSilenceIndicator(0),
//mMasterVolume(0),
//mMasterVibra(0),
mVolumeController(0),
--- a/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpprofilewrapper/src/cpprofilemodel_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -142,9 +142,9 @@
// so hard code here, wait for engine's correcting.
switch (profileId) {
case EProfileWrapperGeneralId:
- return hbTrId("txt_cp_setlabel_active_profile_val_general");
+ return hbTrId("txt_cp_list_general");
case EProfileWrapperMeetingId:
- return hbTrId("txt_cp_setlabel_active_profile_val_meeting");
+ return hbTrId("txt_cp_list_meeting");
default:
return QString("");
}
@@ -153,8 +153,8 @@
{
//hard code, until engine part support qt localized name
QStringList nameList;
- nameList<<hbTrId("txt_cp_setlabel_active_profile_val_general")
- <<hbTrId("txt_cp_setlabel_active_profile_val_meeting");
+ nameList<<hbTrId("txt_cp_list_general")
+ <<hbTrId("txt_cp_list_meeting");
return nameList;
}
--- a/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/cpserviceprovider.pro Thu Jun 10 16:07:41 2010 +0800
@@ -27,8 +27,8 @@
SERVICE.FILE = service_conf.xml
SERVICE.OPTIONS = embeddable
-SERVICE.OPTIONS += hidden embeddable
+SERVICE.OPTIONS += hidden
libFiles.sources = xqservice.dll
libFiles.path = "!:\sys\bin"
-DEPLOYMENT += libFiles
\ No newline at end of file
+DEPLOYMENT += libFiles
--- a/controlpanelui/src/cpserviceprovider/src/main.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/cpserviceprovider/src/main.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -17,6 +17,8 @@
#include <hbapplication.h>
#include <hbstyleloader.h>
#include <QDir>
+#include <QTranslator>
+#include <QLocale>
#include <cpbasepath.h>
#include "cpservicemainwindow.h"
#include "cpsplogger.h"
@@ -29,6 +31,12 @@
CPSP_LOGGER_CONFIG_PATH,QSettings::IniFormat);
CPSP_LOG("Entering CpServiceProvider.exe...");
+ QTranslator translator;
+ if (translator.load("control_panel_" + QLocale::system().name(),"Z:/resource/qt/translations"))
+ {
+ qApp->installTranslator(&translator);
+ }
+
HbStyleLoader::registerFilePath(CP_RESOURCE_PATH + QDir::separator() + WIDGETML_SUB_PATH);
CpServiceMainWindow wnd;
--- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -88,6 +88,11 @@
emit layoutChanged();
}
+void ToneFetcherModel::toBeFreshed()
+{
+ emit layoutAboutToBeChanged();
+}
+
void ToneFetcherModel::clearAll()
{
mUserDataLst.clear();
--- a/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetchermodel.h Thu Jun 10 16:07:41 2010 +0800
@@ -38,6 +38,7 @@
void insertInOrder(QStandardItem *fileName, QStandardItem *filePath, int role = Qt::DisplayRole);
QString path(const QModelIndex &index) const;
void refresh();
+ void toBeFreshed();
void clearAll();
private:
/*
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -34,6 +34,7 @@
#include "tonefetcherview.h"
#include "tonefetchermodel.h"
#include <hbmessagebox.h>
+#include <hbprogressdialog.h>
ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView )
: HbWidget(this),
@@ -42,7 +43,8 @@
mLayout(0),
mToneModel(0),
mServiceView(serviceView),
- mServiceEngine(0)
+ mServiceEngine(0),
+ mWaitNote(0)
{
mSelected = false;
@@ -60,11 +62,18 @@
this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int)));
connect( mServiceEngine, SIGNAL(notifyObjectChanged()),
this, SLOT(onObjectChanged()));
+ connect( mServiceEngine, SIGNAL(notifyRefreshStart()),
+ this, SLOT(refreshStart()));
+ connect( mServiceEngine, SIGNAL(notifyRefreshFinish()),
+ this, SLOT(refreshFinish()));
}
ToneFetcherWidget::~ToneFetcherWidget()
{
- delete mToneModel;
+ delete mToneModel;
+ mToneModel = 0;
+ delete mWaitNote;
+ mWaitNote = 0;
}
void ToneFetcherWidget::on_list_activated(const QModelIndex &index)
@@ -73,7 +82,7 @@
//stop previewing when clicking another item.
if (mServiceEngine->IsPlaying()) {
- mServiceEngine->preview(getCurrentItemPath());
+ mServiceEngine->stop();
}
/*
* when one item is selected, reselecting it will deselect it. selecting another
@@ -125,6 +134,12 @@
connect(mListView, SIGNAL(activated(QModelIndex)),
this, SLOT(on_list_activated(QModelIndex )));
+ if( !mWaitNote ){
+ mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
+ mWaitNote->setText( hbTrId( "Refreshing..." ) );
+ QAction *action = mWaitNote->actions().at(0);//disable Cancel buttion.
+ action->setEnabled(false);
+ }
}
void ToneFetcherWidget::mdeSessionOpened()
@@ -171,7 +186,12 @@
void ToneFetcherWidget::playOrPause()
{
+ if(mServiceEngine->IsPlaying()) {
+ mServiceEngine->stop();
+ } else {
mServiceEngine->preview(getCurrentItemPath());
+ }
+
}
void ToneFetcherWidget::previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId)
@@ -186,6 +206,11 @@
void ToneFetcherWidget::onObjectChanged()
{
+ if (mServiceEngine->IsPlaying()) {
+ mServiceEngine->stop();
+ }
+ emit triggerToolBar(false);
+ mToneModel->toBeFreshed();
mToneModel->clearAll();
mDigitalSoundList.clear();
mSimpleSoundList.clear();
@@ -217,4 +242,18 @@
mToneModel->insertInOrder(fileName, filePath);
}
}
+
+void ToneFetcherWidget::refreshFinish()
+{
+ if (mWaitNote) {
+ mWaitNote->close();
+ }
+}
+
+void ToneFetcherWidget::refreshStart()
+{
+ if (mWaitNote) {
+ mWaitNote->open();
+ }
+}
//End of File
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.h Thu Jun 10 16:07:41 2010 +0800
@@ -32,6 +32,7 @@
class ToneFetcherView;
class ToneFetcherModel;
class HbLabel;
+class HbProgressDialog;
class ToneFetcherWidget : public HbWidget
{
@@ -55,6 +56,8 @@
void queryError(int error );
void previewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId);
void onObjectChanged();
+ void refreshFinish();
+ void refreshStart();
private:
void init();
@@ -73,5 +76,6 @@
QFileInfoList mDigitalSoundList;
bool mSelected;
QModelIndex mOldSeletedItem;
+ HbProgressDialog *mWaitNote;
};
#endif /* TONEFETCHERWIDGET_H_ */
--- a/controlpanelui/src/tonefetcher/tonefetcher.pro Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcher.pro Thu Jun 10 16:07:41 2010 +0800
@@ -51,7 +51,7 @@
SERVICE.FILE = service_conf.xml
SERVICE.OPTIONS = embeddable
-#SERVICE.OPTIONS += hidden
+SERVICE.OPTIONS += hidden
libFiles.sources = xqservice.dll
libFiles.path = "!:\sys\bin"
DEPLOYMENT += libFiles
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -237,6 +237,8 @@
iAudioPlayerStatus = EPlayerNotCreated;
CMFPreviewHandlerBase::ConstructL();
iTonePlayerStatus = EPlayerNotCreated;
+ CCoeEnv* coeEnv = CCoeEnv::Static();
+ coeEnv->AddForegroundObserverL( *this );
}
TonePreviewPrivate::~TonePreviewPrivate()
@@ -264,12 +266,7 @@
}
void TonePreviewPrivate::Play()
- {
- if( IsPlaying() )
- {
- Stop();
- return;
- }
+ {
//sequence for playing a beep once sound
_LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
\x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" );
@@ -601,3 +598,15 @@
Cancel();
emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
}
+
+void TonePreviewPrivate::HandleLosingForeground()
+ {
+ if ( IsPlaying() )
+ {
+ Stop();
+ }
+ }
+void TonePreviewPrivate::HandleGainingForeground()
+ {
+
+ }
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/tonepreviewprivate.h Thu Jun 10 16:07:41 2010 +0800
@@ -27,6 +27,7 @@
#include <e32property.h>
#include <QObject>
#include "tonefetcherengine.h"
+#include <coemain.h>
class C3DRingingToneInterface;
class RWindow;
@@ -164,7 +165,8 @@
class TonePreviewPrivate : public CMFPreviewHandlerBase,
public MDrmAudioPlayerCallback,
- public MMdaAudioToneObserver
+ public MMdaAudioToneObserver,
+ public MCoeForegroundObserver
{
Q_OBJECT
@@ -196,6 +198,9 @@
void MdapcInitComplete(TInt aError,
const TTimeIntervalMicroSeconds& aDuration);
void MdapcPlayComplete(TInt aError);
+ // from MCoeForegroundObserver
+ void HandleLosingForeground();
+ void HandleGainingForeground();
private:
// audio player
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -23,12 +23,69 @@
#include "tonefetcherengine.h"
#include <centralrepository.h>
#include <ProfileEngineDomainCRKeys.h>
+#include <cplogger.h>
+
+
+CTimeOutTimer* CTimeOutTimer::NewL(ToneSelectionEnginePrivate& aObserver)
+ {
+ CTimeOutTimer* self = CTimeOutTimer::NewLC(aObserver);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+
+
+CTimeOutTimer* CTimeOutTimer::NewLC(ToneSelectionEnginePrivate& aObserver)
+ {
+ CTimeOutTimer* self = new (ELeave) CTimeOutTimer(aObserver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+
+
+CTimeOutTimer::CTimeOutTimer(ToneSelectionEnginePrivate& aObserver)
+ : CTimer(EPriorityStandard),
+ iObserver( aObserver )
+ {
+
+ }
+
+
+
+CTimeOutTimer::~CTimeOutTimer()
+ {
+ Cancel();
+ }
+
+
+
+void CTimeOutTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+
+void CTimeOutTimer::RunL()
+ {
+ iObserver.ChangeObject();
+ }
ToneSelectionEnginePrivate::ToneSelectionEnginePrivate( ToneFetcherEngine *engine ) : mServiceEngine( engine )
{
iSession = CMdESession::NewL( *this );
+ iTimer = CTimeOutTimer::NewLC( *this );
+ iContinue = EFalse;
+ iTimerStarted = EFalse;
+ iFreshing = EFalse;
+ CleanupStack::Pop();
+
+
}
ToneSelectionEnginePrivate::~ToneSelectionEnginePrivate()
@@ -78,11 +135,23 @@
void ToneSelectionEnginePrivate::HandleObjectNotification( CMdESession& /*aSession*/,
TObserverNotificationType aType,
- const RArray<TItemId>& /*aObjectIdArray*/ )
+ const RArray<TItemId>& aObjectIdArray )
{
- if ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove )
+ if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
{
- emit notifyObjectChanged();
+ CPFW_LOG("ToneSelectionEnginePrivate::HandleObjectNotification count = " + QVariant(aObjectIdArray.Count()).toString() + " type = " + QVariant(aType).toString());
+ const TInt KOneSecond = 1000*1000;
+ if ( !iFreshing )
+ {
+ emit notifyRefreshStart();
+ iFreshing = ETrue;
+ }
+ if ( !iTimerStarted )
+ {
+ iTimer->After( 5 * KOneSecond );
+ iTimerStarted = ETrue;
+ }
+ iContinue = ETrue;
}
}
@@ -103,7 +172,18 @@
{
if( aObjectIdArray.Count() > 0 )
{
- emit notifyObjectChanged();
+ const TInt KOneSecond = 1000*1000;
+ if ( !iFreshing )
+ {
+ emit notifyRefreshStart();
+ iFreshing = ETrue;
+ }
+ if ( !iTimerStarted )
+ {
+ iTimer->After( 5 * KOneSecond );
+ iTimerStarted = ETrue;
+ }
+ iContinue = ETrue;
}
}
@@ -268,5 +348,29 @@
}
}
}
+
+void ToneSelectionEnginePrivate::ChangeObject()
+ {
+ if ( iTimerStarted )
+ {
+ emit notifyObjectChanged();
+ iTimerStarted = EFalse;
+ }
+
+ if ( iContinue )
+ {
+ iContinue = EFalse;
+ iTimer->After( 5000*1000 );
+ iTimerStarted = ETrue;
+ }
+ else
+ {
+ if ( iFreshing )
+ {
+ emit notifyRefreshFinish();
+ iFreshing = EFalse;
+ }
+ }
+ }
// End of File
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h Thu Jun 10 16:07:41 2010 +0800
@@ -32,9 +32,30 @@
#include <QStringList>
// FORWARD DECLARATIONS
class ToneFetcherEngine;
+class ToneSelectionEnginePrivate;
// CONSTANTS
_LIT( KMimeMp3, "mp3" );
+class CTimeOutTimer : public CTimer
+{
+public:
+ static CTimeOutTimer* NewL(ToneSelectionEnginePrivate& aObserver);
+ static CTimeOutTimer* NewLC(ToneSelectionEnginePrivate& aObserver);
+
+ ~CTimeOutTimer();
+
+protected:
+ virtual void RunL();
+
+private:
+ CTimeOutTimer(ToneSelectionEnginePrivate& aObserver);
+ void ConstructL();
+
+private:
+
+ ToneSelectionEnginePrivate& iObserver;
+};
+
// CLASS DECLARATION
/**
* This class is used for quering tones from mde.
@@ -74,14 +95,15 @@
public:
ToneSelectionEnginePrivate( ToneFetcherEngine *engine );
virtual ~ToneSelectionEnginePrivate();
-
+ void ChangeObject();
signals:
void mdeSessionOpened();
void mdeSessionError( int error );
- void queryComplete( QStringList nameList, QStringList uriList );
+ void queryComplete( const QStringList& nameList, const QStringList& uriList );
void queryError( int error );
void notifyObjectChanged();
-
+ void notifyRefreshStart();
+ void notifyRefreshFinish();
public:
static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr);
@@ -137,6 +159,12 @@
// query error
TInt iQueryError;
+
+ // for refresh
+ CTimeOutTimer *iTimer;
+ TBool iContinue;
+ TBool iTimerStarted;
+ TBool iFreshing;
};
#endif /* TONESELECTIONENGINE_H_ */
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp Thu Jun 10 16:07:41 2010 +0800
@@ -35,6 +35,10 @@
this, SIGNAL(queryError(int)));
connect(d, SIGNAL(notifyObjectChanged()),
this, SIGNAL(notifyObjectChanged()));
+ connect(d, SIGNAL(notifyRefreshStart()),
+ this, SIGNAL(notifyRefreshStart()));
+ connect(d, SIGNAL(notifyRefreshFinish()),
+ this, SIGNAL(notifyRefreshFinish()));
connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)),
this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)));
}
@@ -59,4 +63,10 @@
{
mAudioPlayer->IsPlaying();
}
+
+void ToneFetcherEngine::stop()
+{
+ mAudioPlayer->Stop();
+}
+
//End of File
--- a/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Tue May 25 04:10:19 2010 +0800
+++ b/controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.h Thu Jun 10 16:07:41 2010 +0800
@@ -82,6 +82,11 @@
void preview(const QString &file);
bool IsPlaying();
+
+ /*
+ * stop previewing
+ */
+ void stop();
signals:
void mdeSessionOpened();
void mdeSessionError(int error);
@@ -89,6 +94,8 @@
void queryError(int error);
void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId);
void notifyObjectChanged();
+ void notifyRefreshStart();
+ void notifyRefreshFinish();
private:
ToneSelectionEnginePrivate *d;
TonePreviewPrivate *mAudioPlayer;