summaryrefslogtreecommitdiff
path: root/lockscreen
diff options
authorhandsome_feng <445865575@qq.com>2015-10-19 11:39:30 +0800
committerhandsome_feng <445865575@qq.com>2015-10-19 11:39:30 +0800
commitbb53d8e55a33efac325e5b68afb2020735e80193 (patch)
tree7e7f774427727e4dd3b7733824545f947f4e4473 /lockscreen
parenta10ebc28ad71adff2d51868eb9aeb71283e63008 (diff)
update something
(bzr r4016.2.6)
Diffstat (limited to 'lockscreen')
-rw-r--r--lockscreen/KylinLockScreenShield.cpp2
-rw-r--r--lockscreen/KylinUserPromptView.cpp34
-rw-r--r--lockscreen/LockScreenController.cpp2
-rw-r--r--lockscreen/LockScreenController.h2
-rw-r--r--lockscreen/LockScreenShield.cpp2
-rw-r--r--lockscreen/LockScreenShield.h2
-rw-r--r--lockscreen/LockScreenShieldFactory.cpp2
-rw-r--r--lockscreen/LockScreenShieldFactory.h3
8 files changed, 16 insertions, 33 deletions
diff --git a/lockscreen/KylinLockScreenShield.cpp b/lockscreen/KylinLockScreenShield.cpp
index 3a6c0dfbe..53364ab49 100644
--- a/lockscreen/KylinLockScreenShield.cpp
+++ b/lockscreen/KylinLockScreenShield.cpp
@@ -165,7 +165,7 @@ void KylinShield::ShowPrimaryView()
SetLayout(primary_layout_.GetPointer());
prompt_layout_ = new nux::HLayout();
- prompt_layout_->SetLeftAndRightPadding(9 * Settings::GRID_SIZE.CP(scale));
+ prompt_layout_->SetLeftAndRightPadding(11 * Settings::GRID_SIZE.CP(scale));
if (prompt_view_)
{
diff --git a/lockscreen/KylinUserPromptView.cpp b/lockscreen/KylinUserPromptView.cpp
index 0f2fcb4da..b9dae0f14 100644
--- a/lockscreen/KylinUserPromptView.cpp
+++ b/lockscreen/KylinUserPromptView.cpp
@@ -47,8 +47,9 @@ const RawPixel PADDING = 10_em;
const RawPixel LAYOUT_MARGIN = 20_em;
const RawPixel MSG_LAYOUT_MARGIN = 15_em;
const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;
-const RawPixel ICON_SIZE = 32_em;
+const RawPixel SWITCH_ICON_SIZE = 32_em;
const RawPixel AVATAR_SIZE = 128_em;
+const RawPixel TEXT_INPUT_WIDTH = 281_em;
const int PROMPT_FONT_SIZE = 14;
std::string SanitizeMessage(std::string const& message)
@@ -120,25 +121,17 @@ void KylinUserPromptView::ResetLayout()
nux::Layout* switch_layout = new nux::HLayout();
TextureCache& cache = TextureCache::GetDefault();
- SwitchIcon_ = new IconTexture(cache.FindTexture("cof.png", ICON_SIZE, ICON_SIZE));
+ SwitchIcon_ = new IconTexture(cache.FindTexture("cof.png", SWITCH_ICON_SIZE, SWITCH_ICON_SIZE));
switch_layout->AddView(SwitchIcon_);
SwitchIcon_->mouse_click.connect([this](int x, int y, unsigned long button_flags, unsigned long key_flags) {
session_manager_->SwitchToGreeter();
});
-
- unity::StaticCairoText* switch_label = new unity::StaticCairoText(_("Switch User"));
- switch_label->SetScale(scale);
- switch_layout->AddView(switch_label);
-
- switch_layout->SetMaximumSize(128, ICON_SIZE);
-
+ switch_layout->SetMaximumSize(SWITCH_ICON_SIZE, SWITCH_ICON_SIZE);
GetLayout()->AddLayout(switch_layout);
-// Avatar_ = new IconTexture(session_manager_->UserIconFile(), AVATAR_SIZE);
Avatar_ = new IconTexture(LoadUserIcon(AVATAR_SIZE));
Avatar_->SetMinimumWidth(AVATAR_SIZE);
Avatar_->SetMaximumWidth(AVATAR_SIZE);
-
GetLayout()->AddView(Avatar_);
nux::Layout* prompt_layout = new nux::VLayout();
@@ -166,7 +159,7 @@ void KylinUserPromptView::ResetLayout()
void KylinUserPromptView::UpdateSize()
{
- auto width = 15 * Settings::GRID_SIZE.CP(scale);
+ auto width = 12 * Settings::GRID_SIZE.CP(scale);
auto height = 3 * Settings::GRID_SIZE.CP(scale);
SetMinimumWidth(width);
@@ -177,7 +170,7 @@ void KylinUserPromptView::UpdateSize()
{
layout->SetLeftAndRightPadding(PADDING.CP(scale));
layout->SetTopAndBottomPadding(PADDING.CP(scale));
- static_cast<nux::VLayout*>(layout)->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale));
+// static_cast<nux::HLayout*>(layout)->SetHorizontalInternalMargin(300);//LAYOUT_MARGIN.CP(scale));
}
if (username_)
@@ -189,7 +182,7 @@ void KylinUserPromptView::UpdateSize()
for (auto* area : msg_layout_->GetChildren())
{
- area->SetMaximumWidth(width);
+ area->SetMaximumWidth(TEXT_INPUT_WIDTH);
static_cast<StaticCairoText*>(area)->SetScale(scale);
}
}
@@ -203,6 +196,8 @@ void KylinUserPromptView::UpdateSize()
auto* text_input = static_cast<TextInput*>(area);
text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
+ text_input->SetMinimumWidth(TEXT_INPUT_WIDTH.CP(scale));
+ text_input->SetMaximumWidth(TEXT_INPUT_WIDTH.CP(scale));
text_input->scale = scale();
}
}
@@ -292,6 +287,8 @@ void KylinUserPromptView::AddPrompt(std::string const& message, bool visible, Pr
text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
+ text_input->SetMinimumWidth(TEXT_INPUT_WIDTH.CP(scale));
+ text_input->SetMaximumWidth(TEXT_INPUT_WIDTH.CP(scale));
prompt_layout_->AddView(text_input, 1);
focus_queue_.push_back(text_input);
@@ -330,13 +327,12 @@ void KylinUserPromptView::AddPrompt(std::string const& message, bool visible, Pr
void KylinUserPromptView::AddMessage(std::string const& message, nux::Color const& color)
{
- nux::Geometry const& geo = GetGeometry();
auto* view = new unity::StaticCairoText("");
view->SetScale(scale);
view->SetFont(Settings::Instance().font_name());
view->SetTextColor(color);
view->SetText(message);
- view->SetMaximumWidth(geo.width - PADDING.CP(scale)*2);
+ view->SetMaximumWidth(TEXT_INPUT_WIDTH.CP(scale));
msg_layout_->AddView(view);
GetLayout()->ComputeContentPosition(0, 0);
@@ -345,15 +341,15 @@ void KylinUserPromptView::AddMessage(std::string const& message, nux::Color cons
QueueDraw();
}
-nux::ObjectPtr<nux::BaseTexture> KylinUserPromptView::LoadUserIcon(int icon_size)
+nux::ObjectPtr<nux::BaseTexture> KylinUserPromptView::LoadUserIcon(int SWITCH_ICON_SIZE)
{
glib::Error error;
- glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_size(session_manager_->UserIconFile().c_str(), icon_size, icon_size, &error));
+ glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_size(session_manager_->UserIconFile().c_str(), SWITCH_ICON_SIZE, SWITCH_ICON_SIZE, &error));
if (pixbuf == nullptr)
{
auto* theme = gtk_icon_theme_get_default();
GtkIconLookupFlags flags = GTK_ICON_LOOKUP_FORCE_SIZE;
- pixbuf = gtk_icon_theme_load_icon(theme, "avatar-default", icon_size, flags, &error);
+ pixbuf = gtk_icon_theme_load_icon(theme, "avatar-default", SWITCH_ICON_SIZE, flags, &error);
}
nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
cairo_t* cr = cg.GetInternalContext();
diff --git a/lockscreen/LockScreenController.cpp b/lockscreen/LockScreenController.cpp
index 572c7a8fb..9b1e44e11 100644
--- a/lockscreen/LockScreenController.cpp
+++ b/lockscreen/LockScreenController.cpp
@@ -218,7 +218,6 @@ void Controller::EnsureShields(std::vector<nux::Geometry> const& monitors)
int primary = UScreen::GetDefault()->GetMonitorWithMouse();
// Keep a reference of the old prompt_view
-// nux::ObjectPtr<UserPromptView> prompt_view(prompt_view_.GetPointer());
nux::ObjectPtr<AbstractUserPromptView> prompt_view(prompt_view_.GetPointer());
shields_.resize(num_monitors);
@@ -230,7 +229,6 @@ void Controller::EnsureShields(std::vector<nux::Geometry> const& monitors)
else
prompt_view = test_mode_ ? nullptr : new KylinUserPromptView(session_manager_);
prompt_view_ = prompt_view.GetPointer();
-// new KylinUserPromptView(session_manager_);
}
for (int i = 0; i < num_monitors; ++i)
diff --git a/lockscreen/LockScreenController.h b/lockscreen/LockScreenController.h
index 4887744be..d190fb93c 100644
--- a/lockscreen/LockScreenController.h
+++ b/lockscreen/LockScreenController.h
@@ -41,7 +41,6 @@ namespace unity
namespace lockscreen
{
-//class UserPromptView;
class AbstractUserPromptView;
class Controller : public sigc::trackable
@@ -83,7 +82,6 @@ private:
std::vector<nux::ObjectPtr<AbstractShield>> shields_;
nux::ObjectWeakPtr<AbstractShield> primary_shield_;
-// nux::ObjectWeakPtr<UserPromptView> prompt_view_;
nux::ObjectWeakPtr<AbstractUserPromptView> prompt_view_;
nux::ObjectPtr<nux::BaseWindow> blank_window_;
diff --git a/lockscreen/LockScreenShield.cpp b/lockscreen/LockScreenShield.cpp
index 4978875b6..6199981e1 100644
--- a/lockscreen/LockScreenShield.cpp
+++ b/lockscreen/LockScreenShield.cpp
@@ -27,7 +27,6 @@
#include "CofView.h"
#include "LockScreenPanel.h"
#include "LockScreenSettings.h"
-//#include "UserPromptView.h"
#include "LockScreenAbstractPromptView.h"
#include "unity-shared/UScreen.h"
@@ -46,7 +45,6 @@ const unsigned MAX_GRAB_WAIT = 100;
Shield::Shield(session::Manager::Ptr const& session_manager,
indicator::Indicators::Ptr const& indicators,
Accelerators::Ptr const& accelerators,
-// nux::ObjectPtr<UserPromptView> const& prompt_view,
nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
int monitor_num, bool is_primary)
: AbstractShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary)
diff --git a/lockscreen/LockScreenShield.h b/lockscreen/LockScreenShield.h
index 0b38a42b9..7c2e31380 100644
--- a/lockscreen/LockScreenShield.h
+++ b/lockscreen/LockScreenShield.h
@@ -31,7 +31,6 @@ namespace lockscreen
class BackgroundSettings;
class UserAuthenticator;
-//class UserPromptView;
class AbstractUserPromptView;
class Panel;
class CofView;
@@ -42,7 +41,6 @@ public:
Shield(session::Manager::Ptr const&,
indicator::Indicators::Ptr const&,
Accelerators::Ptr const&,
-// nux::ObjectPtr<UserPromptView> const&,
nux::ObjectPtr<AbstractUserPromptView> const&,
int monitor, bool is_primary);
diff --git a/lockscreen/LockScreenShieldFactory.cpp b/lockscreen/LockScreenShieldFactory.cpp
index 72bf11beb..032689993 100644
--- a/lockscreen/LockScreenShieldFactory.cpp
+++ b/lockscreen/LockScreenShieldFactory.cpp
@@ -19,7 +19,6 @@
#include "LockScreenShieldFactory.h"
#include "LockScreenShield.h"
-//#include "UserPromptView.h"
#include "LockScreenAbstractPromptView.h"
#include "KylinLockScreenShield.h"
@@ -31,7 +30,6 @@ namespace lockscreen
nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager,
indicator::Indicators::Ptr const& indicators,
Accelerators::Ptr const& accelerators,
-// nux::ObjectPtr<UserPromptView> const& prompt_view,
nux::ObjectPtr<AbstractUserPromptView> const& prompt_view,
int monitor, bool is_primary)
{
diff --git a/lockscreen/LockScreenShieldFactory.h b/lockscreen/LockScreenShieldFactory.h
index 58c3b2c26..b841e1288 100644
--- a/lockscreen/LockScreenShieldFactory.h
+++ b/lockscreen/LockScreenShieldFactory.h
@@ -31,7 +31,6 @@ class MockableBaseWindow;
namespace lockscreen
{
-//class UserPromptView;
class AbstractUserPromptView;
struct ShieldFactoryInterface
@@ -43,7 +42,6 @@ struct ShieldFactoryInterface
virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
indicator::Indicators::Ptr const&,
Accelerators::Ptr const&,
-// nux::ObjectPtr<UserPromptView> const&,
nux::ObjectPtr<AbstractUserPromptView> const&,
int monitor, bool is_primary) = 0;
};
@@ -53,7 +51,6 @@ struct ShieldFactory : ShieldFactoryInterface
nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
indicator::Indicators::Ptr const&,
Accelerators::Ptr const&,
-// nux::ObjectPtr<UserPromptView> const&,
nux::ObjectPtr<AbstractUserPromptView> const&,
int monitor, bool is_primary) override;
};