--- a/MixedView/MixedView.pro Mon Oct 25 10:42:36 2010 -0700
+++ b/MixedView/MixedView.pro Mon Oct 25 10:46:37 2010 -0700
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
-QT += core gui multimedia
+QT += core gui multimedia network
TARGET = MixedView
TEMPLATE = app
@@ -17,7 +17,7 @@
FORMS += mainwindow.ui
-INCLUDEPATH+=../../../src/sensors ../../src/multimedia ../../src/multimedia/audio
+INCLUDEPATH+=../../../src/network ../../../src/sensors ../../src/multimedia ../../src/multimedia/audio
CONFIG += mobility
@@ -26,10 +26,9 @@
symbian {
TARGET.UID3 = 0xe4cef592
LIBS += -lcone -leikcore -lavkon
- TARGET.CAPABILITY += LocalServices ReadUserData WriteUserData NetworkServices UserEnvironment Location ReadDeviceData
+ TARGET.CAPABILITY += AllFiles LocalServices ReadUserData WriteUserData NetworkServices UserEnvironment Location ReadDeviceData
TARGET.EPOCSTACKSIZE = 0x14000
- TARGET.EPOCHEAPSIZE = 0x020000 0x800000
+ TARGET.EPOCHEAPSIZE = 0x020000 0x10000000
}
-RESOURCES += \
- resources.qrc
+RESOURCES += resources.qrc
--- a/MixedView/mainwindow.cpp Mon Oct 25 10:42:36 2010 -0700
+++ b/MixedView/mainwindow.cpp Mon Oct 25 10:46:37 2010 -0700
@@ -35,6 +35,9 @@
mScene->setSceneRect(sceneRect);
// scene->setBackgroundBrush (QBrush(Qt::blue));
+ // now set up the boundries
+ setupBoundries();
+
QPixmap mazeImage(":/media/maze.jpg");
int width = screenSize.width();
mazeImage = mazeImage.scaledToWidth(width);
@@ -50,13 +53,9 @@
pauseButton = new QPushButton("Pause");
connect(pauseButton, SIGNAL(clicked()), this, SLOT(pause()));
pauseButton->setMaximumHeight(40);
- pauseButton->setMaximumWidth(300);
QGraphicsProxyWidget *buttonProxy = mScene->addWidget(pauseButton);
buttonProxy->setPos(0, -220);
- // now set up the boundries
- setupBoundries();
-
ui->mainGraphicsView->setScene(mScene);
ui->mainGraphicsView->show();
@@ -69,42 +68,6 @@
// connect the accelerometer to the readingChanged signal
connect(mAccelerometer, SIGNAL(readingChanged()), this, SLOT(updateReading()));
-
- //mPlayer = new QMediaPlayer;
- QMediaResource res(QUrl::fromLocalFile(":/media/pacman_intro.wav"));
- QString codec = res.audioCodec();
- QAudioFormat format;
- // Set up the format, eg.
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(8);
- format.setCodec("audio/pcm");
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
- if (!info.isFormatSupported(format)) {
- //qWarning()<<"raw audio format not supported by backend, cannot play audio.";
- return;
- }
- // file.setFileName(":/media/pacman_intro.wav");
- // file.open(QIODevice::ReadOnly);
-
-
- // int size = file.size();
-
- // mAudio = new QAudioOutput(format, this);
- // file.setParent(mAudio);
-
- // mAudio->start(&file);
- // QSound::play(":/media/pacman_intro.wav");
-
- // mPlayer->setMedia(QUrl::fromLocalFile(":/media/intro.mp3"));
- //int leg = mPlayer->duration();
- // mPlayer->setVolume(100);
- //mPlayer->play();
-
-
mNumHits = 1;
}
@@ -114,11 +77,13 @@
}
void MainWindow::updateGraphics() {
- if (mPause || mNumHits > 1)
+ if (mPause)
return;
if (!bIsMoving)
return;
+ // update the pacman mouth state
+ // will eventually change this to a graphic
switch (mPacState) {
case 0:
mPacman->setSpanAngle(5700);
@@ -162,23 +127,12 @@
else if (pt.y()>145)
pt.setY(145);
-
- QList<QGraphicsItem*> itemList = mScene->items();
- int itemCount = itemList.count();
- bool contains = false;
- for (int i=0;i < itemCount; i++) {
- QGraphicsItem *item = itemList.at(i);
- if (item->contains(pt))
- contains = true;
- }
if (mNumHits == 1) {
- mPacman->setPos(pt);
-
+ mPacman->setPos(pt);
}
else
mPacman->setPos(mLastPt);
-
}
void MainWindow::pause() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/main.cpp Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Symbian Foundation.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+*
+* Description:
+* Project main function.
+*/
+
+#include <QtGui/QApplication>
+#include "mywebwidget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ MyWebWidget w;
+
+#if defined(Q_WS_S60)
+ w.showMaximized();
+#else
+ w.show();
+#endif
+
+ return a.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/mytoolbar.cpp Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2010 Symbian Foundation.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+*
+* Description:
+* Implementation of the MyToolBar class.
+*/
+
+#include <QtGui/QPushButton>
+#include <QtGui/QLabel>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QGeoPositionInfo>
+#include <QGeoPositionInfoSource>
+
+#include "mytoolbar.h"
+
+const QString locString("My Location: ");
+
+MyToolBar::MyToolBar(QWidget* parent)
+ :QWidget(parent)
+{
+ m_backButton = new QPushButton("Back",this);
+ m_locationLabel = new QLabel(this);
+
+ m_location = QGeoPositionInfoSource::createDefaultSource(this);
+ m_location->setUpdateInterval(10000);
+ m_location->startUpdates();
+
+ m_layout = new QHBoxLayout;
+ m_layout->addWidget(m_backButton);
+ m_layout->addWidget(m_locationLabel);
+ m_layout->insertSpacing(1,10);
+ setLayout(m_layout);
+ m_layout->addStretch();
+
+ connect(m_backButton,SIGNAL(clicked()),SLOT(onBackPressed()));
+ connect(m_location,SIGNAL(positionUpdated(QGeoPositionInfo)),SLOT(onPositionUpdated(QGeoPositionInfo)));
+}
+
+MyToolBar::~MyToolBar()
+{
+
+}
+
+void MyToolBar::onPositionUpdated(const QGeoPositionInfo& posInfo)
+{
+ QGeoCoordinate coordinate = posInfo.coordinate();
+ QString label_coordinate = coordinate.toString();
+ m_locationLabel->setText(locString+" "+label_coordinate);
+}
+
+void MyToolBar::onBackPressed()
+{
+ emit goBack();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/mytoolbar.h Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Symbian Foundation.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+*
+* Description:
+* Declaration of the MyToolBar class.
+*/
+
+#ifndef MYTOOLBAR_H
+#define MYTOOLBAR_H
+
+#include <qmobilityglobal.h>
+#include <QtGui/QWidget>
+
+QTM_BEGIN_NAMESPACE
+class QGeoPositionInfo;
+class QGeoPositionInfoSource;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+class QHBoxLayout;
+class QPushButton;
+class QLabel;
+
+class MyToolBar : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MyToolBar(QWidget *parent = 0);
+ ~MyToolBar();
+
+signals:
+ void goBack();
+ void showLocation();
+
+private slots:
+ void onBackPressed();
+ void onPositionUpdated(const QGeoPositionInfo& posInfo);
+
+private:
+ QPushButton* m_backButton;
+ QLabel* m_locationLabel;
+ QHBoxLayout* m_layout;
+ QGeoPositionInfoSource* m_location;
+};
+
+#endif // MYTOOLBAR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/mywebwidget.cpp Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Symbian Foundation.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+*
+* Description:
+* Implementation of the MyWebWidget class.
+*/
+
+#include <QtGui/QLineEdit>
+#include <QtWebKit/QWebView>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QLabel>
+#include <QtCore/QUrl>
+#include <QtGui/QAction>
+#include <QtWebKit/QWebHistory>
+
+#include "mytoolbar.h" //added
+#include "mywebwidget.h"
+
+MyWebWidget::MyWebWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ m_softkeyAction = new QAction( tr("Options"), this );
+ m_softkeyAction->setSoftKeyRole(QAction::PositiveSoftKey);
+ addAction(m_softkeyAction);
+
+ m_lineEdit = new QLineEdit(this);
+ m_lineEdit->setStyleSheet("background-color:white; padding: 6px ; color:blue");
+ m_lineEdit->setText("Enter url ...");
+
+ m_view = new QWebView(this);
+ m_view->load(QUrl("http://blog.symbian.org"));
+
+ m_layout = new QVBoxLayout();
+
+ m_layout->addWidget(m_lineEdit);
+ m_layout->addWidget(m_view);
+ m_layout->insertSpacing(1,10);
+
+ //add toolbar
+ m_toolbar = new MyToolBar(this);
+ m_layout->addWidget(m_toolbar);
+
+ setLayout(m_layout);
+ m_layout->addStretch();
+
+ connect(m_lineEdit,SIGNAL(editingFinished()),SLOT(openUrl()));
+ connect(m_view,SIGNAL(loadFinished(bool)),SLOT(onLoadFinished(bool)));
+
+ //connect the toolbar as well
+ connect(m_toolbar,SIGNAL(goBack()),SLOT(loadPreviousPage()));
+}
+
+MyWebWidget::~MyWebWidget()
+{
+
+}
+
+//added
+void MyWebWidget::loadPreviousPage()
+{
+ if(m_view->history()->canGoBack())
+ {
+ m_view->history()->back();
+ }
+}
+
+void MyWebWidget::openUrl()
+{
+ QString url(m_lineEdit->text());
+ if(!url.contains("http://",Qt::CaseInsensitive))
+ url.prepend("http://");
+ m_view->load(QUrl(url));
+
+}
+
+void MyWebWidget::onLoadFinished(bool finished)
+{
+ if(finished){
+ m_lineEdit->clear();
+ m_lineEdit->setText(tr("Enter url ..."));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/mywebwidget.h Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Symbian Foundation.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+*
+* Description:
+* Declaration of the MyWebWidget class.
+*/
+
+#ifndef MYWEBWIDGET_H
+#define MYWEBWIDGET_H
+
+#include <QtGui/QWidget>
+
+class QWebView;
+class QLineEdit;
+class QVBoxLayout;
+class QLabel;
+class QAction;
+class QWebHistory;
+class QGeoPositionInfoSource;
+class MyToolBar; //added
+
+class MyWebWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MyWebWidget(QWidget *parent = 0);
+ ~MyWebWidget();
+
+private slots:
+ void openUrl();
+ void onLoadFinished(bool finished);
+ void loadPreviousPage();
+
+private:
+ QAction* m_softkeyAction;
+ QWebView* m_view;
+ QLineEdit* m_lineEdit;
+ QLabel* m_label;
+ QVBoxLayout* m_layout;
+ MyToolBar* m_toolbar;
+ QWebHistory* m_history;
+};
+
+#endif // MYWEBWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Mywebwidget3/mywebwidget3.pro Mon Oct 25 10:46:37 2010 -0700
@@ -0,0 +1,28 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-10-06T10:31:49
+#
+#-------------------------------------------------
+
+QT += core gui webkit
+
+TARGET = mywebwidget3
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+ mywebwidget.cpp \
+ mytoolbar.cpp
+
+HEADERS += mywebwidget.h \
+ mytoolbar.h
+
+CONFIG += mobility
+MOBILITY = location
+
+symbian {
+ TARGET.UID3 = 0xe1b774b2
+ TARGET.CAPABILITY += LocalServices ReadUserData WriteUserData NetworkServices UserEnvironment Location ReadDeviceData
+ TARGET.EPOCSTACKSIZE = 0x14000
+ TARGET.EPOCHEAPSIZE = 0x020000 0x4000000
+}