Commit 56e49c1f authored by Aleksei Kanash's avatar Aleksei Kanash

Fixed screens initialization order and logic.

parent b36627ae
...@@ -289,7 +289,6 @@ int UBApplication::exec(const QString& pFileToImport) ...@@ -289,7 +289,6 @@ int UBApplication::exec(const QString& pFileToImport)
bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool(); bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool();
mainWindow->actionMultiScreen->setChecked(bUseMultiScreen); mainWindow->actionMultiScreen->setChecked(bUseMultiScreen);
applicationController->useMultiScreen(bUseMultiScreen);
connect(mainWindow->actionMultiScreen, SIGNAL(triggered(bool)), applicationController, SLOT(useMultiScreen(bool))); connect(mainWindow->actionMultiScreen, SIGNAL(triggered(bool)), applicationController, SLOT(useMultiScreen(bool)));
connect(mainWindow->actionWidePageSize, SIGNAL(triggered(bool)), boardController, SLOT(setWidePageSize(bool))); connect(mainWindow->actionWidePageSize, SIGNAL(triggered(bool)), boardController, SLOT(setWidePageSize(bool)));
connect(mainWindow->actionRegularPageSize, SIGNAL(triggered(bool)), boardController, SLOT(setRegularPageSize(bool))); connect(mainWindow->actionRegularPageSize, SIGNAL(triggered(bool)), boardController, SLOT(setRegularPageSize(bool)));
...@@ -299,7 +298,7 @@ int UBApplication::exec(const QString& pFileToImport) ...@@ -299,7 +298,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionCopy, SIGNAL(triggered()), applicationController, SLOT(actionCopy())); connect(mainWindow->actionCopy, SIGNAL(triggered()), applicationController, SLOT(actionCopy()));
connect(mainWindow->actionPaste, SIGNAL(triggered()), applicationController, SLOT(actionPaste())); connect(mainWindow->actionPaste, SIGNAL(triggered()), applicationController, SLOT(actionPaste()));
applicationController->initScreenLayout(); applicationController->initScreenLayout(bUseMultiScreen);
boardController->setupLayout(); boardController->setupLayout();
if (pFileToImport.length() > 0) if (pFileToImport.length() > 0)
......
...@@ -135,14 +135,15 @@ void UBApplicationController::initViewState(int horizontalPosition, int vertical ...@@ -135,14 +135,15 @@ void UBApplicationController::initViewState(int horizontalPosition, int vertical
} }
void UBApplicationController::initScreenLayout() void UBApplicationController::initScreenLayout(bool useMultiscreen)
{ {
mDisplayManager->setAsControl(mMainWindow, true); mDisplayManager->setAsControl(mMainWindow);
mDisplayManager->setAsDisplay(mDisplayView); mDisplayManager->setAsDisplay(mDisplayView);
mDisplayManager->setAsPreviousDisplays(mPreviousViews); mDisplayManager->setAsPreviousDisplays(mPreviousViews);
mDisplayManager->setAsDesktop(mUninoteController->drawingView()); mDisplayManager->setAsDesktop(mUninoteController->drawingView());
mDisplayManager->setUseMultiScreen(bMultiScreen);
mDisplayManager->adjustScreens(-1); mDisplayManager->adjustScreens(-1);
} }
...@@ -343,7 +344,6 @@ void UBApplicationController::showBoard() ...@@ -343,7 +344,6 @@ void UBApplicationController::showBoard()
mirroringEnabled(false); mirroringEnabled(false);
mMainWindow->switchToBoardWidget(); mMainWindow->switchToBoardWidget();
mDisplayManager->setAsDisplay(mDisplayView);
if (UBApplication::boardController) if (UBApplication::boardController)
UBApplication::boardController->show(); UBApplication::boardController->show();
...@@ -353,7 +353,7 @@ void UBApplicationController::showBoard() ...@@ -353,7 +353,7 @@ void UBApplicationController::showBoard()
mUninoteController->hideWindow(); mUninoteController->hideWindow();
mDisplayManager->adjustScreens(0); mMainWindow->show();
emit mainModeChanged(Board); emit mainModeChanged(Board);
...@@ -727,6 +727,7 @@ void UBApplicationController::importFile(const QString& pFilePath) ...@@ -727,6 +727,7 @@ void UBApplicationController::importFile(const QString& pFilePath)
void UBApplicationController::useMultiScreen(bool use) void UBApplicationController::useMultiScreen(bool use)
{ {
mDisplayManager->setUseMultiScreen(use); mDisplayManager->setUseMultiScreen(use);
mDisplayManager->adjustScreens(0);
UBSettings::settings()->appUseMultiscreen->set(use); UBSettings::settings()->appUseMultiscreen->set(use);
} }
......
...@@ -51,7 +51,7 @@ class UBApplicationController : public QObject ...@@ -51,7 +51,7 @@ class UBApplicationController : public QObject
void blackout(); void blackout();
void initScreenLayout(); void initScreenLayout(bool useMultiscreen);
void closing(); void closing();
......
...@@ -123,11 +123,6 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init) ...@@ -123,11 +123,6 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init)
if(hasControl() && pControlWidget && (pControlWidget != mControlWidget)) if(hasControl() && pControlWidget && (pControlWidget != mControlWidget))
{ {
mControlWidget = pControlWidget; mControlWidget = pControlWidget;
mControlWidget->hide();
mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
if (!init)
mControlWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow); // mControlWidget->setAttribute(Qt::WA_MacNoShadow);
...@@ -140,9 +135,6 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget ) ...@@ -140,9 +135,6 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget )
if(pControlWidget && (pControlWidget != mControlWidget)) if(pControlWidget && (pControlWidget != mControlWidget))
{ {
mDesktopWidget = pControlWidget; mDesktopWidget = pControlWidget;
mDesktopWidget->hide();
mDesktopWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
// mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow); // mControlWidget->setAttribute(Qt::WA_MacNoShadow);
...@@ -155,9 +147,6 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget) ...@@ -155,9 +147,6 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
if(pDisplayWidget && (pDisplayWidget != mDisplayWidget)) if(pDisplayWidget && (pDisplayWidget != mDisplayWidget))
{ {
mDisplayWidget = pDisplayWidget; mDisplayWidget = pDisplayWidget;
mDisplayWidget->hide();
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// mDisplayWidget->setAttribute(Qt::WA_MacNoShadow); // mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
...@@ -310,6 +299,5 @@ void UBDisplayManager::setRoleToScreen(DisplayRole role, int screenIndex) ...@@ -310,6 +299,5 @@ void UBDisplayManager::setRoleToScreen(DisplayRole role, int screenIndex)
void UBDisplayManager::setUseMultiScreen(bool pUse) void UBDisplayManager::setUseMultiScreen(bool pUse)
{ {
mUseMultiScreen = pUse; mUseMultiScreen = pUse;
adjustScreens(0);
} }
...@@ -33,13 +33,13 @@ class UBDisplayManager : public QObject ...@@ -33,13 +33,13 @@ class UBDisplayManager : public QObject
int numPreviousViews(); int numPreviousViews();
void setAsControl(QWidget* pControlWidget, bool init = false); void setControlWidget(QWidget* pControlWidget);
void setAsDisplay(QWidget* pDisplayWidget); void setDisplayWidget(QWidget* pDisplayWidget);
void setAsDesktop(QWidget* pControlWidget); void setDesktopWidget(QWidget* pControlWidget);
void setAsPreviousDisplays(QList<UBBoardView*> pPreviousViews); void setPreviousDisplaysWidgets(QList<UBBoardView*> pPreviousViews);
bool hasControl() bool hasControl()
{ {
...@@ -77,7 +77,7 @@ class UBDisplayManager : public QObject ...@@ -77,7 +77,7 @@ class UBDisplayManager : public QObject
public slots: public slots:
void swapScreens(bool bswap); void reinitScreens(bool bswap);
void adjustScreens(int screen); void adjustScreens(int screen);
......
...@@ -118,7 +118,7 @@ void UBPreferencesController::wire() ...@@ -118,7 +118,7 @@ void UBPreferencesController::wire()
connect(mPreferencesUI->useExternalBrowserCheckBox, SIGNAL(clicked(bool)), settings->webUseExternalBrowser, SLOT(setBool(bool))); connect(mPreferencesUI->useExternalBrowserCheckBox, SIGNAL(clicked(bool)), settings->webUseExternalBrowser, SLOT(setBool(bool)));
connect(mPreferencesUI->displayBrowserPageCheckBox, SIGNAL(clicked(bool)), settings->webShowPageImmediatelyOnMirroredScreen, SLOT(setBool(bool))); connect(mPreferencesUI->displayBrowserPageCheckBox, SIGNAL(clicked(bool)), settings->webShowPageImmediatelyOnMirroredScreen, SLOT(setBool(bool)));
connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), settings->swapControlAndDisplayScreens, SLOT(setBool(bool))); connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), settings->swapControlAndDisplayScreens, SLOT(setBool(bool)));
connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), UBApplication::applicationController->displayManager(), SLOT(swapScreens(bool))); connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), UBApplication::applicationController->displayManager(), SLOT(reinitScreens(bool)));
connect(mPreferencesUI->toolbarAtTopRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool))); connect(mPreferencesUI->toolbarAtTopRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
connect(mPreferencesUI->toolbarAtBottomRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool))); connect(mPreferencesUI->toolbarAtBottomRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
......
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