GUI2/Addon List: improved a bunch of stuff related to inline control buttons
* Flipped the arrow on the Update icon set to point downwards, since it's a download operation. * Renamed existing small Update icon set Publish, and added downwards version to replace Update. * Renamed all addon manager icons and their respective button definitions to be clearer. * Moved unused small icon versions to their own subfolder. * Added separate Publish inline button to image list. This is now used in all cases to publish, regardless of whether the addon has been uploaded previously or not. Prior to this, the Install button was used for non-published addons, and the Update one for published ones. This means the * Refactor addon_list inline button setup to be clearer. * Made inline Uninstall button display in all cases where an addon was installed, instead of just INSTALLED and NSTALLED_UPGRADABLE. It will not display if a publishable addon has not been published, however. * Changed is_local check to match the ADDON_INSTALLED_LOCAL_ONLY. I figured this is a bit more robust. TODO: do the same in the addon manager itself? Art assets credit to @Lordbob
|
@ -362,8 +362,8 @@
|
|||
|
||||
[button]
|
||||
id = "single_install"
|
||||
definition = "install"
|
||||
tooltip = _"Install add-on"
|
||||
definition = "addon_install_small"
|
||||
tooltip = _ "Install add-on"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
@ -385,8 +385,31 @@
|
|||
|
||||
[button]
|
||||
id = "single_update"
|
||||
definition = "update"
|
||||
tooltip = _"Update add-on"
|
||||
definition = "addon_update_small"
|
||||
tooltip = _ "Update add-on"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "single_publish"
|
||||
definition = "addon_publish_small"
|
||||
tooltip = _ "Publish add-on"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
@ -408,7 +431,7 @@
|
|||
|
||||
[button]
|
||||
id = "single_uninstall"
|
||||
definition = "uninstall"
|
||||
definition = "addon_uninstall_small"
|
||||
tooltip = _"Uninstall add-on"
|
||||
[/button]
|
||||
|
||||
|
|
|
@ -375,51 +375,57 @@
|
|||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 64
|
||||
"addon_install"
|
||||
"addon_install_large"
|
||||
"Minimal install button"
|
||||
"icons/addons/addon_install"
|
||||
"icons/addons_manager/install-large"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 64
|
||||
"addon_uninstall"
|
||||
"addon_uninstall_large"
|
||||
"Minimal uninstall button"
|
||||
"icons/addons/addon_uninstall"
|
||||
"icons/addons_manager/uninstall-large"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 64
|
||||
"addon_upgrade"
|
||||
"addon_upgrade_large"
|
||||
"Minimal upgrade button"
|
||||
"icons/addons/addon_update"
|
||||
"icons/addons_manager/update-large"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 64
|
||||
"addon_publish"
|
||||
"addon_publish_large"
|
||||
"Minimal publish button"
|
||||
"icons/addons/addon_publish"
|
||||
"icons/addons_manager/publish-large"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 64
|
||||
"addon_delete"
|
||||
"addon_delete_large"
|
||||
"Minimal delete button"
|
||||
"icons/addons/addon_delete"
|
||||
"icons/addons_manager/delete-large"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 30
|
||||
"install"
|
||||
"addon_install_small"
|
||||
"Minimal install button"
|
||||
"icons/addons/install"
|
||||
"icons/addons_manager/install-small"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 30
|
||||
"uninstall"
|
||||
"addon_uninstall_small"
|
||||
"Minimal install button"
|
||||
"icons/addons/uninstall"
|
||||
"icons/addons_manager/uninstall-small"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 30
|
||||
"update"
|
||||
"addon_update_small"
|
||||
"Minimal install button"
|
||||
"icons/addons/update"
|
||||
"icons/addons_manager/update-small"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 30
|
||||
"addon_publish_small"
|
||||
"Minimal install button"
|
||||
"icons/addons_manager/publish-small"
|
||||
}
|
||||
|
||||
{_GUI_DEFINITION_MINIMAL 30
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
|
||||
[button]
|
||||
id = "install"
|
||||
definition = "addon_install"
|
||||
definition = "addon_install_large"
|
||||
tooltip = _"Install add-on"
|
||||
[/button]
|
||||
|
||||
|
@ -221,7 +221,7 @@
|
|||
|
||||
[button]
|
||||
id = "update"
|
||||
definition = "addon_upgrade"
|
||||
definition = "addon_upgrade_large"
|
||||
tooltip = _"Update add-on"
|
||||
[/button]
|
||||
|
||||
|
@ -243,7 +243,7 @@
|
|||
|
||||
[button]
|
||||
id = "uninstall"
|
||||
definition = "addon_uninstall"
|
||||
definition = "addon_uninstall_large"
|
||||
tooltip = _"Uninstall add-on"
|
||||
[/button]
|
||||
|
||||
|
@ -266,7 +266,7 @@
|
|||
|
||||
[button]
|
||||
id = "publish"
|
||||
definition = "addon_publish"
|
||||
definition = "addon_publish_large"
|
||||
tooltip = _"Publish add-on"
|
||||
[/button]
|
||||
|
||||
|
@ -280,7 +280,7 @@
|
|||
|
||||
[button]
|
||||
id = "delete"
|
||||
definition = "addon_delete"
|
||||
definition = "addon_delete_large"
|
||||
tooltip = _"Delete add-on"
|
||||
[/button]
|
||||
|
||||
|
|
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
images/icons/addons_manager/alt_small_styles/update2-active.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
images/icons/addons_manager/alt_small_styles/update2-pressed.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/icons/addons_manager/alt_small_styles/update2.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
images/icons/addons_manager/update-large-active.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
images/icons/addons_manager/update-large-pressed.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
images/icons/addons_manager/update-large.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
images/icons/addons_manager/update-small-active.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/icons/addons_manager/update-small-pressed.png
Normal file
After Width: | Height: | Size: 993 B |
BIN
images/icons/addons_manager/update-small.png
Normal file
After Width: | Height: | Size: 996 B |
|
@ -36,6 +36,15 @@
|
|||
|
||||
namespace gui2
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const color_t color_outdated {255, 127, 0};
|
||||
|
||||
const unsigned CONTROL_STACK_LAYER_INSTALL = 0;
|
||||
const unsigned CONTROL_STACK_LAYER_UPDATE = 1;
|
||||
const unsigned CONTROL_STACK_LAYER_PUBLISH = 2;
|
||||
|
||||
} // end anon namespace
|
||||
|
||||
REGISTER_WIDGET(addon_list)
|
||||
|
||||
|
@ -51,8 +60,6 @@ addon_list::addon_list(const implementation::builder_addon_list& builder)
|
|||
{
|
||||
}
|
||||
|
||||
static color_t color_outdated {255, 127, 0};
|
||||
|
||||
std::string addon_list::colorize_addon_state_string(const std::string& str, ADDON_STATUS state, bool verbose)
|
||||
{
|
||||
color_t colorname = font::NORMAL_COLOR;
|
||||
|
@ -88,7 +95,7 @@ std::string addon_list::colorize_addon_state_string(const std::string& str, ADDO
|
|||
|
||||
std::string addon_list::describe_status(const addon_tracking_info& info)
|
||||
{
|
||||
std::string tc, tx;
|
||||
std::string tx;
|
||||
|
||||
switch(info.state) {
|
||||
case ADDON_NONE:
|
||||
|
@ -211,84 +218,77 @@ void addon_list::set_addons(const addons_list& addons)
|
|||
// Set special retval for the toggle panels
|
||||
find_widget<toggle_panel>(row_grid, "list_panel", false).set_retval(DEFAULT_ACTION_RETVAL);
|
||||
|
||||
grid* control_grid = find_widget<grid>(row_grid, "single_install_buttons", false, false);
|
||||
if(!control_grid) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Set up the inline control buttons.
|
||||
//
|
||||
stacked_widget& install_update_stack = find_widget<stacked_widget>(row_grid, "install_update_stack", false);
|
||||
|
||||
if(!tracking_info.can_publish) {
|
||||
const bool is_updatable = tracking_info.state == ADDON_INSTALLED_UPGRADABLE;
|
||||
const bool is_installed =
|
||||
tracking_info.state == ADDON_INSTALLED || tracking_info.state == ADDON_INSTALLED_UPGRADABLE;
|
||||
// These three buttons are in the install_update_stack. Only one is shown depending on the addon's state.
|
||||
button& install_button = find_widget<button>(row_grid, "single_install", false);
|
||||
button& update_button = find_widget<button>(row_grid, "single_update", false);
|
||||
button& publish_button = find_widget<button>(row_grid, "single_publish", false);
|
||||
|
||||
install_update_stack.select_layer(static_cast<int>(is_updatable));
|
||||
// This button is always shown.
|
||||
button& uninstall_button = find_widget<button>(row_grid, "single_uninstall", false);
|
||||
|
||||
if(!is_updatable) {
|
||||
button& install_button = find_widget<button>(control_grid, "single_install", false);
|
||||
install_button.set_active(!is_installed);
|
||||
const bool is_installed = is_installed_addon_status(tracking_info.state);
|
||||
const bool is_local = tracking_info.state == ADDON_INSTALLED_LOCAL_ONLY;
|
||||
|
||||
if(install_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(install_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, install_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
} else {
|
||||
button& update_button = find_widget<button>(control_grid, "single_update", false);
|
||||
update_button.set_active(true);
|
||||
// Select the right button layer and set its callback.
|
||||
if(tracking_info.can_publish) {
|
||||
install_update_stack.select_layer(CONTROL_STACK_LAYER_PUBLISH);
|
||||
|
||||
if(update_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(update_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, update_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
}
|
||||
publish_button.set_active(true);
|
||||
|
||||
if(is_installed) {
|
||||
if(uninstall_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(control_grid, "single_uninstall", false),
|
||||
std::bind(&addon_list::addon_action_wrapper, this, uninstall_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
}
|
||||
|
||||
find_widget<button>(control_grid, "single_uninstall", false).set_active(is_installed);
|
||||
|
||||
find_widget<grid>(control_grid, "single_install_buttons", false).set_visible(install_buttons_visibility_);
|
||||
find_widget<label>(row_grid, "installation_status", false).set_visible(install_status_visibility_);
|
||||
} else {
|
||||
const bool is_updatable = tracking_info.state == ADDON_INSTALLED_OUTDATED;
|
||||
const bool can_delete = !addon.local_only;
|
||||
|
||||
button& install_button = find_widget<button>(control_grid, "single_install", false);
|
||||
button& update_button = find_widget<button>(control_grid, "single_update", false);
|
||||
button& uninstall_button = find_widget<button>(control_grid, "single_uninstall", false);
|
||||
|
||||
install_button.set_active(true);
|
||||
update_button.set_active(true);
|
||||
uninstall_button.set_active(can_delete);
|
||||
|
||||
if(true) {
|
||||
connect_signal_mouse_left_click(install_button,
|
||||
if(publish_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(publish_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, publish_function_, std::ref(addon), _3, _4));
|
||||
|
||||
install_button.set_tooltip(_("Publish add-on"));
|
||||
}
|
||||
} else if(tracking_info.state == ADDON_INSTALLED_UPGRADABLE) {
|
||||
install_update_stack.select_layer(CONTROL_STACK_LAYER_UPDATE);
|
||||
|
||||
if(is_updatable) {
|
||||
update_button.set_active(true);
|
||||
|
||||
if(update_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(update_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, publish_function_, std::ref(addon), _3, _4));
|
||||
|
||||
update_button.set_tooltip(_("Send new version to server"));
|
||||
std::bind(&addon_list::addon_action_wrapper, this, update_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
} else {
|
||||
install_update_stack.select_layer(CONTROL_STACK_LAYER_INSTALL);
|
||||
|
||||
if(can_delete) {
|
||||
install_button.set_active(!is_installed);
|
||||
|
||||
if(install_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(install_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, install_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the Uninstall button.
|
||||
if(tracking_info.can_publish) {
|
||||
// Use the uninstall button as a delete-from-server button if the addon's already been published...
|
||||
uninstall_button.set_active(!addon.local_only);
|
||||
|
||||
if(!addon.local_only && delete_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(uninstall_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, delete_function_, std::ref(addon), _3, _4));
|
||||
|
||||
uninstall_button.set_tooltip(_("Delete add-on from server"));
|
||||
}
|
||||
} else {
|
||||
// ... else it functions as normal.
|
||||
uninstall_button.set_active(is_installed);
|
||||
|
||||
install_update_stack.select_layer(static_cast<int>(is_updatable));
|
||||
if(is_installed && uninstall_function_ != nullptr) {
|
||||
connect_signal_mouse_left_click(uninstall_button,
|
||||
std::bind(&addon_list::addon_action_wrapper, this, uninstall_function_, std::ref(addon), _3, _4));
|
||||
}
|
||||
}
|
||||
|
||||
find_widget<grid>(row_grid, "single_install_buttons", false).set_visible(install_buttons_visibility_);
|
||||
find_widget<label>(row_grid, "installation_status", false).set_visible(install_status_visibility_);
|
||||
}
|
||||
|
||||
select_first_addon();
|
||||
|
|