Skip to content

Commit

Permalink
MW-730 [HOME] Connections and icons missing
Browse files Browse the repository at this point in the history
- Resaved fabric images as they couldn't be read by cairo.
- OSX: always load hires images if possible (and needed).
- mforms: removed obsolete XXX tag.

Reviewed by: lolek (rb: 8137)
  • Loading branch information
mike-lischke committed Feb 24, 2015
1 parent b82da13 commit 3e5cfc0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions backend/wbprivate/workbench/home_screen_connections.cpp
Expand Up @@ -287,9 +287,9 @@ class wb::ConnectionInfoPopup : public mforms::Popup
cairo_select_font_face(cr, HOME_DETAILS_FONT, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(cr, HOME_DETAILS_FONT_SIZE);
if (is_fabric)
print_fabric_details_text(cr, content_bounds);
print_fabric_details_text(cr, content_bounds);
else
print_details_text(cr, content_bounds);
print_details_text(cr, content_bounds);

// Buttons at the bottom.
base::Point position = base::Point(content_bounds.left(), content_bounds.bottom() - POPUP_BUTTON_HEIGHT);
Expand Down Expand Up @@ -1389,15 +1389,15 @@ ConnectionsSection::ConnectionsSection(HomeScreen *owner)
_mouse_over_icon = mforms::Utilities::load_icon("wb_tile_mouseover.png");
_mouse_over2_icon = mforms::Utilities::load_icon("wb_tile_mouseover_2.png");
_network_icon = mforms::Utilities::load_icon("wb_tile_network.png");
// TODO: We need an tile icon for the group filter and the status
// TODO: We need a tile icon for the group filter and the status.
_ha_filter_icon = mforms::Utilities::load_icon("wb_tile_network.png");
_managed_status_icon = mforms::Utilities::load_icon("wb_tile_network.png");
_page_down_icon = mforms::Utilities::load_icon("wb_tile_page-down.png");
_page_up_icon = mforms::Utilities::load_icon("wb_tile_page-up.png");
_plus_icon = mforms::Utilities::load_icon("wb_tile_plus.png");
_sakila_icon = mforms::Utilities::load_icon("wb_tile_sakila.png");
_fabric_icon = mforms::Utilities::load_icon("wb_tile_fabric.png");
_schema_icon = mforms::Utilities::load_icon("wb_tile_schema.png", true);
_schema_icon = mforms::Utilities::load_icon("wb_tile_schema.png");
_user_icon = mforms::Utilities::load_icon("wb_tile_user.png");
_manage_icon = mforms::Utilities::load_icon("wb_tile_manage.png");

Expand Down
Binary file modified images/home/wb_tile_fabric.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/home/wb_tile_fabric@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions library/forms/mforms/utilities.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -322,7 +322,6 @@ namespace mforms {

static std::string shorten_string(cairo_t* cr, const std::string& text, double width);

//XXX TODO Linux, Windows
static double get_text_width(const std::string &text, const std::string &font);
#endif

Expand Down
11 changes: 8 additions & 3 deletions library/forms/utilities.cpp
Expand Up @@ -738,10 +738,15 @@ cairo_surface_t* Utilities::load_icon(const std::string& name, bool allow_hidpi)
if (name.empty())
return NULL;

#ifdef __APPLE__
allow_hidpi = true; // For OSX we always want hires images.
#endif

if (allow_hidpi && mforms::App::get()->backing_scale_factor() > 1.0)
{
std::string hidpi_name = base::strip_extension(name) + "@2x" + base::extension(name);
cairo_surface_t *tmp = load_icon(hidpi_name, false);
std::string icon_path = App::get()->get_resource_path(hidpi_name);
cairo_surface_t *tmp = mdc::surface_from_png_image(icon_path);
if (tmp)
{
// Mark the surface as being a hi-res variant of a standard icon.
Expand All @@ -750,8 +755,8 @@ cairo_surface_t* Utilities::load_icon(const std::string& name, bool allow_hidpi)
}
}

std::string icon_path= App::get()->get_resource_path(name);
return mdc::surface_from_png_image(icon_path.c_str());
std::string icon_path = App::get()->get_resource_path(name);
return mdc::surface_from_png_image(icon_path);
}

//--------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 3e5cfc0

Please sign in to comment.