From 434f6ac2e0f411c13690e91ed55b04f75442a096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 2 Oct 2009 13:06:39 +0200 Subject: Removed all but one web view to improve start-up performance. --- main.cpp | 4 ++-- mazescene.cpp | 46 ++++++++++++++++------------------------------ 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/main.cpp b/main.cpp index 0e71e82..a594fdf 100644 --- a/main.cpp +++ b/main.cpp @@ -31,11 +31,11 @@ int main(int argc, char **argv) QPixmapCache::setCacheLimit(100 * 1024); // 100 MB const char *map = - "###&?###" + "###&?#.#" "# #" "= &" "# #" - "# #### #" + "# /### #" "& # #" "* @@ &" "# @@ # #" diff --git a/mazescene.cpp b/mazescene.cpp index 03b4c1c..18197d4 100644 --- a/mazescene.cpp +++ b/mazescene.cpp @@ -212,6 +212,8 @@ MazeScene::MazeScene(const QVector &lights, const char *map, int width, i types['!'] = 6; types['='] = 7; types['*'] = 8; + types['/'] = 9; + types['.'] = 10; int type; for (int y = 0; y < height; ++y) { @@ -493,16 +495,6 @@ WallItem::WallItem(MazeScene *scene, const QPointF &a, const QPointF &b, int typ break; } - static const char *urls[] = - { - "http://www.google.com", - "http://www.wikipedia.com", - "http://programming.reddit.com", - "http://www.trolltech.com", - "http://www.planetkde.org", - "http://labs.trolltech.com/blogs/" - }; - m_scale = 0.8; m_childItem = 0; @@ -536,29 +528,23 @@ WallItem::WallItem(MazeScene *scene, const QPointF &a, const QPointF &b, int typ childWidget = dialog; scene->addProjectedItem(dialog); m_scale = 0.5; - } else if (type == 0 || type == 2) { - static int index; - if (index == 0) { -#ifndef QT_NO_OPENGL - QWidget *widget = new QWidget; - QCheckBox *checkBox = new QCheckBox("Use OpenGL", widget); - checkBox->setChecked(true); - QObject::connect(checkBox, SIGNAL(toggled(bool)), scene, SLOT(toggleRenderer()), Qt::QueuedConnection); - widget->setLayout(new QVBoxLayout); - widget->layout()->addWidget(checkBox); - childWidget = widget; - m_scale = 0.2; -#endif - } else if (!(index % 7)) { - static int webIndex = 0; - const char *url = urls[webIndex++ % (sizeof(urls)/sizeof(char*))]; - + } else if (type == 9) { + if (a.x() > b.x()) { QWebView *view = new QWebView; - view->setUrl(QUrl(url)); + view->setUrl(QUrl(QLatin1String("http://www.google.com"))); childWidget = view; } - - ++index; + } else if (type == 10) { +#ifndef QT_NO_OPENGL + QWidget *widget = new QWidget; + QCheckBox *checkBox = new QCheckBox("Use OpenGL", widget); + checkBox->setChecked(true); + QObject::connect(checkBox, SIGNAL(toggled(bool)), scene, SLOT(toggleRenderer()), Qt::QueuedConnection); + widget->setLayout(new QVBoxLayout); + widget->layout()->addWidget(checkBox); + childWidget = widget; + m_scale = 0.2; +#endif } if (!childWidget) -- cgit v1.2.3