1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Delay resuming as we will most likely fail connecting directly

This commit is contained in:
Uwe L. Korn 2013-05-31 22:06:35 +02:00
parent ca6653b7e0
commit bb450be0e7
2 changed files with 14 additions and 1 deletions

View File

@ -20,6 +20,10 @@
#include "UPowerHandler.h"
#include "utils/Logger.h"
#include <QTimer>
#define UPOWER_RESUME_DELAY 2000
using namespace Tomahawk;
const char* UPowerHandler::UPowerService = "org.freedesktop.UPower";
@ -61,7 +65,15 @@ UPowerHandler::handleSleep()
void
UPowerHandler::handleResume()
{
QMutexLocker locker( &m_mutex );
m_mutex.lock();
// Delay resuming for other wakeup actions, e.g. reconnecting to the network, to take place.
QTimer::singleShot( UPOWER_RESUME_DELAY, this, SLOT( actualResume() ) );
}
void
UPowerHandler::actualResume()
{
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Awake from sleep so connecting all accounts";
Tomahawk::Accounts::AccountManager::instance()->connectAll();
m_mutex.unlock();
}

View File

@ -44,6 +44,7 @@ private:
private slots:
void handleSleep();
void handleResume();
void actualResume();
};
}