linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05222
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2824: Away mode after some time of inactivity
------------------------------------------------------------
revno: 2824
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-01-16 19:29:26 +0100
message:
Away mode after some time of inactivity
modified:
changelog.txt
dcpp/SettingsManager.cpp
dcpp/SettingsManager.h
help/settings_general.html
win32/GeneralPage.cpp
win32/MainWindow.cpp
win32/MainWindow.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-01-16 17:56:17 +0000
+++ changelog.txt 2012-01-16 18:29:26 +0000
@@ -11,6 +11,7 @@
* [L#914457] Fix missing tab icons (poy)
* Add a setting to enable away mode when Windows is locked (poy)
* Make the away message optional (poy)
+* [L#704502] Away mode after some time of inactivity (poy)
-- 0.791 2012-01-14 --
* Update translations
=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp 2012-01-16 17:56:17 +0000
+++ dcpp/SettingsManager.cpp 2012-01-16 18:29:26 +0000
@@ -64,7 +64,7 @@
"MainWindowSizeX", "MainWindowSizeY", "MainWindowPosX", "MainWindowPosY",
"SettingsWidth", "SettingsHeight", "SettingsPage",
"SocksPort", "SocksResolve", "KeepLists", "AutoKick", "QueueFrameShowTree",
- "CompressTransfers", "SFVCheck", "AutoAway", "AwayCompLock",
+ "CompressTransfers", "SFVCheck", "AutoAway", "AwayCompLock", "AwayIdle",
"MaxCompression", "NoAwayMsgToBots", "SkipZeroByte", "AdlsBreakOnFirst",
"HubUserCommands", "AutoSearchAutoMatch", "LogSystem",
"LogFilelistTransfers", "SendUnknownCommands", "MaxHashSpeed", "OpenUserCmdHelp",
@@ -205,7 +205,8 @@
setDefault(COMPRESS_TRANSFERS, true);
setDefault(SFV_CHECK, true);
setDefault(AUTO_AWAY, false);
- setDefault(AWAY_COMP_LOCK, false);
+ setDefault(AWAY_COMP_LOCK, true);
+ setDefault(AWAY_IDLE, 10);
setDefault(TIME_STAMPS_FORMAT, "%H:%M");
setDefault(COUNTRY_FORMAT, "%[2code] - %[name]");
setDefault(MAX_COMPRESSION, 6);
=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h 2012-01-15 16:08:29 +0000
+++ dcpp/SettingsManager.h 2012-01-16 18:29:26 +0000
@@ -82,7 +82,7 @@
MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y, MAIN_WINDOW_POS_X, MAIN_WINDOW_POS_Y,
SETTINGS_WIDTH, SETTINGS_HEIGHT, SETTINGS_PAGE,
SOCKS_PORT, SOCKS_RESOLVE, KEEP_LISTS, AUTO_KICK, QUEUEFRAME_SHOW_TREE,
- COMPRESS_TRANSFERS, SFV_CHECK, AUTO_AWAY, AWAY_COMP_LOCK,
+ COMPRESS_TRANSFERS, SFV_CHECK, AUTO_AWAY, AWAY_COMP_LOCK, AWAY_IDLE,
MAX_COMPRESSION, NO_AWAYMSG_TO_BOTS, SKIP_ZERO_BYTE, ADLS_BREAK_ON_FIRST,
HUB_USER_COMMANDS, AUTO_SEARCH_AUTO_MATCH, LOG_SYSTEM,
LOG_FILELIST_TRANSFERS, SEND_UNKNOWN_COMMANDS, MAX_HASH_SPEED, OPEN_USER_CMD_HELP,
=== modified file 'help/settings_general.html'
--- help/settings_general.html 2012-01-16 17:56:17 +0000
+++ help/settings_general.html 2012-01-16 18:29:26 +0000
@@ -32,11 +32,10 @@
<h2 id="away">Away mode</h2>
<p cshelp="IDH_SETTINGS_GENERAL_AWAY_MODE">
These settings control the away mode. It is a mode that DC++ can be switched to to signify that you
-are away from DC++ and unavailable at the time. You can activate away mode by using the
-<a href="window_main.html#awayindic">Away indicator in the status bar of the main window</a>, the
-<a href="chat_commands.html#awayback">/away <message> and /back chat commands</a>, the
-<a href="settings_general.html#autoaway">Auto-away on minimize option</a> or the
-<a href="settings_general.html#awaycomplock">Auto-away when Windows is locked option</a>.
+are away from DC++ and unavailable at the time. This mode can be manually activated by using the
+<a href="window_main.html#awayindic">Away indicator in the status bar of the main window</a> or the
+<a href="chat_commands.html#awayback">/away <message> and /back chat commands</a>. It can
+also be automatically activated according to the settings below.
</p>
<dl style="margin-left: 40px;">
@@ -51,16 +50,23 @@
<a href="chat_commands.html#awayback">/away <message> chat command</a>.
</dd>
- <dt id="autoaway">Auto-away on minimize (and back on restore)</dt>
+ <dt>Enable away mode when DC++ is minimized</dt>
<dd cshelp="IDH_SETTINGS_GENERAL_AUTO_AWAY">
- Switch to away mode whenever the client is minimized in the Windows taskbar or in the
- notification area (and set away mode off whenever restored).
+ Switch to away mode whenever the DC++ window is minimized in the Windows taskbar or in the
+ notification area; disable away mode when the DC++ window is restored.
</dd>
- <dt id="awaycomplock">Auto-away when Windows is locked (and back when unlocked)</dt>
+ <dt>Enable away mode when the Windows session is locked</dt>
<dd cshelp="IDH_SETTINGS_GENERAL_AWAY_COMP_LOCK">
Switch to away mode whenever the Windows session is locked (generally by Windows key + L or via
- Ctrl + Alt + Del), and set away mode off when the session is unlocked.
+ Ctrl + Alt + Del); disable away mode when the Windows session is unlocked.
+ </dd>
+
+ <dt>Enable away mode after X minutes of inactivity</dt>
+ <dd cshelp="IDH_SETTINGS_GENERAL_AWAY_IDLE">
+ Switch to away mode whenever the Windows session hasn't received any mouse or keyboard input
+ for the last X minutes; disable away mode when input is received again. Set to <b>0</b> to
+ disable this functionality. The default value is <b>10</b> minutes.
</dd>
</dl>
=== modified file 'win32/GeneralPage.cpp'
--- win32/GeneralPage.cpp 2012-01-16 17:56:17 +0000
+++ win32/GeneralPage.cpp 2012-01-16 18:29:26 +0000
@@ -23,6 +23,7 @@
#include <dwt/widgets/Grid.h>
#include <dwt/widgets/Label.h>
+#include <dwt/widgets/Spinner.h>
#include "resource.h"
#include "WinUtil.h"
@@ -30,6 +31,7 @@
using dwt::Grid;
using dwt::GridInfo;
using dwt::Label;
+using dwt::Spinner;
GeneralPage::GeneralPage(dwt::Widget* parent) :
PropPage(parent, 2, 1),
@@ -68,12 +70,11 @@
{
auto conn = cur->addChild(Grid::Seed(1, 2));
- conn->setSpacing(cur->getSpacing());
+ conn->setHelpId(IDH_SETTINGS_GENERAL_CONNECTION);
connections = conn->addChild(WinUtil::Seeds::Dialog::comboBox);
- connections->setHelpId(IDH_SETTINGS_GENERAL_CONNECTION);
- conn->addChild(Label::Seed(T_("MiBits/s")))->setHelpId(IDH_SETTINGS_GENERAL_CONNECTION);
+ conn->addChild(Label::Seed(T_("MiBits/s")));
}
}
@@ -81,7 +82,7 @@
auto group = grid->addChild(GroupBox::Seed(T_("Away mode")));
group->setHelpId(IDH_SETTINGS_GENERAL_AWAY_MODE);
- auto cur = group->addChild(Grid::Seed(3, 1));
+ auto cur = group->addChild(Grid::Seed(4, 1));
cur->column(0).mode = GridInfo::FILL;
cur->setSpacing(grid->getSpacing());
@@ -95,13 +96,28 @@
}
// dummy grid so that the check-box doesn't fill the whole row.
- auto box = cur->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Auto-away on minimize (and back on restore)")));
+ auto box = cur->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Enable away mode when DC++ is minimized")));
box->setHelpId(IDH_SETTINGS_GENERAL_AUTO_AWAY);
items.push_back(Item(box, SettingsManager::AUTO_AWAY, PropPage::T_BOOL));
- box = cur->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Auto-away when Windows is locked (and back when unlocked)")));
+ box = cur->addChild(Grid::Seed(1, 1))->addChild(CheckBox::Seed(T_("Enable away mode when the Windows session is locked")));
box->setHelpId(IDH_SETTINGS_GENERAL_AWAY_COMP_LOCK);
items.push_back(Item(box, SettingsManager::AWAY_COMP_LOCK, PropPage::T_BOOL));
+
+ {
+ auto idle = cur->addChild(Grid::Seed(1, 3));
+ idle->setHelpId(IDH_SETTINGS_GENERAL_AWAY_IDLE);
+ idle->column(1).size = 40;
+ idle->column(1).mode = GridInfo::STATIC;
+
+ idle->addChild(Label::Seed(T_("Enable away mode after")));
+
+ auto box = idle->addChild(WinUtil::Seeds::Dialog::intTextBox);
+ items.push_back(Item(box, SettingsManager::AWAY_IDLE, PropPage::T_INT_WITH_SPIN));
+ idle->setWidget(idle->addChild(Spinner::Seed(0, UD_MAXVAL, box)));
+
+ idle->addChild(Label::Seed(T_("minutes of inactivity (0 = disabled)")));
+ }
}
PropPage::read(items);
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2012-01-15 16:08:29 +0000
+++ win32/MainWindow.cpp 2012-01-16 18:29:26 +0000
@@ -106,7 +106,8 @@
lastUp(0),
lastDown(0),
lastTick(GET_TICK()),
-prevAway(false),
+away(false),
+awayIdle(false),
fullSlots(false)
{
links.homepage = _T("http://dcplusplus.sourceforge.net/");
@@ -1008,11 +1009,19 @@
SettingsManager::getInstance()->set(SettingsManager::TOTAL_UPLOAD, SETTING(TOTAL_UPLOAD) + static_cast<int64_t>(updiff));
SettingsManager::getInstance()->set(SettingsManager::TOTAL_DOWNLOAD, SETTING(TOTAL_DOWNLOAD) + static_cast<int64_t>(downdiff));
+ if(SETTING(AWAY_IDLE)) {
+ LASTINPUTINFO info = { sizeof(LASTINPUTINFO) };
+ if((::GetLastInputInfo(&info) && static_cast<int>(::GetTickCount() - info.dwTime) > SETTING(AWAY_IDLE) * 60 * 1000) ^ awayIdle) {
+ awayIdle = !awayIdle;
+ awayIdle ? Util::incAway() : Util::decAway();
+ }
+ }
+
if(!status)
return;
- if(Util::getAway() != prevAway) {
- prevAway = !prevAway;
+ if(Util::getAway() != away) {
+ away = !away;
updateAwayStatus();
}
@@ -1055,8 +1064,8 @@
}
void MainWindow::updateAwayStatus() {
- status->setIcon(STATUS_AWAY, WinUtil::statusIcon(prevAway ? IDI_USER_AWAY : IDI_USER));
- status->setToolTip(STATUS_AWAY, prevAway ? (T_("Status: Away - Double-click to switch to Available")) :
+ status->setIcon(STATUS_AWAY, WinUtil::statusIcon(away ? IDI_USER_AWAY : IDI_USER));
+ status->setToolTip(STATUS_AWAY, away ? (T_("Status: Away - Double-click to switch to Available")) :
(T_("Status: Available - Double-click to switch to Away")));
}
=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h 2012-01-13 20:55:20 +0000
+++ win32/MainWindow.h 2012-01-16 18:29:26 +0000
@@ -137,7 +137,8 @@
int64_t lastUp;
int64_t lastDown;
uint64_t lastTick;
- bool prevAway;
+ bool away;
+ bool awayIdle;
bool fullSlots;
dwt::Application::FilterIter filterIter;