[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kcontrol/access
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2007-10-30 16:45:30
Message-ID: 1193762730.184898.4370.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 731071 by tokoe:

Delay initialization of Phonon::MediaObject for faster startup
of the session.


 M  +9 -4      kaccess.cpp  
 M  +1 -0      kaccess.h  


--- trunk/KDE/kdebase/workspace/kcontrol/access/kaccess.cpp #731070:731071
@@ -95,9 +95,8 @@
 
 KAccessApp::KAccessApp(bool allowStyles, bool GUIenabled)
   : KUniqueApplication(allowStyles, GUIenabled),
-  overlay(0), _player(Phonon::createPlayer(Phonon::AccessibilityCategory))
+  overlay(0), _player(0)
 {
-  _player->setParent(this);
   _activeWindow = KWindowSystem::activeWindow();
   connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, \
SLOT(activeWindowChanged(WId)));  
@@ -128,7 +127,7 @@
   // bell ---------------------------------------------------------------
   _systemBell = cg.readEntry("SystemBell", true);
   _artsBell = cg.readEntry("ArtsBell", false);
-  _player->setCurrentSource(cg.readPathEntry("ArtsBellFile", QString()));
+  _currentPlayerSource = cg.readPathEntry("ArtsBellFile", QString());
   _visibleBell = cg.readEntry("VisibleBell", false);
   _visibleBellInvert = cg.readEntry("VisibleBellInvert", false);
   _visibleBellColor = cg.readEntry("VisibleBellColor", QColor(Qt::red));
@@ -466,8 +465,14 @@
     }
 
   // ask Phonon to ring a nice bell
-  if (_artsBell)
+  if (_artsBell) {
+    if (!_player) { // as creating the player is expensive, delay the creation
+      _player = Phonon::createPlayer(Phonon::AccessibilityCategory);
+      _player->setParent(this);
+      _player->setCurrentSource(_currentPlayerSource);
+    }
     _player->play();
+  }
 }
 
 QString mouseKeysShortcut (Display *display) {
--- trunk/KDE/kdebase/workspace/kcontrol/access/kaccess.h #731070:731071
@@ -74,6 +74,7 @@
   QWidget *overlay;
 
   Phonon::MediaObject *_player;
+  QString _currentPlayerSource;
 
   WId _activeWindow;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic