Sankore 851 access to web instances

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent f2252033a4
commit 75bced4117
  1. 38
      src/web/UBWebController.cpp
  2. 2
      src/web/UBWebController.h

@ -64,6 +64,11 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
{ {
connect(mMainWindow->actionWebTools, SIGNAL(toggled(bool)), this, SLOT(toggleWebToolsPalette(bool))); connect(mMainWindow->actionWebTools, SIGNAL(toggled(bool)), this, SLOT(toggleWebToolsPalette(bool)));
mStackedWidget = new QStackedWidget();
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mStackedWidget->addWidget(new QWidget(mStackedWidget));
mMainWindow->addWebWidget(mStackedWidget); mMainWindow->addWebWidget(mStackedWidget);
for (int i = 0; i < TotalNumberOfWebInstances; i += 1){ for (int i = 0; i < TotalNumberOfWebInstances; i += 1){
@ -76,13 +81,15 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
// TODO : Comment the next line to continue the Youtube button bugfix // TODO : Comment the next line to continue the Youtube button bugfix
initialiazemOEmbedProviders(); initialiazemOEmbedProviders();
} }
UBWebController::~UBWebController() UBWebController::~UBWebController()
{ {
// NOOP // NOOP
if (mStackedWidget) {
delete mStackedWidget;
}
} }
void UBWebController::initialiazemOEmbedProviders() void UBWebController::initialiazemOEmbedProviders()
@ -119,6 +126,7 @@ void UBWebController::webBrowserInstance()
mCurrentWebBrowser = &mWebBrowserList[WebBrowser]; mCurrentWebBrowser = &mWebBrowserList[WebBrowser];
mToolsCurrentPalette = &mToolsPaletteList[WebBrowser]; mToolsCurrentPalette = &mToolsPaletteList[WebBrowser];
mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser]; mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow); (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow);
@ -134,6 +142,10 @@ void UBWebController::webBrowserInstance()
mMainWindow->actionBookmarks->setVisible(showAddBookmarkButtons); mMainWindow->actionBookmarks->setVisible(showAddBookmarkButtons);
mMainWindow->actionAddBookmark->setVisible(showAddBookmarkButtons); mMainWindow->actionAddBookmark->setVisible(showAddBookmarkButtons);
mStackedWidget->setCurrentIndex(WebBrowser);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(WebBrowser, (*mCurrentWebBrowser)); mStackedWidget->insertWidget(WebBrowser, (*mCurrentWebBrowser));
showTabAtTop(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()); showTabAtTop(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool());
@ -150,9 +162,8 @@ void UBWebController::webBrowserInstance()
(*mCurrentWebBrowser)->tabWidget()->lineEdits()->show(); (*mCurrentWebBrowser)->tabWidget()->lineEdits()->show();
} }
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(WebBrowser); mStackedWidget->setCurrentIndex(WebBrowser);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget(); mMainWindow->switchToWebWidget();
setupPalettes(); setupPalettes();
@ -165,7 +176,6 @@ void UBWebController::webBrowserInstance()
if (mDownloadViewIsVisible) if (mDownloadViewIsVisible)
WBBrowserWindow::downloadManager()->show(); WBBrowserWindow::downloadManager()->show();
} }
void UBWebController::tutorialWebInstance() void UBWebController::tutorialWebInstance()
@ -191,13 +201,17 @@ void UBWebController::tutorialWebInstance()
{ {
mCurrentWebBrowser = &mWebBrowserList[Tutorial]; mCurrentWebBrowser = &mWebBrowserList[Tutorial];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true); (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*))); connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*)));
mStackedWidget->setCurrentIndex(Tutorial);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(Tutorial, (*mCurrentWebBrowser)); mStackedWidget->insertWidget(Tutorial, (*mCurrentWebBrowser));
adaptToolBar(); adaptToolBar();
mTrapFlashController = new UBTrapFlashController((*mCurrentWebBrowser)); mTrapFlashController = new UBTrapFlashController((*mCurrentWebBrowser));
@ -212,12 +226,9 @@ void UBWebController::tutorialWebInstance()
else else
(*mCurrentWebBrowser)->loadUrl(currentUrl); (*mCurrentWebBrowser)->loadUrl(currentUrl);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(Tutorial); mStackedWidget->setCurrentIndex(Tutorial);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget(); mMainWindow->switchToWebWidget();
screenLayoutChanged(); screenLayoutChanged();
bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool(); bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool();
@ -246,6 +257,7 @@ void UBWebController::paraschoolWebInstance()
if (UBSettings::settings()->webUseExternalBrowser->get().toBool()){ if (UBSettings::settings()->webUseExternalBrowser->get().toBool()){
QDesktopServices::openUrl(currentUrl); QDesktopServices::openUrl(currentUrl);
} }
else { else {
mCurrentWebBrowser = &mWebBrowserList[Paraschool]; mCurrentWebBrowser = &mWebBrowserList[Paraschool];
mToolsCurrentPalette = &mToolsPaletteList[Paraschool]; mToolsCurrentPalette = &mToolsPaletteList[Paraschool];
@ -254,6 +266,10 @@ void UBWebController::paraschoolWebInstance()
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true); (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*))); connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*)));
mStackedWidget->setCurrentIndex(Paraschool);
if (mStackedWidget->currentWidget()) {
mStackedWidget->removeWidget(mStackedWidget->currentWidget());
}
mStackedWidget->insertWidget(Paraschool, (*mCurrentWebBrowser)); mStackedWidget->insertWidget(Paraschool, (*mCurrentWebBrowser));
adaptToolBar(); adaptToolBar();
@ -267,11 +283,9 @@ void UBWebController::paraschoolWebInstance()
} }
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mStackedWidget->setCurrentIndex(Paraschool); mStackedWidget->setCurrentIndex(Paraschool);
UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget());
mMainWindow->switchToWebWidget(); mMainWindow->switchToWebWidget();
screenLayoutChanged(); screenLayoutChanged();
bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool(); bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool();

@ -104,7 +104,7 @@ class UBWebController : public QObject
void lookForEmbedContent(QString* pHtml, QString tag, QString attribute, QList<QUrl>* pList); void lookForEmbedContent(QString* pHtml, QString tag, QString attribute, QList<QUrl>* pList);
void checkForOEmbed(QString* pHtml); void checkForOEmbed(QString* pHtml);
QStackedWidget mStackedWidget[TotalNumberOfWebInstances]; QStackedWidget *mStackedWidget;
UBMainWindow *mMainWindow; UBMainWindow *mMainWindow;

Loading…
Cancel
Save