parent
cfb92c47f0
commit
80ab910cbd
|
@ -267,8 +267,6 @@ void MainWindow::Impl::onSpeedSet(tr_direction dir, int KBps)
|
|||
|
||||
Gtk::Menu* MainWindow::Impl::createSpeedMenu(tr_direction dir)
|
||||
{
|
||||
static int const speeds_KBps[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750 };
|
||||
|
||||
auto* m = Gtk::make_managed<Gtk::Menu>();
|
||||
Gtk::RadioButtonGroup group;
|
||||
|
||||
|
@ -283,10 +281,10 @@ Gtk::Menu* MainWindow::Impl::createSpeedMenu(tr_direction dir)
|
|||
|
||||
m->append(*Gtk::make_managed<Gtk::SeparatorMenuItem>());
|
||||
|
||||
for (auto const speed : speeds_KBps)
|
||||
for (auto const KBps : { 50, 100, 250, 500, 1000, 2500, 5000, 10000 })
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::MenuItem>(tr_formatter_speed_KBps(speed));
|
||||
w->signal_activate().connect([this, dir, speed]() { onSpeedSet(dir, speed); });
|
||||
auto* w = Gtk::make_managed<Gtk::MenuItem>(tr_formatter_speed_KBps(KBps));
|
||||
w->signal_activate().connect([this, dir, KBps]() { onSpeedSet(dir, KBps); });
|
||||
m->append(*w);
|
||||
}
|
||||
|
||||
|
|
|
@ -766,8 +766,7 @@
|
|||
NSMenuItem* item;
|
||||
if (menu.numberOfItems == 3)
|
||||
{
|
||||
NSInteger const speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100,
|
||||
150, 200, 250, 500, 750, 1000, 1500, 2000, -1 };
|
||||
NSInteger const speedLimitActionValue[] = { 50, 100, 250, 500, 1000, 2500, 5000, 10000, -1 };
|
||||
|
||||
for (NSInteger i = 0; speedLimitActionValue[i] != -1; i++)
|
||||
{
|
||||
|
|
|
@ -407,7 +407,6 @@ QMenu* MainWindow::createOptionsMenu()
|
|||
{
|
||||
auto const init_speed_sub_menu = [this](QMenu* menu, QAction*& off_action, QAction*& on_action, int pref, int enabled_pref)
|
||||
{
|
||||
std::array<int, 13> stock_speeds = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750 };
|
||||
int const current_value = prefs_.get<int>(pref);
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
|
@ -427,10 +426,10 @@ QMenu* MainWindow::createOptionsMenu()
|
|||
|
||||
menu->addSeparator();
|
||||
|
||||
for (int const i : stock_speeds)
|
||||
for (auto const KBps : { 50, 100, 250, 500, 1000, 2500, 5000, 10000 })
|
||||
{
|
||||
QAction* action = menu->addAction(Formatter::get().speedToString(Speed::fromKBps(i)));
|
||||
action->setProperty(PrefVariantsKey, QVariantList{ pref, i, enabled_pref, true });
|
||||
auto* const action = menu->addAction(Formatter::get().speedToString(Speed::fromKBps(KBps)));
|
||||
action->setProperty(PrefVariantsKey, QVariantList{ pref, KBps, enabled_pref, true });
|
||||
connect(action, &QAction::triggered, this, qOverload<>(&MainWindow::onSetPrefs));
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -294,12 +294,22 @@ export class OverflowMenu extends EventTarget {
|
|||
select.id = 'speed-up-select';
|
||||
div.append(select);
|
||||
|
||||
const speeds = ['10', '100', '200', '500', '750', unlimited];
|
||||
const speeds = [
|
||||
'50',
|
||||
'100',
|
||||
'250',
|
||||
'500',
|
||||
'1000',
|
||||
'2500',
|
||||
'5000',
|
||||
'10000',
|
||||
unlimited,
|
||||
];
|
||||
for (const speed of [
|
||||
...new Set(speeds)
|
||||
.add(`${session_properties[RPC._UpSpeedLimit]}`)
|
||||
.values(),
|
||||
].sort()) {
|
||||
].sort((a, b) => a - b)) {
|
||||
const option = document.createElement('option');
|
||||
option.value = speed;
|
||||
option.textContent =
|
||||
|
@ -343,10 +353,11 @@ export class OverflowMenu extends EventTarget {
|
|||
...new Set(speeds)
|
||||
.add(`${session_properties[RPC._DownSpeedLimit]}`)
|
||||
.values(),
|
||||
].sort()) {
|
||||
].sort((a, b) => a - b)) {
|
||||
const option = document.createElement('option');
|
||||
option.value = speed;
|
||||
option.textContent = speed;
|
||||
option.textContent =
|
||||
speed === unlimited ? unlimited : Formatter.speed(speed);
|
||||
select.append(option);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue