TEMPLATE = app
TARGET = groove
#target = groove
-target.path = /usr/bin
+#target.path = /usr/bin
#//target.path = /usr/local/
-INSTALLS += target
+#INSTALLS += target
#CONFIG += build_all
DEPENDPATH += .
INCLUDEPATH += .
-#INCLUDEPATH += /usr/include/qjson
-INCLUDEPATH += ../qjson/src/
+INCLUDEPATH += /usr/include/qjson
+#INCLUDEPATH += ../qjson/src/
#INCLUDEPATH += ./src/
#LIBS += -L/usr/lib -lqjson ##Desktop Target
-#LIBS += -L/usr/local/lib -lqjson ##Armel Target
-LIBS += -L~/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1014-slim/usr/lib -lqjson ##Armel Target SDK
+LIBS += -L/usr/local/lib -lqjson ##Armel Target
+#LIBS += -L~/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1014-slim/usr/lib -lqjson ##Armel Target SDK
#LIBS += -L../qjson/lib -lqjson ##X86 maemo
QT += network
QT += phonon
qmaemo5rotator.h
OTHER_FILES += \
- icon.svg
-
-RESOURCES += \
- reasource.qrc
+ icon.svg \
+ groove.png
unix {
PREFIX = /usr
BINDIR = $$PREFIX/bin
#MAKE INSTALL
- INSTALLS += target
+ INSTALLS += target desktop icon64
target.path =$$BINDIR
+
+ desktop.path = $$DATADIR/applications/hildon
+ desktop.files += groove.desktop
+
+ icon64.path = $$DATADIR/icons/hicolor/64x64/apps
+ icon64.files += groove.png
}
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList">
- <value type="QString">LIBS+=-L~/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1014-slim/usr/lib -lqjson</value>
+ <value type="QString">INCLUDEPATH+=../qjson/src LIBS+=-L~/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1014-slim/usr/lib -lqjson</value>
</valuelist>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
</valuemap>
<value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">1</value>
<valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
- <value key="192.168.1.3" type="QDateTime">2010-06-25T05:45:13</value>
+ <value key="192.168.1.3" type="QDateTime">2010-06-25T21:36:22</value>
</valuemap>
<value key="Qt4ProjectManager.MaemoRunConfiguration.Simulator" type="QString"></value>
</valuemap>
pushMenu->addAction("Song:");
//pushMenu->addAction("Artist:");
//pushMenu->addAction("Album:");
-
+ pd = new grooveProgressBar(this);
+ pd->hide();
QMenu *moreAction = new QMenu();
moreAction->addAction("Playlist");
- moreAction->addAction("Add current song to playlist");
- moreAction->addAction("Show download Progress");
+ connect(moreAction->addAction("Add current song to playlist"),SIGNAL(triggered()),this,SLOT(addSongPlaylist()));
+ connect(moreAction->addAction("Show download Progress"),SIGNAL(triggered()),pd,SLOT(show()));
moreButton->setMenu(moreAction);
//sMethod->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum);
pl = new playlist();
pl->setGscom(gs);
player->setPlaylist(pl);
+ connect(pl,SIGNAL(downloadProgress(int,qint64,qint64)),this,SLOT(progressUpdate(int,qint64,qint64)));
+ connect(pl,SIGNAL(bufferReady(int)),pd,SLOT(close()));
}
void groove::search()
{
return;
//gs->getSong();
player->play(pl->addSong(item));
+ pd->setMaximum(100);
+ pd->setValue(0);
+ pd->show();
}
//selected.
//if
}
+void groove::addSongPlaylist()
+{
+ QModelIndexList selected = resultView->selectionModel()->selectedRows(0);
+ if(!selected.isEmpty())
+ {
+ QStandardItem *item = model->item(selected.first().row(),2);
+ if(item == 0)
+ return;
+ //gs->getSong();
+ if(pl->currentplaying() == -1)
+ {
+ player->play(pl->addSong(item));
+ }
+ else
+ pl->addSong(item);
+ pd->setMaximum(100);
+ pd->setValue(0);
+ pd->show();
+ model->item(selected.first().row(),1)->setText("Added to Playlist");;
+ }
+}
+
void groove::stop()
{
player->stop();
{
qDebug() << "He pressed the button";
}
+void groove::progressUpdate(int p, qint64 d, qint64 t)
+{
+ //if(!pd->isHidden())
+ //{
+ pd->setMaximum(t);
+ pd->setValue(d);
+ //}
+}
+
void groove::orientationChanged()
{
#ifdef Q_WS_MAEMO_5
#include "qmaemo5rotator.h"
#include <QMenuBar>
#include "playlist.h"
+#include "grooveprogressbar.h"
class groove : public QWidget
{
void stop();
void moreB();
void orientationChanged();
-
+private slots:
+ void progressUpdate(int,qint64,qint64);
+ void addSongPlaylist();
private:
sPlayer *player;
QMenuBar *mBar;
gscom *gs;
QMaemo5Rotator *rot;
playlist *pl;
+ grooveProgressBar *pd;
};
#include "grooveprogressbar.h"
#include "qmaemo5rotator.h"
-grooveProgressBar::grooveProgressBar(QDialog *parent) :
+grooveProgressBar::grooveProgressBar(QWidget *parent) :
QDialog(parent)
{
bar = new QProgressBar();
lay->addWidget(bar);
this->setLayout(lay);
this->setWindowTitle("Downloading / Buffering");
- rot = new QMaemo5Rotator(QMaemo5Rotator::AutomaticBehavior,this);
+ //rot = new QMaemo5Rotator(QMaemo5Rotator::AutomaticBehavior,this);
}
void grooveProgressBar::setMaximum(int maximum)
{
{
Q_OBJECT
public:
- explicit grooveProgressBar(QDialog *parent = 0);
+ explicit grooveProgressBar(QWidget *parent = 0);
void setMaximum(int maximum);
void setValue(int position);
int maximum();
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="48"
- height="48"
+ width="64"
+ height="64"
id="svg2"
version="1.1"
inkscape:version="0.47 r22583"
- sodipodi:docname="icon.svg">
+ sodipodi:docname="icon.svg"
+ inkscape:export-filename="/home/eli/Projects/qt4/Groove/icon.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
<defs
id="defs4">
<inkscape:perspective
id="perspective10" />
<filter
inkscape:collect="always"
- id="filter3692">
+ id="filter3692"
+ color-interpolation-filters="sRGB">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.17004"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
- inkscape:pageopacity="0.0"
+ inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
- inkscape:cx="192.53571"
+ inkscape:cx="130.92857"
inkscape:cy="62.857143"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1004.3622)">
+ transform="translate(0,-988.3622)">
<text
xml:space="preserve"
- style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#1a1a1a;fill-opacity:1;stroke:#d4aa00;stroke-opacity:1;font-family:FreeSerif;-inkscape-font-specification:FreeSerif;filter:url(#filter3692)"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#1a1a1a;fill-opacity:1;stroke:#d4aa00;stroke-opacity:1;filter:url(#filter3692);font-family:FreeSerif;-inkscape-font-specification:FreeSerif"
x="-0.10571399"
y="1033.0308"
id="text2816"
- transform="matrix(1.494539,0,0,1.494539,2.7232098,-495.39786)"><tspan
+ transform="matrix(1.9166445,0,0,1.9166445,3.7979447,-934.21415)"><tspan
sodipodi:role="line"
id="tspan2818"
x="-0.10571399"
pList->at(position)->buffer->~QBuffer();
pList->at(position)->buffer = new QBuffer();
}
+bool playlist::existAt(int position)
+{
+ return (pList->size() > position);
+}
int playlist::currentplaying()
{
}
bool playlist::bReady(int b)
{
- return pList->at(b)->bufferready;
+ if(pList->size() > b)
+ return pList->at(b)->bufferready;
+ else
+ return false;
}
void playlist::setBufferRdy(int b)
{
req.setUrl(*pList->at(currentdownloaditem)->server);
qDebug() << pList->at(currentdownloaditem)->server;
req.setHeader(req.ContentTypeHeader,QVariant("application/x-www-form-urlencoded"));
- if(reply)
- reply->~QNetworkReply();
+ delete reply;
reply = manager->post(req,QString("streamKey=" + pList->at(this->currentdownloaditem)->streamkey->toAscii()).toAscii());
pList->at(this->currentdownloaditem)->buffer->open(QBuffer::ReadWrite | QBuffer::Truncate);
connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadSlot(qint64,qint64)));
else
if(this->currentplaying() == this->currentSkeyItem)
this->beginDownload(this->currentSkeyItem);
+ this->currentSkeyItem = -1;
}
int playlist::addSong(QStandardItem *item)
void playlist::downloadDone(int position)
{
- if(pList->size() < position+1)
+ if(this->existAt(position+1) && this->currentSkeyItem == -1)
beginDownload(position+1);
else
this->currentdownloaditem = -1;
bool bReady(int b);
int findFirstNotPlayed();
void beginDownload(int position);
+ bool existAt(int position);
signals:
void downloadProgress(int position, qint64 d, qint64 t);
+++ /dev/null
-<RCC>
- <qresource prefix="/icons">
- <file>icon.svg</file>
- </qresource>
-</RCC>
void sPlayer::markComplete()
{
pl->markPlayed(pl->currentplaying());
- pl->setCurrentPlaying(-1);
+ if(pl->existAt(pl->currentplaying()+1))
+ {
+ pl->setCurrentPlaying(pl->currentplaying()+1);
+ if(pl->bReady(pl->currentplaying()))
+ this->start(pl->currentplaying());
+ }
+ else
+ pl->setCurrentPlaying(-1);
}
sPlayer::~sPlayer()