mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-25 02:00:19 -06:00
8f146ebb4c
Added functionality to open different website link and load the website data to different tab. To achieve this, new customized QTabWidget and QWebView are added to render the data to WebView widget. All the widgets (New Tab, WebViewWinodw, and QToolButton) are added dynamically. QToolButton is used to traverse back and forward to web document opened in WebViewWindow. Introduced the New class called WebViewWindow which is derived from QWebView. Each tab of the QTabWidget contains the instance of WebViewWindow class. WebViewWindow class is useful to display the web document. Introduced New class called TabWindow which is derived from QTabWidget. This class is useful to achieve following functionality: - Customize the close button of tabbar so that it can only be visible other then main pgAdmin 4 window. - Enable/Disable the toolbutton added left side of tabbar depending on the web history traversed by the user in WebViewWindow. - Set the tooltip text of the tabbar depending on the title change event of WebViewWindow class. Modified the Qt project file to support the both the version of python 2 and python 3. Qt5 is recommended to test pgAdmin4 in dektop mode.
91 lines
2.0 KiB
C++
91 lines
2.0 KiB
C++
//////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2016, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
// BrowserWindow.h - Declaration of the main window class
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef BROWSERWINDOW_H
|
|
#define BROWSERWINDOW_H
|
|
|
|
#include "pgAdmin4.h"
|
|
#include "TabWindow.h"
|
|
#include "WebViewWindow.h"
|
|
|
|
#if QT_VERSION >= 0x050000
|
|
#include <QtWidgets>
|
|
#include <QtWebKitWidgets>
|
|
#else
|
|
#include <QMainWindow>
|
|
#include <QWebView>
|
|
#endif
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QAction;
|
|
class QMenu;
|
|
QT_END_NAMESPACE
|
|
|
|
class BrowserWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
BrowserWindow(QString url);
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
protected slots:
|
|
void finishLoading(bool);
|
|
void urlLinkClicked(const QUrl &);
|
|
void closetabs();
|
|
void tabTitleChanged(const QString &);
|
|
|
|
private slots:
|
|
void openUrl();
|
|
void pythonPath();
|
|
void about();
|
|
|
|
public slots:
|
|
void tabIndexChanged(int index);
|
|
void goBackPage();
|
|
void goForwardPage();
|
|
|
|
private:
|
|
QString m_appServerUrl;
|
|
WebViewWindow *m_mainWebView;
|
|
QMenu *fileMenu;
|
|
QMenu *helpMenu;
|
|
QAction *openUrlAction;
|
|
QAction *pythonPathAction;
|
|
QAction *exitAction;
|
|
QAction *aboutAction;
|
|
|
|
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;
|
|
|
|
bool m_initialLoad;
|
|
int m_loadAttempt;
|
|
|
|
void createActions();
|
|
void createMenus();
|
|
void pause(int seconds = 1);
|
|
int findURLTab(const QUrl &name);
|
|
};
|
|
|
|
#endif // BROWSERWINDOW_H
|