2013-06-16 08:17:46 -05:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2017-01-04 07:33:32 -06:00
|
|
|
// Copyright (C) 2013 - 2017, The pgAdmin Development Team
|
2013-06-16 08:17:46 -05:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
// BrowserWindow.h - Declaration of the main window class
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef BROWSERWINDOW_H
|
|
|
|
#define BROWSERWINDOW_H
|
|
|
|
|
2013-06-21 17:21:11 -05:00
|
|
|
#include "pgAdmin4.h"
|
2016-01-18 08:33:28 -06:00
|
|
|
#include "TabWindow.h"
|
|
|
|
#include "WebViewWindow.h"
|
2013-06-16 08:17:46 -05:00
|
|
|
|
|
|
|
#if QT_VERSION >= 0x050000
|
2017-05-09 02:33:44 -05:00
|
|
|
#include <QtWidgets>
|
|
|
|
|
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
|
|
|
#include <QtWebEngineWidgets>
|
|
|
|
#else
|
|
|
|
#include <QtWebKitWidgets>
|
|
|
|
#include <QNetworkCookieJar>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#endif
|
2016-11-08 04:54:34 -06:00
|
|
|
#else
|
2017-05-09 02:33:44 -05:00
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
|
|
|
#include <QtWebEngineView>
|
|
|
|
#else
|
|
|
|
#include <QWebView>
|
2017-05-10 03:04:39 -05:00
|
|
|
#include <QNetworkCookieJar>
|
|
|
|
#include <QNetworkAccessManager>
|
2017-05-09 02:33:44 -05:00
|
|
|
#endif
|
2016-11-08 04:54:34 -06:00
|
|
|
#endif
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2017-06-16 03:57:19 -05:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
|
|
|
#include <QWebEngineHistory>
|
|
|
|
#else
|
|
|
|
#include <QWebHistory>
|
|
|
|
#endif
|
|
|
|
|
2013-06-16 08:17:46 -05:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QAction;
|
|
|
|
class QMenu;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class BrowserWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-10-04 12:16:31 -05:00
|
|
|
BrowserWindow(QString url);
|
2017-05-09 02:33:44 -05:00
|
|
|
~BrowserWindow();
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2013-10-04 09:08:18 -05:00
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
2013-06-21 18:49:40 -05:00
|
|
|
protected slots:
|
2016-01-18 08:33:28 -06:00
|
|
|
void urlLinkClicked(const QUrl &);
|
|
|
|
void tabTitleChanged(const QString &);
|
2016-11-28 23:18:39 -06:00
|
|
|
#ifdef __APPLE__
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-28 23:18:39 -06:00
|
|
|
void onMacCut();
|
|
|
|
void onMacCopy();
|
|
|
|
void onMacPaste();
|
|
|
|
#endif
|
|
|
|
#endif
|
2013-06-21 18:49:40 -05:00
|
|
|
|
2013-06-16 08:17:46 -05:00
|
|
|
private slots:
|
|
|
|
void openUrl();
|
2016-06-17 05:31:52 -05:00
|
|
|
void preferences();
|
2013-06-16 08:17:46 -05:00
|
|
|
void about();
|
2017-06-13 04:21:51 -05:00
|
|
|
void setZoomLevel(int zoomFlag);
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-08 04:54:34 -06:00
|
|
|
void downloadRequested(QWebEngineDownloadItem *download);
|
|
|
|
#endif
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
public slots:
|
2016-07-13 06:26:24 -05:00
|
|
|
void download(const QNetworkRequest &request);
|
|
|
|
void unsupportedContent(QNetworkReply * reply);
|
|
|
|
void downloadFinished();
|
|
|
|
void downloadFileProgress(qint64 , qint64 );
|
|
|
|
void progressCanceled();
|
|
|
|
void current_dir_path(const QString &dir);
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-08 04:54:34 -06:00
|
|
|
void createNewTabWindow(QWebEnginePage * &);
|
|
|
|
void downloadEngineFileProgress(qint64 , qint64 );
|
|
|
|
void downloadEngineFinished();
|
2017-05-09 02:33:44 -05:00
|
|
|
#else
|
|
|
|
void createNewTabWindowKit(QWebPage * &);
|
2016-11-08 04:54:34 -06:00
|
|
|
#endif
|
2016-01-18 08:33:28 -06:00
|
|
|
|
2013-06-16 08:17:46 -05:00
|
|
|
private:
|
2013-10-04 11:12:10 -05:00
|
|
|
QString m_appServerUrl;
|
2016-01-18 08:33:28 -06:00
|
|
|
WebViewWindow *m_mainWebView;
|
2016-06-17 05:31:52 -05:00
|
|
|
|
|
|
|
QShortcut *openUrlShortcut;
|
|
|
|
QShortcut *preferencesShortcut;
|
|
|
|
QShortcut *exitShortcut;
|
|
|
|
QShortcut *aboutShortcut;
|
2016-09-22 06:37:38 -05:00
|
|
|
QShortcut *zoomInShortcut;
|
|
|
|
QShortcut *zoomOutShortcut;
|
2017-06-13 04:21:51 -05:00
|
|
|
QShortcut *zoomResetShortcut;
|
|
|
|
QSignalMapper *signalMapper;
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
QGridLayout *m_tabGridLayout;
|
|
|
|
QGridLayout *m_mainGridLayout;
|
2017-06-16 03:57:19 -05:00
|
|
|
DockTabWidget *m_tabWidget;
|
2016-01-18 08:33:28 -06:00
|
|
|
QWidget *m_pgAdminMainTab;
|
|
|
|
|
|
|
|
QWidget *m_addNewTab;
|
|
|
|
QGridLayout *m_addNewGridLayout;
|
|
|
|
WebViewWindow *m_addNewWebView;
|
|
|
|
QHBoxLayout *m_horizontalLayout;
|
2017-06-16 03:57:19 -05:00
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
QWidget *m_widget;
|
|
|
|
QToolButton *m_toolBtnBack;
|
|
|
|
QToolButton *m_toolBtnForward;
|
2017-06-16 03:57:19 -05:00
|
|
|
QToolButton *m_toolBtnClose;
|
2016-01-18 08:33:28 -06:00
|
|
|
|
2016-07-13 06:26:24 -05:00
|
|
|
QString m_downloadFilename;
|
|
|
|
int m_downloadStarted;
|
|
|
|
int m_downloadCancelled;
|
|
|
|
QFile *m_file;
|
|
|
|
QProgressDialog *m_progressDialog;
|
|
|
|
QString m_defaultFilename;
|
|
|
|
QString m_last_open_folder_path;
|
|
|
|
QString m_dir;
|
|
|
|
QNetworkReply *m_reply;
|
2017-05-09 02:33:44 -05:00
|
|
|
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-08 04:54:34 -06:00
|
|
|
QWebEngineDownloadItem *m_download;
|
2017-05-09 02:33:44 -05:00
|
|
|
#else
|
|
|
|
QNetworkCookieJar *m_cookieJar;
|
|
|
|
QNetworkAccessManager *m_netAccessMan;
|
2016-11-08 04:54:34 -06:00
|
|
|
#endif
|
2013-06-21 18:49:40 -05:00
|
|
|
|
2013-06-16 08:17:46 -05:00
|
|
|
void createActions();
|
2013-06-21 18:49:40 -05:00
|
|
|
void pause(int seconds = 1);
|
2016-01-18 08:33:28 -06:00
|
|
|
int findURLTab(const QUrl &name);
|
2017-06-16 03:57:19 -05:00
|
|
|
void enableDisableToolButtons(WebViewWindow *webViewPtr);
|
2016-12-12 03:40:46 -06:00
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-28 23:18:39 -06:00
|
|
|
void triggerWebViewWindowEvents(QWebEnginePage::WebAction action);
|
2016-12-12 03:40:46 -06:00
|
|
|
#endif
|
|
|
|
#endif
|
2013-06-16 08:17:46 -05:00
|
|
|
};
|
|
|
|
|
2013-06-21 17:21:11 -05:00
|
|
|
#endif // BROWSERWINDOW_H
|