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
|
|
|
|
#include <QtWidgets>
|
2016-11-08 04:54:34 -06:00
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
#include <QtWebEngineWidgets>
|
|
|
|
#else
|
2013-06-16 08:17:46 -05:00
|
|
|
#include <QtWebKitWidgets>
|
2016-11-08 04:54:34 -06:00
|
|
|
#endif
|
2013-06-16 08:17:46 -05:00
|
|
|
#else
|
|
|
|
#include <QMainWindow>
|
2016-11-08 04:54:34 -06:00
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
#include <QtWebEngineView>
|
|
|
|
#else
|
2013-06-16 08:17:46 -05:00
|
|
|
#include <QWebView>
|
|
|
|
#endif
|
2016-11-08 04:54:34 -06:00
|
|
|
#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);
|
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:
|
|
|
|
void finishLoading(bool);
|
2016-01-18 08:33:28 -06:00
|
|
|
void urlLinkClicked(const QUrl &);
|
|
|
|
void closetabs();
|
|
|
|
void tabTitleChanged(const QString &);
|
2016-11-28 23:18:39 -06:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
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();
|
2016-09-22 06:37:38 -05:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
2016-11-08 04:54:34 -06:00
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
void downloadRequested(QWebEngineDownloadItem *download);
|
|
|
|
#endif
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
public slots:
|
|
|
|
void tabIndexChanged(int index);
|
|
|
|
void goBackPage();
|
|
|
|
void goForwardPage();
|
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);
|
2016-11-08 04:54:34 -06:00
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
void createNewTabWindow(QWebEnginePage * &);
|
|
|
|
void downloadEngineFileProgress(qint64 , qint64 );
|
|
|
|
void downloadEngineFinished();
|
|
|
|
#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;
|
2013-06-16 08:17:46 -05:00
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
QGridLayout *m_tabGridLayout;
|
|
|
|
QGridLayout *m_mainGridLayout;
|
|
|
|
TabWindow *m_tabWidget;
|
|
|
|
QWidget *m_pgAdminMainTab;
|
|
|
|
|
|
|
|
QWidget *m_addNewTab;
|
|
|
|
QGridLayout *m_addNewGridLayout;
|
|
|
|
WebViewWindow *m_addNewWebView;
|
|
|
|
QHBoxLayout *m_horizontalLayout;
|
|
|
|
QWidget *m_widget;
|
|
|
|
QToolButton *m_toolBtnBack;
|
|
|
|
QToolButton *m_toolBtnForward;
|
|
|
|
|
2013-10-04 11:12:10 -05:00
|
|
|
bool m_initialLoad;
|
|
|
|
int m_loadAttempt;
|
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;
|
2016-11-08 04:54:34 -06:00
|
|
|
#if QT_VERSION >= 0x050500
|
|
|
|
QWebEngineDownloadItem *m_download;
|
|
|
|
#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);
|
2016-12-12 03:40:46 -06:00
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#if QT_VERSION >= 0x050500
|
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
|