#include "configdialog.h"
#include "aboutdialog.h"
#include "accountdialog.h"
+ #include "appsettings.h"
//#include "vlcstatus.h"
PlayerMainWindow::PlayerMainWindow(QWidget *parent) :
connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout()));
connect(ui->actionPortrait,SIGNAL(triggered()),this,SLOT(setPortrait()));
connect(ui->actionLandscape,SIGNAL(triggered()),this,SLOT(setLandscape()));
+ connect(ui->actionAutoRotate,SIGNAL(triggered()),this,SLOT(setAutoRotate()));
connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(show()));
connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(showPlayList()));
connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(show()));
connect(ui->playpauseButton,SIGNAL(clicked()),this,SLOT(playpause()));
connect(ui->stopButton,SIGNAL(clicked()),this,SLOT(stop()));
- //connect(ui->pauseButton,SIGNAL(clicked()),this,SLOT(playpause()));
connect(ui->previousButton,SIGNAL(clicked()),this,SLOT(previous()));
connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(next()));
connect(ui->fullscreenButton,SIGNAL(clicked()),this,SLOT(fullscreen()));
void PlayerMainWindow::setPortrait()
{
- #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
- this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
+ #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+ AppSettings::setOrientation(PORTRAIT);
+ this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
#endif
-
-
}
void PlayerMainWindow::setLandscape()
{
- #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
- this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
- #endif
+ #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
+ AppSettings::setOrientation(LANDSCAPE);
+ this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true);
+ #endif
}
void PlayerMainWindow::setAutoRotate()
{
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
- this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
- #endif
+ AppSettings::setOrientation(AUTO_ROTATE);
+ this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
+ #endif
}
void PlayerMainWindow::orientationChanged() {
void PlayerMainWindow::volUp()
{
QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=volume");
- url.addEncodedQueryItem(QByteArray("val"), QByteArray("%2B20"));
+ url.addEncodedQueryItem(QByteArray("val"), QByteArray("%2B10"));
mNetManager->get(QNetworkRequest(url));
}
void PlayerMainWindow::volDown()
{
- mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=-20")));
+ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=-10")));
}
void PlayerMainWindow::volMute()
{
void PlayerMainWindow::askStatus()
{
-
+ //qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss");
QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml")));
connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus()));
}
QString album = metaInfoNode.namedItem("album").toElement().text();
QString now_playing = metaInfoNode.namedItem("now_playing").toElement().text();
QString art_url = metaInfoNode.namedItem("art_url").toElement().text();
+ //metaInfoNode.clear();
+ //infoNode.clear();
+ //docElem.clear();
+ //doc.clear();
// Populate the current status structure
// now would be a good time to work out if we are a new track / file or not.
// key if we are going to look for album art later
}
- if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100)
+ if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) {
+ ui->slider->blockSignals(true);
ui->slider->setValue(mCurrentStatus.position);
+ ui->slider->blockSignals(false);
+ }
ui->labelTitle->setText(mCurrentStatus.title);
ui->labelArtist->setText(mCurrentStatus.artist);
}
void PlayerMainWindow::playlistIdUpdated(int id, bool hasart, QString extension) {
+ Q_UNUSED(extension);
if (hasart) {
getCoverArt(id);
}
else {
ui->labelArtLandscape->setVisible(false);
ui->labelArtPortrait->setVisible(false);
- // could use a default graphic here!
+ // could use a default graphic from extension here!
// setCoverArtFromPixmap();
}
}
+ void PlayerMainWindow::error(QNetworkReply::NetworkError code) {
+ qDebug() << "Error Code: " << code;
+ }
void PlayerMainWindow::readReady() {
QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
// append to buffer
this->setCoverArt(mResponse);
// only interested in finished signals
disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
+ delete reply;
}
void PlayerMainWindow::getCoverArt(int id) {
+ qDebug() << "getCoverArt id=!" << id;
mResponse.clear();
QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/art?id=" + QString::number(id))));
connect(reply,SIGNAL(readyRead()),this,SLOT(readReady()));
+ connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError)));
connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *)));
}
}
}
else {
+ qDebug() << "image load failed!";
+ qDebug() << "data.length" << data.length();
ui->labelArtPortrait->setVisible(false);
ui->labelArtLandscape->setVisible(false);
}
+ delete image;
}
void PlayerMainWindow::setCoverArtFromPixmap(QPixmap image) {
mHasImage = true;
ui->labelArtLandscape->setPixmap(image.scaledToHeight(120, Qt::SmoothTransformation));
- ui->labelArtPortrait->setPixmap(image.scaledToHeight(310, Qt::SmoothTransformation));
+ ui->labelArtPortrait->setPixmap(image.scaledToHeight(320, Qt::SmoothTransformation));
if (mIsLandscape) {
ui->labelArtPortrait->setVisible(false);
ui->labelArtLandscape->setVisible(true);