qtmobility/src/systeminfo/qsysteminfo.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
   360 Q_GLOBAL_STATIC(QSystemInfoPrivate, sysinfoPrivate)
   360 Q_GLOBAL_STATIC(QSystemInfoPrivate, sysinfoPrivate)
   361 Q_GLOBAL_STATIC(QSystemNetworkInfoPrivate, netInfoPrivate)
   361 Q_GLOBAL_STATIC(QSystemNetworkInfoPrivate, netInfoPrivate)
   362 Q_GLOBAL_STATIC(QSystemDisplayInfoPrivate, displayInfoPrivate)
   362 Q_GLOBAL_STATIC(QSystemDisplayInfoPrivate, displayInfoPrivate)
   363 Q_GLOBAL_STATIC(QSystemStorageInfoPrivate, storageInfoPrivate)
   363 Q_GLOBAL_STATIC(QSystemStorageInfoPrivate, storageInfoPrivate)
   364 Q_GLOBAL_STATIC(QSystemDeviceInfoPrivate, deviceInfoPrivate)
   364 Q_GLOBAL_STATIC(QSystemDeviceInfoPrivate, deviceInfoPrivate)
   365 Q_GLOBAL_STATIC(QSystemScreenSaverPrivate, screenSaverPrivate)
       
   366 
   365 
   367  /*!
   366  /*!
   368 \fn QSystemInfo::QSystemInfo(QObject *parent)
   367 \fn QSystemInfo::QSystemInfo(QObject *parent)
   369    Constructs a QSystemInfo object with the given \a parent.
   368    Constructs a QSystemInfo object with the given \a parent.
   370  */
   369  */
   476 /*!
   475 /*!
   477     Returns the status of the network \a mode.
   476     Returns the status of the network \a mode.
   478 */
   477 */
   479 QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode)
   478 QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode)
   480 {
   479 {
   481     qWarning() << __FUNCTION__;
       
   482     return netInfoPrivate()->networkStatus(mode);
   480     return netInfoPrivate()->networkStatus(mode);
   483 }
   481 }
   484 
   482 
   485 /*!
   483 /*!
   486     Returns the strength of the network signal, per network \a mode , 0 - 100 linear scaling,
   484     Returns the strength of the network signal, per network \a mode , 0 - 100 linear scaling,
   580   Returns the first found QNetworkInterface for type \a mode.
   578   Returns the first found QNetworkInterface for type \a mode.
   581   */
   579   */
   582 QNetworkInterface QSystemNetworkInfo::interfaceForMode(QSystemNetworkInfo::NetworkMode mode)
   580 QNetworkInterface QSystemNetworkInfo::interfaceForMode(QSystemNetworkInfo::NetworkMode mode)
   583 {
   581 {
   584     return netInfoPrivate()->interfaceForMode(mode);
   582     return netInfoPrivate()->interfaceForMode(mode);
       
   583 }
       
   584 /*!
       
   585   Returns the current active mode. If more than one mode is active, returns the
       
   586   default or preferred mode. If no modes are active, returns UnknownMode.
       
   587   */
       
   588 QSystemNetworkInfo::NetworkMode QSystemNetworkInfo::currentMode()
       
   589 {
       
   590     return netInfoPrivate()->currentMode();
       
   591 }
       
   592 
       
   593 /*!
       
   594     \internal
       
   595 
       
   596     This function is called when the client connects to the networkSignalStrengthChanged()
       
   597     signal.
       
   598 */
       
   599 void QSystemNetworkInfo::connectNotify(const char *signal)
       
   600 {
       
   601     //check for networkSignalStrengthChanged() signal connect notification
       
   602     //This is not required on all platforms
       
   603 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
       
   604     if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(
       
   605                                  networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int))))) {
       
   606         netInfoPrivate()->setWlanSignalStrengthCheckEnabled(true);
       
   607     }
       
   608 #endif
       
   609 }
       
   610 
       
   611 /*!
       
   612     \internal
       
   613 
       
   614     This function is called when the client disconnects from the networkSignalStrengthChanged()
       
   615     signal.
       
   616 
       
   617     \sa connectNotify()
       
   618 */
       
   619 void QSystemNetworkInfo::disconnectNotify(const char *signal)
       
   620 {
       
   621     //check for networkSignalStrengthChanged() signal disconnect notification
       
   622     //This is not required on all platforms
       
   623 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
       
   624     if (QLatin1String(signal) == QLatin1String(QMetaObject::normalizedSignature(SIGNAL(
       
   625                                  networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode, int))))) {
       
   626         netInfoPrivate()->setWlanSignalStrengthCheckEnabled(false);
       
   627     }
       
   628 #endif
   585 }
   629 }
   586 
   630 
   587 // display
   631 // display
   588  /*!
   632  /*!
   589    \fn QSystemDisplayInfo::QSystemDisplayInfo(QObject *parent)
   633    \fn QSystemDisplayInfo::QSystemDisplayInfo(QObject *parent)
   861    On platforms where there is no one default screensaver mechanism, such as Linux, this class
   905    On platforms where there is no one default screensaver mechanism, such as Linux, this class
   862    may not be available.
   906    may not be available.
   863  */
   907  */
   864 
   908 
   865 QSystemScreenSaver::QSystemScreenSaver(QObject *parent)
   909 QSystemScreenSaver::QSystemScreenSaver(QObject *parent)
   866     : QObject(parent), d(screenSaverPrivate())
   910     : QObject(parent)
   867 {
   911 {
       
   912 #ifdef Q_OS_LINUX
       
   913     d = new QSystemScreenSaverPrivate(static_cast<QSystemScreenSaverLinuxCommonPrivate*>(parent));
       
   914 #else
       
   915     d = new QSystemScreenSaverPrivate(parent);
       
   916 #endif
   868     screenSaverIsInhibited = screenSaverInhibited();
   917     screenSaverIsInhibited = screenSaverInhibited();
   869 }
   918 }
   870 
   919 
   871 /*!
   920 /*!
   872   Destroys the QSystemScreenSaver object.
   921   Destroys the QSystemScreenSaver object.
   873  */
   922  */
   874 QSystemScreenSaver::~QSystemScreenSaver()
   923 QSystemScreenSaver::~QSystemScreenSaver()
   875 {
   924 {
   876     qWarning() << Q_FUNC_INFO;
       
   877     delete d;
   925     delete d;
   878 }
   926 }
   879 
   927 
   880 /*!
   928 /*!
   881     Temporarily inhibits the screensaver.
   929     Temporarily inhibits the screensaver.