X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=groove.cpp;h=050a7433620337706ebbdd31fd3fa0037f09d8ba;hb=e006b301436516a819a53aa4aa5ca8f79625ebfa;hp=02bda404d11e6cd68774ef6c4c2d910a37123069;hpb=c1ea8a35f5d845999c3ba212f3e09e101cf7721a;p=groove diff --git a/groove.cpp b/groove.cpp index 02bda40..050a743 100644 --- a/groove.cpp +++ b/groove.cpp @@ -1,5 +1,5 @@ #include "groove.h" - +#include "qmaemo5rotator.h" groove::groove(QWidget *parent) : @@ -16,7 +16,7 @@ groove::groove(QWidget *parent) : button = new QPushButton("Search"); QPushButton *dButton = new QPushButton("Play"); QPushButton *stopButton = new QPushButton("Stop"); - QPushButton *moreButton = new QPushButton(); + QPushButton *moreButton = new QPushButton("..."); resultView = new QTableView(); QMenu *pushMenu = new QMenu(); //showFullScreen(); @@ -26,6 +26,12 @@ groove::groove(QWidget *parent) : //pushMenu->addAction("Artist:"); //pushMenu->addAction("Album:"); + QMenu *moreAction = new QMenu(); + moreAction->addAction("Playlist"); + moreAction->addAction("Add current song to playlist"); + moreAction->addAction("Show download Progress"); + moreButton->setMenu(moreAction); + //sMethod->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Maximum); sMethod->setMaximumWidth(sMethod->sizeHint().rwidth()); sMethod->setMenu(pushMenu); @@ -45,8 +51,9 @@ groove::groove(QWidget *parent) : /*QPalette pal = resultView->palette(); pal.setBrush(QPalette::Highlight,QBrush(Qt::transparent,Qt::NoBrush)); resultView->setPalette(pal);*/ - + portrait = false; layout->addWidget(sMethod); + rot = new QMaemo5Rotator(QMaemo5Rotator::AutomaticBehavior,this); layout->addWidget(lineEdit); layout->addWidget(button); vlayout->addLayout(layout); @@ -66,7 +73,12 @@ groove::groove(QWidget *parent) : connect(lineEdit,SIGNAL(returnPressed()),this, SLOT(search())); connect(pushMenu,SIGNAL(triggered(QAction*)),this,SLOT(changeS(QAction*))); connect(dButton,SIGNAL(clicked()),this, SLOT(play())); - connect(gs,SIGNAL(sKeyFound()),this,SLOT(startP())); + connect(stopButton,SIGNAL(clicked()),this,SLOT(stop())); + connect(moreButton,SIGNAL(clicked()),this,SLOT(moreB())); + //connect(rotator,SIGNAL(orientationChanged(Orientation)),this,SLOT(orientationChanged())); + pl = new playlist(); + pl->setGscom(gs); + player->setPlaylist(pl); } void groove::search() { @@ -122,17 +134,26 @@ void groove::play() if(item == 0) return; //gs->getSong(); - gs->getSong(item->text()); + player->play(pl->addSong(item)); } //selected. //if } -void groove::startP() +void groove::stop() { - if(!gs->sku.isValid()) - return; - player->~sPlayer(); - player = new sPlayer(); - player->play(gs->streamID,gs->sku); - + player->stop(); +} +void groove::moreB() +{ + qDebug() << "He pressed the button"; +} +void groove::orientationChanged() +{ +#ifdef Q_WS_MAEMO_5 + QRect screenGeometry = QApplication::desktop()->screenGeometry(); + if (screenGeometry.width() > screenGeometry.height()) + portrait = false; + else + portrait = true; +#endif }