Small clean of subtitles applet code.
[mafwsubrenderer] / qmafw-gst-subtitles-renderer / src / MafwGstRendererNetworkMonitor.cpp
1 /*
2  * This file is part of QMAFW
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
5  * reserved.
6  *
7  * Contact: Visa Smolander <visa.smolander@nokia.com>
8  *
9  * This software, including documentation, is protected by copyright controlled
10  * by Nokia Corporation. All rights are reserved. Copying, including
11  * reproducing, storing, adapting or translating, any or all of this material
12  * requires the prior written consent of Nokia Corporation. This material also
13  * contains confidential information which may not be disclosed to others
14  * without the prior written consent of Nokia.
15  *
16  */
17
18 #include "MafwGstRendererNetworkMonitor.h"
19 #include "MafwGstRendererHaltState.h"
20
21 #include <QDebug>
22 #include <QtNetwork/QNetworkConfigurationManager>
23
24 /********************************************************************
25  * MafwGstRendererNetworkMonitor::MafwGstRendererNetworkMonitor
26  ********************************************************************/
27 MafwGstRendererNetworkMonitor::MafwGstRendererNetworkMonitor()
28     :
29     m_networkManager(new QNetworkConfigurationManager(this))
30 {
31     connect(m_networkManager, SIGNAL(configurationChanged(QNetworkConfiguration)),
32             this, SLOT(handleConfigurationChange(QNetworkConfiguration)));
33 }
34
35 /********************************************************************
36  * MafwGstRendererNetworkMonitor::MafwGstRendererNetworkMonitor
37  ********************************************************************/
38 MafwGstRendererNetworkMonitor::~MafwGstRendererNetworkMonitor()
39 {
40
41 }
42
43 /********************************************************************
44  * MafwGstRendererNetworkMonitor::handleConfigurationChange
45  ********************************************************************/
46 void MafwGstRendererNetworkMonitor::handleConfigurationChange(const QNetworkConfiguration &config)
47 {
48     qDebug() << __PRETTY_FUNCTION__ << "Configs status: " << config.name() << config.state();
49
50     QNetworkConfiguration::StateFlags flags = config.state();
51     if( flags.testFlag(QNetworkConfiguration::Active) )
52     {
53         Q_EMIT networkChangeFinished();
54         m_currentConfiguration = config;
55     }
56     else if( !m_currentConfiguration.isValid() || config == m_currentConfiguration )
57     {
58         Q_EMIT prepareNetworkChange();
59     }
60 }