File indexing completed on 2024-05-12 04:58:31

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2015  David Rosca <nowrep@gmail.com>
0004 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
0005 *
0006 * This program is free software: you can redistribute it and/or modify
0007 * it under the terms of the GNU General Public License as published by
0008 * the Free Software Foundation, either version 3 of the License, or
0009 * (at your option) any later version.
0010 *
0011 * This program is distributed in the hope that it will be useful,
0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 * GNU General Public License for more details.
0015 *
0016 * You should have received a copy of the GNU General Public License
0017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 * ============================================================ */
0019 #ifndef TABBEDWEBVIEW_H
0020 #define TABBEDWEBVIEW_H
0021 
0022 #include "qzcommon.h"
0023 #include "webview.h"
0024 
0025 class QLabel;
0026 class QHostInfo;
0027 
0028 class BrowserWindow;
0029 class TabWidget;
0030 class WebPage;
0031 class WebTab;
0032 class Menu;
0033 
0034 class FALKON_EXPORT TabbedWebView : public WebView
0035 {
0036     Q_OBJECT
0037 public:
0038     explicit TabbedWebView(WebTab* webTab);
0039 
0040     void setPage(WebPage* page);
0041 
0042     // BrowserWindow can be null!
0043     BrowserWindow* browserWindow() const;
0044     void setBrowserWindow(BrowserWindow* window);
0045 
0046     WebTab* webTab() const;
0047 
0048     QString getIp() const;
0049     int tabIndex() const;
0050 
0051     QWidget* overlayWidget() override;
0052     void closeView() override;
0053     void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) override;
0054 
0055     bool isFullScreen() override;
0056     void requestFullScreen(bool enable) override;
0057 
0058 Q_SIGNALS:
0059     void wantsCloseTab(int);
0060     void ipChanged(const QString&);
0061 
0062 public Q_SLOTS:
0063     void setAsCurrentTab();
0064     void userLoadAction(const LoadRequest &req);
0065 
0066 private Q_SLOTS:
0067     void slotLoadStarted();
0068     void slotLoadFinished();
0069     void slotLoadProgress(int prog);
0070     void linkHovered(const QString &link);
0071     void setIp(const QHostInfo &info);
0072 
0073     void inspectElement();
0074 
0075 private:
0076     void _contextMenuEvent(QContextMenuEvent *event) override;
0077     void _mouseMoveEvent(QMouseEvent *event) override;
0078 
0079     BrowserWindow* m_window;
0080     WebTab* m_webTab;
0081     Menu* m_menu;
0082 
0083     QString m_currentIp;
0084 };
0085 
0086 #endif // TABBEDWEBVIEW_H