New DBus functions and mediaartlocal support
[someplayer] / src / dbusadaptor.h
1 /*
2  * SomePlayer - An alternate music player for Maemo 5
3  * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef DBUSADAPTOR
21 #define DBUSADAPTOR
22
23 #include <QtCore/QObject>
24 #include <QtDBus/QtDBus>
25 #include <QTime>
26
27 #define _DBUS_ACTION_TIMEOUT_ (500)
28
29 class QByteArray;
30 template<class T> class QList;
31 template<class Key, class Value> class QMap;
32 class QString;
33 class QStringList;
34 class QVariant;
35
36 /*
37  * Adaptor class for interface ru.somebody.someplayer
38  */
39 class DBusAdaptop: public QDBusAbstractAdaptor
40 {
41         Q_OBJECT
42         Q_CLASSINFO("D-Bus Interface", "ru.somebody.someplayer")
43         Q_CLASSINFO("D-Bus Introspection", ""
44                     "  <interface name=\"ru.somebody.someplayer\">\n"
45                     "    <method name=\"prev\">\n"
46                     "      <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
47                     "    </method>\n"
48                     "    <method name=\"next\">\n"
49                     "      <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
50                     "    </method>\n"
51                     "    <method name=\"toggle\">\n"
52                     "      <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
53                     "    </method>\n"
54                     "    <method name=\"stop\">\n"
55                     "      <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
56                     "    </method>\n"
57                     "    <method name=\"artist\">\n"
58                     "      <arg direction=\"out\" type=\"s\"/>\n"
59                     "    </method>\n"
60                     "    <method name=\"album\">\n"
61                     "      <arg direction=\"out\" type=\"s\"/>\n"
62                     "    </method>\n"
63                     "    <method name=\"title\">\n"
64                     "      <arg direction=\"out\" type=\"s\"/>\n"
65                     "    </method>\n"
66                     "    <method name=\"title_artist_album\">\n"
67                     "      <arg direction=\"out\" type=\"s\"/>\n"
68                     "    </method>\n"
69                     "    <method name=\"state\">\n"
70                     "      <arg direction=\"out\" type=\"s\"/>\n"
71                     "    </method>\n"
72                     "  </interface>\n"
73                     "")
74 public:
75         DBusAdaptop(QObject *parent);
76         virtual ~DBusAdaptop();
77
78 public: // PROPERTIES
79 public Q_SLOTS: // METHODS
80         QString album();
81         QString artist();
82         Q_NOREPLY void next();
83         Q_NOREPLY void prev();
84         Q_NOREPLY void stop();
85         QString title();
86         QString title_artist_album();
87         QString state();
88         QString albumart();
89         Q_NOREPLY void toggle();
90         Q_NOREPLY void pause();
91         Q_NOREPLY void playIfPaused();
92
93         void processBTSignal(QString, QString);
94 Q_SIGNALS: // SIGNALS
95         void stateChanged();
96         void albumArt(QString path);
97 private:
98         QTime _time;
99 };
100
101 #endif