prev();
} else if (state == "play-cd" || state == "pause-cd") {
toggle();
+ } else if (state == "connection") {
+ bool present = QDBusInterface ("org.freedesktop.Hal",
+ "/org/freedesktop/Hal/devices/platform_headphone",
+ "org.freedesktop.Hal.Device",
+ QDBusConnection::systemBus()).call ("GetProperty", "button.state.value").arguments().at(0).toBool();
+ if (!present) {
+ pause();
+ } else {
+ QTimer::singleShot(1000, this, SLOT(playIfPaused()));
+ }
+
}
}
}
_time = t;
}
+
+void DBusAdaptop::pause() {
+ QMetaObject::invokeMethod(parent(), "pause");
+}
+
+void DBusAdaptop::playIfPaused() {
+ QMetaObject::invokeMethod(parent(), "playIfPaused");
+}
Q_NOREPLY void stop();
QString title();
Q_NOREPLY void toggle();
+ Q_NOREPLY void pause();
+ Q_NOREPLY void playIfPaused();
void processBTSignal(QString, QString);
Q_SIGNALS: // SIGNALS
return Track();
}
}
+
+void Player::pause() {
+ if (_state == PLAYER_PLAYING) {
+ _player->pause();
+ _state = PLAYER_PAUSED;
+ emit stateChanged(_state);
+ }
+}
+
+void Player::playIfPaused() {
+ if (_state == PLAYER_PAUSED) {
+ play();
+ }
+}