149
145
* \param name the name of this widget
151
147
MythUIWebBrowser::MythUIWebBrowser(MythUIType *parent, const QString &name)
152
: MythUIType(parent, name),
153
#ifdef USING_QTWEBKIT
148
: MythUIType(parent, name), m_browser(NULL),
156
149
m_image(NULL), m_active(false),
157
150
m_initialized(false), m_lastUpdateTime(QTime()),
158
151
m_updateInterval(0), m_zoom(1.0),
855
848
MythUIWebBrowser *browser = new MythUIWebBrowser(parent, objectName());
856
849
browser->CopyFrom(this);
860
#else // USING_QTWEBKIT
861
///////////////////////////////////////////////////////////////////////////////
862
// fake MythUIWebBrowser
863
// remove when we require qtwebkit
864
///////////////////////////////////////////////////////////////////////////////
870
#include "mythpainter.h"
871
#include "mythfontproperties.h"
872
#include "mythverbose.h"
873
#include "mythmainwindow.h"
874
#include "mythimage.h"
876
#include "mythuiwebbrowser.h"
878
MythUIWebBrowser::MythUIWebBrowser(MythUIType *parent, const QString &name)
879
: MythUIType(parent, name)
884
m_initialized = false;
887
SetCanTakeFocus(false);
890
void MythUIWebBrowser::Init(void)
892
QImage image = QImage(m_Area.size(), QImage::Format_ARGB32);
893
m_image = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage();
894
m_image->Assign(image);
896
QRect area(0, 0, m_Area.width(), m_Area.height());
897
QPainter painter((QImage*)m_image);
898
painter.fillRect(area, QColor(Qt::white));
899
painter.setPen(Qt::black);
900
painter.setFont(QFont("Arial", 30));
901
painter.drawText(area, Qt::AlignCenter|Qt::TextWordWrap,
902
"This feature requires QtWebKit from Qt 4.4.0 or later");
905
m_initialized = true;
908
void MythUIWebBrowser::Finalize(void)
912
MythUIType::Finalize();
915
MythUIWebBrowser::~MythUIWebBrowser()
924
void MythUIWebBrowser::LoadPage(QUrl url)
929
void MythUIWebBrowser::SetHtml(const QString &html, const QUrl &baseUrl)
935
void MythUIWebBrowser::SetBackgroundColor(QColor color)
940
void MythUIWebBrowser::SetActive(bool active)
945
void SetHtml(const QString &html, const QUrl &baseUrl)
949
void MythUIWebBrowser::ZoomIn(void)
953
void MythUIWebBrowser::ZoomOut(void)
957
void MythUIWebBrowser::SetZoom(float zoom)
962
float MythUIWebBrowser::GetZoom(void)
967
bool MythUIWebBrowser::CanGoForward(void)
972
bool MythUIWebBrowser::CanGoBack(void)
977
void MythUIWebBrowser::Back(void)
981
void MythUIWebBrowser::Forward(void)
985
QIcon MythUIWebBrowser::GetIcon(void)
990
QUrl MythUIWebBrowser::GetUrl(void)
995
void MythUIWebBrowser::slotLoadStarted(void)
999
void MythUIWebBrowser::slotLoadFinished(bool ok)
1004
void MythUIWebBrowser::slotLoadProgress(int progress)
1009
void MythUIWebBrowser::slotTitleChanged(const QString &title)
1014
void MythUIWebBrowser::slotStatusBarMessage(const QString &text)
1019
void MythUIWebBrowser::slotIconChanged(void)
1023
void MythUIWebBrowser::slotTakingFocus(void)
1027
void MythUIWebBrowser::slotLosingFocus(void)
1031
void MythUIWebBrowser::UpdateBuffer(void)
1035
void MythUIWebBrowser::Pulse(void)
1039
void MythUIWebBrowser::DrawSelf(MythPainter *p, int xoffset, int yoffset,
1040
int alphaMod, QRect clipRegion)
1046
QRect area = m_Area;
1047
area.translate(xoffset, yoffset);
1049
p->DrawImage(area.x(), area.y(), m_image, alphaMod);
1052
bool MythUIWebBrowser::keyPressEvent(QKeyEvent *event)
1057
void MythUIWebBrowser::HandleMouseAction(const QString &action)
1062
bool MythUIWebBrowser::ParseElement(QDomElement &element)
1064
return MythUIType::ParseElement(element);
1067
void MythUIWebBrowser::CopyFrom(MythUIType *base)
1069
MythUIWebBrowser *browser = dynamic_cast<MythUIWebBrowser *>(base);
1072
VERBOSE(VB_IMPORTANT, "ERROR, bad parsing");
1076
MythUIType::CopyFrom(base);
1079
void MythUIWebBrowser::CreateCopy(MythUIType *parent)
1081
MythUIWebBrowser *browser = new MythUIWebBrowser(parent, objectName());
1082
browser->CopyFrom(this);
1085
#endif // USING_QTWEBKIT