1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the demos of the Qt Toolkit. |
7 ** This file is part of the demos of the Qt Toolkit. |
8 ** |
8 ** |
46 #include <QtWebKit> |
46 #include <QtWebKit> |
47 |
47 |
48 #include "ControlStrip.h" |
48 #include "ControlStrip.h" |
49 #include "TitleBar.h" |
49 #include "TitleBar.h" |
50 #include "flickcharm.h" |
50 #include "flickcharm.h" |
|
51 #include "webview.h" |
51 #include "ZoomStrip.h" |
52 #include "ZoomStrip.h" |
52 |
53 |
53 #if defined (Q_OS_SYMBIAN) |
54 #if defined (Q_OS_SYMBIAN) |
54 #include "sym_iap_util.h" |
55 #include "sym_iap_util.h" |
55 #endif |
56 #endif |
60 , m_webView(0) |
61 , m_webView(0) |
61 , m_progress(0) |
62 , m_progress(0) |
62 , m_currentZoom(100) |
63 , m_currentZoom(100) |
63 { |
64 { |
64 m_titleBar = new TitleBar(this); |
65 m_titleBar = new TitleBar(this); |
65 m_webView = new QWebView(this); |
66 m_webView = new WebView(this); |
66 m_zoomStrip = new ZoomStrip(this); |
67 m_zoomStrip = new ZoomStrip(this); |
67 m_controlStrip = new ControlStrip(this); |
68 m_controlStrip = new ControlStrip(this); |
68 |
69 |
69 m_zoomLevels << 30 << 50 << 67 << 80 << 90; |
70 m_zoomLevels << 30 << 50 << 67 << 80 << 90; |
70 m_zoomLevels << 100; |
71 m_zoomLevels << 100; |
79 connect(m_zoomStrip, SIGNAL(zoomOutClicked()), SLOT(zoomOut())); |
80 connect(m_zoomStrip, SIGNAL(zoomOutClicked()), SLOT(zoomOut())); |
80 |
81 |
81 connect(m_controlStrip, SIGNAL(menuClicked()), SIGNAL(menuButtonClicked())); |
82 connect(m_controlStrip, SIGNAL(menuClicked()), SIGNAL(menuButtonClicked())); |
82 connect(m_controlStrip, SIGNAL(backClicked()), m_webView, SLOT(back())); |
83 connect(m_controlStrip, SIGNAL(backClicked()), m_webView, SLOT(back())); |
83 connect(m_controlStrip, SIGNAL(forwardClicked()), m_webView, SLOT(forward())); |
84 connect(m_controlStrip, SIGNAL(forwardClicked()), m_webView, SLOT(forward())); |
|
85 connect(m_controlStrip, SIGNAL(closeClicked()), qApp, SLOT(quit())); |
84 |
86 |
85 QPalette pal = m_webView->palette(); |
87 QPalette pal = m_webView->palette(); |
86 pal.setBrush(QPalette::Base, Qt::white); |
88 pal.setBrush(QPalette::Base, Qt::white); |
87 m_webView->setPalette(pal); |
89 m_webView->setPalette(pal); |
88 |
90 |
93 connect(m_webView, SIGNAL(loadStarted()), SLOT(start())); |
95 connect(m_webView, SIGNAL(loadStarted()), SLOT(start())); |
94 connect(m_webView, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); |
96 connect(m_webView, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); |
95 connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(finish(bool))); |
97 connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(finish(bool))); |
96 connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); |
98 connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); |
97 |
99 |
98 m_webView->setHtml("Will try to load page soon!"); |
100 m_webView->setHtml("about:blank"); |
99 m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
101 m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
100 m_webView->setFocus(); |
102 m_webView->setFocus(); |
101 #ifdef Q_OS_SYMBIAN |
103 #ifdef Q_OS_SYMBIAN |
102 QTimer::singleShot(0, this, SLOT(setDefaultIap())); |
104 QTimer::singleShot(0, this, SLOT(setDefaultIap())); |
103 #endif |
105 #endif |