Permalink
Browse files

import a bunch of graphics and css from the cloud player

  • Loading branch information...
1 parent 1c9c2a2 commit 4dd1e5a164bef0b710d93d426c4928cb43030e93 @RJ committed Dec 25, 2009
View
@@ -11,8 +11,23 @@
#include <QNetworkCookieJar>
#include <QNetworkCookie>
+
MainWindow::MainWindow(QWidget *parent)
{
+ /*QXmppLogger::getLogger()->setLoggingType(QXmppLogger::FILE);
+
+ bool ok;
+ QString server= QInputDialog::getText(this, "Enter jabber server address", "jid",
+ QLineEdit::Normal, "talk.google.com", &ok);
+ QString jid = QInputDialog::getText(this, "Enter jabber username (user@example.com)", "jid",
+ QLineEdit::Normal, "rj@metabrew.com", &ok);
+ QString pass = QInputDialog::getText(this, "Enter jabber password", "pass",
+ QLineEdit::Normal, "", &ok);
+
+ jabber = new Jabber();
+ jabber->connectToServer(server, jid, pass);
+*/
+
setParent(parent);
source = 0;
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
@@ -41,7 +56,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(webkitApi, SIGNAL(stopRequested()), this, SLOT(stop()));
connect(audioOutput, SIGNAL(volumeChanged(qreal)), this, SLOT(volumeChanged(qreal)));
- QString url("./www/index.html");
+ QString url("./www/player/index.html");
webView->load(QUrl(url));
}
@@ -54,26 +69,33 @@ void MainWindow::setupUi()
QGridLayout *layout = new QGridLayout();
webView = new QWebView();
+ webView->setPage(new Webpage);
webView->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true); // needs QT >= 4.6
- // QNetworkCookieJar jar;
+ // QNetworkCookieJar jar;
//QList<QNetworkCookie> cookies;
//cookies.append( QNetworkCookie("auth","XXX") );
//jar.setCookiesFromUrl(cookies, QUrl(""))
//->page->networkAccessManager()->setCookieJar( new QNetworkCookieJar() );
playurlBtn = new QPushButton("Play Stream");
playfileBtn = new QPushButton("Play Local File");
+ reloadBtn = new QPushButton("Reload");
- layout->addWidget(webView, 0, 0, 1, 2);
+ layout->addWidget(webView, 0, 0, 1, 3);
+ /*
layout->addWidget(playurlBtn, 1, 0);
layout->addWidget(playfileBtn, 1, 1);
-
+ layout->addWidget(reloadBtn, 1, 2);
+ */
+ //layout->setSpacing(0);
+ layout->setContentsMargins(QMargins(0,0,0,0));
setLayout(layout);
show();
connect(playurlBtn, SIGNAL(clicked()), this, SLOT(on_streambutton_clicked()));
connect(playfileBtn, SIGNAL(clicked()), this, SLOT(on_playbutton_clicked()));
+ connect(reloadBtn, SIGNAL(clicked()), this, SLOT(on_reloadbutton_clicked()));
}
void MainWindow::volumeChanged(qreal vr)
@@ -203,7 +225,7 @@ void MainWindow::metaStateChanged(Phonon::State newState, Phonon::State /* oldSt
//QTime displayTime(0, (int)((time / 60000) % 60), (int)((time / 1000) % 60), 0);
//QString prog = displayTime.toString("mm:ss");
//setWindowTitle(prog);
-
+ qDebug() << time << " /// " << mediaObject->remainingTime();
webkitApi->emitTick(time, mediaObject->remainingTime());
//int secs = time / 1000;
//jseval(QString("Musickit.tick(%1); null").arg(secs));
@@ -215,8 +237,9 @@ void MainWindow::metaStateChanged(Phonon::State newState, Phonon::State /* oldSt
void MainWindow::log(QString str)
{
- QString js("mk_log(\"" + str.replace("\"","\\\"") + "\"); null");
- jseval(js);
+ qDebug() << str;
+ //QString js("mk_log(\"" + str.replace("\"","\\\"") + "\"); null");
+ //jseval(js);
}
void MainWindow::jseval(QString str)
@@ -231,7 +254,7 @@ void MainWindow::metaStateChanged(Phonon::State newState, Phonon::State /* oldSt
-void MainWindow::changeEvent(QEvent *e)
+void MainWindow::changeEvent(QEvent * /* e */)
{
/*QMainWindow::changeEvent(e);
switch (e->type()) {
@@ -262,3 +285,8 @@ void MainWindow::on_streambutton_clicked()
play(QUrl(url));
}
}
+
+void MainWindow::on_reloadbutton_clicked()
+{
+ webView->reload();
+}
View
@@ -13,6 +13,15 @@
#include <QEvent>
#include "WebkitApi.h"
+#include "jabber.h"
+
+class Webpage : public QWebPage
+{
+ virtual void javaScriptConsoleMessage ( const QString & message, int lineNumber, const QString & sourceID )
+ {
+ qDebug() << message << " @ no. " << lineNumber << " sourceid: " << sourceID;
+ }
+};
class MainWindow : QWidget {
Q_OBJECT
@@ -27,6 +36,7 @@ class MainWindow : QWidget {
private slots:
void on_playbutton_clicked();
void on_streambutton_clicked();
+ void on_reloadbutton_clicked();
void stateChanged(Phonon::State newState, Phonon::State oldState);
void tick(qint64 time);
void sourceChanged(const Phonon::MediaSource &source);
@@ -42,10 +52,13 @@ private slots:
private:
+ Jabber * jabber;
+
WebkitApi * webkitApi;
QWebView * webView;
QPushButton *playurlBtn;
QPushButton *playfileBtn;
+ QPushButton *reloadBtn;
void setupUi();
void play(QUrl);
View
@@ -7,10 +7,16 @@ QT += network \
webkit \
xml \
phonon
+
TARGET = musickit
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
- WebkitApi.cpp
+ WebkitApi.cpp
HEADERS += mainwindow.h \
- WebkitApi.h
+ WebkitApi.h
+
+
+
+# explicitly link to winsock (not sure why this is needed)
+#windows:LIBS += -lws2_32
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(80,80,80);"/>
+ <stop offset="90%" style="stop-color: rgb(50,50,50);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(50,80,80);"/>
+ <stop offset="90%" style="stop-color: rgb(30,120,50);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(50,80,80);"/>
+ <stop offset="90%" style="stop-color: rgb(30,50,50);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(240,240,240);"/>
+ <stop offset="90%" style="stop-color: rgb(200,200,200);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(0,0,0);"/>
+ <stop offset="90%" style="stop-color: rgb(30,30,30);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(110,120,120);"/>
+ <stop offset="90%" style="stop-color: rgb(80,90,90);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100px" height="100px" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="10%" style="stop-color: rgb(50,50,50);"/>
+ <stop offset="90%" style="stop-color: rgb(0,0,0);"/>
+ </linearGradient>
+</defs>
+<rect fill="url(#grad)" x="0" y="0" width="100%" height="100%" />
+</svg>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 4dd1e5a

Please sign in to comment.