![]() |
Home · All Namespaces · All Classes |
Provides informations and actions on PulseAudio MainVolume API. More...
#include <volumebarlogic.h>


Public Slots | |
| void | setVolume (quint32 value) |
| void | stepsUpdated (quint32 value, quint32 maxvalue) |
Signals | |
| void | volumeChanged (quint32 value, quint32 maxvalue) |
Public Member Functions | |
| VolumeBarLogic () | |
| Construct a VolumeBarLogic instance. | |
| ~VolumeBarLogic () | |
| Destructs a VolumeBarLogic instance. | |
| quint32 | volume () |
| get the current volume-level value | |
| quint32 | maxVolume () |
| get the current volume-level stepcount | |
Provides informations and actions on PulseAudio MainVolume API.
Definition at line 28 of file volumebarlogic.h.
| VolumeBarLogic::VolumeBarLogic | ( | ) |
Construct a VolumeBarLogic instance.
Definition at line 42 of file volumebarlogic.cpp.
:
QObject (),
dbus_conn (NULL),
currentvolume (0),
currentmax (0)
{
openConnection (true);
}
| VolumeBarLogic::~VolumeBarLogic | ( | ) |
Destructs a VolumeBarLogic instance.
Definition at line 51 of file volumebarlogic.cpp.
{
if (dbus_conn) {
dbus_connection_unref (dbus_conn);
dbus_conn = 0;
}
}
| quint32 VolumeBarLogic::maxVolume | ( | ) |
get the current volume-level stepcount
Definition at line 281 of file volumebarlogic.cpp.
{
ping ();
return currentmax;
}
| void VolumeBarLogic::setVolume | ( | quint32 | value | ) | [slot] |
a method for change the volume-level
| value | The desired volume-level (valid range: [0 - maxvalue-1]) |
Definition at line 224 of file volumebarlogic.cpp.
{
currentvolume = value;
// Check the connection, maybe PulseAudio restarted meanwhile
openConnection ();
// Don't try to set the volume via d-bus when it isn't available
if (dbus_conn == NULL)
return;
DBusMessage *message;
char *volume_if = (char *) VOLUME_IF;
char *method = (char *) "CurrentStep";
message = dbus_message_new_method_call (VOLUME_SV,
VOLUME_PATH,
"org.freedesktop.DBus.Properties",
"Set");
if (message &&
dbus_message_append_args (message,
DBUS_TYPE_STRING, &volume_if,
DBUS_TYPE_STRING, &method,
DBUS_TYPE_INVALID)) {
DBusMessageIter append;
DBusMessageIter sub;
// Create and append the variant argument ...
dbus_message_iter_init_append (message, &append);
dbus_message_iter_open_container (&append,
DBUS_TYPE_VARIANT,
DBUS_TYPE_UINT32_AS_STRING,
&sub);
// Set the variant argument value:
dbus_message_iter_append_basic (&sub, DBUS_TYPE_UINT32, &value);
// Close the append iterator
dbus_message_iter_close_container (&append, &sub);
// Send/flush the message immediately:
dbus_connection_send (dbus_conn, message, NULL);
} else {
qWarning() << "Cannot set volume! [not enough memory]";
}
if (message)
dbus_message_unref (message);
}
| void VolumeBarLogic::stepsUpdated | ( | quint32 | value, | |
| quint32 | maxvalue | |||
| ) | [slot] |
an internal slot whats stores the actual volume values and emits the volumeChanged signal [this is public because it called from a C callback function...]
| value | The new volume-level what we got from PulseAudio | |
| maxvalue | The new stepcount what we got from PulseAudio |
Definition at line 216 of file volumebarlogic.cpp.
{
currentvolume = value;
currentmax = maxvalue;
emit volumeChanged (value, maxvalue);
}

| quint32 VolumeBarLogic::volume | ( | ) |
get the current volume-level value
Definition at line 274 of file volumebarlogic.cpp.
{
ping ();
return currentvolume;
}
| void VolumeBarLogic::volumeChanged | ( | quint32 | value, | |
| quint32 | maxvalue | |||
| ) | [signal] |
a signal what is emitted whenever the volume-level and/or the volume-level step-counts are updated
| value | The new volume-level | |
| maxvalue | The new volume-level stepcount value |
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:19:35 Doxygen 1.7.1 |
MeeGo Touch |