Commit 725996d7 authored by Mike Sheldon's avatar Mike Sheldon

Add support for playing audio in the MeeGo client.

parent 2675201f
...@@ -8,7 +8,7 @@ Homepage: http://libre.fm ...@@ -8,7 +8,7 @@ Homepage: http://libre.fm
Package: librefm Package: librefm
Architecture: any Architecture: any
Depends: qt-components, ${shlibs:Depends}, ${misc:Depends} Depends: qt-components, gstreamer0.10-plugins-good, ${shlibs:Depends}, ${misc:Depends}
Description: Stream music from Libre.fm and discover new artists Description: Stream music from Libre.fm and discover new artists
Listen to free music released under creative commons licenses from Listen to free music released under creative commons licenses from
Libre.fm. You can legally download, remix and share any music you Libre.fm. You can legally download, remix and share any music you
......
############################################################################# #############################################################################
# Makefile for building: librefm # Makefile for building: librefm
# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jul 1 17:37:58 2011 # Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jul 1 22:03:21 2011
# Project: src.pro # Project: src.pro
# Template: app # Template: app
# Command: /usr/bin/qmake -o Makefile src.pro # Command: /usr/bin/qmake -o Makefile src.pro
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
CC = gcc CC = gcc
CXX = g++ CXX = g++
DEFINES = -DDATADIR=\"/usr/share\" -DPKGDATADIR=\"\" -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED DEFINES = -DDATADIR=\"/usr/share\" -DPKGDATADIR=\"\" -DQT_DECLARATIVE_LIB -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo -I. -I/targets/HARMATTAN_X86/usr/include/qt4/QtCore -I/targets/HARMATTAN_X86/usr/include/qt4/QtGui -I/targets/HARMATTAN_X86/usr/include/qt4/QtDeclarative -I/targets/HARMATTAN_X86/usr/include/qt4 -I. -I. INCPATH = -I/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo -I. -I/targets/HARMATTAN_X86/usr/include/qt4/QtCore -I/targets/HARMATTAN_X86/usr/include/qt4/QtGui -I/targets/HARMATTAN_X86/usr/include/qt4/phonon -I/targets/HARMATTAN_X86/usr/include/qt4/QtDeclarative -I/targets/HARMATTAN_X86/usr/include/qt4 -I. -I/usr/include/qt4/phonon_compat -I.
LINK = g++ LINK = g++
LFLAGS = LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -lQtDeclarative -lQtGui -lQtCore -lpthread LIBS = $(SUBLIBS) -L/usr/lib -lQtDeclarative -lphonon -lQtGui -lQtCore -lpthread
AR = ar cqs AR = ar cqs
RANLIB = RANLIB =
QMAKE = /usr/bin/qmake QMAKE = /usr/bin/qmake
...@@ -45,13 +45,11 @@ OBJECTS_DIR = ./ ...@@ -45,13 +45,11 @@ OBJECTS_DIR = ./
SOURCES = main.cpp \ SOURCES = main.cpp \
servercomm.cpp \ servercomm.cpp \
track.cpp moc_servercomm.cpp \ track.cpp moc_servercomm.cpp
moc_track.cpp
OBJECTS = main.o \ OBJECTS = main.o \
servercomm.o \ servercomm.o \
track.o \ track.o \
moc_servercomm.o \ moc_servercomm.o
moc_track.o
DIST = /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/g++.conf \ DIST = /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/g++.conf \
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/unix.conf \ /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/unix.conf \
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/linux.conf \ /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/common/linux.conf \
...@@ -123,6 +121,7 @@ Makefile: src.pro /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo/ ...@@ -123,6 +121,7 @@ Makefile: src.pro /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo/
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/lex.prf \ /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/lex.prf \
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \ /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtDeclarative.prl \ /usr/lib/libQtDeclarative.prl \
/usr/lib/libphonon.prl \
/usr/lib/libQtGui.prl \ /usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl /usr/lib/libQtCore.prl
$(QMAKE) -o Makefile src.pro $(QMAKE) -o Makefile src.pro
...@@ -146,6 +145,7 @@ Makefile: src.pro /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo/ ...@@ -146,6 +145,7 @@ Makefile: src.pro /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/linux-g++-maemo/
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/lex.prf: /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/lex.prf:
/targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf: /targets/HARMATTAN_X86/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtDeclarative.prl: /usr/lib/libQtDeclarative.prl:
/usr/lib/libphonon.prl:
/usr/lib/libQtGui.prl: /usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl: /usr/lib/libQtCore.prl:
qmake: FORCE qmake: FORCE
...@@ -174,15 +174,13 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean ...@@ -174,15 +174,13 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_servercomm.cpp moc_track.cpp compiler_moc_header_make_all: moc_servercomm.cpp
compiler_moc_header_clean: compiler_moc_header_clean:
-$(DEL_FILE) moc_servercomm.cpp moc_track.cpp -$(DEL_FILE) moc_servercomm.cpp
moc_servercomm.cpp: servercomm.h moc_servercomm.cpp: track.h \
servercomm.h
/usr/bin/moc $(DEFINES) $(INCPATH) servercomm.h -o moc_servercomm.cpp /usr/bin/moc $(DEFINES) $(INCPATH) servercomm.h -o moc_servercomm.cpp
moc_track.cpp: track.h
/usr/bin/moc $(DEFINES) $(INCPATH) track.h -o moc_track.cpp
compiler_rcc_make_all: compiler_rcc_make_all:
compiler_rcc_clean: compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp compiler_image_collection_make_all: qmake_image_collection.cpp
...@@ -202,10 +200,12 @@ compiler_clean: compiler_moc_header_clean ...@@ -202,10 +200,12 @@ compiler_clean: compiler_moc_header_clean
####### Compile ####### Compile
main.o: main.cpp servercomm.h main.o: main.cpp servercomm.h \
track.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
servercomm.o: servercomm.cpp servercomm.h servercomm.o: servercomm.cpp servercomm.h \
track.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o servercomm.o servercomm.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o servercomm.o servercomm.cpp
track.o: track.cpp track.h track.o: track.cpp track.h
...@@ -214,9 +214,6 @@ track.o: track.cpp track.h ...@@ -214,9 +214,6 @@ track.o: track.cpp track.h
moc_servercomm.o: moc_servercomm.cpp moc_servercomm.o: moc_servercomm.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_servercomm.o moc_servercomm.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_servercomm.o moc_servercomm.cpp
moc_track.o: moc_track.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_track.o moc_track.cpp
####### Install ####### Install
install_target: first FORCE install_target: first FORCE
...@@ -269,6 +266,7 @@ uninstall_iconScale: FORCE ...@@ -269,6 +266,7 @@ uninstall_iconScale: FORCE
install_image: first FORCE install_image: first FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/librefm/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/librefm/ @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/librefm/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/librefm/
-$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/ban.png $(INSTALL_ROOT)/usr/share/librefm/ -$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/ban.png $(INSTALL_ROOT)/usr/share/librefm/
-$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/empty-album.png $(INSTALL_ROOT)/usr/share/librefm/
-$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/librefm-logo.png $(INSTALL_ROOT)/usr/share/librefm/ -$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/librefm-logo.png $(INSTALL_ROOT)/usr/share/librefm/
-$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/librefm-tower.png $(INSTALL_ROOT)/usr/share/librefm/ -$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/librefm-tower.png $(INSTALL_ROOT)/usr/share/librefm/
-$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/love.png $(INSTALL_ROOT)/usr/share/librefm/ -$(INSTALL_FILE) /scratchbox/users/mike/home/mike/scratchbox/src/Libre.fm/librefm-0.1/src/love.png $(INSTALL_ROOT)/usr/share/librefm/
...@@ -276,6 +274,7 @@ install_image: first FORCE ...@@ -276,6 +274,7 @@ install_image: first FORCE
uninstall_image: FORCE uninstall_image: FORCE
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/ban.png -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/ban.png
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/empty-album.png
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/librefm-logo.png -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/librefm-logo.png
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/librefm-tower.png -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/librefm-tower.png
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/love.png -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/love.png
......
...@@ -19,6 +19,7 @@ int main(int argc, char *argv[]) ...@@ -19,6 +19,7 @@ int main(int argc, char *argv[])
{ {
qInstallMsgHandler( msgHandler ); qInstallMsgHandler( msgHandler );
QApplication app(argc, argv); QApplication app(argc, argv);
app.setApplicationName("Libre.fm");
QDeclarativeView view; QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("src/librefm.qml")); view.setSource(QUrl::fromLocalFile("src/librefm.qml"));
//view.setSource(QUrl::fromLocalFile(DATADIR "/librefm/librefm.qml")); //view.setSource(QUrl::fromLocalFile(DATADIR "/librefm/librefm.qml"));
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkReply>
#include <QDateTime> #include <QDateTime>
#include <QtXml/QDomDocument> #include <QtXml/QDomDocument>
#include <phonon/AudioOutput>
#include "servercomm.h" #include "servercomm.h"
ServerComm::ServerComm(QObject *parent) : ServerComm::ServerComm(QObject *parent) :
...@@ -15,6 +16,9 @@ ServerComm::ServerComm(QObject *parent) : ...@@ -15,6 +16,9 @@ ServerComm::ServerComm(QObject *parent) :
playlist = new QList<Track>(); playlist = new QList<Track>();
settings = new QSettings("Libre.fm", "Libre.fm"); settings = new QSettings("Libre.fm", "Libre.fm");
currentSong = -1; currentSong = -1;
media = new Phonon::MediaObject(this);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
Phonon::createPath(media, audioOutput);
// Check login details // Check login details
qDebug() << "Checking settings..."; qDebug() << "Checking settings...";
...@@ -208,8 +212,12 @@ void ServerComm::parseTrack(QDomNode trackNode) { ...@@ -208,8 +212,12 @@ void ServerComm::parseTrack(QDomNode trackNode) {
} }
void ServerComm::play(int song) { void ServerComm::play(int song) {
currentSong = song;
Track t = playlist->at(song); Track t = playlist->at(song);
playing(t.artist, t.album, t.title, t.image); playing(t.artist, t.album, t.title, t.image);
QUrl url(t.location);
media->setCurrentSource(url);
media->play();
if (song >= playlist->length() - 3) { if (song >= playlist->length() - 3) {
getPlaylist(); getPlaylist();
...@@ -217,11 +225,11 @@ void ServerComm::play(int song) { ...@@ -217,11 +225,11 @@ void ServerComm::play(int song) {
} }
void ServerComm::next() { void ServerComm::next() {
play(currentSong++); play(++currentSong);
} }
void ServerComm::prev() { void ServerComm::prev() {
if(currentSong > 1) { if(currentSong > 1) {
play(currentSong--); play(--currentSong);
} }
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <QtXml/QDomDocument> #include <QtXml/QDomDocument>
#include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkAccessManager>
#include <QList> #include <QList>
#include <phonon/MediaObject>
#include "track.h" #include "track.h"
class ServerComm : public QObject class ServerComm : public QObject
...@@ -25,6 +26,7 @@ private: ...@@ -25,6 +26,7 @@ private:
int currentSong; int currentSong;
QSettings *settings; QSettings *settings;
QList<Track> *playlist; QList<Track> *playlist;
Phonon::MediaObject *media;
void parseTrack(QDomNode trackNode); void parseTrack(QDomNode trackNode);
signals: signals:
......
TEMPLATE = app TEMPLATE = app
QT += declarative QT += declarative
QT += phonon
CONFIG += meegotouch CONFIG += meegotouch
TARGET = "librefm" TARGET = "librefm"
DEPENDPATH += . DEPENDPATH += .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment