diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-12-04 09:17:46 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-12-04 09:17:46 +0100 |
| commit | dc8cbcb65a3918d4fc7933d84016de6fa5433a3e (patch) | |
| tree | 0bebbfb219c6d028876a11d8135e6467b3332d6e /lockscreen | |
| parent | bbbfdc89681093f0a28f6efb942aad4cb0e4e7b0 (diff) | |
LockScreenPromptFactory: add factory to create prompt views
(bzr r4016.3.2)
Diffstat (limited to 'lockscreen')
| -rw-r--r-- | lockscreen/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | lockscreen/LockScreenController.cpp | 10 | ||||
| -rw-r--r-- | lockscreen/LockScreenPromptFactory.cpp | 42 | ||||
| -rw-r--r-- | lockscreen/LockScreenPromptFactory.h | 42 | ||||
| -rw-r--r-- | lockscreen/LockScreenShieldFactory.cpp | 1 | ||||
| -rw-r--r-- | lockscreen/LockScreenShieldFactory.h | 9 |
6 files changed, 93 insertions, 12 deletions
diff --git a/lockscreen/CMakeLists.txt b/lockscreen/CMakeLists.txt index 97857a36a..86d3f492e 100644 --- a/lockscreen/CMakeLists.txt +++ b/lockscreen/CMakeLists.txt @@ -27,6 +27,7 @@ set (LOCKSCREEN_SOURCES LockScreenShield.cpp LockScreenShieldFactory.cpp LockScreenPanel.cpp + LockScreenPromptFactory.cpp LockScreenAcceleratorController.cpp LockScreenAccelerators.cpp ScreenSaverDBusManager.cpp diff --git a/lockscreen/LockScreenController.cpp b/lockscreen/LockScreenController.cpp index f6dda343d..3bd91a0b3 100644 --- a/lockscreen/LockScreenController.cpp +++ b/lockscreen/LockScreenController.cpp @@ -23,13 +23,12 @@ #include <UnityCore/GLibDBusProxy.h> #include <NuxCore/Logger.h> -#include "KylinUserPromptView.h" +#include "LockScreenAbstractPromptView.h" +#include "LockScreenPromptFactory.h" #include "LockScreenShield.h" #include "LockScreenSettings.h" -#include "UserPromptView.h" #include "unity-shared/AnimationUtils.h" #include "unity-shared/UScreen.h" -#include "unity-shared/UnitySettings.h" #include "unity-shared/WindowManager.h" namespace unity @@ -227,10 +226,7 @@ void Controller::EnsureShields(std::vector<nux::Geometry> const& monitors) if (!prompt_view) { - if (unity::Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN) - prompt_view = test_mode_ ? nullptr : new KylinUserPromptView(session_manager_); - else - prompt_view = test_mode_ ? nullptr : new UserPromptView(session_manager_); + prompt_view = test_mode_ ? nux::ObjectPtr<AbstractUserPromptView>() : PromptFactory::CreatePrompt(session_manager_); prompt_view_ = prompt_view.GetPointer(); } diff --git a/lockscreen/LockScreenPromptFactory.cpp b/lockscreen/LockScreenPromptFactory.cpp new file mode 100644 index 000000000..02e39eb24 --- /dev/null +++ b/lockscreen/LockScreenPromptFactory.cpp @@ -0,0 +1,42 @@ +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- +/* +* Copyright (C) 2015 Canonical Ltd +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 3 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* Authored by: Marco Trevisan <marco.trevisan@canonical.com> +*/ + +#include "LockScreenPromptFactory.h" +#include "KylinUserPromptView.h" +#include "UserPromptView.h" +#include "unity-shared/UnitySettings.h" + +namespace unity +{ +namespace lockscreen +{ +nux::ObjectPtr<AbstractUserPromptView> PromptFactory::CreatePrompt(session::Manager::Ptr const& sm) +{ + nux::ObjectPtr<AbstractUserPromptView> prompt; + + if (unity::Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN) + prompt = new KylinUserPromptView(sm); + else + prompt = new UserPromptView(sm); + + return prompt; +} + +} +} diff --git a/lockscreen/LockScreenPromptFactory.h b/lockscreen/LockScreenPromptFactory.h new file mode 100644 index 000000000..af21e1982 --- /dev/null +++ b/lockscreen/LockScreenPromptFactory.h @@ -0,0 +1,42 @@ +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- +/* +* Copyright (C) 2015 Canonical Ltd +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 3 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* Authored by: Marco Trevisan <marco.trevisan@canonical.com> +*/ + +#ifndef UNITY_LOCKSCREEN_PROMPT_FACTORY +#define UNITY_LOCKSCREEN_PROMPT_FACTORY + +#include <NuxCore/NuxCore.h> +#include <UnityCore/SessionManager.h> + +namespace unity +{ +class MockableBaseWindow; + +namespace lockscreen +{ +class AbstractUserPromptView; + +struct PromptFactory +{ + static nux::ObjectPtr<AbstractUserPromptView> CreatePrompt(session::Manager::Ptr const&); +}; + +} +} + +#endif // UNITY_LOCKSCREEN_PROMPT_FACTORY diff --git a/lockscreen/LockScreenShieldFactory.cpp b/lockscreen/LockScreenShieldFactory.cpp index 1583e67e0..4f8d51ade 100644 --- a/lockscreen/LockScreenShieldFactory.cpp +++ b/lockscreen/LockScreenShieldFactory.cpp @@ -19,7 +19,6 @@ #include "LockScreenShieldFactory.h" #include "LockScreenShield.h" -#include "LockScreenAbstractPromptView.h" #include "KylinLockScreenShield.h" #include "unity-shared/UnitySettings.h" diff --git a/lockscreen/LockScreenShieldFactory.h b/lockscreen/LockScreenShieldFactory.h index aa7e21700..1e66b754d 100644 --- a/lockscreen/LockScreenShieldFactory.h +++ b/lockscreen/LockScreenShieldFactory.h @@ -20,18 +20,19 @@ #ifndef UNITY_LOCKSCREEN_SHIELD_FACTORY #define UNITY_LOCKSCREEN_SHIELD_FACTORY -#include <Nux/Nux.h> -#include "LockScreenBaseShield.h" +#include <NuxCore/NuxCore.h> +#include <UnityCore/SessionManager.h> +#include <UnityCore/Indicators.h> +#include "LockScreenAccelerators.h" namespace unity { - class MockableBaseWindow; namespace lockscreen { - class AbstractUserPromptView; +class BaseShield; struct ShieldFactoryInterface { |
