diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-04-14 06:23:22 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-04-14 06:23:22 (GMT) |
commit | 90de3e5c903b67b2e5f3d7dc14266fe24f1daa23 (patch) | |
tree | b2ec0c85f2455f738d6466f129a1f4d057caffa9 /examples/network | |
parent | 0def696a8d569f0895010706fb989e78b25c13c1 (diff) | |
download | Qt-90de3e5c903b67b2e5f3d7dc14266fe24f1daa23.zip Qt-90de3e5c903b67b2e5f3d7dc14266fe24f1daa23.tar.gz Qt-90de3e5c903b67b2e5f3d7dc14266fe24f1daa23.tar.bz2 |
Bearer management changes from Qt Mobility (7a5ff985)
7a5ff9859f5775915ae80c287f51c772599c2379
Diffstat (limited to 'examples/network')
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.cpp | 28 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.h | 7 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.pro | 27 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor_maemo.ui | 310 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.cpp | 11 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.h | 9 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget_maemo.ui | 262 |
7 files changed, 630 insertions, 24 deletions
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 5b2bad1..4a6c6ff 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -43,7 +43,7 @@ #include "sessionwidget.h" #include <QDebug> - +#include <QMessageBox> #ifdef Q_OS_WIN #include <winsock2.h> #undef interface @@ -57,15 +57,20 @@ BearerMonitor::BearerMonitor(QWidget *parent) : QWidget(parent) { setupUi(this); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + newSessionButton->hide(); + deleteSessionButton->hide(); +#else delete tabWidget->currentWidget(); sessionGroup->hide(); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) +#endif +#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowMaximized); #endif updateConfigurations(); - +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) onlineStateChanged(!manager.allConfigurations(QNetworkConfiguration::Active).isEmpty()); - +#endif QNetworkConfiguration defaultConfiguration = manager.defaultConfiguration(); for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) { QTreeWidgetItem *item = treeWidget->topLevelItem(i); @@ -101,9 +106,10 @@ BearerMonitor::BearerMonitor(QWidget *parent) connect(newSessionButton, SIGNAL(clicked()), this, SLOT(createNewSession())); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) connect(deleteSessionButton, SIGNAL(clicked()), this, SLOT(deleteSession())); - +#endif connect(scanButton, SIGNAL(clicked()), this, SLOT(performScan())); } @@ -234,9 +240,15 @@ void BearerMonitor::updateConfigurations() void BearerMonitor::onlineStateChanged(bool isOnline) { if (isOnline) +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + QMessageBox::information(this, "Connection state changed", "Online", QMessageBox::Close); + else + QMessageBox::information(this, "Connection state changed", "Offline", QMessageBox::Close); +#else onlineState->setText(tr("Online")); else onlineState->setText(tr("Offline")); +#endif } #ifdef Q_OS_WIN @@ -362,7 +374,9 @@ void BearerMonitor::createSessionFor(QTreeWidgetItem *item) tabWidget->addTab(session, conf.name()); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) sessionGroup->show(); +#endif sessionWidgets.append(session); } @@ -374,6 +388,7 @@ void BearerMonitor::createNewSession() createSessionFor(item); } +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) void BearerMonitor::deleteSession() { SessionWidget *session = qobject_cast<SessionWidget *>(tabWidget->currentWidget()); @@ -386,6 +401,7 @@ void BearerMonitor::deleteSession() sessionGroup->hide(); } } +#endif void BearerMonitor::performScan() { diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index d7025dd..3172b5b 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -46,6 +46,8 @@ #include <qnetworksession.h> #if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) #include "ui_bearermonitor_240_320.h" +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#include "ui_bearermonitor_maemo.h" #else #include "ui_bearermonitor_640_480.h" #endif @@ -80,8 +82,9 @@ private slots: void createSessionFor(QTreeWidgetItem *item); void createNewSession(); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) void deleteSession(); - +#endif void performScan(); private: diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index 4b86187..42100bc 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -1,3 +1,6 @@ +TARGET = bearermonitor +QT = core gui network + HEADERS = sessionwidget.h \ bearermonitor.h @@ -5,22 +8,18 @@ SOURCES = main.cpp \ bearermonitor.cpp \ sessionwidget.cpp -FORMS = bearermonitor_240_320.ui \ - bearermonitor_640_480.ui \ - sessionwidget.ui - -TARGET = bearermonitor - -QT = core gui network - -win32 { - !wince* { - LIBS += -lWs2_32 - } else { - LIBS += -lWs2 - } +maemo5|maemo6 { + FORMS = bearermonitor_maemo.ui \ + sessionwidget_maemo.ui +} else { + FORMS = bearermonitor_240_320.ui \ + bearermonitor_640_480.ui \ + sessionwidget.ui } +win32:!wince*:LIBS += -lWs2_32 +wince*:LIBS += -lWs2 + CONFIG += console symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/examples/network/bearermonitor/bearermonitor_maemo.ui b/examples/network/bearermonitor/bearermonitor_maemo.ui new file mode 100644 index 0000000..5f17e7d --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor_maemo.ui @@ -0,0 +1,310 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>BearerMonitor</class> + <widget class="QWidget" name="BearerMonitor"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>612</width> + <height>495</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="usesScrollButtons"> + <bool>false</bool> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Configurations</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QTreeWidget" name="treeWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <column> + <property name="text"> + <string>1</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="configurationNameLayout"> + <item> + <widget class="QLabel" name="configurationNameLabel"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationName"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationStateLayout"> + <item> + <widget class="QLabel" name="configurationStateLabel"> + <property name="text"> + <string>State:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationState"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationTypeLayout"> + <item> + <widget class="QLabel" name="configurationTypeLabel"> + <property name="text"> + <string>Type:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationType"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Invalid</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationPurposeLayout"> + <item> + <widget class="QLabel" name="configurationPurposeLabel"> + <property name="text"> + <string>Purpose:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationPurpose"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Unknown</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationIdentifierLayout"> + <item> + <widget class="QLabel" name="configurationIdentifierLabel"> + <property name="text"> + <string>Identifier:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationIdentifier"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationRoamingLayout"> + <item> + <widget class="QLabel" name="configurationRoamingLabel"> + <property name="text"> + <string>Roaming:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationRoaming"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationChildrenLayout"> + <item> + <widget class="QLabel" name="configurationChildrenLabel"> + <property name="text"> + <string>Children:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configurationChildren"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="nlaGroup"> + <property name="title"> + <string>Network Location Awareness</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="registerButton"> + <property name="text"> + <string>Register</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="unregisterButton"> + <property name="text"> + <string>Unregister</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QPushButton" name="newSessionButton"> + <property name="text"> + <string>New Session</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deleteSessionButton"> + <property name="text"> + <string>Delete Session</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="scanButton"> + <property name="text"> + <string>Scan</string> + </property> + </widget> + </item> + <item> + <widget class="QProgressBar" name="progressBar"> + <property name="maximum"> + <number>0</number> + </property> + <property name="value"> + <number>23280</number> + </property> + <property name="textVisible"> + <bool>false</bool> + </property> + <property name="invertedAppearance"> + <bool>false</bool> + </property> + <property name="format"> + <string>%p%</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 655c1ac..443f4b2 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -75,6 +75,10 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren this, SLOT(closeSession())); connect(stopSessionButton, SIGNAL(clicked()), this, SLOT(stopSession())); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + connect(deleteSessionButton, SIGNAL(clicked()), + this, SLOT(deleteSession())); +#endif } SessionWidget::~SessionWidget() @@ -91,6 +95,13 @@ void SessionWidget::timerEvent(QTimerEvent *e) } } +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +void SessionWidget::deleteSession() +{ + delete this; +} +#endif + void SessionWidget::updateSession() { updateSessionState(session->state()); diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index ae5cc96..5e9d62c 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -42,8 +42,11 @@ #ifndef SESSIONWIDGET_H #define SESSIONWIDGET_H +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#include "ui_sessionwidget_maemo.h" +#else #include "ui_sessionwidget.h" - +#endif #include <qnetworksession.h> QT_USE_NAMESPACE @@ -68,7 +71,9 @@ private Q_SLOTS: void closeSession(); void stopSession(); void updateSession(); - +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + void deleteSession(); +#endif private: QNetworkSession *session; int statsTimer; diff --git a/examples/network/bearermonitor/sessionwidget_maemo.ui b/examples/network/bearermonitor/sessionwidget_maemo.ui new file mode 100644 index 0000000..86f915c --- /dev/null +++ b/examples/network/bearermonitor/sessionwidget_maemo.ui @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SessionWidget</class> + <widget class="QWidget" name="SessionWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>497</width> + <height>615</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="sessionIdLayout"> + <item> + <widget class="QLabel" name="sessionIdLabel"> + <property name="text"> + <string>Session ID:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="sessionId"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="sessionStateLayout"> + <item> + <widget class="QLabel" name="sessionStateLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Session State:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="sessionState"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Invalid</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="configurationLayout"> + <item> + <widget class="QLabel" name="configurationLabel"> + <property name="text"> + <string>Configuration:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="configuration"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="bearerLayout"> + <item> + <widget class="QLabel" name="bearerLabel"> + <property name="text"> + <string>Bearer:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="bearer"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="interfaceNameLayout"> + <item> + <widget class="QLabel" name="interfaceNameLabel"> + <property name="text"> + <string>Interface Name:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="interfaceName"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="interfaceGuidLayout"> + <item> + <widget class="QLabel" name="interfaceGuidLabel"> + <property name="text"> + <string>Interface GUID:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="interfaceGuid"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="lastErrorLayout"> + <item> + <widget class="QLabel" name="lastErrorLabel"> + <property name="text"> + <string>Last Error:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lastError"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="errorStringLayout"> + <item> + <widget class="QLabel" name="errorStringLabel"> + <property name="text"> + <string>Error String</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="errorString"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QPushButton" name="openSessionButton"> + <property name="text"> + <string>Open</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="closeSessionButton"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="openSyncSessionButton"> + <property name="text"> + <string>Blocking Open</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="stopSessionButton"> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deleteSessionButton"> + <property name="text"> + <string>Delete</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |