--- /dev/null
+<!--
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+-->
+
+<node>
+ <interface name="ru.somebody.someplayer">
+ <method name="prev">
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
+ </method>
+ <method name="next">
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
+ </method>
+ <method name="toggle">
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
+ </method>
+ <method name="stop">
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true" />
+ </method>
+ <method name="artist">
+ <arg type="s" direction="out"/>
+ </method>
+ <method name="album">
+ <arg type="s" direction="out"/>
+ </method>
+ <method name="title">
+ <arg type="s" direction="out"/>
+ </method>
+ </interface>
+</node>
+
#
#-------------------------------------------------
-QT += core gui phonon sql
+QT += core gui phonon sql dbus
TARGET = someplayer
TEMPLATE = app
src/timerdialog.cpp \
src/equalizerdialog.cpp \
src/saveplaylistdialog.cpp \
- src/settingsdialog.cpp
+ src/settingsdialog.cpp \
+ src/dbusadaptor.cpp
HEADERS += src/mainwindow.h \
src/player/player.h \
src/equalizerdialog.h \
src/saveplaylistdialog.h \
src/settingsdialog.h \
- src/abstractitemrenderer.h
+ src/abstractitemrenderer.h \
+ src/dbusadaptor.h
FORMS += src/ui/mainwindow.ui \
src/ui/playerform.ui \
--- /dev/null
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "dbusadaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class DBusAdaptop
+ */
+
+DBusAdaptop::DBusAdaptop(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+DBusAdaptop::~DBusAdaptop()
+{
+ // destructor
+}
+
+QString DBusAdaptop::album()
+{
+ // handle method call ru.somebody.someplayer.album
+ QString out0;
+ QMetaObject::invokeMethod(parent(), "album", Q_RETURN_ARG(QString, out0));
+ return out0;
+}
+
+QString DBusAdaptop::artist()
+{
+ // handle method call ru.somebody.someplayer.artist
+ QString out0;
+ QMetaObject::invokeMethod(parent(), "artist", Q_RETURN_ARG(QString, out0));
+ return out0;
+}
+
+void DBusAdaptop::next()
+{
+ // handle method call ru.somebody.someplayer.next
+ QMetaObject::invokeMethod(parent(), "next");
+}
+
+void DBusAdaptop::prev()
+{
+ // handle method call ru.somebody.someplayer.prev
+ QMetaObject::invokeMethod(parent(), "prev");
+}
+
+void DBusAdaptop::stop()
+{
+ // handle method call ru.somebody.someplayer.stop
+ QMetaObject::invokeMethod(parent(), "stop");
+}
+
+QString DBusAdaptop::title()
+{
+ // handle method call ru.somebody.someplayer.title
+ QString out0;
+ QMetaObject::invokeMethod(parent(), "title", Q_RETURN_ARG(QString, out0));
+ return out0;
+}
+
+void DBusAdaptop::toggle()
+{
+ // handle method call ru.somebody.someplayer.toggle
+ QMetaObject::invokeMethod(parent(), "toggle");
+}
+
--- /dev/null
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef DBUSADAPTOR
+#define DBUSADAPTOR
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface ru.somebody.someplayer
+ */
+class DBusAdaptop: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "ru.somebody.someplayer")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"ru.somebody.someplayer\">\n"
+" <method name=\"prev\">\n"
+" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
+" </method>\n"
+" <method name=\"next\">\n"
+" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
+" </method>\n"
+" <method name=\"toggle\">\n"
+" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
+" </method>\n"
+" <method name=\"stop\">\n"
+" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
+" </method>\n"
+" <method name=\"artist\">\n"
+" <arg direction=\"out\" type=\"s\"/>\n"
+" </method>\n"
+" <method name=\"album\">\n"
+" <arg direction=\"out\" type=\"s\"/>\n"
+" </method>\n"
+" <method name=\"title\">\n"
+" <arg direction=\"out\" type=\"s\"/>\n"
+" </method>\n"
+" </interface>\n"
+ "")
+public:
+ DBusAdaptop(QObject *parent);
+ virtual ~DBusAdaptop();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+ QString album();
+ QString artist();
+ Q_NOREPLY void next();
+ Q_NOREPLY void prev();
+ Q_NOREPLY void stop();
+ QString title();
+ Q_NOREPLY void toggle();
+Q_SIGNALS: // SIGNALS
+};
+
+#endif
Config config;
_icons_theme = config.getValue("ui/iconstheme").toString();
_current_playlist_changed = true;
+ setAttribute(Qt::WA_Maemo5StackedWindow);
}
LibraryForm::~LibraryForm()
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
- a.setApplicationName("someplayer");
+ a.setApplicationName("ru.somebody.someplayer");
MainWindow w;
_library_form->updateIcons();
_player_form->updateIcons();
hideSearchPanel();
+ _player_form->reload(true);
library();
}
Config config;
config.setValue(QString("equalizer/band%1").arg(band), value);
}
+
+QString Player::artist() {
+ if (_current < 0)
+ return "";
+ return _playlist.tracks().at(_current).metadata().artist();
+}
+
+QString Player::album() {
+ if (_current < 0)
+ return "";
+ return _playlist.tracks().at(_current).metadata().album();
+}
+
+QString Player::title() {
+ if (_current < 0)
+ return "";
+ return _playlist.tracks().at(_current).metadata().title();
+}
void disableEqualizer();
void setEqualizerValue(int band, double value);
void equalizerValue(int band, double *);
+ QString artist();
+ QString album();
+ QString title();
private slots:
void _stateChanged(Phonon::State, Phonon::State);
void _tick(qint64);
connect(_tag_resolver, SIGNAL(decoded(Track)), this, SLOT(_track_decoded(Track)));
connect(ui->volumeButton, SIGNAL(clicked()), this, SLOT(_toggle_volume()));
ui->topWidget->setVisible(false);
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+
+ // dbus
+ _dbusadaptor = new DBusAdaptop(_player);
+ QDBusConnection connection = QDBusConnection::sessionBus();
+ bool ret = connection.registerService(_SERVICE_NAME_);
+ ret = connection.registerObject("/", _player);
}
PlayerForm::~PlayerForm()
#include <QTime>
#include "trackrenderer.h"
#include "tagresolver.h"
+#include "dbusadaptor.h"
namespace Ui {
class PlayerForm;
int _search_current_id;
QString _icons_theme;
+ DBusAdaptop *_dbusadaptor;
};
#endif // PLAYERFORM_H
#include "config.h"
#define _DYNAMIC_PLAYLIST_MAX_COUNT_ 50
-#define _SOMEPLAYER_VERSION_ "1.3.2"
+#define _SOMEPLAYER_VERSION_ "1.3.3"
#define NDEBUG
+#define _SERVICE_NAME_ "ru.somebody.someplayer"
+
#endif
<property name="geometry">
<rect>
<x>0</x>
- <y>-88</y>
- <width>760</width>
+ <y>0</y>
+ <width>776</width>
<height>296</height>
</rect>
</property>
</property>
</spacer>
</item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</item>
</layout>
</widget>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>SettingsDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>SettingsDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>