UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow* pMainWindow, QObject* parent, UBRightPalette* rightPalette) : QObject(parent) , mMainWindow(pMainWindow) , mControlView(pControlView) , mDisplayView(pDisplayView) , mMirror(0) , mMainMode(Board) , mDisplayManager(0) , mAutomaticCheckForUpdates(false) , mCheckingForUpdates(false) , mIsShowingDesktop(false) , mHttp(0) { mDisplayManager = new UBDisplayManager(this); mUninoteController = new UBDesktopAnnotationController(this, rightPalette); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), this, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), mUninoteController, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), UBApplication::webController, SLOT(screenLayoutChanged())); connect(mUninoteController, SIGNAL(imageCaptured(const QPixmap &, bool)), this, SLOT(addCapturedPixmap(const QPixmap &, bool))); connect(mUninoteController, SIGNAL(restoreUniboard()), this, SLOT(hideDesktop())); for(int i = 0; i < mDisplayManager->numPreviousViews(); i++) { UBBoardView *previousView = new UBBoardView(UBApplication::boardController, UBItemLayerType::FixedBackground, UBItemLayerType::Tool, 0); previousView->setInteractive(false); mPreviousViews.append(previousView); } mBlackScene = new UBGraphicsScene(0); // deleted by UBApplicationController::destructor mBlackScene->setBackground(true, false); if (mDisplayManager->numScreens() >= 2) { mMirror = new UBScreenMirror(); } connect(UBApplication::webController, SIGNAL(imageCaptured(const QPixmap &, bool, const QUrl&)) , this, SLOT(addCapturedPixmap(const QPixmap &, bool, const QUrl&))); networkAccessManager = new QNetworkAccessManager (this); QTimer::singleShot (1000, this, SLOT (checkUpdateAtLaunch())); #ifdef Q_WS_X11 mMainWindow->setStyleSheet("QToolButton { font-size: 11px}"); #endif }
void UBWebController::webBrowserInstance() { QString webHomePage = UBSettings::settings()->webHomePage->get().toString(); QUrl currentUrl = WBBrowserWindow::guessUrlFromString(webHomePage); if (UBSettings::settings()->webUseExternalBrowser->get().toBool()) { QDesktopServices::openUrl(currentUrl); } else { mCurrentWebBrowser = &mWebBrowserList[WebBrowser]; mToolsCurrentPalette = &mToolsPaletteList[WebBrowser]; mKeyboardCurrentPalette = &mKeyboardPaletteList[WebBrowser]; mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser]; if (!(*mCurrentWebBrowser)) { (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow); connect((*mCurrentWebBrowser), SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*))); WBBrowserWindow::downloadManager()->setParent((*mCurrentWebBrowser), Qt::Tool); UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->webToolBar, mMainWindow->actionBoard, 32); UBApplication::app()->decorateActionMenu(mMainWindow->actionMenu); bool showAddBookmarkButtons = UBSettings::settings()->webShowAddBookmarkButton->get().toBool(); mMainWindow->actionBookmarks->setVisible(showAddBookmarkButtons); mMainWindow->actionAddBookmark->setVisible(showAddBookmarkButtons); mStackedWidget->insertWidget(WebBrowser, (*mCurrentWebBrowser)); showTabAtTop(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool()); adaptToolBar(); mTrapFlashController = new UBTrapFlashController((*mCurrentWebBrowser)); connect((*mCurrentWebBrowser), SIGNAL(activeViewPageChanged()), this, SLOT(activePageChanged())); (*mCurrentWebBrowser)->loadUrl(currentUrl); (*mCurrentWebBrowser)->tabWidget()->tabBar()->show(); (*mCurrentWebBrowser)->tabWidget()->lineEdits()->show(); } UBApplication::applicationController->setMirrorSourceWidget((*mCurrentWebBrowser)->paintWidget()); mStackedWidget->setCurrentIndex(WebBrowser); mMainWindow->switchToWebWidget(); setupPalettes(); screenLayoutChanged(); bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool(); UBApplication::mainWindow->actionWebShowHideOnDisplay->setChecked(mirroring); (*mToolsCurrentPalette)->show(); }
void UIMachineLogicSeamless::prepareMachineWindows() { /* Do not create window(s) if they created already: */ if (isMachineWindowsCreated()) return; #ifdef Q_WS_MAC // TODO: Is that really need here? /* We have to make sure that we are getting the front most process. * This is necessary for Qt versions > 4.3.3: */ ::darwinSetFrontMostProcess(); #endif /* Q_WS_MAC */ /* Update the multi screen layout: */ m_pScreenLayout->update(); /* Create machine window(s): */ for (int cScreenId = 0; cScreenId < m_pScreenLayout->guestScreenCount(); ++cScreenId) addMachineWindow(UIMachineWindow::create(this, cScreenId)); /* Connect screen-layout change handler: */ for (int i = 0; i < machineWindows().size(); ++i) connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()), static_cast<UIMachineWindowSeamless*>(machineWindows()[i]), SLOT(sltPlaceOnScreen())); /* Remember what machine window(s) created: */ setMachineWindowsCreated(true); }
void UIMachineLogicFullscreen::prepareMachineWindows() { /* Do not create window(s) if they created already: */ if (isMachineWindowsCreated()) return; #ifdef Q_WS_MAC // TODO: Is that "darwinSetFrontMostProcess" really need here? /* We have to make sure that we are getting the front most process. * This is necessary for Qt versions > 4.3.3: */ ::darwinSetFrontMostProcess(); #endif /* Q_WS_MAC */ /* Update the multi screen layout: */ m_pScreenLayout->update(); /* Create machine window(s): */ for (int cScreenId = 0; cScreenId < m_pScreenLayout->guestScreenCount(); ++cScreenId) addMachineWindow(UIMachineWindow::create(this, cScreenId)); /* Connect screen-layout change handler: */ for (int i = 0; i < machineWindows().size(); ++i) connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()), static_cast<UIMachineWindowFullscreen*>(machineWindows()[i]), SLOT(sltPlaceOnScreen())); #ifdef Q_WS_MAC /* If the user change the screen, we have to decide again if the * presentation mode should be changed. */ connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()), this, SLOT(sltScreenLayoutChanged())); /* Note: Presentation mode has to be set *after* the windows are created. */ setPresentationModeEnabled(true); #endif /* Q_WS_MAC */ /* Remember what machine window(s) created: */ setMachineWindowsCreated(true); }