From aea95eeec5e75db4b0978ba77f44cb2a5861f1f2 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Mon, 12 Dec 2011 13:44:20 +0100 Subject: [PATCH 01/12] only show backend changed notification once per app doing it once for all apps is insanely tricky ... plus which one to use? --- phonon/factory.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/phonon/factory.cpp b/phonon/factory.cpp index 770c799..ab27798 100644 --- a/phonon/factory.cpp +++ b/phonon/factory.cpp @@ -68,6 +68,9 @@ class FactoryPrivate : public Phonon::Factory::Sender QList objects; QList mediaNodePrivateList; + /// Whether the 'backend changed, please restart' message was shown. + bool m_backendChangedNotified; + private Q_SLOTS: /** * This is called via DBUS when the user changes the Phonon Backend. @@ -215,10 +218,11 @@ bool FactoryPrivate::createBackend() FactoryPrivate::FactoryPrivate() : #ifndef QT_NO_PHONON_PLATFORMPLUGIN - m_platformPlugin(0), - m_noPlatformPlugin(false), + m_platformPlugin(0), + m_noPlatformPlugin(false), #endif //QT_NO_PHONON_PLATFORMPLUGIN - m_backendObject(0) + m_backendObject(0), + m_backendChangedNotified(false) { // Add the post routine to make sure that all other global statics (especially the ones from Qt) // are still available. If the FactoryPrivate dtor is called too late many bad things can happen @@ -303,16 +307,16 @@ void Factory::deregisterFrontendObject(MediaNodePrivate *bp) #ifndef PHONON_NO_DBUS void FactoryPrivate::phononBackendChanged() { -#ifdef __GNUC__ -#warning TODO hyperspeed: the message box only ought to be shown once and not for \ - every backend switch -#endif + if (m_backendChangedNotified) + return; + QMessageBox::information(qApp->activeWindow(), tr("Restart Application"), tr("You changed the backend of the Phonon multimedia system.\n\n" "To apply this change you will need to" " restart '%1'.").arg(qAppName())); emit backendChanged(); + m_backendChangedNotified = true; } #endif //PHONON_NO_DBUS -- 1.8.3.1