summaryrefslogtreecommitdiff
diff options
authorhandsome_feng <445865575@qq.com>2015-11-12 10:14:37 +0800
committerhandsome_feng <445865575@qq.com>2015-11-12 10:14:37 +0800
commitd6a56f9b78ef585784c2b72810316ff28635881b (patch)
treec2dc9984185d36028bb48714f44d2a6640d59f4e
parent552ce4d44ab796a441d8ddf2a881de4705ad3c44 (diff)
Update the icon to the final version
(bzr r4016.2.25)
-rw-r--r--lockscreen/KylinUserPromptView.cpp9
-rw-r--r--resources/login.pngbin1576 -> 1194 bytes
-rw-r--r--resources/switch_user.pngbin2182 -> 1587 bytes
-rw-r--r--unity-shared/TextInput.cpp44
4 files changed, 8 insertions, 45 deletions
diff --git a/lockscreen/KylinUserPromptView.cpp b/lockscreen/KylinUserPromptView.cpp
index ecdd15f22..a61d4796b 100644
--- a/lockscreen/KylinUserPromptView.cpp
+++ b/lockscreen/KylinUserPromptView.cpp
@@ -47,8 +47,7 @@ const RawPixel LAYOUT_MARGIN = 20_em;
const RawPixel MSG_LAYOUT_MARGIN = 15_em;
const RawPixel MSG_LAYOUT_PADDING = 33_em;
const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;
-const RawPixel SWITCH_ICON_HEIGHT = 32_em;
-const RawPixel SWITCH_ICON_WIDTH = 100_em;
+const RawPixel SWITCH_ICON_SIZE = 32_em;
const RawPixel AVATAR_SIZE = 128_em;
const RawPixel TEXT_INPUT_HEIGHT = 36_em;
const RawPixel TEXT_INPUT_WIDTH = 320_em;
@@ -127,12 +126,12 @@ void KylinUserPromptView::ResetLayout()
nux::Layout* switch_layout = new nux::HLayout();
TextureCache& cache = TextureCache::GetDefault();
- SwitchIcon_ = new IconTexture(cache.FindTexture("switch_user.png", SWITCH_ICON_WIDTH.CP(scale), SWITCH_ICON_HEIGHT.CP(scale)));
+ SwitchIcon_ = new IconTexture(cache.FindTexture("switch_user.png", SWITCH_ICON_SIZE.CP(scale), SWITCH_ICON_SIZE.CP(scale)));
switch_layout->AddView(SwitchIcon_);
SwitchIcon_->mouse_click.connect([this](int x, int y, unsigned long button_flags, unsigned long key_flags) {
session_manager_->SwitchToGreeter();
});
- switch_layout->SetMaximumSize(SWITCH_ICON_WIDTH.CP(scale), SWITCH_ICON_HEIGHT.CP(scale));
+ switch_layout->SetMaximumSize(SWITCH_ICON_SIZE.CP(scale), SWITCH_ICON_SIZE.CP(scale));
GetLayout()->AddLayout(switch_layout);
}
@@ -167,7 +166,7 @@ void KylinUserPromptView::ResetLayout()
void KylinUserPromptView::UpdateSize()
{
- auto width = 15 * Settings::GRID_SIZE.CP(scale);
+ auto width = 13 * Settings::GRID_SIZE.CP(scale);
auto height = 3 * Settings::GRID_SIZE.CP(scale);
SetMinimumWidth(width);
diff --git a/resources/login.png b/resources/login.png
index c845a49db..24abb4b2b 100644
--- a/resources/login.png
+++ b/resources/login.png
Binary files differ
diff --git a/resources/switch_user.png b/resources/switch_user.png
index a495765ec..9d08b5862 100644
--- a/resources/switch_user.png
+++ b/resources/switch_user.png
Binary files differ
diff --git a/unity-shared/TextInput.cpp b/unity-shared/TextInput.cpp
index 70d16ae32..5845beae1 100644
--- a/unity-shared/TextInput.cpp
+++ b/unity-shared/TextInput.cpp
@@ -53,9 +53,7 @@ const RawPixel HINT_PADDING = 3_em;
const RawPixel TOOLTIP_Y_OFFSET = 3_em;
const RawPixel TOOLTIP_OFFSET = 10_em;
const RawPixel DEFAULT_ICON_SIZE = 22_em;
-
-const RawPixel LOGIN_ICON_WIDTH = 62_em;
-const RawPixel LOGIN_ICON_HEIGHT = 36_em;
+const RawPixel LOGIN_ICON_SIZE = 34_em;
std::string WARNING_ICON = "dialog-warning-symbolic";
// Fonts
@@ -103,10 +101,7 @@ TextInput::TextInput(NUX_FILE_LINE_DECL)
, last_height_(-1)
{
layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
- if (g_strcmp0(getenv("KYLIN_CURRENT_DESKTOP"), "Kylin") == 0)
- layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale), 0);
- else
- layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale), TEXT_INPUT_RIGHT_BORDER.CP(scale));
+ layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale), TEXT_INPUT_RIGHT_BORDER.CP(scale));
layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT.CP(scale));
SetLayout(layout_);
@@ -262,42 +257,11 @@ void TextInput::UpdateHintFont()
nux::ObjectPtr<nux::BaseTexture> TextInput::LoadActivatorIcon(int icon_size)
{
+ TextureCache& cache = TextureCache::GetDefault();
if (g_strcmp0(getenv("KYLIN_CURRENT_DESKTOP"), "Kylin") == 0)
- {
- glib::Error error;
- glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_size(PKGDATADIR"/login.png", LOGIN_ICON_WIDTH, LOGIN_ICON_HEIGHT, &error));
-
- if (pixbuf != nullptr)
- {
- nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
- cairo_t* cr = cg.GetInternalContext();
- cairo_text_extents_t et;
- const std::string login = _("Login");
- double x, y;
-
- gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
- cairo_paint(cr);
- cairo_select_font_face(cr, "Ubuntu", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- cairo_set_font_size(cr, 18);
- cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
-
- cairo_text_extents(cr, login.c_str(), &et);
- x = LOGIN_ICON_WIDTH/2 - (et.width/2 + et.x_bearing);
- y = LOGIN_ICON_HEIGHT/2 - (et.height/2 + et.y_bearing);
- cairo_move_to(cr, x, y);
- cairo_show_text(cr, login.c_str());
-
- return texture_ptr_from_cairo_graphics(cg);
- } else {
- TextureCache& cache = TextureCache::GetDefault();
- return cache.FindTexture("arrow_right.png", icon_size, icon_size);
- }
- }
+ return cache.FindTexture("login.png", LOGIN_ICON_SIZE.CP(scale), LOGIN_ICON_SIZE.CP(scale));
else
- {
- TextureCache& cache = TextureCache::GetDefault();
return cache.FindTexture("arrow_right.png", icon_size, icon_size);
- }
}
nux::ObjectPtr<nux::BaseTexture> TextInput::LoadWarningIcon(int icon_size)