Commit e6a2b419 authored by Claudio Valerio's avatar Claudio Valerio
parent d16520d1
......@@ -85,15 +85,12 @@ WBHistoryManager *WBBrowserWindow::sHistoryManager = 0;
WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWindow, bool isViewerWebInstance)
: QWidget(parent)
, mWebToolBar(0)
, mSearchToolBar(0)
, mTabWidget(new WBTabWidget(this))
, mSearchAction(0)
, mUniboardMainWindow(uniboardMainWindow)
, mWebToolBar(0)
{
qDebug() << "Height: " << this->height();
qDebug() << "width: " << this->width();
QWebSettings *defaultSettings = QWebSettings::globalSettings();
defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true);
......@@ -110,11 +107,10 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
this->setLayout(layout);
connect(mTabWidget, SIGNAL(loadPage(const QString &)),
this, SLOT(loadPage(const QString &)));
connect(mTabWidget, SIGNAL(loadPage(const QString &)), this, SLOT(loadPage(const QString &)));
connect(mTabWidget, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
connect(mTabWidget, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
if (!isViewerWebInstance) {
connect(mTabWidget, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
......@@ -122,12 +118,7 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
connect(mTabWidget, SIGNAL(loadFinished(bool)), this, SIGNAL(activeViewPageChanged()));
connect(mTabWidget, SIGNAL(lastTabClosed()),
mTabWidget, SLOT(newTab()));
connect(mTabWidget, SIGNAL(geometryChangeRequested(const QRect &)),
this, SLOT(geometryChangeRequested(const QRect &)));
connect(mTabWidget, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &)));
slotUpdateWindowTitle();
......@@ -141,7 +132,15 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
WBBrowserWindow::~WBBrowserWindow()
{
// NOOP
if(mTabWidget){
delete mTabWidget;
mTabWidget = NULL;
}
if(mSearchToolBar){
delete mSearchToolBar;
mSearchToolBar = NULL;
}
}
......
......@@ -87,8 +87,7 @@ WBTabBar::WBTabBar(QWidget *parent)
connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
}
setTabsClosable(true);
connect(this, SIGNAL(tabCloseRequested(int)),
this, SIGNAL(closeTab(int)));
connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(closeTab(int)));
setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
setMovable(true);
setDocumentMode(false);
......@@ -116,26 +115,23 @@ void WBTabBar::contextMenuRequested(const QPoint &position)
menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab);
int index = tabAt(position);
if (-1 != index) {
QAction *action = menu.addAction(tr("Clone Tab"),
this, SLOT(cloneTab()));
QAction *action = menu.addAction(tr("Clone Tab"), this, SLOT(cloneTab()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("&Close Tab"),
this, SLOT(closeTab()), QKeySequence::Close);
action = menu.addAction(tr("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close);
action->setData(index);
action = menu.addAction(tr("Close &Other Tabs"),
this, SLOT(closeOtherTabs()));
action = menu.addAction(tr("Close &Other Tabs"), this, SLOT(closeOtherTabs()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("Reload Tab"),
this, SLOT(reloadTab()), QKeySequence::Refresh);
action = menu.addAction(tr("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh);
action->setData(index);
} else {
}
else {
menu.addSeparator();
}
menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs()));
......@@ -412,45 +408,30 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent)
p.setColor(QPalette::Window, palette().color(QPalette::Base));
emptyWidget->setPalette(p);
emptyWidget->setAutoFillBackground(true);
disconnect(this, SIGNAL(currentChanged(int)),
this, SLOT(currentChanged(int)));
disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
addTab(emptyWidget, tr("(Untitled)"));
connect(this, SIGNAL(currentChanged(int)),
this, SLOT(currentChanged(int)));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
return 0;
}
// webview
WBWebView *webView = new WBWebView;
urlLineEdit->setWebView(webView);
connect(webView, SIGNAL(loadStarted()),
this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadFinished(bool)),
this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(iconChanged()),
this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(titleChanged(const QString &)),
this, SLOT(webViewTitleChanged(const QString &)));
connect(webView, SIGNAL(urlChanged(const QUrl &)),
this, SLOT(webViewUrlChanged(const QUrl &)));
connect(webView->page(), SIGNAL(windowCloseRequested()),
this, SLOT(windowCloseRequested()));
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
this, SIGNAL(printRequested(QWebFrame *)));
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)),
UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool)));
connect(webView, SIGNAL(embedCodeCaptured(const QString&)),
UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&)));
connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &)));
connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &)));
connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)), UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool)));
connect(webView, SIGNAL(embedCodeCaptured(const QString&)), UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&)));
addTab(webView, tr("(Untitled)"));
if (makeCurrent)
......@@ -465,7 +446,6 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent)
if (count() == 1)
currentChanged(currentIndex());
emit tabsChanged();
return webView;
}
......@@ -553,13 +533,13 @@ void WBTabWidget::closeTab(int index)
removeTab(index);
webView->deleteLater();
emit tabsChanged();
if (hasFocus && count() > 0)
currentWebView()->setFocus();
if (count() == 0)
emit lastTabClosed();
if (count() == 0){
newTab();
emit currentChanged(0);
}
}
void WBTabWidget::webViewLoadStarted()
......@@ -616,7 +596,6 @@ void WBTabWidget::webViewUrlChanged(const QUrl &url)
{
mTabBar->setTabData(index, url);
}
emit tabsChanged();
// web view does not reload sometime on OSX ... force it
webView->show();
......
......@@ -143,8 +143,6 @@ class WBTabWidget : public QTabWidget
signals:
// tab widget signals
void loadPage(const QString &url);
void tabsChanged();
void lastTabClosed();
// current tab signals
void setCurrentTitle(const QString &url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment