1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

auto away done right (fixes #751)

This commit is contained in:
dubslow 2014-11-14 17:43:38 -06:00 committed by Tux3 / Mlkj / !Lev.uXFMLA
parent ce6e50b912
commit 02e29d6600

View File

@ -178,9 +178,7 @@ void Widget::init()
idleTimer = new QTimer();
idleTimer->setSingleShot(true);
int mins = Settings::getInstance().getAutoAwayTime();
if (mins > 0)
idleTimer->start(mins * 1000*60);
setIdleTimer(Settings::getInstance().getAutoAwayTime());
qRegisterMetaType<Status>("Status");
qRegisterMetaType<vpx_image>("vpx_image");
@ -409,11 +407,6 @@ QString Widget::askProfiles()
return profile;
}
void Widget::setIdleTimer(int minutes)
{
idleTimer->start(minutes * 1000*60);
}
QString Widget::getUsername()
{
return core->getUsername();
@ -1054,10 +1047,8 @@ bool Widget::event(QEvent * e)
qDebug() << "Widget: auto away deactivated at" << QTime::currentTime().toString();
autoAwayActive = false;
emit statusSet(Status::Online);
int mins = Settings::getInstance().getAutoAwayTime();
if (mins > 0)
idleTimer->start(mins * 1000*60);
}
setIdleTimer(Settings::getInstance().getAutoAwayTime());
default:
break;
}
@ -1065,6 +1056,12 @@ bool Widget::event(QEvent * e)
return QWidget::event(e);
}
void Widget::setIdleTimer(int minutes)
{
if (minutes > 0)
idleTimer->start(minutes * 1000*60);
}
void Widget::onUserAway()
{
if (Settings::getInstance().getAutoAwayTime() > 0