1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 17:42:10 +01:00
falkonOfficial/src/webview/webview.h

185 lines
5.0 KiB
C
Raw Normal View History

2011-03-03 18:29:20 +01:00
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
2011-03-03 18:29:20 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
2011-03-02 16:57:41 +01:00
#ifndef WEBVIEW_H
#define WEBVIEW_H
#include <QWebView>
#include <QDebug>
#include <QTabWidget>
#include <QContextMenuEvent>
#include <QWebElement>
#include <QClipboard>
#include <QLabel>
#include <QProcess>
#include <QWebInspector>
#include <QDockWidget>
#include <QWebPage>
#include <QHostInfo>
class QupZilla;
class TabWidget;
class WebPage;
class NetworkManagerProxy;
class WebTab;
class LocationBar;
2011-03-02 16:57:41 +01:00
class WebView : public QWebView
{
Q_OBJECT
public:
explicit WebView(QupZilla* mainClass, WebTab* webTab);
2011-03-02 16:57:41 +01:00
~WebView();
bool isLoading() { return m_isLoading;}
int getLoading() { return m_progress; }
void zoomReset();
QUrl url() const;
QString title() const;
void reload();
WebPage* webPage() const;
WebTab* webTab() const;
2011-03-02 16:57:41 +01:00
QString getIp() { return m_currentIp; }
QLabel* animationLoading(int index, bool addMovie);
QIcon siteIcon();
2011-03-02 16:57:41 +01:00
void addNotification(QWidget* notif);
bool hasRss() { return m_hasRss; }
void setMouseWheelEnabled(bool state) { m_mouseWheelEnabled = state; }
2011-03-02 16:57:41 +01:00
bool eventFilter(QObject* obj, QEvent* event);
void setLocationBar(LocationBar* bar) { m_locationBar = bar; }
LocationBar* locationBar() { return m_locationBar; }
2011-03-02 16:57:41 +01:00
static QUrl guessUrlFromString(const QString &string);
static bool isUrlValid(const QUrl &url);
2011-03-25 19:16:21 +01:00
int tabIndex() const;
2011-03-02 16:57:41 +01:00
signals:
void showUrl(QUrl url);
void siteIconChanged();
void wantsCloseTab(int index);
void changed();
void ipChanged(QString ip);
void showNotification(QWidget* notif);
void viewportResized(QSize size);
void rssChanged(bool state);
2011-03-02 16:57:41 +01:00
public slots:
void load(const QUrl &url);
void titleChanged();
void stop();
void back();
void forward();
void slotReload();
2011-03-02 16:57:41 +01:00
void iconChanged();
void selectAll();
void closeTab();
2011-03-02 16:57:41 +01:00
void zoomIn();
void zoomOut();
private slots:
void copyText();
void trackMouse(bool state) { m_mouseTrack = state; }
2011-03-02 16:57:41 +01:00
void showImage();
void copyImageToClipboard();
void downloadImageToDisk();
void searchSelectedText();
2011-03-02 16:57:41 +01:00
void copyLinkToClipboard();
void loadStarted();
void downloadRequested(const QNetworkRequest &request);
void setProgress(int prog);
void loadFinished(bool state);
void linkClicked(const QUrl &url);
void urlChanged(const QUrl &url);
void linkHovered(const QString &link, const QString &title, const QString &content);
void openUrlInNewWindow();
void openUrlInNewTab();
void downloadLinkToDisk();
void sendLinkByMail();
void bookmarkLink();
void showSource();
void showSourceOfSelection();
2011-03-02 16:57:41 +01:00
void showSiteInfo();
void getFocus(const QUrl &urla);
void showInspector();
void stopAnimation();
2011-04-24 09:08:53 +02:00
void setIp(const QHostInfo &info);
void checkRss();
void slotIconChanged();
2011-03-02 16:57:41 +01:00
// ClickedFrame
void loadClickedFrame();
void loadClickedFrameInNewTab();
void reloadClickedFrame();
void printClickedFrame();
void clickedFrameZoomIn();
void clickedFrameZoomOut();
void clickedFrameZoomReset();
void showClickedFrameSource();
2011-03-02 16:57:41 +01:00
private:
2011-03-17 17:03:04 +01:00
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void contextMenuEvent(QContextMenuEvent* event);
void wheelEvent(QWheelEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void resizeEvent(QResizeEvent* event);
void keyPressEvent(QKeyEvent* event);
2011-03-02 16:57:41 +01:00
TabWidget* tabWidget() const;
bool isCurrent();
void applyZoom();
QupZilla* p_QupZilla;
2011-03-02 16:57:41 +01:00
QString m_hoveredLink;
QList<int> m_zoomLevels;
QUrl m_aboutToLoadUrl;
QUrl m_lastUrl;
2011-03-02 16:57:41 +01:00
QString m_currentIp;
QIcon m_siteIcon;
int m_progress;
int m_currentZoom;
2011-03-02 16:57:41 +01:00
WebPage* m_page;
WebTab* m_webTab;
2011-03-02 16:57:41 +01:00
NetworkManagerProxy* m_networkProxy;
LocationBar* m_locationBar;
QMenu* m_menu;
QWebFrame* m_clickedFrame;
bool m_mouseTrack;
bool m_navigationVisible;
bool m_mouseWheelEnabled;
bool m_wantsClose;
bool m_isLoading;
bool m_hasRss;
bool m_rssChecked;
QList<QTouchEvent::TouchPoint> m_touchPoints;
//QTimer* m_loadingTimer;
2011-03-02 16:57:41 +01:00
// static QList<WebView*> s_deletedPointers;
// static bool isPointerValid(WebView* pointer);
2011-03-02 16:57:41 +01:00
};
#endif // WEBVIEW_H