Fixed little problem with BT AudioSink status
authorNikolay Tischenko <niktischenko@gmail.com>
Fri, 1 Apr 2011 16:47:29 +0000 (23:47 +0700)
committerNikolay Tischenko <niktischenko@gmail.com>
Fri, 1 Apr 2011 16:47:29 +0000 (23:47 +0700)
src/dbusadaptor.cpp
src/dbusadaptor.h

index a6264f0..44f97c3 100644 (file)
@@ -47,6 +47,7 @@ DBusAdaptop::DBusAdaptop(QObject *parent)
                qWarning() << "Can not connect to HAL 2";
        }
        setAutoRelaySignals(true);
+       _is_bt_conencted = false;
 }
 
 DBusAdaptop::~DBusAdaptop()
@@ -165,8 +166,16 @@ void DBusAdaptop::processBTConnect(QString stateName, QDBusVariant state) {
        }
        if (stateName == "State") {
                if (state.variant().toString() == "disconnected") {
+                       if (!_is_bt_conencted) {
+                               return;
+                       }
+                       _is_bt_conencted = false;
                        pause();
                } else if (state.variant().toString() == "connected") {
+                       if (_is_bt_conencted) {
+                               return;
+                       }
+                       _is_bt_conencted = true;
                        QTimer::singleShot(1000, this, SLOT(playIfPaused()));
                }
        }
index 5e0caca..9d0f8f9 100644 (file)
@@ -101,6 +101,7 @@ Q_SIGNALS: // SIGNALS
        void albumArt(QString path);
 private:
        QTime _time;
+       bool _is_bt_conencted;
 };
 
 #endif