From 4adbefb36e52cb33564e704d8ea6a49425db8caf Mon Sep 17 00:00:00 2001 From: Elias Woods Date: Tue, 20 Jul 2010 15:49:22 -0400 Subject: [PATCH 1/1] modified: bottombar.cpp modified: bottombar.h modified: groove.cpp modified: playlist.cpp modified: splayer.cpp modified: splayer.h --- Groove.pro.user | 240 ++++++++----------------------------------------------- bottombar.cpp | 23 +++++- bottombar.h | 12 +++ groove.cpp | 5 ++ playlist.cpp | 3 + splayer.cpp | 13 +++ splayer.h | 1 + 7 files changed, 87 insertions(+), 210 deletions(-) diff --git a/Groove.pro.user b/Groove.pro.user index 4190cf1..158a9e8 100644 --- a/Groove.pro.user +++ b/Groove.pro.user @@ -2,7 +2,7 @@ ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -13,102 +13,6 @@ ProjectExplorer.Project.Target.0 - Desktop - Qt4ProjectManager.Target.DesktopTarget - 0 - 0 - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - LD_LIBRARY_PATH=/usr/lib - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/eli/Projects/qt-build - 2 - 0 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /scratchbox/users/eli/home/eli/qt4/Groove-build - 2 - 0 - true - - 2 - - Groove - Qt4ProjectManager.Qt4RunConfiguration - 2 - - Groove.pro - false - false - - LD_LIBRARY_PATH=/home/eli/NokiaQtSDK/QtCreator/lib/qtcreator:../qjson-build/lib/ - - false - false - - - 1 - - - - ProjectExplorer.Project.Target.1 - Maemo Qt4ProjectManager.Target.MaemoDeviceTarget 0 @@ -118,17 +22,27 @@ qmake QtProjectManager.QMakeBuildStep - INCLUDEPATH+=../qjson/src LIBS+=-L~/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1014-slim/usr/lib -lqjson + INCLUDEPATH+=../qjson/src Make Qt4ProjectManager.MakeStep false - + + -j2 + - 2 + + + Qt4ProjectManager.MaemoPackageCreationStep + + true + /usr/local/bin/groove + + + 3 Make Qt4ProjectManager.MakeStep @@ -144,8 +58,8 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /scratchbox/users/eli/home/eli/qt4/Groove-build - 5 + /home/eli/Projects/Groove-build-maemo + 3 9 true @@ -162,7 +76,15 @@ - 2 + + + Qt4ProjectManager.MaemoPackageCreationStep + + true + /usr/local/bin/groove + + + 3 Make Qt4ProjectManager.MakeStep @@ -178,125 +100,27 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - /scratchbox/users/eli/home/eli/qt4/Groove-build - 5 + /home/eli/Projects/Groove-build-maemo + 3 9 true 2 Groove.pro - Groove on Maemo device + New Maemo Run Configuration Qt4ProjectManager.MaemoRunConfiguration - - 2010-06-30T23:36:47 - - 1 - - 2010-07-07T05:24:28 - 2010-07-15T08:53:48 - - - - 1 - - - - ProjectExplorer.Project.Target.2 - - Qt Simulator - Qt4ProjectManager.Target.QtSimulatorTarget - 0 - 0 - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /scratchbox/users/eli/home/eli/qt4/Groove-build-simulator - 4 - 0 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /scratchbox/users/eli/home/eli/qt4/Groove-build-simulator - 4 - 0 - true - - 2 - - Groove - Qt4ProjectManager.Qt4RunConfiguration - 2 - - Groove.pro - false - false - - false - false - + + 0 + 1 ProjectExplorer.Project.TargetCount - 3 + 1 ProjectExplorer.Project.Updater.FileVersion diff --git a/bottombar.cpp b/bottombar.cpp index 09faf6c..8a12aa0 100644 --- a/bottombar.cpp +++ b/bottombar.cpp @@ -7,23 +7,42 @@ bottomBar::bottomBar(QWidget *parent) : { ui->setupUi(this); QRect screenGeometry = QApplication::desktop()->screenGeometry(); - QGraphicsScene *main = new QGraphicsScene(0,0,screenGeometry.width(),15); + main = new QGraphicsScene(0,0,screenGeometry.width(),15); ui->graphicsView->setScene(main); ui->graphicsView->setSceneRect(0,0,screenGeometry.width(),15); ui->graphicsView->setTransformationAnchor(QGraphicsView::NoAnchor); main->setBackgroundBrush(this->palette().window()); main->setSceneRect(0,0,screenGeometry.width(),15); - main->addRect(0,0,screenGeometry.width()/2,15,QPen(Qt::white),QBrush(Qt::white)); + this->playbackProgress = main->addRect(0,0,screenGeometry.width()/2,15,QPen(Qt::white),QBrush(Qt::white)); } bottomBar::~bottomBar() { delete ui; } +void bottomBar::setPlaybackProgress(int min, int max) +{ + this->playbackProgress->setRect(0,0,(min/max)*main->width(),15); + ui->graphicsView->update(); +} + +void bottomBar::on_nextB_clicked() +{ + emit this->nextB(); +} +void bottomBar::on_pauseB_clicked() +{ + emit this->pause(); +} + void bottomBar::on_addButton_clicked() { emit this->addB(); } +void bottomBar::on_backB_clicked() +{ + emit this->back(); +} void bottomBar::changeEvent(QEvent *e) { diff --git a/bottombar.h b/bottombar.h index cb80599..175fe9b 100644 --- a/bottombar.h +++ b/bottombar.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class bottomBar; @@ -15,15 +17,25 @@ class bottomBar : public QWidget public: explicit bottomBar(QWidget *parent = 0); ~bottomBar(); +public slots: + void setPlaybackProgress(int min,int max); signals: void addB(); + void nextB(); + void pause(); + void back(); protected: void changeEvent(QEvent *e); private slots: void on_addButton_clicked(); + void on_nextB_clicked(); + void on_pauseB_clicked(); + void on_backB_clicked(); private: Ui::bottomBar *ui; + QGraphicsRectItem *playbackProgress; + QGraphicsScene *main; }; #endif // BOTTOMBAR_H diff --git a/groove.cpp b/groove.cpp index ced6f4e..7d0df67 100644 --- a/groove.cpp +++ b/groove.cpp @@ -105,6 +105,11 @@ groove::groove(QWidget *parent) : connect(ok,SIGNAL(searchRequest(QString)),this,SLOT(performSearch(QString))); connect(ok,SIGNAL(closeApp()),this,SLOT(close())); connect(bBar,SIGNAL(addB()),this,SLOT(addSongPlaylist())); + connect(bBar,SIGNAL(nextB()),player,SLOT(playNext())); + connect(bBar,SIGNAL(pause()),this,SLOT(stop())); + connect(bBar,SIGNAL(back()),player,SLOT(back())); + bBar->setPlaybackProgress(80,100); + } void groove::performSearch(QString s) { diff --git a/playlist.cpp b/playlist.cpp index 3c9f6ea..e79229d 100644 --- a/playlist.cpp +++ b/playlist.cpp @@ -17,6 +17,7 @@ void playlist::markPlayed(int position) } void playlist::freeMemory(int position) { + pList->at(position)->downloaded = false; delete pList->at(position)->buffer; pList->at(position)->buffer = new QBuffer(); } @@ -45,6 +46,8 @@ bool playlist::setCurrentPlaying(int position) if(pList->size() > position) { this->currentplayingitem = position; + if(!pList->at(position)->downloaded && this->currentdownloaditem != this->currentplayingitem) + this->beginDownload(position); /*if(pList->at(position)->bufferready == false &&) { if(!pList->at(position)->downloaded) diff --git a/splayer.cpp b/splayer.cpp index a59899d..23fe2a0 100644 --- a/splayer.cpp +++ b/splayer.cpp @@ -56,6 +56,19 @@ sPlayer::~sPlayer() //reply->~QIODevice(); media->~MediaNode(); } +void sPlayer::back() +{ + media->stop(); + if(pl->existAt(pl->currentplaying()-1)) + { + pl->setCurrentPlaying(pl->currentplaying()-1); + if(pl->bReady(pl->currentplaying())) + this->start(pl->currentplaying()); + } + else + pl->setCurrentPlaying(-1); +} + void sPlayer::abortDownload() { //pd->hide(); diff --git a/splayer.h b/splayer.h index 6d41fd6..9390c8b 100644 --- a/splayer.h +++ b/splayer.h @@ -30,6 +30,7 @@ public slots: void playNext(); void putb(int p,qint64,qint64); void abortDownload(); + void back(); private slots: void markComplete(); private: -- 1.7.9.5