From 7220a630342a4f7779b05fbb7079a78e84694aa4 Mon Sep 17 00:00:00 2001 From: Didier Clerc Date: Thu, 18 Oct 2012 11:43:12 +0200 Subject: [PATCH] Handling the multiscreen option --- src/core/UBApplication.cpp | 10 ++++++++++ src/core/UBApplication.h | 2 ++ src/core/UBPreferencesController.cpp | 1 + 3 files changed, 13 insertions(+) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index f673cc35..8ae3d589 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -55,6 +55,7 @@ #include "frameworks/UBCryptoUtils.h" #include "tools/UBToolsManager.h" +#include "UBDisplayManager.h" #include "core/memcheck.h" QPointer UBApplication::undoStack; @@ -378,9 +379,18 @@ int UBApplication::exec(const QString& pFileToImport) else applicationController->showBoard(); + onScreenCountChanged(1); + connect(desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(onScreenCountChanged(int))); return QApplication::exec(); } +void UBApplication::onScreenCountChanged(int newCount) +{ + Q_UNUSED(newCount); + UBDisplayManager displayManager; + mainWindow->actionMultiScreen->setEnabled(displayManager.numScreens() > 1); +} + void UBApplication::importUniboardFiles() { mUniboardSankoreTransition = new UniboardSankoreTransition(); diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index b08fdcee..9726cd52 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -117,6 +117,8 @@ class UBApplication : public QtSingleApplication #endif void importUniboardFiles(); + void onScreenCountChanged(int newCount); + private: void updateProtoActionsState(); void setupTranslators(QStringList args); diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp index 06f62b5d..8bfede9f 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -88,6 +88,7 @@ UBPreferencesController::~UBPreferencesController() void UBPreferencesController::adjustScreens(int screen) { + Q_UNUSED(screen); UBDisplayManager displayManager; mPreferencesUI->multiDisplayGroupBox->setEnabled(displayManager.numScreens() > 1); }