Browse Source

Use checkable action for alternative speed limits and display button as "pressed when enabled"

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
00c92d6d61
  1. 9
      src/GUI.cpp
  2. 1
      src/statusbar.h
  3. 10
      src/ui/mainwindow.ui

9
src/GUI.cpp

@ -947,13 +947,7 @@ void GUI::createSystrayDelayed() {
} }
void GUI::updateAltSpeedsBtn(bool alternative) { void GUI::updateAltSpeedsBtn(bool alternative) {
if(alternative) { actionUse_alternative_speed_limits->setChecked(alternative);
actionUse_alternative_speed_limits->setIcon(QIcon(":/Icons/slow.png"));
actionUse_alternative_speed_limits->setText(tr("Use normal speed limits"));
} else {
actionUse_alternative_speed_limits->setIcon(QIcon(":/Icons/slow_off.png"));
actionUse_alternative_speed_limits->setText(tr("Use alternative speed limits"));
}
} }
QMenu* GUI::getTrayIconMenu() { QMenu* GUI::getTrayIconMenu() {
@ -965,6 +959,7 @@ QMenu* GUI::getTrayIconMenu() {
myTrayIconMenu->addAction(actionDownload_from_URL); myTrayIconMenu->addAction(actionDownload_from_URL);
myTrayIconMenu->addSeparator(); myTrayIconMenu->addSeparator();
updateAltSpeedsBtn(Preferences::isAltBandwidthEnabled()); updateAltSpeedsBtn(Preferences::isAltBandwidthEnabled());
actionUse_alternative_speed_limits->setChecked(Preferences::isAltBandwidthEnabled());
myTrayIconMenu->addAction(actionUse_alternative_speed_limits); myTrayIconMenu->addAction(actionUse_alternative_speed_limits);
myTrayIconMenu->addAction(actionSet_global_download_limit); myTrayIconMenu->addAction(actionSet_global_download_limit);
myTrayIconMenu->addAction(actionSet_global_upload_limit); myTrayIconMenu->addAction(actionSet_global_upload_limit);

1
src/statusbar.h

@ -195,6 +195,7 @@ public slots:
if(alternative) { if(alternative) {
altSpeedsBtn->setIcon(QIcon(":/Icons/slow.png")); altSpeedsBtn->setIcon(QIcon(":/Icons/slow.png"));
altSpeedsBtn->setToolTip(tr("Click to disable alternative speed limits")); altSpeedsBtn->setToolTip(tr("Click to disable alternative speed limits"));
altSpeedsBtn->setDown(true);
} else { } else {
altSpeedsBtn->setIcon(QIcon(":/Icons/slow_off.png")); altSpeedsBtn->setIcon(QIcon(":/Icons/slow_off.png"));
altSpeedsBtn->setToolTip(tr("Click to enable alternative speed limits")); altSpeedsBtn->setToolTip(tr("Click to enable alternative speed limits"));

10
src/ui/mainwindow.ui

@ -269,12 +269,14 @@
</property> </property>
</action> </action>
<action name="actionUse_alternative_speed_limits"> <action name="actionUse_alternative_speed_limits">
<property name="icon"> <property name="checkable">
<iconset resource="../icons.qrc"> <bool>true</bool>
<normaloff>:/Icons/slow_off.png</normaloff>:/Icons/slow_off.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Use alternative speed limits</string> <string>Alternative speed limits</string>
</property>
<property name="toolTip">
<string>Alternative speed limits</string>
</property> </property>
</action> </action>
<action name="actionTop_tool_bar"> <action name="actionTop_tool_bar">

Loading…
Cancel
Save