X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwidgets%2FTabWidget.h;fp=src%2Fwidgets%2FTabWidget.h;h=525c81a291c170edb3342156f60251ec2fe8fcff;hp=0000000000000000000000000000000000000000;hb=0d23ee5e9b43b247cdda0a4cbb73f8b1a70f4500;hpb=e28b208d6f953d24bd05927a16775d103714fd36 diff --git a/src/widgets/TabWidget.h b/src/widgets/TabWidget.h new file mode 100644 index 0000000..525c81a --- /dev/null +++ b/src/widgets/TabWidget.h @@ -0,0 +1,137 @@ +/* + * Copyright © 2022 Soren Stoutner . + * + * This file is part of Privacy Browser PC . + * + * Privacy Browser PC 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. + * + * Privacy Browser PC 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 Privacy Browser PC. If not, see . + */ + +#ifndef TABWIDGET_H +#define TABWIDGET_H + +// Application headers. +#include "PrivacyWebEngineView.h" + +// KDE Framework headers. +#include + +// Qt toolkit headers. +#include +#include +#include +#include +#include +#include +#include +#include + +class TabWidget : public QWidget +{ + // Include the Q_OBJECT macro. + Q_OBJECT + +public: + // The primary contructor. + explicit TabWidget(QWidget *parent); + + // The destructor. + ~TabWidget(); + + // The public functions. + void applyOnTheFlyZoomFactor(const double &zoomFactor); + void loadInitialWebsite(); + std::list* getCookieList() const; + QString& getDomainSettingsName() const; + void setTabBarVisible(const bool visible) const; + void toggleDomStorage() const; + void toggleJavaScript() const; + void toggleLocalStorage(); + + // The public static variables. + static QString webEngineDefaultUserAgent; + +signals: + // The signals. + void addCookie(const QNetworkCookie &cookie) const; + void removeCookie(const QNetworkCookie &cookie) const; + void clearUrlLineEditFocus() const; + void fullScreenRequested(const bool toggleOn) const; + void hideProgressBar() const; + void linkHovered(const QString &linkUrl) const; + void showProgressBar(const int &progress) const; + void updateBackAction(const bool &isEnabled) const; + void updateCookiesAction(const int numberOfCookies) const; + void updateDomStorageAction(const bool &isEnabled) const; + void updateDomainSettingsIndicator(const bool status) const; + void updateForwardAction(const bool &isEnabled) const; + void updateJavaScriptAction(const bool &isEnabled) const; + void updateLocalStorageAction(const bool &isEnabled) const; + void updateSearchEngineActions(const QString &searchEngine, const bool &updateCustomSearchEngineStatus) const; + void updateUrlLineEdit(const QUrl &newUrl) const; + void updateUserAgentActions(const QString &userAgent, const bool &updateCustomUserAgentStatus) const; + void updateZoomFactorAction(const double &zoomFactor) const; + +public Q_SLOTS: + // The public slots. + void addTab(); + void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const; + void applyApplicationSettings(); + void applyDomainSettingsAndReload(); + void applyDomainSettingsWithoutReloading(const QString &hostname); + void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer); + void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const; + void back() const; + void deleteAllCookies() const; + void deleteCookieFromStore(const QNetworkCookie &cookie) const; + void forward() const; + void home() const; + void loadUrlFromLineEdit(QString url) const; + void mouseBack() const; + void mouseForward() const; + void print() const; + void printPreview() const; + void refresh() const; + +private Q_SLOTS: + // The private slots. + void addFirstTab(); + void deleteTab(const int tabIndex); + void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest) const; + void loadFinished() const; + void loadProgress(const int &progress) const; + void loadStarted() const; + void pageLinkHovered(const QString &linkUrl) const; + void printWebpage(QPrinter *printerPointer) const; + void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer) const; + void showSaveFilePickerDialog(QUrl &downloadUrl, QString &suggestedFileName); + void updateUiWithTabSettings(); + void updateUrl(const QUrl &url) const; + +private: + // The private variables. + double currentZoomFactor; // This can be removed once has been resolved. + PrivacyWebEngineView *currentPrivacyWebEngineViewPointer; + QWebEngineCookieStore *currentWebEngineCookieStorePointer; + QWebEngineHistory *currentWebEngineHistoryPointer; + QWebEnginePage *currentWebEnginePagePointer; + QWebEngineProfile *currentWebEngineProfilePointer; + QWebEngineSettings *currentWebEngineSettingsPointer; + QIcon defaultTabIcon = QIcon::fromTheme(QStringLiteral("globe")); + QString searchEngineUrl; + QTabWidget *tabWidgetPointer; + + // The private functions. + void applyDomainSettings(const QString &hostname, const bool reloadWebsite); +}; +#endif