summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Koskinen <janne.p.koskinen@digia.com>2009-11-25 12:16:41 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2009-11-25 12:16:41 (GMT)
commit7284cef6067eab30582f0f1accc7717bf67cb1e6 (patch)
treeef3ec2499e4c6cd14dc4aa5f96dba86e6f79382d
parentcee1c16a4738e30db5c011f4ae7e273387b5d998 (diff)
parent800ad1c685060bfb6f469a506e8cd85ff3d81577 (diff)
downloadQt-7284cef6067eab30582f0f1accc7717bf67cb1e6.zip
Qt-7284cef6067eab30582f0f1accc7717bf67cb1e6.tar.gz
Qt-7284cef6067eab30582f0f1accc7717bf67cb1e6.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
-rw-r--r--src/gui/kernel/qapplication_s60.cpp56
-rw-r--r--src/gui/styles/qs60style.cpp5
-rw-r--r--src/gui/styles/qs60style_p.h2
3 files changed, 35 insertions, 28 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index fb2bc72..89d961c 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -133,36 +133,46 @@ private:
TTimeIntervalMicroSeconds iDuration;
};
+static QS60Beep* qt_S60Beep = 0;
+
QS60Beep::~QS60Beep()
{
+ if (iToneUtil) {
+ switch (iState) {
+ case EBeepPlaying:
+ iToneUtil->CancelPlay();
+ break;
+ case EBeepNotPrepared:
+ iToneUtil->CancelPrepare();
+ break;
+ }
+ }
delete iToneUtil;
}
QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- QS60Beep* self=new (ELeave) QS60Beep();
+ QS60Beep* self = new (ELeave) QS60Beep();
CleanupStack::PushL(self);
self->ConstructL(aFrequency, aDuration);
CleanupStack::Pop();
return self;
-};
+}
void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- iToneUtil=CMdaAudioToneUtility::NewL(*this);
- iState=EBeepNotPrepared;
- iFrequency=aFrequency;
- iDuration=aDuration;
- iToneUtil->PrepareToPlayTone(iFrequency,iDuration);
+ iToneUtil = CMdaAudioToneUtility::NewL(*this);
+ iState = EBeepNotPrepared;
+ iFrequency = aFrequency;
+ iDuration = aDuration;
+ iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
}
void QS60Beep::Play()
{
- if (iState != EBeepNotPrepared) {
- if (iState == EBeepPlaying) {
- iToneUtil->CancelPlay();
- iState = EBeepPrepared;
- }
+ if (iState == EBeepPlaying) {
+ iToneUtil->CancelPlay();
+ iState = EBeepPrepared;
}
iToneUtil->Play();
@@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError)
{
if (aError == KErrNone) {
iState = EBeepPrepared;
+ Play();
}
}
void QS60Beep::MatoPlayComplete(TInt aError)
{
Q_UNUSED(aError);
- iState=EBeepPrepared;
+ iState = EBeepPrepared;
}
@@ -1226,6 +1237,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
*****************************************************************************/
void qt_cleanup()
{
+ if(qt_S60Beep) {
+ delete qt_S60Beep;
+ qt_S60Beep = 0;
+ }
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
@@ -1467,14 +1482,13 @@ void QApplication::setCursorFlashTime(int msecs)
void QApplication::beep()
{
- TInt frequency=440;
- TTimeIntervalMicroSeconds duration(500000);
- QS60Beep* beep=NULL;
- TRAPD(err, beep=QS60Beep::NewL(frequency, duration));
- if (!err)
- beep->Play();
- delete beep;
- beep=NULL;
+ if (!qt_S60Beep) {
+ TInt frequency = 880;
+ TTimeIntervalMicroSeconds duration(500000);
+ TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
+ }
+ if (qt_S60Beep)
+ qt_S60Beep->Play();
}
/*!
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b5c0d4f..03f7a95 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const
storeThemePalette(&widgetPalette);
}
-void QS60StylePrivate::setThemePalette(QStyleOption *option) const
-{
- setThemePalette(&option->palette);
-}
-
QPalette* QS60StylePrivate::themePalette()
{
return m_themePalette;
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ea86bb2..36979a2 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -418,8 +418,6 @@ public:
//set theme palette for application
void setThemePalette(QApplication *application) const;
- //set theme palette for style option
- void setThemePalette(QStyleOption *option) const;
//access to theme palette
static QPalette* themePalette();