From adc6d4776e6570fa6e6d5d2e4e40fe7eab0ebb99 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Nov 2010 13:45:46 +1000 Subject: Fix bearermonitor when building for Maemo in scratchbox. Use the correct ui file when building in scratchbox. Remove use of message boxes. --- examples/network/bearermonitor/bearermonitor.cpp | 22 +- examples/network/bearermonitor/bearermonitor.h | 4 +- examples/network/bearermonitor/bearermonitor.pro | 3 +- .../network/bearermonitor/bearermonitor_maemo.ui | 601 +++++++++++---------- examples/network/bearermonitor/main.cpp | 9 +- examples/network/bearermonitor/sessionwidget.cpp | 4 +- examples/network/bearermonitor/sessionwidget.h | 5 +- 7 files changed, 353 insertions(+), 295 deletions(-) (limited to 'examples/network') diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 2c976ffc37..75ffb01608 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -41,8 +41,8 @@ #include "bearermonitor.h" #include "sessionwidget.h" -#include -#include +#include + #ifdef Q_OS_WIN #include #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(tabWidget->currentWidget()); diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index 45e7275345..df1c78bb6b 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -45,7 +45,7 @@ #include #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 4b2c35b972..bd9bd68e5c 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 a7940c6fe9..9c72bfd5b1 100644 --- a/examples/network/bearermonitor/bearermonitor_maemo.ui +++ b/examples/network/bearermonitor/bearermonitor_maemo.ui @@ -7,300 +7,359 @@ 0 0 612 - 495 + 555 BearerMonitor - + - - - - 0 - 0 - + + + System State - - 0 + + true - - false + + + 0 + + + + + Online State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Configurations && Sessions - - - Configurations - - - - - - - 0 - 0 - - - - false + + true + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 0 + + + false + + + + Configurations - - - 1 - - - - - - - - - - - - Name: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - State: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Type: - - - - - - - - 0 - 0 - - - - Invalid - - - - - - - - - - - Purpose: - - - - - - - - 0 - 0 - - - - Unknown - - - - - - - - - - - Identifier: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Roaming: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Children: - - - - - - - - 0 - 0 - - + + + + + + 0 + 0 + + + + false + + + false + + - + 1 - - - - - - - - Network Location Awareness - - + + + + + + + + + + + Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Type: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Purpose: + + + + + + + + 0 + 0 + + + + Unknown + + + + + + + + + + + Identifier: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Roaming: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Children: + + + + + + + + 0 + 0 + + + + + + + + + + + + + Network Location Awareness + + + + + + Register + + + + + + + Unregister + + + + + + - + - Register + New Session - + - Unregister + Delete Session + + + + Scan + + + + + + + 0 + + + 23280 + + + false + + + false + + + %p% + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + - - - - - - New Session - - - - - - - Delete Session - - - - - - - Scan - - - - - - - 0 - - - 23280 - - - false - - - false - - - %p% - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - + + + + + + diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp index 1a22c1341e..11399e410e 100644 --- a/examples/network/bearermonitor/main.cpp +++ b/examples/network/bearermonitor/main.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include +#include +#include #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 5ec9d53b1b..51de0f2f17 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 c92db4417c..846a1afcc9 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -42,7 +42,8 @@ #define SESSIONWIDGET_H #include -#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 -- cgit v1.2.3