mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Delay resuming as we will most likely fail connecting directly
This commit is contained in:
@@ -20,6 +20,10 @@
|
|||||||
#include "UPowerHandler.h"
|
#include "UPowerHandler.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#define UPOWER_RESUME_DELAY 2000
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
const char* UPowerHandler::UPowerService = "org.freedesktop.UPower";
|
const char* UPowerHandler::UPowerService = "org.freedesktop.UPower";
|
||||||
@@ -61,7 +65,15 @@ UPowerHandler::handleSleep()
|
|||||||
void
|
void
|
||||||
UPowerHandler::handleResume()
|
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";
|
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Awake from sleep so connecting all accounts";
|
||||||
Tomahawk::Accounts::AccountManager::instance()->connectAll();
|
Tomahawk::Accounts::AccountManager::instance()->connectAll();
|
||||||
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleSleep();
|
void handleSleep();
|
||||||
void handleResume();
|
void handleResume();
|
||||||
|
void actualResume();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user