diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-11-04 03:45:46 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-11-04 03:49:32 (GMT) |
commit | adc6d4776e6570fa6e6d5d2e4e40fe7eab0ebb99 (patch) | |
tree | dc3db3ec8ae56fc8f13440a550e55959d4bf40bc /examples | |
parent | ab672d88f906b0d6f2d45f9ebbfbf12fdcfba51e (diff) | |
download | Qt-adc6d4776e6570fa6e6d5d2e4e40fe7eab0ebb99.zip Qt-adc6d4776e6570fa6e6d5d2e4e40fe7eab0ebb99.tar.gz Qt-adc6d4776e6570fa6e6d5d2e4e40fe7eab0ebb99.tar.bz2 |
Fix bearermonitor when building for Maemo in scratchbox.
Use the correct ui file when building in scratchbox.
Remove use of message boxes.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.cpp | 22 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.h | 4 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.pro | 3 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor_maemo.ui | 601 | ||||
-rw-r--r-- | examples/network/bearermonitor/main.cpp | 9 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.cpp | 4 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.h | 5 |
7 files changed, 353 insertions, 295 deletions
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 2c976ff..75ffb01 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -41,8 +41,8 @@ #include "bearermonitor.h" #include "sessionwidget.h" -#include <QDebug> -#include <QMessageBox> +#include <QtCore/QDebug> + #ifdef Q_OS_WIN #include <winsock2.h> #undef interface @@ -56,20 +56,18 @@ BearerMonitor::BearerMonitor(QWidget *parent) : QWidget(parent) { setupUi(this); -#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#ifdef MAEMO_UI newSessionButton->hide(); deleteSessionButton->hide(); #else delete tabWidget->currentWidget(); sessionGroup->hide(); #endif -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(MAEMO_UI) 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); @@ -104,7 +102,7 @@ BearerMonitor::BearerMonitor(QWidget *parent) connect(newSessionButton, SIGNAL(clicked()), this, SLOT(createNewSession())); -#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) +#ifndef MAEMO_UI connect(deleteSessionButton, SIGNAL(clicked()), this, SLOT(deleteSession())); #endif @@ -257,15 +255,9 @@ 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 @@ -393,7 +385,7 @@ void BearerMonitor::createSessionFor(QTreeWidgetItem *item) tabWidget->addTab(session, conf.name()); -#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) +#ifndef MAEMO_UI sessionGroup->show(); #endif @@ -408,7 +400,7 @@ void BearerMonitor::createNewSession() createSessionFor(item); } -#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) +#ifndef MAEMO_UI void BearerMonitor::deleteSession() { SessionWidget *session = qobject_cast<SessionWidget *>(tabWidget->currentWidget()); diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index 45e7275..df1c78b 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -45,7 +45,7 @@ #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) +#elif defined(MAEMO_UI) #include "ui_bearermonitor_maemo.h" #else #include "ui_bearermonitor_640_480.h" @@ -81,7 +81,7 @@ private slots: void createSessionFor(QTreeWidgetItem *item); void createNewSession(); -#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) +#ifndef MAEMO_UI void deleteSession(); #endif void performScan(); diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index 4b2c35b..bd9bd68 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -8,7 +8,8 @@ SOURCES = main.cpp \ bearermonitor.cpp \ sessionwidget.cpp -maemo5|maemo6 { +maemo5|maemo6|linux-g++-maemo { + DEFINES += MAEMO_UI FORMS = bearermonitor_maemo.ui \ sessionwidget_maemo.ui } else { diff --git a/examples/network/bearermonitor/bearermonitor_maemo.ui b/examples/network/bearermonitor/bearermonitor_maemo.ui index a7940c6..9c72bfd 100644 --- a/examples/network/bearermonitor/bearermonitor_maemo.ui +++ b/examples/network/bearermonitor/bearermonitor_maemo.ui @@ -7,300 +7,359 @@ <x>0</x> <y>0</y> <width>612</width> - <height>495</height> + <height>555</height> </rect> </property> <property name="windowTitle"> <string>BearerMonitor</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0"> <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QGroupBox" name="systemState"> + <property name="title"> + <string>System State</string> </property> - <property name="currentIndex"> - <number>0</number> + <property name="flat"> + <bool>true</bool> </property> - <property name="usesScrollButtons"> - <bool>false</bool> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="onlineStateLabel"> + <property name="text"> + <string>Online State:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="onlineState"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="configurations"> + <property name="title"> + <string>Configurations && Sessions</string> </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> + <property name="flat"> + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> + <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> - <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> + <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> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <column> <property name="text"> - <string/> + <string>1</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"> + </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="registerButton"> + <widget class="QPushButton" name="newSessionButton"> <property name="text"> - <string>Register</string> + <string>New Session</string> </property> </widget> </item> <item> - <widget class="QPushButton" name="unregisterButton"> + <widget class="QPushButton" name="deleteSessionButton"> <property name="text"> - <string>Unregister</string> + <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> - </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> + </item> + </layout> + </widget> + </widget> + </item> + </layout> </widget> </item> </layout> diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp index 1a22c13..11399e4 100644 --- a/examples/network/bearermonitor/main.cpp +++ b/examples/network/bearermonitor/main.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include <QApplication> +#include <QtGui/QApplication> +#include <QtGui/QMainWindow> #include "bearermonitor.h" @@ -46,8 +47,12 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); + QMainWindow mainWindow; + BearerMonitor monitor; - monitor.show(); + + mainWindow.setCentralWidget(&monitor); + mainWindow.show(); return app.exec(); } diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 5ec9d53..51de0f2 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -74,7 +74,7 @@ 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) +#ifdef MAEMO_UI connect(deleteSessionButton, SIGNAL(clicked()), this, SLOT(deleteSession())); #endif @@ -94,7 +94,7 @@ void SessionWidget::timerEvent(QTimerEvent *e) } } -#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#ifdef MAEMO_UI void SessionWidget::deleteSession() { delete this; diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index c92db44..846a1af 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -42,7 +42,8 @@ #define SESSIONWIDGET_H #include <qnetworksession.h> -#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + +#ifdef MAEMO_UI #include "ui_sessionwidget_maemo.h" #else #include "ui_sessionwidget.h" @@ -71,7 +72,7 @@ private Q_SLOTS: void stopSession(); void updateSession(); void updateSessionError(QNetworkSession::SessionError error); -#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#ifdef MAEMO_UI void deleteSession(); #endif |