Fucking stupid osx...

parent 17e1d439
......@@ -48,26 +48,6 @@
#define SENDER "maingui"
#if defined(Q_OS_MAC)
#include <QWebPage>
/*
* For some reason youtube think that the default user agent
* on OSX doesn't support HTML5 videos,
* so, we change it faking the Linux one
*/
QWebPageForMac::QWebPageForMac(WebWin* &win) : QWebPage(win)
{
}
QString QWebPageForMac::userAgentForUrl(const QUrl &url) const
{
return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) skylivex Safari/537.21";
}
#endif
MainWin::MainWin(QString &htmlfile)
: SkylivexWin(htmlfile)
{
......
......@@ -44,25 +44,6 @@
#include "webwin.h"
#include "jsbridge.h"
#if defined(Q_OS_MAC)
#include <QWebPage>
/*
* For some reason youtube think that the default user agent
* on OSX doesn't support HTML5 videos,
* so, we change it faking the Linux one
*/
class QWebPageForMac : public QWebPage
{
Q_OBJECT
public:
QWebPageForMac(WebWin* &win);
QString userAgentForUrl(const QUrl &url) const;
};
#endif
/*
* class MainWin
* This is just a little webkit transparent window
......
......@@ -50,6 +50,26 @@
#define SENDER "webwin"
#if defined(Q_OS_MAC)
/*
* For some reason youtube think that the default user agent
* on OSX doesn't support HTML5 videos,
* so, we change it faking the Linux one
*/
QWebPageForMac::QWebPageForMac(WebWin* &win) : QWebPage(win)
{
}
QString QWebPageForMac::userAgentForUrl(const QUrl &url) const
{
return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) skylivex Safari/537.21";
}
#endif
WebWin::WebWin(QString &htmlfile)
: QWebView(0)
{
......@@ -100,7 +120,12 @@ void WebWin::closeEvent(QCloseEvent *event)
QWebView* WebWin::createWindow(QWebPage::WebWindowType type)
{
WebWin *wv = new WebWin;
#if defined(Q_OS_MAC)
QWebPageForMac *newWeb = new QWebPageForMac(wv);
#else
QWebPage *newWeb = new QWebPage(wv);
#endif
wv->setPage(newWeb);
wv->setAttribute(Qt::WA_DeleteOnClose, true);
if (type == QWebPage::WebModalDialog)
......@@ -254,7 +279,11 @@ SkylivexWin::SkylivexWin()
SkylivexWin* SkylivexWin::createSkyliveWindow(QString url, QWebPage::WebWindowType type)
{
SkylivexWin *wv = new SkylivexWin;
//#if defined(Q_OS_MAC)
//QWebPageForMac *newWeb = new QWebPageForMac(wv);
//#else
QWebPage *newWeb = new QWebPage(wv);
//#endif
wv->jsbridge = new JSBridge();
wv->jsbridge->wwin = qobject_cast<SkylivexWin *>(wv);
newWeb->mainFrame()->addToJavaScriptWindowObject("SkyliveX", wv->jsbridge);
......
......@@ -52,6 +52,23 @@ typedef void (WebWin::*SKHandlerFunction)(SKMessage&);
//typedef int (WebWin::*SKHandlerFunction)(SKMessage&);
#if defined(Q_OS_MAC)
/*
* For some reason youtube think that the default user agent
* on OSX doesn't support HTML5 videos,
* so, we change it faking the Linux one
*/
class QWebPageForMac : public QWebPage
{
Q_OBJECT
public:
QWebPageForMac(WebWin* &win);
QString userAgentForUrl(const QUrl &url) const;
};
#endif
/*
* class WebWin
* This is just a little webkit transparent window
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment