Engines
mprisdbustypes.cpp
Go to the documentation of this file.00001 /* 00002 * Copyright 2008 Alex Merry <alex.merry@kdemail.net> 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License as 00006 * published by the Free Software Foundation; either version 2 of 00007 * the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #include "mprisdbustypes.h" 00018 00019 // Marshall the MprisDBusVersion data into a D-BUS argument 00020 QDBusArgument &operator<<(QDBusArgument &argument, const MprisDBusVersion &version) 00021 { 00022 argument.beginStructure(); 00023 argument << version.major << version.minor; 00024 argument.endStructure(); 00025 return argument; 00026 } 00027 00028 // Retrieve the MprisDBusVersion data from the D-BUS argument 00029 const QDBusArgument &operator>>(const QDBusArgument &argument, MprisDBusVersion &version) 00030 { 00031 argument.beginStructure(); 00032 argument >> version.major >> version.minor; 00033 argument.endStructure(); 00034 return argument; 00035 } 00036 00037 // Marshall the MprisDBusStatus data into a D-BUS argument 00038 QDBusArgument &operator<<(QDBusArgument &argument, const MprisDBusStatus &status) 00039 { 00040 argument.beginStructure(); 00041 argument << (qint32)status.play; 00042 argument << (qint32)status.random; 00043 argument << (qint32)status.trackRepeat; 00044 argument << (qint32)status.playlistRepeat; 00045 argument.endStructure(); 00046 return argument; 00047 } 00048 00049 // Retrieve the MprisDBusStatus data from the D-BUS argument 00050 const QDBusArgument &operator>>(const QDBusArgument &argument, MprisDBusStatus &status) 00051 { 00052 qint32 play, random, trackRepeat, playlistRepeat; 00053 00054 argument.beginStructure(); 00055 argument >> play; 00056 argument >> random; 00057 argument >> trackRepeat; 00058 argument >> playlistRepeat; 00059 argument.endStructure(); 00060 00061 status.play = (MprisDBusStatus::PlayMode)play; 00062 status.random = (MprisDBusStatus::RandomMode)random; 00063 status.trackRepeat = (MprisDBusStatus::TrackRepeatMode)trackRepeat; 00064 status.playlistRepeat = (MprisDBusStatus::PlaylistRepeatMode)playlistRepeat; 00065 00066 return argument; 00067 } 00068 00069 // vim: sw=4 sts=4 et tw=100