#include "groove.h"
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_HILDON)
#include "qmaemo5rotator.h"
-
+#endif
+#include <QtDBus>
+#include "bottombar.h"
groove::groove(QWidget *parent) :
QWidget(parent)
QVBoxLayout *vlayout = new QVBoxLayout();
QHBoxLayout *bottomLayout = new QHBoxLayout();
button = new QPushButton("Search");
- QPushButton *dButton = new QPushButton("Play");
- QPushButton *stopButton = new QPushButton("Stop");
+ QPushButton *dButton = new QPushButton("Queue");
+ QPushButton *stopButton = new QPushButton("Pause");
QPushButton *moreButton = new QPushButton("...");
+ QPushButton *nextB = new QPushButton("->");
+ topBar *ok = new topBar(this);
resultView = new QTableView();
QMenu *pushMenu = new QMenu();
//showFullScreen();
pd = new grooveProgressBar(this);
pd->hide();
QMenu *moreAction = new QMenu();
- moreAction->addAction("Playlist");
- connect(moreAction->addAction("Add current song to playlist"),SIGNAL(triggered()),this,SLOT(addSongPlaylist()));
+ //moreAction->addAction("Playlist");
+ connect(moreAction->addAction("Play Now"),SIGNAL(triggered()),this,SLOT(play()));
connect(moreAction->addAction("Show download Progress"),SIGNAL(triggered()),pd,SLOT(show()));
moreButton->setMenu(moreAction);
resultView->setPalette(pal);*/
portrait = false;
layout->addWidget(sMethod);
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_HILDON)
rot = new QMaemo5Rotator(QMaemo5Rotator::AutomaticBehavior,this);
+#endif
+ //this->setAttribute(Qt::WA_Maemo5AutoOrientation);
layout->addWidget(lineEdit);
layout->addWidget(button);
- vlayout->addLayout(layout);
+ vlayout->addWidget(ok);
+ //vlayout->addLayout(layout);
vlayout->addWidget(resultView);
- vlayout->addLayout(bottomLayout);
+ //vlayout->addLayout(bottomLayout);
+ bottomBar *bBar = new bottomBar();
+ vlayout->addWidget(bBar);
+ vlayout->setSpacing(0);
bottomLayout->addWidget(dButton);
bottomLayout->addWidget(stopButton);
+ bottomLayout->addWidget(nextB);
bottomLayout->addWidget(moreButton);
vlayout->setMenuBar(mBar);
+ vlayout->setContentsMargins(QMargins());
setLayout(vlayout);
- setWindowTitle("GrooveShark");
+ setWindowTitle("Groove");
//Create New Grooveshark connection
gs = new gscom();
//Connections
connect(gs, SIGNAL(finishedSearch()), this, SLOT(finishedS()));
connect(lineEdit,SIGNAL(returnPressed()),this, SLOT(search()));
connect(pushMenu,SIGNAL(triggered(QAction*)),this,SLOT(changeS(QAction*)));
- connect(dButton,SIGNAL(clicked()),this, SLOT(play()));
+ connect(dButton,SIGNAL(clicked()),this, SLOT(addSongPlaylist()));
connect(stopButton,SIGNAL(clicked()),this,SLOT(stop()));
connect(moreButton,SIGNAL(clicked()),this,SLOT(moreB()));
//connect(rotator,SIGNAL(orientationChanged(Orientation)),this,SLOT(orientationChanged()));
player->setPlaylist(pl);
connect(pl,SIGNAL(downloadProgress(int,qint64,qint64)),this,SLOT(progressUpdate(int,qint64,qint64)));
connect(pl,SIGNAL(bufferReady(int)),pd,SLOT(close()));
+ connect(pl,SIGNAL(freeze(bool)),resultView,SLOT(setDisabled(bool)));
+ connect(pl,SIGNAL(freeze(bool)),pushMenu,SLOT(setDisabled(bool)));
+ connect(pl,SIGNAL(freeze(bool)),dButton,SLOT(setDisabled(bool)));
+ connect(nextB,SIGNAL(clicked()),player,SLOT(playNext()));
+ connect(ok,SIGNAL(changeTask()),this,SLOT(showOthers()));
+ connect(ok,SIGNAL(searchRequest(QString)),this,SLOT(performSearch(QString)));
+ connect(ok,SIGNAL(closeApp()),this,SLOT(close()));
+ connect(bBar,SIGNAL(addB()),this,SLOT(addSongPlaylist()));
}
+void groove::performSearch(QString s)
+{
+ qDebug() << s;
+ resultView->setModel(gs->getSongModel(s));
+}
+
void groove::search()
{
if(!lineEdit->text().isEmpty())
sMethod->setText(action->text());
sMethod->setMaximumWidth(sMethod->sizeHint().rwidth());
}
+void groove::showOthers()
+{
+ QDBusConnection c = QDBusConnection::sessionBus();
+ QDBusMessage m = QDBusMessage::createSignal("/", "com.nokia.hildon_desktop", "exit_app_view");
+ c.send(m);
+}
+
void groove::play()
{
QModelIndexList selected = resultView->selectionModel()->selectedRows(0);
void groove::stop()
{
- player->stop();
+ player->pause();
}
void groove::moreB()
{
{
//if(!pd->isHidden())
//{
+
+
pd->setMaximum(t);
pd->setValue(d);
//}