/* ============================================================ * QupZilla - WebKit based browser * Copyright (C) 2010-2011 nowrep * * 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 . * ============================================================ */ #ifndef WEBVIEW_H #define WEBVIEW_H #include #include #include #include #include #include #include #include #include #include #include #include class QupZilla; class TabWidget; class WebPage; class NetworkManagerProxy; class WebView : public QWebView { Q_OBJECT public: explicit WebView(QupZilla* mainClass, QWidget* parent = 0); ~WebView(); bool isLoading() { return m_isLoading;} int getLoading() { return m_progress; } void zoomReset(); void load(QUrl url); QUrl url() const; QString title() const; void reload(); WebPage* webPage() const; QString getIp() { return m_currentIp; } QLabel* animationLoading(int index, bool addMovie); QIcon siteIcon() { return m_siteIcon; } void addNotification(QWidget* notif); bool hasRss() { return !m_rss.isEmpty(); } QList > getRss() { return m_rss; } static QUrl guessUrlFromString(const QString &string); static bool isUrlValid(const QUrl &url); int tabIndex() const; public slots: void stop(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Stop); loadFinished(true);} } void back(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Back);} } void forward(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Forward);} } void slotReload(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Reload);} } void iconChanged(); void selectAll(); void zoomIn(); void zoomOut(); private slots: void showImage(); void copyImageToClipboard(); void downloadImageToDisk(); void searchOnGoogle(); 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 titleChanged(); void linkHovered(const QString &link, const QString &title, const QString &content); void openUrlInNewWindow(); void openUrlInNewTab(); void closeTab(); void downloadLinkToDisk(); void sendLinkByMail(); void bookmarkLink(); void showSource(); void showSiteInfo(); void getFocus(const QUrl &urla); void showInspector(); void stopAnimation(); void setIp(QHostInfo info); void checkRss(); void slotIconChanged(); private: void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); void contextMenuEvent(QContextMenuEvent* event); void wheelEvent(QWheelEvent* event); TabWidget* tabWidget() const; bool isCurrent(); void applyZoom(); QupZilla* p_QupZilla; int m_progress; bool m_isLoading; QString m_hoveredLink; QList m_zoomLevels; int m_currentZoom; QUrl m_aboutToLoadUrl; QUrl m_lastUrl; bool m_wantsClose; QString m_currentIp; QList > m_rss; QIcon m_siteIcon; WebPage* m_page; NetworkManagerProxy* m_networkProxy; //QTimer* m_loadingTimer; //Too confusing signals: void showUrl(QUrl url); void siteIconChanged(); void setPrivacy(bool state); void wantsCloseTab(int index); void changed(); void ipChanged(QString ip); void showNotification(QWidget* notif); }; #endif // WEBVIEW_H