git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 7c8f3e25 authored by Mike Sheldon's avatar Mike Sheldon

Add support for playing audio in the MeeGo client.

parent 3ec8bf99
......@@ -8,7 +8,7 @@ Homepage: http://libre.fm
Package: librefm
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
Listen to free music released under creative commons licenses from
Libre.fm. You can legally download, remix and share any music you
......
#############################################################################
# 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
# Template: app
# Command: /usr/bin/qmake -o Makefile src.pro
......@@ -10,13 +10,13 @@
CC = gcc
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)
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++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -lQtDeclarative -lQtGui -lQtCore -lpthread
LIBS = $(SUBLIBS) -L/usr/lib -lQtDeclarative -lphonon -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
......@@ -45,13 +45,11 @@ OBJECTS_DIR = ./
SOURCES = main.cpp \
servercomm.cpp \
track.cpp moc_servercomm.cpp \
moc_track.cpp
track.cpp moc_servercomm.cpp
OBJECTS = main.o \
servercomm.o \
track.o \
moc_servercomm.o \
moc_track.o
moc_servercomm.o
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/linux.conf \
......@@ -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/include_source_dir.prf \
/usr/lib/libQtDeclarative.prl \
/usr/lib/libphonon.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -o Makefile src.pro
......@@ -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/include_source_dir.prf:
/usr/lib/libQtDeclarative.prl:
/usr/lib/libphonon.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
......@@ -174,15 +174,13 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
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:
-$(DEL_FILE) moc_servercomm.cpp moc_track.cpp
moc_servercomm.cpp: servercomm.h
-$(DEL_FILE) moc_servercomm.cpp
moc_servercomm.cpp: track.h \
servercomm.h
/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_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
......@@ -202,10 +200,12 @@ compiler_clean: compiler_moc_header_clean
####### Compile
main.o: main.cpp servercomm.h
main.o: main.cpp servercomm.h \
track.h
$(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
track.o: track.cpp track.h
......@@ -214,9 +214,6 @@ track.o: track.cpp track.h
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_target: first FORCE
......@@ -269,6 +266,7 @@ uninstall_iconScale: FORCE
install_image: first FORCE
@$(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/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-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/
......@@ -276,6 +274,7 @@ install_image: first FORCE
uninstall_image: FORCE
-$(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-tower.png
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/share/librefm/love.png
......
......@@ -19,6 +19,7 @@ int main(int argc, char *argv[])
{
qInstallMsgHandler( msgHandler );
QApplication app(argc, argv);
app.setApplicationName("Libre.fm");
QDeclarativeView view;
view.setSource(QUrl::fromLocalFile("src/librefm.qml"));
//view.setSource(QUrl::fromLocalFile(DATADIR "/librefm/librefm.qml"));
......
......@@ -5,6 +5,7 @@
#include <QtNetwork/QNetworkReply>
#include <QDateTime>
#include <QtXml/QDomDocument>
#include <phonon/AudioOutput>
#include "servercomm.h"
ServerComm::ServerComm(QObject *parent) :
......@@ -15,6 +16,9 @@ ServerComm::ServerComm(QObject *parent) :
playlist = new QList<Track>();
settings = new QSettings("Libre.fm", "Libre.fm");
currentSong = -1;
media = new Phonon::MediaObject(this);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
Phonon::createPath(media, audioOutput);
// Check login details
qDebug() << "Checking settings...";
......@@ -208,8 +212,12 @@ void ServerComm::parseTrack(QDomNode trackNode) {
}
void ServerComm::play(int song) {
currentSong = song;
Track t = playlist->at(song);
playing(t.artist, t.album, t.title, t.image);
QUrl url(t.location);
media->setCurrentSource(url);
media->play();
if (song >= playlist->length() - 3) {
getPlaylist();
......@@ -217,11 +225,11 @@ void ServerComm::play(int song) {
}
void ServerComm::next() {
play(currentSong++);
play(++currentSong);
}
void ServerComm::prev() {
if(currentSong > 1) {
play(currentSong--);
play(--currentSong);
}
}
......@@ -7,6 +7,7 @@
#include <QtXml/QDomDocument>
#include <QtNetwork/QNetworkAccessManager>
#include <QList>
#include <phonon/MediaObject>
#include "track.h"
class ServerComm : public QObject
......@@ -25,6 +26,7 @@ private:
int currentSong;
QSettings *settings;
QList<Track> *playlist;
Phonon::MediaObject *media;
void parseTrack(QDomNode trackNode);
signals:
......
TEMPLATE = app
QT += declarative
QT += phonon
CONFIG += meegotouch
TARGET = "librefm"
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