kopete/protocols/messenger/libpapillon
Papillon::StatusMessage Class Reference
#include <Papillon/StatusMessage>
Detailed Description
Dynamic Personal Status Message for Windows Live Messenger.A status message can contain a plain status message and can also contain metadata about the current song played and more.
Set the plain status message using setMessage().
Example of code for setCurrentMedia():
Papillon::StatusMessage mediaStatus; QList<QVariant> mediaArgs; QString formatterString; if( musicData.contains("title") ) { formatterString += "{0}"; mediaArgs.append( musicData.value("title") ); } if( musicData.contains("artist") ) { formatterString += "- {1}"; mediaArgs.append( musicData.value("artist") ); } mediaStatus.setCurrentMediaType( Papillon::Presence::MediaMusic ); mediaStatus.setCurrentMediaFormatterString( formatterString ); mediaStatus.setCurrentMediaArguments( mediaArgs );
You can use fromXml() to create a StatusMessage from a XML string and toXml() to get the XML string for the current StatusMessage.
This class is implicit shared.
Definition at line 65 of file papillonstatusmessage.h.
Public Member Functions | |
| StatusMessage () | |
| StatusMessage (const QString &plainStatusMessage) | |
| StatusMessage (const StatusMessage ©) | |
| StatusMessage & | operator= (const StatusMessage &other) |
| ~StatusMessage () | |
| void | clear () |
| QString | message () const |
| void | setMessage (const QString &message) |
| void | setCurrentMediaEnabled (bool enabled) |
| void | setCurrentMediaApplication (const QString &application) |
| void | setCurrentMediaType (Papillon::Presence::MediaType mediaType) |
| void | setCurrentMediaFormatterString (const QString &formatterString) |
| void | setCurrentMediaArguments (const QList< QVariant > &arguments) |
| bool | isCurrentMediaEnabled () const |
| QString | currentMediaApplication () const |
| Papillon::Presence::MediaType | currentMediaType () const |
| QString | currentMediaFormatterString () const |
| QList< QVariant > | currentMediaArguments () const |
| QString | formattedMediaString () const |
| QString | toXml () const |
Static Public Member Functions | |
| static StatusMessage | fromXml (const QString &xml) |
Constructor & Destructor Documentation
| Papillon::StatusMessage::StatusMessage | ( | ) |
| Papillon::StatusMessage::StatusMessage | ( | const QString & | plainStatusMessage | ) | [explicit] |
Create a new status message with plain status message already set.
- Parameters:
-
plainStatusMessage The plain status message.
Definition at line 54 of file papillonstatusmessage.cpp.
| Papillon::StatusMessage::StatusMessage | ( | const StatusMessage & | copy | ) |
Copy constructor Do not create a deep copy, just increase the reference count.
Definition at line 60 of file papillonstatusmessage.cpp.
| Papillon::StatusMessage::~StatusMessage | ( | ) |
Definition at line 71 of file papillonstatusmessage.cpp.
Member Function Documentation
| StatusMessage & Papillon::StatusMessage::operator= | ( | const StatusMessage & | other | ) |
Copy-assignment operator Do not create a deep copy, just increate the reference count.
Definition at line 64 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::clear | ( | ) |
Clear all values of the current StatusMessage.
Use this method to reset all values.
Definition at line 75 of file papillonstatusmessage.cpp.
| QString Papillon::StatusMessage::message | ( | ) | const |
Get the current plain status message.
- Returns:
- Plain status message (also know as personal status message)
Definition at line 85 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::setMessage | ( | const QString & | message | ) |
Set the current plain status message.
- Parameters:
-
message New status message to set.
Definition at line 90 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::setCurrentMediaEnabled | ( | bool | enabled | ) |
Set if current media should be enabled.
(optional)
This option is optional and it's true by default.
- Parameters:
-
enabled Enabled or not.
Definition at line 95 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::setCurrentMediaApplication | ( | const QString & | application | ) |
Set the application for the current media.
(optional)
This option is optional and it's empty by default.
- Parameters:
-
application Application name for the current media (ex: Amarok, Kaffeine)
Definition at line 100 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::setCurrentMediaType | ( | Papillon::Presence::MediaType | mediaType | ) |
Set the current media type.
(required)
Set mediaType to Papillon::OnlineStatus::MediaNone to ignore CurrentMedia.
- See also:
- Papillon::OnlineStatus::MediaType for more details.
- Parameters:
-
mediaType Current media type
Definition at line 105 of file papillonstatusmessage.cpp.
| void Papillon::StatusMessage::setCurrentMediaFormatterString | ( | const QString & | formatterString | ) |
Set the formatter string.
(required)
The formatter string looks like this(without the quotes): "{0} - {1} ({2})". Each argument is represented by its index. The formatter string is how the client application should display the current media.
- Parameters:
-
formatterString the formatter string.
Definition at line 110 of file papillonstatusmessage.cpp.
Set the current media arguments.
(required)
The arguments is the values used to replace the placeholder in the formatter string.
- Parameters:
-
arguments Argument list.
Definition at line 115 of file papillonstatusmessage.cpp.
| bool Papillon::StatusMessage::isCurrentMediaEnabled | ( | ) | const |
Get if the current media should be enabled/displayed.
- Returns:
- Current media enabled or not.
Definition at line 120 of file papillonstatusmessage.cpp.
| QString Papillon::StatusMessage::currentMediaApplication | ( | ) | const |
Get the current media application.
- Returns:
- Current media application.
Definition at line 125 of file papillonstatusmessage.cpp.
| Papillon::Presence::MediaType Papillon::StatusMessage::currentMediaType | ( | ) | const |
Get the current media type.
If this return Papillon::OnlineStatus::MediaNone then you should ignore all information about current media.
- Returns:
- Current media type (MediaNone if no type is defined)
Definition at line 130 of file papillonstatusmessage.cpp.
| QString Papillon::StatusMessage::currentMediaFormatterString | ( | ) | const |
Get the current media formatter string.
Formatter string is in the form "{0} - {1} ({2})"
- Returns:
- Current media formatter string.
Definition at line 135 of file papillonstatusmessage.cpp.
Get the current media arguments.
- Returns:
- Current media argument list
Definition at line 140 of file papillonstatusmessage.cpp.
| QString Papillon::StatusMessage::formattedMediaString | ( | ) | const |
Return a formatted string representation of current media.
This will result a string such as "Acid Rain - Liquid Tension Experiment (Liquid Tension Experiment 2)", where the formatter string was "{0} - {1} ({2})".
- Returns:
- a formatted represenation of the current media.
Definition at line 145 of file papillonstatusmessage.cpp.
| StatusMessage Papillon::StatusMessage::fromXml | ( | const QString & | xml | ) | [static] |
Parse a XML represenation of the personal status message.
Input should look like: "<Data><PSM>libpapillon rules</PSM><CurrentMedia></CurrentMedia></Data>".
- Parameters:
-
xml XML document as a string.
- Returns:
- New StatusMessage with information parsed from the XML document.
Definition at line 157 of file papillonstatusmessage.cpp.
| QString Papillon::StatusMessage::toXml | ( | ) | const |
Return a XML representation of current StatusMessage.
This string will be ready to be send to the server.
The resulting string look like "<Data><PSM>libpapillon rules</PSM><CurrentMedia></CurrentMedia></Data>".
- Returns:
- resulting XML document as a string.
Definition at line 227 of file papillonstatusmessage.cpp.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference