Merge branch 'master' into master

This commit is contained in:
toff
2018-09-29 11:31:06 +02:00
committed by GitHub
22 changed files with 825 additions and 143 deletions
+13 -12
View File
@@ -54,6 +54,7 @@
#include "display/window_download_statusbar.h"
#include "display/text_element_string.h"
#include "rpc/parse_commands.h"
#include "control.h"
#include "download.h"
@@ -395,20 +396,20 @@ Download::bind_keys() {
const char* keys = control->ui()->get_throttle_keys();
m_bindings[keys[ 0]] = std::bind(&Download::adjust_up_throttle, this, 1);
m_bindings[keys[ 1]] = std::bind(&Download::adjust_up_throttle, this, -1);
m_bindings[keys[ 2]] = std::bind(&Download::adjust_down_throttle, this, 1);
m_bindings[keys[ 3]] = std::bind(&Download::adjust_down_throttle, this, -1);
m_bindings[keys[ 0]] = std::bind(&Download::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 1]] = std::bind(&Download::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 2]] = std::bind(&Download::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 3]] = std::bind(&Download::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 4]] = std::bind(&Download::adjust_up_throttle, this, 5);
m_bindings[keys[ 5]] = std::bind(&Download::adjust_up_throttle, this, -5);
m_bindings[keys[ 6]] = std::bind(&Download::adjust_down_throttle, this, 5);
m_bindings[keys[ 7]] = std::bind(&Download::adjust_down_throttle, this, -5);
m_bindings[keys[ 4]] = std::bind(&Download::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 5]] = std::bind(&Download::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 6]] = std::bind(&Download::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 7]] = std::bind(&Download::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 8]] = std::bind(&Download::adjust_up_throttle, this, 50);
m_bindings[keys[ 9]] = std::bind(&Download::adjust_up_throttle, this, -50);
m_bindings[keys[10]] = std::bind(&Download::adjust_down_throttle, this, 50);
m_bindings[keys[11]] = std::bind(&Download::adjust_down_throttle, this, -50);
m_bindings[keys[ 8]] = std::bind(&Download::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[ 9]] = std::bind(&Download::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[10]] = std::bind(&Download::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[11]] = std::bind(&Download::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.large"));
}
}
+2 -1
View File
@@ -89,7 +89,8 @@ public:
void adjust_up_throttle(int throttle);
void adjust_down_throttle(int throttle);
display::Window* window() { return NULL; }
display::Window* window() { return NULL; }
core::Download* download() { return m_download; };
private:
Download(const Download&);
+3 -6
View File
@@ -126,16 +126,13 @@ DownloadList::set_current_view(const std::string& name) {
return dynamic_cast<ElementDownloadList*>(m_uiArray[DISPLAY_DOWNLOAD_LIST])->receive_change_view(name);
}
// This should also do focus_next() or something.
void
DownloadList::unfocus_download(core::Download* d) {
if (current_view()->focus() >= current_view()->end_visible() || *current_view()->focus() != d)
return;
if (m_state == DISPLAY_DOWNLOAD)
if (m_state == DISPLAY_DOWNLOAD && d == static_cast<Download*>(m_uiArray[DISPLAY_DOWNLOAD])->download())
activate_display(DISPLAY_DOWNLOAD_LIST);
current_view()->next_focus();
if (*current_view()->focus() == d && current_view()->focus() < current_view()->end_visible())
current_view()->next_focus();
}
void
+7
View File
@@ -220,7 +220,14 @@ ElementDownloadList::receive_change_view(const std::string& name) {
return;
}
std::string old_name = view() ? view()->name() : "";
if (!old_name.empty())
rpc::commands.call_catch("event.view.hide", rpc::make_target(), name,
"View hide event action failed: ");
set_view(*itr);
if (!old_name.empty())
rpc::commands.call_catch("event.view.show", rpc::make_target(), old_name,
"View show event action failed: ");
}
void
+12 -12
View File
@@ -140,20 +140,20 @@ Root::setup_keys() {
const char* keys = get_throttle_keys();
m_bindings[keys[ 0]] = std::bind(&Root::adjust_up_throttle, this, 1);
m_bindings[keys[ 1]] = std::bind(&Root::adjust_up_throttle, this, -1);
m_bindings[keys[ 2]] = std::bind(&Root::adjust_down_throttle, this, 1);
m_bindings[keys[ 3]] = std::bind(&Root::adjust_down_throttle, this, -1);
m_bindings[keys[ 0]] = std::bind(&Root::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 1]] = std::bind(&Root::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 2]] = std::bind(&Root::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 3]] = std::bind(&Root::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.small"));
m_bindings[keys[ 4]] = std::bind(&Root::adjust_up_throttle, this, 5);
m_bindings[keys[ 5]] = std::bind(&Root::adjust_up_throttle, this, -5);
m_bindings[keys[ 6]] = std::bind(&Root::adjust_down_throttle, this, 5);
m_bindings[keys[ 7]] = std::bind(&Root::adjust_down_throttle, this, -5);
m_bindings[keys[ 4]] = std::bind(&Root::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 5]] = std::bind(&Root::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 6]] = std::bind(&Root::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 7]] = std::bind(&Root::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.medium"));
m_bindings[keys[ 8]] = std::bind(&Root::adjust_up_throttle, this, 50);
m_bindings[keys[ 9]] = std::bind(&Root::adjust_up_throttle, this, -50);
m_bindings[keys[10]] = std::bind(&Root::adjust_down_throttle, this, 50);
m_bindings[keys[11]] = std::bind(&Root::adjust_down_throttle, this, -50);
m_bindings[keys[ 8]] = std::bind(&Root::adjust_up_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[ 9]] = std::bind(&Root::adjust_up_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[10]] = std::bind(&Root::adjust_down_throttle, this, (int) rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings[keys[11]] = std::bind(&Root::adjust_down_throttle, this, (int) -rpc::call_command_value("ui.throttle.global.step.large"));
m_bindings['\x0C'] = std::bind(&display::Manager::force_redraw, m_control->display()); // ^L
m_bindings['\x11'] = std::bind(&Control::receive_normal_shutdown, m_control); // ^Q