diff options
Diffstat (limited to 'demos')
98 files changed, 2958 insertions, 242 deletions
diff --git a/demos/affine/affine.pro b/demos/affine/affine.pro index b928753..4973496 100644 --- a/demos/affine/affine.pro +++ b/demos/affine/affine.pro @@ -18,6 +18,8 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.jpg sources.path = $$[QT_INSTALL_DEMOS]/affine INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + wince*: { DEPLOYMENT_PLUGIN += qjpeg } diff --git a/demos/arthurplugin/arthurplugin.pro b/demos/arthurplugin/arthurplugin.pro index e9eb1f3..d4827a1 100644 --- a/demos/arthurplugin/arthurplugin.pro +++ b/demos/arthurplugin/arthurplugin.pro @@ -44,6 +44,8 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.jpg *.png sources.path = $$[QT_INSTALL_DEMOS]/arthurplugin INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + win32-msvc* { QMAKE_CFLAGS += /Zm500 QMAKE_CXXFLAGS += /Zm500 diff --git a/demos/books/books.pro b/demos/books/books.pro index a2cd33f..94b049a 100644 --- a/demos/books/books.pro +++ b/demos/books/books.pro @@ -13,6 +13,8 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro images sources.path = $$[QT_INSTALL_DEMOS]/books INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + wince*: { CONFIG(debug, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll CONFIG(release, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index 13e8a1d..ca00062 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -3,7 +3,7 @@ TARGET = browser QT += webkit network CONFIG += qt warn_on -contains(QT_BUILD_PARTS, tools): CONFIG += uitools +contains(QT_BUILD_PARTS, tools):!symbian: CONFIG += uitools else: DEFINES += QT_NO_UITOOLS FORMS += \ @@ -89,3 +89,7 @@ target.path = $$[QT_INSTALL_DEMOS]/browser sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.plist *.icns *.ico *.rc *.pro *.html *.doc images htmls data sources.path = $$[QT_INSTALL_DEMOS]/browser INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian:TARGET.UID3 = 0xA000CF70 diff --git a/demos/browser/browsermainwindow.cpp b/demos/browser/browsermainwindow.cpp index 8d4df01..010ed98 100644 --- a/demos/browser/browsermainwindow.cpp +++ b/demos/browser/browsermainwindow.cpp @@ -576,7 +576,7 @@ QUrl BrowserMainWindow::guessUrlFromString(const QString &string) int dotIndex = urlStr.indexOf(QLatin1Char('.')); if (dotIndex != -1) { QString prefix = urlStr.left(dotIndex).toLower(); - QByteArray schema = (prefix == QLatin1String("ftp")) ? prefix.toLatin1() : "http"; + QByteArray schema = (prefix == QLatin1String("ftp")) ? prefix.toLatin1() : QByteArray("http"); QUrl url = QUrl::fromEncoded(schema + "://" + urlStr.toUtf8(), QUrl::TolerantMode); if (url.isValid()) diff --git a/demos/browser/searchlineedit.cpp b/demos/browser/searchlineedit.cpp index a9b924e..3ca6a53 100644 --- a/demos/browser/searchlineedit.cpp +++ b/demos/browser/searchlineedit.cpp @@ -50,7 +50,9 @@ ClearButton::ClearButton(QWidget *parent) : QAbstractButton(parent) { +#ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); +#endif // QT_NO_CURSOR setToolTip(tr("Clear")); setVisible(false); setFocusPolicy(Qt::NoFocus); @@ -103,7 +105,9 @@ SearchButton::SearchButton(QWidget *parent) m_menu(0) { setObjectName(QLatin1String("SearchButton")); +#ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); +#endif //QT_NO_CURSOR setFocusPolicy(Qt::NoFocus); } diff --git a/demos/browser/webview.cpp b/demos/browser/webview.cpp index 004e995..21a9bae 100644 --- a/demos/browser/webview.cpp +++ b/demos/browser/webview.cpp @@ -54,7 +54,9 @@ #include <QtWebKit/QWebHitTestResult> +#ifndef QT_NO_UITOOLS #include <QtUiTools/QUiLoader> +#endif //QT_NO_UITOOLS #include <QtCore/QDebug> #include <QtCore/QBuffer> diff --git a/demos/chip/chip.pro b/demos/chip/chip.pro index 53fa23b..a24a634 100644 --- a/demos/chip/chip.pro +++ b/demos/chip/chip.pro @@ -17,3 +17,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.html *.doc images sources.path = $$[QT_INSTALL_DEMOS]/chip INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/composition/composition.pro b/demos/composition/composition.pro index d5c4a60..90562eb 100644 --- a/demos/composition/composition.pro +++ b/demos/composition/composition.pro @@ -17,6 +17,8 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.jpg *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/composition INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + win32-msvc* { QMAKE_CXXFLAGS += /Zm500 QMAKE_CFLAGS += /Zm500 diff --git a/demos/deform/deform.pro b/demos/deform/deform.pro index db8484d..31ba2e9 100644 --- a/demos/deform/deform.pro +++ b/demos/deform/deform.pro @@ -17,3 +17,7 @@ target.path = $$[QT_INSTALL_DEMOS]/deform sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/deform INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian:TARGET.UID3 = 0xA000A63D diff --git a/demos/deform/pathdeform.cpp b/demos/deform/pathdeform.cpp index 165af05..5530010 100644 --- a/demos/deform/pathdeform.cpp +++ b/demos/deform/pathdeform.cpp @@ -53,6 +53,10 @@ #include <QDesktopWidget> #include <qmath.h> +#if defined(Q_OS_SYMBIAN) +// TODO: Remove all FONT_OUTLINE_TWEAK related code as soon as the S60FontEngine can deliver outlines +#define FONT_OUTLINE_TWEAK +#endif PathDeformControls::PathDeformControls(QWidget *parent, PathDeformRenderer* renderer, bool smallScreen) : QWidget(parent) @@ -241,6 +245,14 @@ void PathDeformControls::layoutForSmallScreen() QRect screen_size = QApplication::desktop()->screenGeometry(); radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5); + +#ifdef FONT_OUTLINE_TWEAK + radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/7); + fontSizeLabel->setText("Qt Logo Size:"); + m_renderer->setText("A"); // Any Letter would be fine + fontSizeSlider->setValue(100); +#endif + m_renderer->setText(tr("Qt")); } diff --git a/demos/demobase.pri b/demos/demobase.pri new file mode 100644 index 0000000..ec26f3a --- /dev/null +++ b/demos/demobase.pri @@ -0,0 +1,12 @@ +symbian { + RSS_RULES ="group_name=\"QtDemos\";" + + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt Software\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt Software\"" \ + " " + default_deployment.pkg_prerules += vendorinfo +} diff --git a/demos/demos.pro b/demos/demos.pro index eda04dc..d734c05 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -1,27 +1,32 @@ TEMPLATE = subdirs SUBDIRS = \ - demos_shared \ - demos_deform \ - demos_gradients \ - demos_pathstroke \ - demos_affine \ - demos_composition \ - demos_books \ - demos_interview \ - demos_mainwindow \ - demos_spreadsheet \ - demos_textedit \ - demos_chip \ - demos_embeddeddialogs \ - demos_undo \ - demos_sub-attaq + demos_shared \ + demos_deform \ + demos_gradients \ + demos_pathstroke \ + demos_affine \ + demos_composition \ + demos_books \ + demos_interview \ + demos_mainwindow \ + demos_spreadsheet \ + demos_textedit \ + demos_chip \ + demos_embeddeddialogs \ + demos_undo \ + demos_sub-attaq + +symbian: SUBDIRS = \ + demos_shared \ + demos_deform \ + demos_pathstroke contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl):!contains(QT_CONFIG, opengles2):{ SUBDIRS += demos_boxes } mac*: SUBDIRS += demos_macmainwindow -wince*|embedded: SUBDIRS += embedded +wince*|symbian|embedded: SUBDIRS += embedded !contains(QT_EDITION, Console):!cross_compile:!embedded:!wince*:SUBDIRS += demos_arthurplugin @@ -39,6 +44,8 @@ sources.files = README *.pro sources.path = $$[QT_INSTALL_DEMOS] INSTALLS += sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + demos_chip.subdir = chip demos_embeddeddialogs.subdir = embeddeddialogs demos_shared.subdir = shared diff --git a/demos/embedded/anomaly/README.TXT b/demos/embedded/anomaly/README.TXT new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/demos/embedded/anomaly/README.TXT diff --git a/demos/embedded/anomaly/anomaly.pro b/demos/embedded/anomaly/anomaly.pro new file mode 100644 index 0000000..cf9277e --- /dev/null +++ b/demos/embedded/anomaly/anomaly.pro @@ -0,0 +1,32 @@ +QT += network \ + webkit +HEADERS += src/BrowserWindow.h \ + src/BrowserView.h \ + src/TitleBar.h \ + src/HomeView.h \ + src/AddressBar.h \ + src/BookmarksView.h \ + src/flickcharm.h \ + src/ZoomStrip.h \ + src/ControlStrip.h +SOURCES += src/Main.cpp \ + src/BrowserWindow.cpp \ + src/BrowserView.cpp \ + src/TitleBar.cpp \ + src/HomeView.cpp \ + src/AddressBar.cpp \ + src/BookmarksView.cpp \ + src/flickcharm.cpp \ + src/ZoomStrip.cpp \ + src/ControlStrip.cpp +RESOURCES += src/anomaly.qrc + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian { + HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h + LIBS += -lesock -lconnmon + TARGET.CAPABILITY = NetworkServices + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + TARGET.UID3 = 0xA000CF71 +} diff --git a/demos/embedded/anomaly/src/AddressBar.cpp b/demos/embedded/anomaly/src/AddressBar.cpp new file mode 100644 index 0000000..0fd3d35 --- /dev/null +++ b/demos/embedded/anomaly/src/AddressBar.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "AddressBar.h" + +#include <QtCore> +#include <QtGui> + +class LineEdit: public QLineEdit +{ +public: + LineEdit(QWidget *parent = 0): QLineEdit(parent) {} + + void paintEvent(QPaintEvent *event) { + QLineEdit::paintEvent(event); + if (text().isEmpty()) { + QPainter p(this); + int flags = Qt::AlignLeft | Qt::AlignVCenter; + p.setPen(palette().color(QPalette::Disabled, QPalette::Text)); + p.drawText(rect().adjusted(10, 0, 0, 0), flags, "Enter address or search terms"); + p.end(); + } + } +}; + +AddressBar::AddressBar(QWidget *parent) + : QWidget(parent) +{ + m_lineEdit = new LineEdit(parent); + connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(processAddress())); + m_toolButton = new QToolButton(parent); + m_toolButton->setText("Go"); + connect(m_toolButton, SIGNAL(clicked()), SLOT(processAddress())); +} + +QSize AddressBar::sizeHint() const +{ + return m_lineEdit->sizeHint(); +} + +void AddressBar::processAddress() +{ + if (!m_lineEdit->text().isEmpty()) + emit addressEntered(m_lineEdit->text()); +} + +void AddressBar::resizeEvent(QResizeEvent *event) +{ + int x, y, w, h; + + m_toolButton->adjustSize(); + x = width() - m_toolButton->width(); + y = 0; + w = m_toolButton->width(); + h = height() - 1; + m_toolButton->setGeometry(x, y, w, h); + m_toolButton->show(); + + x = 0; + y = 0; + w = width() - m_toolButton->width(); + h = height() - 1; + m_lineEdit->setGeometry(x, y, w, h); + m_lineEdit->show(); +} + +void AddressBar::focusInEvent(QFocusEvent *event) +{ + m_lineEdit->setFocus(); + QWidget::focusInEvent(event); +} diff --git a/demos/embedded/anomaly/src/AddressBar.h b/demos/embedded/anomaly/src/AddressBar.h new file mode 100644 index 0000000..a1e58d2 --- /dev/null +++ b/demos/embedded/anomaly/src/AddressBar.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef ADDRESSBAR_H +#define ADDRESSBAR_H + +#include <QWidget> + +class QLineEdit; +class QToolButton; + +class AddressBar : public QWidget +{ + Q_OBJECT + +public: + AddressBar(QWidget *parent = 0); + QSize sizeHint() const; + +protected: + void resizeEvent(QResizeEvent *event); + void focusInEvent(QFocusEvent *event); + +signals: + void addressEntered(const QString &address); + +private slots: + void processAddress(); + +private: + QLineEdit *m_lineEdit; + QToolButton *m_toolButton; +}; + +#endif // ADDRESSBAR_H diff --git a/demos/embedded/anomaly/src/BookmarksView.cpp b/demos/embedded/anomaly/src/BookmarksView.cpp new file mode 100644 index 0000000..62e483c --- /dev/null +++ b/demos/embedded/anomaly/src/BookmarksView.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "BookmarksView.h" + +#include <QtGui> + +BookmarksView::BookmarksView(QWidget *parent) + : QWidget(parent) +{ + QListWidget *m_iconView = new QListWidget(this); + connect(m_iconView, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(activate(QListWidgetItem*))); + + QVBoxLayout *layout = new QVBoxLayout(this); + setLayout(layout); + layout->addWidget(m_iconView); + + m_iconView->addItem("www.google.com"); + m_iconView->addItem("doc.trolltech.com/4.5"); + m_iconView->addItem("news.bbc.co.uk/text_only.stm"); + m_iconView->addItem("mobile.wikipedia.org"); + m_iconView->addItem("www.qtsoftware.com"); + m_iconView->addItem("en.wikipedia.org"); + + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); +} + +void BookmarksView::activate(QListWidgetItem *item) +{ + QUrl url = item->text().prepend("http://"); + emit urlSelected(url); +} diff --git a/demos/embedded/anomaly/src/BookmarksView.h b/demos/embedded/anomaly/src/BookmarksView.h new file mode 100644 index 0000000..3c9a054 --- /dev/null +++ b/demos/embedded/anomaly/src/BookmarksView.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef BOOKMARKSVIEW_H +#define BOOKMARKSVIEW_H + +#include <QWidget> + +class QListWidgetItem; +class QUrl; + +class BookmarksView : public QWidget +{ + Q_OBJECT + +public: + BookmarksView(QWidget *parent = 0); + +signals: + void urlSelected(const QUrl &url); + +private slots: + void activate(QListWidgetItem *item); +}; + +#endif // BOOKMARKSVIEW_H diff --git a/demos/embedded/anomaly/src/BrowserView.cpp b/demos/embedded/anomaly/src/BrowserView.cpp new file mode 100644 index 0000000..b882a2e --- /dev/null +++ b/demos/embedded/anomaly/src/BrowserView.cpp @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "BrowserView.h" + +#include <QtGui> +#include <QtNetwork> +#include <QtWebKit> + +#include "ControlStrip.h" +#include "TitleBar.h" +#include "flickcharm.h" +#include "ZoomStrip.h" + +#if defined (Q_OS_SYMBIAN) +#include "sym_iap_util.h" +#endif + +BrowserView::BrowserView(QWidget *parent) + : QWidget(parent) + , m_titleBar(0) + , m_webView(0) + , m_progress(0) + , m_currentZoom(100) +{ + m_titleBar = new TitleBar(this); + m_webView = new QWebView(this); + m_zoomStrip = new ZoomStrip(this); + m_controlStrip = new ControlStrip(this); + + m_zoomLevels << 30 << 50 << 67 << 80 << 90; + m_zoomLevels << 100; + m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; + + QTimer::singleShot(0, this, SLOT(initialize())); +} + +void BrowserView::initialize() +{ + connect(m_zoomStrip, SIGNAL(zoomInClicked()), SLOT(zoomIn())); + connect(m_zoomStrip, SIGNAL(zoomOutClicked()), SLOT(zoomOut())); + + connect(m_controlStrip, SIGNAL(menuClicked()), SIGNAL(menuButtonClicked())); + connect(m_controlStrip, SIGNAL(backClicked()), m_webView, SLOT(back())); + connect(m_controlStrip, SIGNAL(forwardClicked()), m_webView, SLOT(forward())); + + QPalette pal = m_webView->palette(); + pal.setBrush(QPalette::Base, Qt::white); + m_webView->setPalette(pal); + + FlickCharm *flickCharm = new FlickCharm(this); + flickCharm->activateOn(m_webView); + + m_webView->setZoomFactor(static_cast<qreal>(m_currentZoom)/100.0); + connect(m_webView, SIGNAL(loadStarted()), SLOT(start())); + connect(m_webView, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); + connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(finish(bool))); + connect(m_webView, SIGNAL(urlChanged(QUrl)), SLOT(updateTitleBar())); + + m_webView->setHtml("Will try to load page soon!"); + m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_webView->setFocus(); +#ifdef Q_OS_SYMBIAN + QTimer::singleShot(0, this, SLOT(setDefaultIap())); +#endif +} + +void BrowserView::start() +{ + m_progress = 0; + updateTitleBar(); + //m_titleBar->setText(m_webView->url().toString()); +} + +void BrowserView::setProgress(int percent) +{ + m_progress = percent; + updateTitleBar(); + //m_titleBar->setText(QString("Loading %1%").arg(percent)); +} + +void BrowserView::updateTitleBar() +{ + QUrl url = m_webView->url(); + m_titleBar->setHost(url.host()); + m_titleBar->setTitle(m_webView->title()); + m_titleBar->setProgress(m_progress); +} + +void BrowserView::finish(bool ok) +{ + m_progress = 0; + updateTitleBar(); + + // TODO: handle error + if (!ok) { + //m_titleBar->setText("Loading failed."); + } +} + +void BrowserView::zoomIn() +{ + int i = m_zoomLevels.indexOf(m_currentZoom); + Q_ASSERT(i >= 0); + if (i < m_zoomLevels.count() - 1) + m_currentZoom = m_zoomLevels[i + 1]; + + m_webView->setZoomFactor(static_cast<qreal>(m_currentZoom)/100.0); +} + +void BrowserView::zoomOut() +{ + int i = m_zoomLevels.indexOf(m_currentZoom); + Q_ASSERT(i >= 0); + if (i > 0) + m_currentZoom = m_zoomLevels[i - 1]; + + m_webView->setZoomFactor(static_cast<qreal>(m_currentZoom)/100.0); +} + +void BrowserView::resizeEvent(QResizeEvent *event) +{ + QWidget::resizeEvent(event); + + int h1 = m_titleBar->sizeHint().height(); + int h2 = m_controlStrip->sizeHint().height(); + + m_titleBar->setGeometry(0, 0, width(), h1); + m_controlStrip->setGeometry(0, height() - h2, width(), h2); + m_webView->setGeometry(0, h1, width(), height() - h1); + + int zw = m_zoomStrip->sizeHint().width(); + int zh = m_zoomStrip->sizeHint().height(); + m_zoomStrip->move(width() - zw, (height() - zh) / 2); +} +#ifdef Q_OS_SYMBIAN +void BrowserView::setDefaultIap() +{ + qt_SetDefaultIap(); + m_webView->load(QUrl("http://news.bbc.co.uk/text_only.stm")); +} +#endif + +void BrowserView::navigate(const QUrl &url) +{ + m_webView->load(url); +} diff --git a/demos/embedded/anomaly/src/BrowserView.h b/demos/embedded/anomaly/src/BrowserView.h new file mode 100644 index 0000000..a9cf8d2 --- /dev/null +++ b/demos/embedded/anomaly/src/BrowserView.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef BROWSERVIEW_H +#define BROWSERVIEW_H + +#include <QWidget> +#include <QVector> + +class QUrl; +class QWebView; +class TitleBar; +class ControlStrip; +class ZoomStrip; + +class BrowserView : public QWidget +{ + Q_OBJECT + +public: + BrowserView(QWidget *parent = 0); + +public slots: + void navigate(const QUrl &url); + void zoomIn(); + void zoomOut(); +#ifdef Q_OS_SYMBIAN + void setDefaultIap(); +#endif + +private slots: + void initialize(); + void start(); + void setProgress(int percent); + void finish(bool); + void updateTitleBar(); + +signals: + void menuButtonClicked(); + +protected: + void resizeEvent(QResizeEvent *event); + +private: + TitleBar *m_titleBar; + QWebView *m_webView; + ZoomStrip *m_zoomStrip; + ControlStrip *m_controlStrip; + int m_progress; + int m_currentZoom; + QVector<int> m_zoomLevels; +}; + +#endif // BROWSERVIEW_H diff --git a/demos/embedded/anomaly/src/BrowserWindow.cpp b/demos/embedded/anomaly/src/BrowserWindow.cpp new file mode 100644 index 0000000..61dcb61 --- /dev/null +++ b/demos/embedded/anomaly/src/BrowserWindow.cpp @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "BrowserWindow.h" + +#include <QtCore> +#include <QtGui> + +#include "BrowserView.h" +#include "HomeView.h" + +BrowserWindow::BrowserWindow() + : QWidget() + , m_homeView(0) + , m_browserView(0) +{ + m_timeLine = new QTimeLine(300, this); + m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve); + QTimer::singleShot(0, this, SLOT(initialize())); +} + +void BrowserWindow::initialize() +{ + m_homeView = new HomeView(this); + m_browserView = new BrowserView(this); + + m_homeView->hide(); + m_homeView->resize(size()); + m_homeView->move(0, 0); + + m_browserView->hide(); + m_browserView->resize(size()); + m_browserView->move(0, 0); + + connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString))); + connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl))); + + connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView())); + + m_homeView->setVisible(false); + m_browserView->setVisible(false); + slide(0); + + connect(m_timeLine, SIGNAL(frameChanged(int)), SLOT(slide(int))); +} + + +// from Demo Browser +QUrl guessUrlFromString(const QString &string) +{ + QString urlStr = string.trimmed(); + QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); + + // Check if it looks like a qualified URL. Try parsing it and see. + bool hasSchema = test.exactMatch(urlStr); + if (hasSchema) { + QUrl url = QUrl::fromEncoded(urlStr.toUtf8(), QUrl::TolerantMode); + if (url.isValid()) + return url; + } + + // Might be a file. + if (QFile::exists(urlStr)) { + QFileInfo info(urlStr); + return QUrl::fromLocalFile(info.absoluteFilePath()); + } + + // Might be a shorturl - try to detect the schema. + if (!hasSchema) { + int dotIndex = urlStr.indexOf(QLatin1Char('.')); + if (dotIndex != -1) { + QString prefix = urlStr.left(dotIndex).toLower(); + QString schema = (prefix == QString("ftp")) ? prefix.toLatin1() : QString("http"); + QString location = schema + "://" + urlStr; + QUrl url = QUrl::fromEncoded(location.toUtf8(), QUrl::TolerantMode); + if (url.isValid()) + return url; + } + } + + // Fall back to QUrl's own tolerant parser. + QUrl url = QUrl::fromEncoded(string.toUtf8(), QUrl::TolerantMode); + + // finally for cases where the user just types in a hostname add http + if (url.scheme().isEmpty()) + url = QUrl::fromEncoded("http://" + string.toUtf8(), QUrl::TolerantMode); + return url; +} + +void BrowserWindow::gotoAddress(const QString &address) +{ + m_browserView->navigate(guessUrlFromString(address)); + showBrowserView(); +} + +void BrowserWindow::navigate(const QUrl &url) +{ + m_browserView->navigate(url); + showBrowserView(); +} + +void BrowserWindow::slide(int pos) +{ + m_browserView->move(pos, 0); + m_homeView->move(pos - width(), 0); + m_browserView->show(); + m_homeView->show(); +} + +void BrowserWindow::showHomeView() +{ + if (m_timeLine->state() != QTimeLine::NotRunning) + return; + + m_timeLine->setFrameRange(0, width()); + m_timeLine->start(); + m_homeView->setFocus(); +} + +void BrowserWindow::showBrowserView() +{ + if (m_timeLine->state() != QTimeLine::NotRunning) + return; + + m_timeLine->setFrameRange(width(), 0); + m_timeLine->start(); + m_browserView->setFocus(); +} + +void BrowserWindow::keyReleaseEvent(QKeyEvent *event) +{ + QWidget::keyReleaseEvent(event); + + if (event->key() == Qt::Key_F3) { + if (m_homeView->isVisible()) + showBrowserView(); + else + showHomeView(); + } +} + +void BrowserWindow::resizeEvent(QResizeEvent *event) +{ + if (m_homeView) + m_homeView->resize(size()); + + if (m_browserView) + m_browserView->resize(size()); +} diff --git a/demos/embedded/anomaly/src/BrowserWindow.h b/demos/embedded/anomaly/src/BrowserWindow.h new file mode 100644 index 0000000..b65d421 --- /dev/null +++ b/demos/embedded/anomaly/src/BrowserWindow.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + + +#ifndef BROWSERWINDOW_H +#define BROWSERWINDOW_H + +#include <QWidget> +class QTimeLine; +class QUrl; + +class BrowserView; +class HomeView; + +class BrowserWindow : public QWidget +{ + Q_OBJECT + +public: + BrowserWindow(); + +private slots: + void initialize(); + void navigate(const QUrl &url); + void gotoAddress(const QString &address); + +public slots: + void showBrowserView(); + void showHomeView(); + void slide(int); + +protected: + void keyReleaseEvent(QKeyEvent *event); + void resizeEvent(QResizeEvent *event); + +private: + HomeView *m_homeView; + BrowserView *m_browserView; + QTimeLine *m_timeLine; +}; + +#endif // BROWSERWINDOW_H diff --git a/demos/embedded/anomaly/src/ControlStrip.cpp b/demos/embedded/anomaly/src/ControlStrip.cpp new file mode 100644 index 0000000..4801870 --- /dev/null +++ b/demos/embedded/anomaly/src/ControlStrip.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "ControlStrip.h" + +#include <QtCore> +#include <QtGui> + +ControlStrip::ControlStrip(QWidget *parent) + : QWidget(parent) +{ + menuPixmap.load(":/images/edit-find.png"); + backPixmap.load(":/images/go-previous.png"); + forwardPixmap.load(":/images/go-next.png"); +} + +QSize ControlStrip::sizeHint() const +{ + return minimumSizeHint(); +} + +QSize ControlStrip::minimumSizeHint() const +{ + return QSize(320, 48); +} + +void ControlStrip::mousePressEvent(QMouseEvent *event) +{ + int h = height(); + int x = event->pos().x(); + + if (x < h) { + emit menuClicked(); + event->accept(); + return; + } + + if (x > width() - h) { + emit forwardClicked(); + event->accept(); + return; + } + + if ((x < width() - 2 * h) && (x > width() - 3 * h)) { + emit backClicked(); + event->accept(); + return; + } +} + +void ControlStrip::paintEvent(QPaintEvent *event) +{ + int h = height(); + int s = (h - menuPixmap.height()) / 2; + + QPainter p(this); + p.fillRect(event->rect(), QColor(32, 32, 32, 192)); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + p.drawPixmap(s, s, menuPixmap); + p.drawPixmap(width() - 3 * h + s, s, backPixmap); + p.drawPixmap(width() - h + s, s, forwardPixmap); + p.end(); +} diff --git a/demos/embedded/anomaly/src/ControlStrip.h b/demos/embedded/anomaly/src/ControlStrip.h new file mode 100644 index 0000000..d3fb253 --- /dev/null +++ b/demos/embedded/anomaly/src/ControlStrip.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef CONTROLSTRIP_H +#define CONTROLSTRIP_H + +#include <QWidget> + +class ControlStrip : public QWidget +{ + Q_OBJECT + +public: + ControlStrip(QWidget *parent = 0); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +signals: + void menuClicked(); + void backClicked(); + void forwardClicked(); + +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + +private: + QPixmap menuPixmap; + QPixmap backPixmap; + QPixmap forwardPixmap; +}; + +#endif // CONTROLSTRIP_H diff --git a/demos/embedded/anomaly/src/HomeView.cpp b/demos/embedded/anomaly/src/HomeView.cpp new file mode 100644 index 0000000..f4e19f5 --- /dev/null +++ b/demos/embedded/anomaly/src/HomeView.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "HomeView.h" + +#include <QtCore> +#include <QtGui> + +#include "AddressBar.h" +#include "BookmarksView.h" + +HomeView::HomeView(QWidget *parent) + : QWidget(parent) + , m_addressBar(0) +{ + m_addressBar = new AddressBar(parent); + connect(m_addressBar, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString))); + + m_bookmarks = new BookmarksView(parent); + connect(m_bookmarks, SIGNAL(urlSelected(QUrl)), SIGNAL(urlActivated(QUrl))); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setMargin(4); + layout->setSpacing(4); + layout->addWidget(m_addressBar); + layout->addWidget(m_bookmarks); +} + +void HomeView::gotoAddress(const QString &address) +{ + emit addressEntered(address); +} + +void HomeView::focusInEvent(QFocusEvent *event) +{ + m_addressBar->setFocus(); + QWidget::focusInEvent(event); +} diff --git a/demos/embedded/anomaly/src/HomeView.h b/demos/embedded/anomaly/src/HomeView.h new file mode 100644 index 0000000..a33881a --- /dev/null +++ b/demos/embedded/anomaly/src/HomeView.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef HOMEVIEW_H +#define HOMEVIEW_H + +#include <QWidget> + +class QUrl; + +class AddressBar; +class BookmarksView; + +class HomeView : public QWidget +{ + Q_OBJECT + +public: + HomeView(QWidget *parent); + +signals: + void urlActivated(const QUrl &url); + void addressEntered(const QString &address); + +private slots: + void gotoAddress(const QString &address); + +protected: + void focusInEvent(QFocusEvent *event); + +private: + AddressBar *m_addressBar; + BookmarksView *m_bookmarks; +}; + +#endif // HOMEVIEW_H diff --git a/demos/embedded/anomaly/src/Main.cpp b/demos/embedded/anomaly/src/Main.cpp new file mode 100644 index 0000000..f3e2298 --- /dev/null +++ b/demos/embedded/anomaly/src/Main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include <QtCore> +#include <QtGui> +#include <QtWebKit> + +#include "BrowserWindow.h" + +int main(int argc, char *argv[]) +{ +#if !defined(Q_WS_S60) + QApplication::setGraphicsSystem("raster"); +#endif + + QApplication app(argc, argv); + + app.setApplicationName("Anomaly"); + app.setApplicationVersion("0.0.0"); + + BrowserWindow window; +#ifdef Q_OS_SYMBIAN + window.showFullScreen(); + QWebSettings::globalSettings()->setObjectCacheCapacities(128*1024, 1024*1024, 1024*1024); + QWebSettings::globalSettings()->setMaximumPagesInCache(3); +#else + window.resize(360, 640); + window.show(); + app.setStyle("windows"); +#endif + + return app.exec(); +} diff --git a/demos/embedded/anomaly/src/TitleBar.cpp b/demos/embedded/anomaly/src/TitleBar.cpp new file mode 100644 index 0000000..2e4eda5 --- /dev/null +++ b/demos/embedded/anomaly/src/TitleBar.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "TitleBar.h" + +#include <QtCore> +#include <QtGui> + +TitleBar::TitleBar(QWidget *parent) + : QWidget(parent) + , m_progress(0) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); +} + +void TitleBar::setHost(const QString &host) +{ + m_host = host; + update(); +} + +void TitleBar::setTitle(const QString &title) +{ + m_title = title; + update(); +} + +void TitleBar::setProgress(int percent) +{ + m_progress = percent; + update(); +} + +QSize TitleBar::sizeHint() const +{ + return minimumSizeHint(); +} + +QSize TitleBar::minimumSizeHint() const +{ + QFontMetrics fm = fontMetrics(); + return QSize(100, fm.height()); +} + +void TitleBar::paintEvent(QPaintEvent *event) +{ + QString title = m_host; + if (!m_title.isEmpty()) + title.append(": ").append(m_title); + + QPalette pal = palette(); + QPainter p(this); + p.fillRect(event->rect(), pal.color(QPalette::Highlight)); + + if (m_progress > 0) { + + QRect box = rect(); + box.setLeft(16); + box.setWidth(width() - box.left() - 110); + + p.setPen(pal.color(QPalette::HighlightedText)); + p.setOpacity(0.8); + p.drawText(box, Qt::AlignLeft + Qt::AlignVCenter, title); + + int x = width() - 100 - 5; + int y = 1; + int h = height() - 4; + + p.setOpacity(1.0); + p.setBrush(Qt::NoBrush); + p.setPen(pal.color(QPalette::HighlightedText)); + p.drawRect(x, y, 100, h); + p.setPen(Qt::NoPen); + p.setBrush(pal.color(QPalette::HighlightedText)); + p.drawRect(x, y, m_progress, h); + } else { + + QRect box = rect(); + box.setLeft(16); + box.setWidth(width() - box.left() - 5); + p.setPen(pal.color(QPalette::HighlightedText)); + p.drawText(box, Qt::AlignLeft + Qt::AlignVCenter, title); + } + + p.end(); +} diff --git a/demos/embedded/anomaly/src/TitleBar.h b/demos/embedded/anomaly/src/TitleBar.h new file mode 100644 index 0000000..7f56860 --- /dev/null +++ b/demos/embedded/anomaly/src/TitleBar.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef TITLEBAR_H +#define TITLEBAR_H + +#include <QWidget> + +class TitleBar : public QWidget +{ + Q_OBJECT + +public: + TitleBar(QWidget *parent = 0); + + void setHost(const QString &host); + void setTitle(const QString &title); + void setProgress(int percent); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +protected: + void paintEvent(QPaintEvent *event); + +private: + QString m_host; + QString m_title; + int m_progress; +}; + +#endif // TITLEBAR_H diff --git a/demos/embedded/anomaly/src/ZoomStrip.cpp b/demos/embedded/anomaly/src/ZoomStrip.cpp new file mode 100644 index 0000000..8848347 --- /dev/null +++ b/demos/embedded/anomaly/src/ZoomStrip.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "ZoomStrip.h" + +#include <QtCore> +#include <QtGui> + +ZoomStrip::ZoomStrip(QWidget *parent) + : QWidget(parent) +{ + zoomInPixmap.load(":/images/list-add.png"); + zoomOutPixmap.load(":/images/list-remove.png"); +} + +QSize ZoomStrip::sizeHint() const +{ + return minimumSizeHint(); +} + +QSize ZoomStrip::minimumSizeHint() const +{ + return QSize(48, 96); +} + +void ZoomStrip::mousePressEvent(QMouseEvent *event) +{ + if (event->pos().y() < height() / 2) + emit zoomInClicked(); + else + emit zoomOutClicked(); +} + +void ZoomStrip::paintEvent(QPaintEvent *event) +{ + int w = width(); + int s = (w - zoomInPixmap.width()) / 2; + + QPainter p(this); + p.fillRect(event->rect(), QColor(128, 128, 128, 128)); + p.drawPixmap(s, s, zoomInPixmap); + p.drawPixmap(s, s + w, zoomOutPixmap); + p.end(); +} diff --git a/demos/embedded/anomaly/src/ZoomStrip.h b/demos/embedded/anomaly/src/ZoomStrip.h new file mode 100644 index 0000000..f613249 --- /dev/null +++ b/demos/embedded/anomaly/src/ZoomStrip.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Anomaly project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef ZOOMSTRIP_H +#define ZOOMSTRIP_H + +#include <QWidget> + +class ZoomStrip : public QWidget +{ + Q_OBJECT + +public: + ZoomStrip(QWidget *parent = 0); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +signals: + void zoomInClicked(); + void zoomOutClicked(); + +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + +private: + QPixmap zoomInPixmap; + QPixmap zoomOutPixmap; +}; + +#endif // ZOOMSTRIP_H diff --git a/demos/embedded/anomaly/src/anomaly.qrc b/demos/embedded/anomaly/src/anomaly.qrc new file mode 100644 index 0000000..601a34e --- /dev/null +++ b/demos/embedded/anomaly/src/anomaly.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/" > + <file>images/go-next.png</file> + <file>images/go-previous.png</file> + <file>images/edit-find.png</file> + <file>images/list-add.png</file> + <file>images/list-remove.png</file> + </qresource> +</RCC> diff --git a/demos/embedded/anomaly/src/flickcharm.cpp b/demos/embedded/anomaly/src/flickcharm.cpp new file mode 100644 index 0000000..851cadf --- /dev/null +++ b/demos/embedded/anomaly/src/flickcharm.cpp @@ -0,0 +1,309 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Graphics Dojo project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#include "flickcharm.h" + +#include <QAbstractScrollArea> +#include <QApplication> +#include <QBasicTimer> +#include <QEvent> +#include <QHash> +#include <QList> +#include <QMouseEvent> +#include <QScrollBar> +#include <QWebFrame> +#include <QWebView> + +#include <QDebug> + +struct FlickData { + typedef enum { Steady, Pressed, ManualScroll, AutoScroll, Stop } State; + State state; + QWidget *widget; + QPoint pressPos; + QPoint offset; + QPoint dragPos; + QPoint speed; + QList<QEvent*> ignored; +}; + +class FlickCharmPrivate +{ +public: + QHash<QWidget*, FlickData*> flickData; + QBasicTimer ticker; +}; + +FlickCharm::FlickCharm(QObject *parent): QObject(parent) +{ + d = new FlickCharmPrivate; +} + +FlickCharm::~FlickCharm() +{ + delete d; +} + +void FlickCharm::activateOn(QWidget *widget) +{ + QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget); + if (scrollArea) { + scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + QWidget *viewport = scrollArea->viewport(); + + viewport->installEventFilter(this); + scrollArea->installEventFilter(this); + + d->flickData.remove(viewport); + d->flickData[viewport] = new FlickData; + d->flickData[viewport]->widget = widget; + d->flickData[viewport]->state = FlickData::Steady; + + return; + } + + QWebView *webView = dynamic_cast<QWebView*>(widget); + if (webView) { + QWebFrame *frame = webView->page()->mainFrame(); + frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + + webView->installEventFilter(this); + + d->flickData.remove(webView); + d->flickData[webView] = new FlickData; + d->flickData[webView]->widget = webView; + d->flickData[webView]->state = FlickData::Steady; + + return; + } + + qWarning() << "FlickCharm only works on QAbstractScrollArea (and derived classes)"; + qWarning() << "or QWebView (and derived classes)"; +} + +void FlickCharm::deactivateFrom(QWidget *widget) +{ + QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget); + if (scrollArea) { + QWidget *viewport = scrollArea->viewport(); + + viewport->removeEventFilter(this); + scrollArea->removeEventFilter(this); + + delete d->flickData[viewport]; + d->flickData.remove(viewport); + + return; + } + + QWebView *webView = dynamic_cast<QWebView*>(widget); + if (webView) { + webView->removeEventFilter(this); + + delete d->flickData[webView]; + d->flickData.remove(webView); + + return; + } +} + +static QPoint scrollOffset(QWidget *widget) +{ + int x = 0, y = 0; + + QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget); + if (scrollArea) { + x = scrollArea->horizontalScrollBar()->value(); + y = scrollArea->verticalScrollBar()->value(); + } + + QWebView *webView = dynamic_cast<QWebView*>(widget); + if (webView) { + QWebFrame *frame = webView->page()->mainFrame(); + x = frame->evaluateJavaScript("window.scrollX").toInt(); + y = frame->evaluateJavaScript("window.scrollY").toInt(); + } + + return QPoint(x, y); +} + +static void setScrollOffset(QWidget *widget, const QPoint &p) +{ + QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget); + if (scrollArea) { + scrollArea->horizontalScrollBar()->setValue(p.x()); + scrollArea->verticalScrollBar()->setValue(p.y()); + } + + QWebView *webView = dynamic_cast<QWebView*>(widget); + QWebFrame *frame = webView ? webView->page()->mainFrame() : 0; + if (frame) + frame->evaluateJavaScript(QString("window.scrollTo(%1,%2);").arg(p.x()).arg(p.y())); +} + +static QPoint deaccelerate(const QPoint &speed, int a = 1, int max = 64) +{ + int x = qBound(-max, speed.x(), max); + int y = qBound(-max, speed.y(), max); + x = (x == 0) ? x : (x > 0) ? qMax(0, x - a) : qMin(0, x + a); + y = (y == 0) ? y : (y > 0) ? qMax(0, y - a) : qMin(0, y + a); + return QPoint(x, y); +} + +bool FlickCharm::eventFilter(QObject *object, QEvent *event) +{ + if (!object->isWidgetType()) + return false; + + QEvent::Type type = event->type(); + if (type != QEvent::MouseButtonPress && + type != QEvent::MouseButtonRelease && + type != QEvent::MouseMove) + return false; + + QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event); + if (!mouseEvent || mouseEvent->modifiers() != Qt::NoModifier) + return false; + + QWidget *viewport = dynamic_cast<QWidget*>(object); + FlickData *data = d->flickData.value(viewport); + if (!viewport || !data || data->ignored.removeAll(event)) + return false; + + bool consumed = false; + switch (data->state) { + + case FlickData::Steady: + if (mouseEvent->type() == QEvent::MouseButtonPress) + if (mouseEvent->buttons() == Qt::LeftButton) { + consumed = true; + data->state = FlickData::Pressed; + data->pressPos = mouseEvent->pos(); + data->offset = scrollOffset(data->widget); + } + break; + + case FlickData::Pressed: + if (mouseEvent->type() == QEvent::MouseButtonRelease) { + consumed = true; + data->state = FlickData::Steady; + + QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress, + data->pressPos, Qt::LeftButton, + Qt::LeftButton, Qt::NoModifier); + QMouseEvent *event2 = new QMouseEvent(*mouseEvent); + + data->ignored << event1; + data->ignored << event2; + QApplication::postEvent(object, event1); + QApplication::postEvent(object, event2); + } + if (mouseEvent->type() == QEvent::MouseMove) { + consumed = true; + data->state = FlickData::ManualScroll; + data->dragPos = QCursor::pos(); + if (!d->ticker.isActive()) + d->ticker.start(20, this); + } + break; + + case FlickData::ManualScroll: + if (mouseEvent->type() == QEvent::MouseMove) { + consumed = true; + QPoint delta = mouseEvent->pos() - data->pressPos; + setScrollOffset(data->widget, data->offset - delta); + } + if (mouseEvent->type() == QEvent::MouseButtonRelease) { + consumed = true; + data->state = FlickData::AutoScroll; + } + break; + + case FlickData::AutoScroll: + if (mouseEvent->type() == QEvent::MouseButtonPress) { + consumed = true; + data->state = FlickData::Stop; + data->speed = QPoint(0, 0); + data->pressPos = mouseEvent->pos(); + data->offset = scrollOffset(data->widget); + } + if (mouseEvent->type() == QEvent::MouseButtonRelease) { + consumed = true; + data->state = FlickData::Steady; + data->speed = QPoint(0, 0); + } + break; + + case FlickData::Stop: + if (mouseEvent->type() == QEvent::MouseButtonRelease) { + consumed = true; + data->state = FlickData::Steady; + } + if (mouseEvent->type() == QEvent::MouseMove) { + consumed = true; + data->state = FlickData::ManualScroll; + data->dragPos = QCursor::pos(); + if (!d->ticker.isActive()) + d->ticker.start(20, this); + } + break; + + default: + break; + } + + return consumed; +} + +void FlickCharm::timerEvent(QTimerEvent *event) +{ + int count = 0; + QHashIterator<QWidget*, FlickData*> item(d->flickData); + while (item.hasNext()) { + item.next(); + FlickData *data = item.value(); + + if (data->state == FlickData::ManualScroll) { + count++; + data->speed = QCursor::pos() - data->dragPos; + data->dragPos = QCursor::pos(); + } + + if (data->state == FlickData::AutoScroll) { + count++; + data->speed = deaccelerate(data->speed); + QPoint p = scrollOffset(data->widget); + setScrollOffset(data->widget, p - data->speed); + if (data->speed == QPoint(0, 0)) + data->state = FlickData::Steady; + } + } + + if (!count) + d->ticker.stop(); + + QObject::timerEvent(event); +} diff --git a/demos/embedded/anomaly/src/flickcharm.h b/demos/embedded/anomaly/src/flickcharm.h new file mode 100644 index 0000000..74de9c5 --- /dev/null +++ b/demos/embedded/anomaly/src/flickcharm.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Graphics Dojo project on Qt Labs. +** +** This file may be used under the terms of the GNU General Public +** License version 2.0 or 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of +** this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ + +#ifndef FLICKCHARM_H +#define FLICKCHARM_H + +#include <QObject> + +class FlickCharmPrivate; +class QWidget; + +class FlickCharm: public QObject +{ + Q_OBJECT +public: + FlickCharm(QObject *parent = 0); + ~FlickCharm(); + void activateOn(QWidget *widget); + void deactivateFrom(QWidget *widget); + bool eventFilter(QObject *object, QEvent *event); + +protected: + void timerEvent(QTimerEvent *event); + +private: + FlickCharmPrivate *d; +}; + +#endif // FLICKCHARM_H diff --git a/demos/embedded/anomaly/src/images/edit-find.png b/demos/embedded/anomaly/src/images/edit-find.png Binary files differnew file mode 100644 index 0000000..5594785 --- /dev/null +++ b/demos/embedded/anomaly/src/images/edit-find.png diff --git a/demos/embedded/anomaly/src/images/go-next.png b/demos/embedded/anomaly/src/images/go-next.png Binary files differnew file mode 100644 index 0000000..a68e2db --- /dev/null +++ b/demos/embedded/anomaly/src/images/go-next.png diff --git a/demos/embedded/anomaly/src/images/go-previous.png b/demos/embedded/anomaly/src/images/go-previous.png Binary files differnew file mode 100644 index 0000000..c37bc04 --- /dev/null +++ b/demos/embedded/anomaly/src/images/go-previous.png diff --git a/demos/embedded/anomaly/src/images/list-add.png b/demos/embedded/anomaly/src/images/list-add.png Binary files differnew file mode 100644 index 0000000..2acdd8f --- /dev/null +++ b/demos/embedded/anomaly/src/images/list-add.png diff --git a/demos/embedded/anomaly/src/images/list-remove.png b/demos/embedded/anomaly/src/images/list-remove.png Binary files differnew file mode 100644 index 0000000..c5524f7 --- /dev/null +++ b/demos/embedded/anomaly/src/images/list-remove.png diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp new file mode 100644 index 0000000..8b70c1d --- /dev/null +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// EXTERNAL INCLUDES +#include <QKeyEvent> +#include <QMessageBox> +#include <QListWidget> +#include <QVBoxLayout> +#include <QFileInfoList> +#include <QListWidgetItem> + +// INTERNAL INCLUDES + +// CLASS HEADER +#include "contenttab.h" + + +// CONSTRUCTORS & DESTRUCTORS +ContentTab::ContentTab(QWidget *parent) : + QListWidget(parent) +{ + setDragEnabled(false); + setIconSize(QSize(45, 45)); +} + +ContentTab::~ContentTab() +{ +} + +// NEW PUBLIC METHODS +void ContentTab::init(const QDesktopServices::StandardLocation &location, + const QString &filter, + const QString &icon) +{ + setContentDir(location); + QStringList filterList; + filterList = filter.split(";"); + m_ContentDir.setNameFilters(filterList); + setIcon(icon); + + connect(this, SIGNAL(itemClicked(QListWidgetItem *)), + this, SLOT(openItem(QListWidgetItem *))); + + populateListWidget(); +} + +// NEW PROTECTED METHODS +void ContentTab::setContentDir(const QDesktopServices::StandardLocation &location) +{ + m_ContentDir.setPath(QDesktopServices::storageLocation(location)); +} + +void ContentTab::setIcon(const QString &icon) +{ + m_Icon = QIcon(icon); +} + +void ContentTab::populateListWidget() +{ + QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time); + foreach(QFileInfo item, fileList) { + new QListWidgetItem(m_Icon, itemName(item), this); + } +} + +QString ContentTab::itemName(const QFileInfo &item) +{ + return QString(item.baseName() + "." + item.completeSuffix()); +} + +QUrl ContentTab::itemUrl(QListWidgetItem *item) +{ + return QUrl("file:///" + m_ContentDir.absolutePath() + "/" + item->text()); +} + +void ContentTab::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Up: + if (currentRow() == 0) { + setCurrentRow(count() - 1); + } else { + setCurrentRow(currentRow() - 1); + } + break; + case Qt::Key_Down: + if (currentRow() == (count() - 1)) { + setCurrentRow(0); + } else { + setCurrentRow(currentRow() + 1); + } + break; + case Qt::Key_Select: + openItem(currentItem()); + default: + QListWidget::keyPressEvent(event); + break; + } +} + +void ContentTab::handleErrorInOpen(QListWidgetItem *item) +{ + Q_UNUSED(item); + QMessageBox::warning(this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close); +} + +// NEW SLOTS +void ContentTab::openItem(QListWidgetItem *item) +{ + bool ret = QDesktopServices::openUrl(itemUrl(item)); + if (!ret) + handleErrorInOpen(item); +} + + +// End of File diff --git a/demos/embedded/desktopservices/contenttab.h b/demos/embedded/desktopservices/contenttab.h new file mode 100644 index 0000000..e703754 --- /dev/null +++ b/demos/embedded/desktopservices/contenttab.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CONTENTTAB_H_ +#define CONTENTTAB_H_ + +// EXTERNAL INCLUDES +#include <QDir> +#include <QUrl> +#include <QIcon> +#include <QFileInfo> +#include <QListWidget> +#include <QDesktopServices> + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +QT_BEGIN_NAMESPACE +class QListWidgetItem; +QT_END_NAMESPACE + +// CLASS DECLARATION + +/** +* ContentTab class. +* +* This class implements general purpose tab for media files. +*/ +class ContentTab : public QListWidget +{ + Q_OBJECT + +public: // Constructors & Destructors + ContentTab(QWidget *parent); + virtual ~ContentTab(); + +public: // New Methods + virtual void init(const QDesktopServices::StandardLocation &location, + const QString &filter, + const QString &icon); + +protected: // New Methods + virtual void setContentDir(const QDesktopServices::StandardLocation &location); + virtual void setIcon(const QString &icon); + virtual void populateListWidget(); + virtual QString itemName(const QFileInfo &item); + virtual QUrl itemUrl(QListWidgetItem *item); + virtual void handleErrorInOpen(QListWidgetItem *item); +protected: + void keyPressEvent(QKeyEvent *event); + +public slots: // New Slots + virtual void openItem(QListWidgetItem *item); + +protected: // Owned variables + QDir m_ContentDir; + QIcon m_Icon; +}; + + +#endif // CONTENTTAB_H_ + +// End of File diff --git a/demos/embedded/desktopservices/data/Explosion.wav b/demos/embedded/desktopservices/data/Explosion.wav Binary files differnew file mode 100644 index 0000000..7b140b1 --- /dev/null +++ b/demos/embedded/desktopservices/data/Explosion.wav diff --git a/demos/embedded/desktopservices/data/designer.png b/demos/embedded/desktopservices/data/designer.png Binary files differnew file mode 100644 index 0000000..0988fce --- /dev/null +++ b/demos/embedded/desktopservices/data/designer.png diff --git a/demos/embedded/desktopservices/data/monkey_on_64x64.png b/demos/embedded/desktopservices/data/monkey_on_64x64.png Binary files differnew file mode 100644 index 0000000..990f604 --- /dev/null +++ b/demos/embedded/desktopservices/data/monkey_on_64x64.png diff --git a/demos/embedded/desktopservices/data/sax.mp3 b/demos/embedded/desktopservices/data/sax.mp3 Binary files differnew file mode 100644 index 0000000..0a078b1 --- /dev/null +++ b/demos/embedded/desktopservices/data/sax.mp3 diff --git a/demos/embedded/desktopservices/desktopservices.pro b/demos/embedded/desktopservices/desktopservices.pro new file mode 100644 index 0000000..32dfa40 --- /dev/null +++ b/demos/embedded/desktopservices/desktopservices.pro @@ -0,0 +1,23 @@ +TEMPLATE = app +TARGET = +INCLUDEPATH += . + +HEADERS += desktopwidget.h contenttab.h linktab.h +SOURCES += desktopwidget.cpp contenttab.cpp linktab.cpp main.cpp + +RESOURCES += desktopservices.qrc + +music.sources = data/*.mp3 data/*.wav +music.path = /data/sounds/ + +image.sources = data/*.png +image.path = /data/images/ + +DEPLOYMENT += music image + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian { + TARGET.UID3 = 0xA000C611 + ICON = ./resources/heart.svg +} diff --git a/demos/embedded/desktopservices/desktopservices.qrc b/demos/embedded/desktopservices/desktopservices.qrc new file mode 100644 index 0000000..410175f --- /dev/null +++ b/demos/embedded/desktopservices/desktopservices.qrc @@ -0,0 +1,8 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/"> + <file>resources/music.png</file> + <file>resources/photo.png</file> + <file>resources/browser.png</file> + <file>resources/message.png</file> +</qresource> +</RCC> diff --git a/demos/embedded/desktopservices/desktopwidget.cpp b/demos/embedded/desktopservices/desktopwidget.cpp new file mode 100644 index 0000000..fbcc078 --- /dev/null +++ b/demos/embedded/desktopservices/desktopwidget.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// EXTERNAL INCLUDES +#include <QTabWidget> +#include <QVBoxLayout> +#include <QDesktopServices> + +// INTERNAL INCLUDES +#include "linktab.h" +#include "contenttab.h" + +// CLASS HEADER +#include "desktopwidget.h" + +// CONSTRUCTORS & DESTRUCTORS +DesktopWidget::DesktopWidget(QWidget *parent) : QWidget(parent) + +{ + QTabWidget *tabWidget = new QTabWidget(this); + + // Images + ContentTab* imageTab = new ContentTab(tabWidget); + imageTab->init(QDesktopServices::PicturesLocation, + "*.png;*.jpg;*.jpeg;*.bmp;*.gif", + ":/resources/photo.png"); + tabWidget->addTab(imageTab, tr("Images")); + + // Music + ContentTab* musicTab = new ContentTab(tabWidget); + musicTab->init(QDesktopServices::MusicLocation, + "*.wav;*.mp3;*.mp4", + ":/resources/music.png"); + tabWidget->addTab(musicTab, tr("Music")); + + // Links + LinkTab* othersTab = new LinkTab(tabWidget);; + // Given icon file will be overriden by LinkTab + othersTab->init(QDesktopServices::PicturesLocation, "", ""); + tabWidget->addTab(othersTab, tr("Links")); + + // Layout + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(tabWidget); + setLayout(layout); +} + +DesktopWidget::~DesktopWidget() +{ +} + +// End of file diff --git a/demos/embedded/desktopservices/desktopwidget.h b/demos/embedded/desktopservices/desktopwidget.h new file mode 100644 index 0000000..c550715 --- /dev/null +++ b/demos/embedded/desktopservices/desktopwidget.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DESKTOPWIDGET_H_ +#define DESKTOPWIDGET_H_ + +// EXTERNAL INCLUDES +#include <QWidget> + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +QT_BEGIN_NAMESPACE +class QTabWidget; +QT_END_NAMESPACE + +// CLASS DECLARATION +/** +* DesktopWidget class. +* +* Implements the main top level widget for QDesktopServices demo app. +*/ +class DesktopWidget : public QWidget +{ + Q_OBJECT + +public: // Constructors & Destructors + DesktopWidget(QWidget *parent); + ~DesktopWidget(); + +}; + +#endif // DESKTOPWIDGET_H_ + +// End of file diff --git a/demos/embedded/desktopservices/linktab.cpp b/demos/embedded/desktopservices/linktab.cpp new file mode 100644 index 0000000..95024da --- /dev/null +++ b/demos/embedded/desktopservices/linktab.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// EXTERNAL INCLUDES +#include <QUrl> +#include <QMessageBox> +#include <QListWidgetItem> + +// INTERNAL INCLUDES + +// CLASS HEADER +#include "linktab.h" + +LinkTab::LinkTab(QWidget *parent) : + ContentTab(parent) +{ +} + +LinkTab::~LinkTab() +{ +} + +void LinkTab::populateListWidget() +{ + m_WebItem = new QListWidgetItem(QIcon(":/resources/browser.png"), tr("Launch Browser"), this); + m_MailToItem = new QListWidgetItem(QIcon(":/resources/message.png"), tr("New e-mail"), this); +} + +QUrl LinkTab::itemUrl(QListWidgetItem *item) +{ + if (m_WebItem == item) { + return QUrl(tr("http://www.qtsoftware.com")); + } else if (m_MailToItem == item) { + return QUrl(tr("mailto:qts60-feedback@trolltech.com?subject=QtS60 feedback&body=Hello")); + } else { + // We should never endup here + Q_ASSERT(false); + return QUrl(); + } +} +void LinkTab::handleErrorInOpen(QListWidgetItem *item) +{ + if (m_MailToItem == item) { + QMessageBox::warning(this, tr("Operation Failed"), tr("Please check that you have\ne-mail account defined."), QMessageBox::Close); + } else { + ContentTab::handleErrorInOpen(item); + } +} + +// End of file diff --git a/demos/embedded/desktopservices/linktab.h b/demos/embedded/desktopservices/linktab.h new file mode 100644 index 0000000..3f8cc5d --- /dev/null +++ b/demos/embedded/desktopservices/linktab.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LINKTAB_H_ +#define LINKTAB_H_ + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "contenttab.h" + +// FORWARD DECLARATIONS +QT_BEGIN_NAMESPACE +class QWidget; +class QListWidgetItem; +QT_END_NAMESPACE + +// CLASS DECLARATION + +/** +* LinkTab class. +* +* This class implements tab for opening http and mailto links. +*/ +class LinkTab : public ContentTab +{ + Q_OBJECT + +public: // Constructors & Destructors + LinkTab(QWidget *parent); + ~LinkTab(); + +protected: // Derived Methods + virtual void populateListWidget(); + virtual QUrl itemUrl(QListWidgetItem *item); + virtual void handleErrorInOpen(QListWidgetItem *item); + +private: // Used variables + QListWidgetItem *m_WebItem; + QListWidgetItem *m_MailToItem; + +private: // Owned variables + +}; + +#endif // CONTENTTAB_H_ + +// End of File diff --git a/demos/embedded/desktopservices/main.cpp b/demos/embedded/desktopservices/main.cpp new file mode 100644 index 0000000..89c31d8 --- /dev/null +++ b/demos/embedded/desktopservices/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include "desktopwidget.h" + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(desktopservices); + + QApplication app(argc, argv); + DesktopWidget* myWidget = new DesktopWidget(0); + myWidget->showMaximized(); + + return app.exec(); +} + +// End of file diff --git a/demos/embedded/desktopservices/resources/browser.png b/demos/embedded/desktopservices/resources/browser.png Binary files differnew file mode 100644 index 0000000..28561e1 --- /dev/null +++ b/demos/embedded/desktopservices/resources/browser.png diff --git a/demos/embedded/desktopservices/resources/heart.svg b/demos/embedded/desktopservices/resources/heart.svg new file mode 100644 index 0000000..ba5f050 --- /dev/null +++ b/demos/embedded/desktopservices/resources/heart.svg @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="595.27559pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"> +<metadata> +<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> +<cc:Work rdf:about=""> +<dc:title>Heart Left-Highlight</dc:title> +<dc:description>This is a normal valentines day heart.</dc:description> +<dc:subject> +<rdf:Bag> +<rdf:li>holiday</rdf:li> +<rdf:li>valentines</rdf:li> +<rdf:li></rdf:li> +<rdf:li>valentine</rdf:li> +<rdf:li>hash(0x8a091c0)</rdf:li> +<rdf:li>hash(0x8a0916c)</rdf:li> +<rdf:li>signs_and_symbols</rdf:li> +<rdf:li>hash(0x8a091f0)</rdf:li> +<rdf:li>day</rdf:li> +</rdf:Bag> +</dc:subject> +<dc:publisher> +<cc:Agent rdf:about="http://www.openclipart.org"> +<dc:title>Jon Phillips</dc:title> +</cc:Agent> +</dc:publisher> +<dc:creator> +<cc:Agent> +<dc:title>Jon Phillips</dc:title> +</cc:Agent> +</dc:creator> +<dc:rights> +<cc:Agent> +<dc:title>Jon Phillips</dc:title> +</cc:Agent> +</dc:rights> +<dc:date></dc:date> +<dc:format>image/svg+xml</dc:format> +<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> +<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/> +<dc:language>en</dc:language> +</cc:Work> +<cc:License rdf:about="http://web.resource.org/cc/PublicDomain"> +<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> +<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> +<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> +</cc:License> +</rdf:RDF> +</metadata> +<defs id="defs3"/> +<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/> +<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1"> +<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/> +<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/> +</g> +</svg> diff --git a/demos/embedded/desktopservices/resources/message.png b/demos/embedded/desktopservices/resources/message.png Binary files differnew file mode 100644 index 0000000..e30052b --- /dev/null +++ b/demos/embedded/desktopservices/resources/message.png diff --git a/demos/embedded/desktopservices/resources/music.png b/demos/embedded/desktopservices/resources/music.png Binary files differnew file mode 100644 index 0000000..11a57bb --- /dev/null +++ b/demos/embedded/desktopservices/resources/music.png diff --git a/demos/embedded/desktopservices/resources/photo.png b/demos/embedded/desktopservices/resources/photo.png Binary files differnew file mode 100644 index 0000000..5ba15c1 --- /dev/null +++ b/demos/embedded/desktopservices/resources/photo.png diff --git a/demos/embedded/embedded.pro b/demos/embedded/embedded.pro index 4fd8f9f..f876dc1 100644 --- a/demos/embedded/embedded.pro +++ b/demos/embedded/embedded.pro @@ -2,13 +2,18 @@ TEMPLATE = subdirs SUBDIRS = styledemo contains(QT_CONFIG, svg) { - SUBDIRS += embeddedsvgviewer - # no QProcess + SUBDIRS += embeddedsvgviewer \ + desktopservices !vxworks:!qnx:SUBDIRS += fluidlauncher } +contains(QT_CONFIG, webkit) { + SUBDIRS += anomaly +} + # install sources.files = README *.pro sources.path = $$[QT_INSTALL_DEMOS]/embedded INSTALLS += sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.cpp b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.cpp index 42756a4..9613905 100644 --- a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.cpp +++ b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.cpp @@ -143,7 +143,7 @@ void EmbeddedSvgViewer::updateImageScale() } -void EmbeddedSvgViewer::resizeEvent ( QResizeEvent * event ) +void EmbeddedSvgViewer::resizeEvent ( QResizeEvent * /* event */ ) { qreal origZoom = m_zoomLevel; diff --git a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro index 505e607..3ce2fbf 100644 --- a/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro +++ b/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.pro @@ -9,8 +9,12 @@ RESOURCES += embeddedsvgviewer.qrc target.path = $$[QT_INSTALL_DEMOS]/embedded/embeddedsvgviewer sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.svg files sources.path = $$[QT_INSTALL_DEMOS]/embedded/embeddedsvgviewer -INSTALLS += target sources +INSTALLS += target sources -wince*: { +wince* { DEPLOYMENT_PLUGIN += qsvg } + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian:TARGET.UID3 = 0xA000A640 diff --git a/demos/embedded/fluidlauncher/config_s60/config.xml b/demos/embedded/fluidlauncher/config_s60/config.xml new file mode 100644 index 0000000..95e96bd --- /dev/null +++ b/demos/embedded/fluidlauncher/config_s60/config.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<demolauncher> + <demos> + <example filename="embeddedsvgviewer" name="SVG Viewer" image="screenshots/embeddedsvgviewer_s60.png" args="/data/images/qt/demos/embeddedsvgviewer/shapes.svg"/> + <example filename="styledemo" name="Stylesheets" image="screenshots/styledemo_s60.png"/> + <example filename="deform" name="Vector Deformation" image="screenshots/deform.png" args="-small-screen"/> + <example filename="pathstroke" name="Path Stroking" image="screenshots/pathstroke.png" args="-small-screen"/> + <example filename="wiggly" name="Wiggly Text" image="screenshots/wiggly_s60.png" args="-small-screen"/> + <example filename="ftp" name="Ftp Client" image="screenshots/ftp_s60.png"/> + <example filename="context2d" name="Context2d" image="screenshots/context2d_s60.png"/> + <example filename="saxbookmarks" name="SaxBookmarks" image="screenshots/saxbookmarks_s60.png"/> + <example filename="desktopservices" name="Desktop Services" image="screenshots/desktopservices_s60.png"/> + <example filename="fridgemagnets" name="Fridge Magnets" image="screenshots/fridgemagnets_s60.png" args="-small-screen"/> + <example filename="drilldown" name="Drilldown" image="screenshots/drilldown_s60.png"/> + <example filename="softkeys" name="Softkeys" image="screenshots/softkeys_s60.png"/> + <example filename="anomaly" name="Anomaly Browser" image="screenshots/anomaly_s60.png"/> + </demos> + <slideshow timeout="60000" interval="10000"> + <imagedir dir="slides"/> + </slideshow> +</demolauncher> diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp index 27ec5b4..e93e023 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.cpp +++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp @@ -39,12 +39,14 @@ ** ****************************************************************************/ -#include <QtXml> +#include <QXmlStreamReader> #include "fluidlauncher.h" #define DEFAULT_INPUT_TIMEOUT 10000 +#define SIZING_FACTOR_HEIGHT 6/10 +#define SIZING_FACTOR_WIDTH 6/10 FluidLauncher::FluidLauncher(QStringList* args) { @@ -62,7 +64,11 @@ FluidLauncher::FluidLauncher(QStringList* args) inputTimer->setSingleShot(true); inputTimer->setInterval(DEFAULT_INPUT_TIMEOUT); - pictureFlowWidget->setSlideSize(QSize( (screen_size.width()*2)/5, (screen_size.height()*2)/5 )); + const int h = screen_size.height() * SIZING_FACTOR_HEIGHT; + const int w = screen_size.width() * SIZING_FACTOR_WIDTH; + const int hh = qMin(h, w); + const int ww = hh / 3 * 2; + pictureFlowWidget->setSlideSize(QSize(ww, hh)); bool success; int configIndex = args->indexOf("-config"); @@ -100,61 +106,97 @@ bool FluidLauncher::loadConfig(QString configPath) slideShowWidget->clearImages(); - QDomDocument xmlDoc; - xmlDoc.setContent(&xmlFile, true); + xmlFile.open(QIODevice::ReadOnly); + QXmlStreamReader reader(&xmlFile); + while (!reader.atEnd()) { + reader.readNext(); - QDomElement rootElement = xmlDoc.documentElement(); - - // Process the demos node: - QDomNodeList demoNodes = rootElement.firstChildElement("demos").elementsByTagName("example"); - for (int i=0; i<demoNodes.size(); i++) { - QDomElement element = demoNodes.item(i).toElement(); - - if (element.hasAttribute("filename")) { - DemoApplication* newDemo = new DemoApplication( - element.attribute("filename"), - element.attribute("name", "Unamed Demo"), - element.attribute("image"), - element.attribute("args").split(" ")); - demoList.append(newDemo); + if (reader.isStartElement()) { + if (reader.name() == "demos") + parseDemos(reader); + else if(reader.name() == "slideshow") + parseSlideshow(reader); } } + if (reader.hasError()) { + qDebug() << QString("Error parsing %1 on line %2 column %3: \n%4") + .arg(configPath) + .arg(reader.lineNumber()) + .arg(reader.columnNumber()) + .arg(reader.errorString()); + } - // Process the slideshow node: - QDomElement slideshowElement = rootElement.firstChildElement("slideshow"); + // Append an exit Item + DemoApplication* exitItem = new DemoApplication(QString(), QLatin1String("Exit Embedded Demo"), QString(), QStringList()); + demoList.append(exitItem); - if (slideshowElement.hasAttribute("timeout")) { - bool valid; - int timeout = slideshowElement.attribute("timeout").toInt(&valid); - if (valid) - inputTimer->setInterval(timeout); - } + return true; +} - if (slideshowElement.hasAttribute("interval")) { - bool valid; - int interval = slideshowElement.attribute("interval").toInt(&valid); - if (valid) - slideShowWidget->setSlideInterval(interval); + +void FluidLauncher::parseDemos(QXmlStreamReader& reader) +{ + while (!reader.atEnd()) { + reader.readNext(); + if (reader.isStartElement() && reader.name() == "example") { + QXmlStreamAttributes attrs = reader.attributes(); + QStringRef filename = attrs.value("filename"); + if (!filename.isEmpty()) { + QStringRef name = attrs.value("name"); + QStringRef image = attrs.value("image"); + QStringRef args = attrs.value("args"); + + DemoApplication* newDemo = new DemoApplication( + filename.toString(), + name.isEmpty() ? "Unamed Demo" : name.toString(), + image.toString(), + args.toString().split(" ")); + demoList.append(newDemo); + } + } else if(reader.isEndElement() && reader.name() == "demos") { + return; + } } +} - for (QDomNode node=slideshowElement.firstChild(); !node.isNull(); node=node.nextSibling()) { - QDomElement element = node.toElement(); +void FluidLauncher::parseSlideshow(QXmlStreamReader& reader) +{ + QXmlStreamAttributes attrs = reader.attributes(); + + QStringRef timeout = attrs.value("timeout"); + bool valid; + if (!timeout.isEmpty()) { + int t = timeout.toString().toInt(&valid); + if (valid) + inputTimer->setInterval(t); + } - if (element.tagName() == "imagedir") - slideShowWidget->addImageDir(element.attribute("dir")); - else if (element.tagName() == "image") - slideShowWidget->addImage(element.attribute("image")); + QStringRef interval = attrs.value("interval"); + if (!interval.isEmpty()) { + int i = interval.toString().toInt(&valid); + if (valid) + slideShowWidget->setSlideInterval(i); } - // Append an exit Item - DemoApplication* exitItem = new DemoApplication(QString(), QLatin1String("Exit Embedded Demo"), QString(), QStringList()); - demoList.append(exitItem); + while (!reader.atEnd()) { + reader.readNext(); + if (reader.isStartElement()) { + QXmlStreamAttributes attrs = reader.attributes(); + if (reader.name() == "imagedir") { + QStringRef dir = attrs.value("dir"); + slideShowWidget->addImageDir(dir.toString()); + } else if(reader.name() == "image") { + QStringRef image = attrs.value("image"); + slideShowWidget->addImage(image.toString()); + } + } else if(reader.isEndElement() && reader.name() == "slideshow") { + return; + } + } - return true; } - void FluidLauncher::populatePictureFlow() { pictureFlowWidget->setSlideCount(demoList.count()); diff --git a/demos/embedded/fluidlauncher/fluidlauncher.h b/demos/embedded/fluidlauncher/fluidlauncher.h index 77d0980..7914847 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.h +++ b/demos/embedded/fluidlauncher/fluidlauncher.h @@ -44,6 +44,7 @@ #include <QtGui> #include <QTimer> +#include <QStringRef> #include "pictureflow.h" #include "slideshow.h" @@ -73,7 +74,8 @@ private: bool loadConfig(QString configPath); void populatePictureFlow(); void switchToSlideshow(); - + void parseDemos(QXmlStreamReader& reader); + void parseSlideshow(QXmlStreamReader& reader); }; diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index 76d12ad..3eff37b 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -1,8 +1,7 @@ TEMPLATE = app -TARGET = +TARGET = DEPENDPATH += . INCLUDEPATH += . -QT += xml # Input HEADERS += \ @@ -40,7 +39,8 @@ wince*{ $$QT_BUILD_TREE/demos/pathstroke/$${BUILD_DIR}/pathstroke.exe \ $$QT_BUILD_TREE/examples/graphicsview/elasticnodes/$${BUILD_DIR}/elasticnodes.exe \ $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/wiggly.exe \ - $$QT_BUILD_TREE/examples/painting/concentriccircles/$${BUILD_DIR}/concentriccircles.exe + $$QT_BUILD_TREE/examples/painting/concentriccircles/$${BUILD_DIR}/concentriccircles.exe \ + $$QT_BUILD_TREE/examples/draganddrop/$${BUILD_DIR}/fridgemagnets.exe executables.path = . @@ -54,3 +54,96 @@ wince*{ DEPLOYMENT_PLUGIN += qgif qjpeg qmng qsvg } + +symbian { + load(data_caging_paths) + + TARGET.UID3 = 0xA000A641 + + executables.sources = \ + embeddedsvgviewer.exe \ + styledemo.exe \ + deform.exe \ + pathstroke.exe \ + wiggly.exe \ + ftp.exe \ + context2d.exe \ + saxbookmarks.exe \ + desktopservices.exe \ + fridgemagnets.exe \ + drilldown.exe \ + softkeys.exe + contains(QT_CONFIG, webkit) { + executables.sources += anomaly.exe + } + + executables.path = /sys/bin + + reg_resource.sources = \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/embeddedsvgviewer_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/styledemo_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/deform_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/pathstroke_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/wiggly_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/ftp_reg.rsc\ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/saxbookmarks_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/desktopservices_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/fridgemagnets_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/drilldown_reg.rsc \ + $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/softkeys_reg.rsc + contains(QT_CONFIG, webkit) { + reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc + } + + reg_resource.path = $$REG_RESOURCE_IMPORT_DIR + + resource.sources = \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/styledemo.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/deform.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/pathstroke.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/wiggly.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/ftp.rsc\ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/saxbookmarks.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/desktopservices.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/drilldown.rsc \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.rsc + contains(QT_CONFIG, webkit) { + resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc + } + + resource.path = $$APP_RESOURCE_DIR + + mifs.sources = \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C611.mif + mifs.path = $$APP_RESOURCE_DIR + + files.sources = $$PWD/screenshots $$PWD/slides + files.path = . + + config.sources = $$PWD/config_s60/config.xml + config.path = . + + viewerimages.sources = $$PWD/../embeddedsvgviewer/shapes.svg + viewerimages.path = /data/images/qt/demos/embeddedsvgviewer + + desktopservices_music.sources = \ + $$PWD/../desktopservices/data/*.mp3 \ + $$PWD/../desktopservices/data/*.wav + desktopservices_music.path = /data/sounds + + desktopservices_images.sources = $$PWD/../desktopservices/data/*.png + desktopservices_images.path = /data/images + + saxbookmarks.sources = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel + saxbookmarks.sources += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel + saxbookmarks.path = /data/qt/saxbookmarks + + DEPLOYMENT += config files executables viewerimages saxbookmarks reg_resource resource \ + mifs desktopservices_music desktopservices_images + + TARGET.EPOCHEAPSIZE = 100000 20000000 +} diff --git a/demos/embedded/fluidlauncher/pictureflow.cpp b/demos/embedded/fluidlauncher/pictureflow.cpp index f0fedf4..4076f07 100644 --- a/demos/embedded/fluidlauncher/pictureflow.cpp +++ b/demos/embedded/fluidlauncher/pictureflow.cpp @@ -106,6 +106,14 @@ #include <QDebug> +static const int captionFontSize = +#ifdef Q_WS_S60 + 8; +#else + 14; +#endif + + // uncomment this to enable bilinear filtering for texture mapping // gives much better rendering, at the cost of memory space // #define PICTUREFLOW_BILINEAR_FILTER @@ -740,14 +748,14 @@ void PictureFlowPrivate::render() QPainter painter; painter.begin(&buffer); - QFont font("Arial", 14); + QFont font("Arial", captionFontSize); font.setBold(true); painter.setFont(font); painter.setPen(Qt::white); //painter.setPen(QColor(255,255,255,127)); if (!captions.isEmpty()) - painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/2), + painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/4), Qt::AlignCenter, captions[centerIndex]); painter.end(); @@ -788,18 +796,18 @@ void PictureFlowPrivate::render() QPainter painter; painter.begin(&buffer); - QFont font("Arial", 14); + QFont font("Arial", captionFontSize); font.setBold(true); painter.setFont(font); int leftTextIndex = (step>0) ? centerIndex : centerIndex-1; painter.setPen(QColor(255,255,255, (255-fade) )); - painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/2), + painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/4), Qt::AlignCenter, captions[leftTextIndex]); painter.setPen(QColor(255,255,255, fade)); - painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/2), + painter.drawText( QRect(0,0, buffer.width(), (buffer.height() - slideSize().height())/4), Qt::AlignCenter, captions[leftTextIndex+1]); painter.end(); @@ -1263,6 +1271,12 @@ void PictureFlow::keyPressEvent(QKeyEvent* event) return; } + if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Select) { + emit itemActivated(d->getTarget()); + event->accept(); + return; + } + event->ignore(); } diff --git a/demos/embedded/fluidlauncher/screenshots/anomaly_s60.png b/demos/embedded/fluidlauncher/screenshots/anomaly_s60.png Binary files differnew file mode 100644 index 0000000..b9a73fd --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/anomaly_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/context2d_s60.png b/demos/embedded/fluidlauncher/screenshots/context2d_s60.png Binary files differnew file mode 100644 index 0000000..a53f5b0 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/context2d_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/desktopservices_s60.png b/demos/embedded/fluidlauncher/screenshots/desktopservices_s60.png Binary files differnew file mode 100644 index 0000000..f4aa1a2 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/desktopservices_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/drilldown_s60.png b/demos/embedded/fluidlauncher/screenshots/drilldown_s60.png Binary files differnew file mode 100644 index 0000000..50376c1 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/drilldown_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer_s60.png b/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer_s60.png Binary files differnew file mode 100644 index 0000000..11459dc --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/fridgemagnets_s60.png b/demos/embedded/fluidlauncher/screenshots/fridgemagnets_s60.png Binary files differnew file mode 100644 index 0000000..56da9dc --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/fridgemagnets_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/ftp_s60.png b/demos/embedded/fluidlauncher/screenshots/ftp_s60.png Binary files differnew file mode 100644 index 0000000..ea6a321 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/ftp_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/saxbookmarks_s60.png b/demos/embedded/fluidlauncher/screenshots/saxbookmarks_s60.png Binary files differnew file mode 100644 index 0000000..c451198 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/saxbookmarks_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/softkeys_s60.png b/demos/embedded/fluidlauncher/screenshots/softkeys_s60.png Binary files differnew file mode 100644 index 0000000..03989fb --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/softkeys_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/styledemo_s60.png b/demos/embedded/fluidlauncher/screenshots/styledemo_s60.png Binary files differnew file mode 100644 index 0000000..bad9692 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/styledemo_s60.png diff --git a/demos/embedded/fluidlauncher/screenshots/wiggly_s60.png b/demos/embedded/fluidlauncher/screenshots/wiggly_s60.png Binary files differnew file mode 100644 index 0000000..690ab48 --- /dev/null +++ b/demos/embedded/fluidlauncher/screenshots/wiggly_s60.png diff --git a/demos/embedded/styledemo/files/application.qss b/demos/embedded/styledemo/files/application.qss index a632ad1..432fe6b 100644 --- a/demos/embedded/styledemo/files/application.qss +++ b/demos/embedded/styledemo/files/application.qss @@ -6,7 +6,7 @@ QWidget#StyleWidget QLabel, QAbstractButton { - font: 18px bold; + font: bold; color: beige; } diff --git a/demos/embedded/styledemo/files/blue.qss b/demos/embedded/styledemo/files/blue.qss index aa87277..ac8671b 100644 --- a/demos/embedded/styledemo/files/blue.qss +++ b/demos/embedded/styledemo/files/blue.qss @@ -5,7 +5,7 @@ QLabel, QAbstractButton { - font: 10pt bold; + font: bold; color: yellow; } @@ -28,7 +28,6 @@ QAbstractButton border-style: solid; border-radius: 5; padding: 3px; - qproperty-focusPolicy: NoFocus; } QAbstractButton:pressed diff --git a/demos/embedded/styledemo/files/khaki.qss b/demos/embedded/styledemo/files/khaki.qss index 9c0f77c..b0d4a0f 100644 --- a/demos/embedded/styledemo/files/khaki.qss +++ b/demos/embedded/styledemo/files/khaki.qss @@ -16,7 +16,6 @@ QPushButton, QToolButton { padding: 3px; /* min-width: 96px; */ /* min-height: 48px; */ - qproperty-focusPolicy: NoFocus } QPushButton:hover, QToolButton:hover { @@ -30,7 +29,7 @@ QPushButton:pressed, QToolButton:pressed { } QLabel, QAbstractButton { - font: italic 11pt "Times New Roman"; + font: italic "Times New Roman"; } QFrame, QLabel#title { diff --git a/demos/embedded/styledemo/files/transparent.qss b/demos/embedded/styledemo/files/transparent.qss index e3a9912..b38eb36 100644 --- a/demos/embedded/styledemo/files/transparent.qss +++ b/demos/embedded/styledemo/files/transparent.qss @@ -6,7 +6,6 @@ QWidget#StyleWidget QLabel, QAbstractButton { - font: 13pt; color: beige; } diff --git a/demos/embedded/styledemo/styledemo.pro b/demos/embedded/styledemo/styledemo.pro index ee5e4d6..e0ef202 100644 --- a/demos/embedded/styledemo/styledemo.pro +++ b/demos/embedded/styledemo/styledemo.pro @@ -10,3 +10,7 @@ target.path = $$[QT_INSTALL_DEMOS]/embedded/styledemo sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/embedded/styledemo INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian:TARGET.UID3 = 0xA000A63F diff --git a/demos/embedded/styledemo/stylewidget.ui b/demos/embedded/styledemo/stylewidget.ui index 586faea..a084dde 100644 --- a/demos/embedded/styledemo/stylewidget.ui +++ b/demos/embedded/styledemo/stylewidget.ui @@ -1,135 +1,139 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>StyleWidget</class> - <widget class="QWidget" name="StyleWidget" > - <property name="geometry" > + <widget class="QWidget" name="StyleWidget"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>339</width> - <height>230</height> + <width>174</width> + <height>220</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>3</number> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>4</number> </property> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Expanding" > + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title" > + <property name="title"> <string>Styles</string> </property> - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>3</number> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="margin"> + <number>4</number> </property> - <property name="margin" > - <number>3</number> + <property name="spacing"> + <number>4</number> </property> - <item> - <widget class="QPushButton" name="noStyle" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" > + <item row="0" column="0"> + <widget class="QPushButton" name="transparentStyle"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > - <string>No-Style</string> + <property name="text"> + <string>Transp.</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > - <bool>true</bool> + <property name="checked"> + <bool>false</bool> </property> - <property name="autoExclusive" > + <property name="autoExclusive"> <bool>true</bool> </property> </widget> </item> - <item> - <widget class="QPushButton" name="blueStyle" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" > + <item row="2" column="0"> + <widget class="QPushButton" name="blueStyle"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > + <property name="text"> <string>Blue</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > + <property name="checked"> <bool>false</bool> </property> - <property name="autoExclusive" > + <property name="autoExclusive"> <bool>true</bool> </property> </widget> </item> - <item> - <widget class="QPushButton" name="khakiStyle" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" > + <item row="0" column="1"> + <widget class="QPushButton" name="khakiStyle"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > + <property name="text"> <string>Khaki</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > + <property name="checked"> <bool>false</bool> </property> - <property name="autoExclusive" > + <property name="autoExclusive"> <bool>true</bool> </property> </widget> </item> - <item> - <widget class="QPushButton" name="transparentStyle" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="Minimum" > + <item row="2" column="1"> + <widget class="QPushButton" name="noStyle"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > - <string>Transparent</string> + <property name="text"> + <string>None</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > - <bool>false</bool> + <property name="checked"> + <bool>true</bool> </property> - <property name="autoExclusive" > + <property name="autoExclusive"> <bool>true</bool> </property> </widget> @@ -138,11 +142,11 @@ </widget> </item> <item> - <spacer name="verticalSpacer_3" > - <property name="orientation" > + <spacer name="verticalSpacer_3"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>0</height> @@ -151,56 +155,56 @@ </spacer> </item> <item> - <widget class="QFrame" name="frame" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" > + <widget class="QFrame" name="frame"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <layout class="QVBoxLayout" name="frameLayout" > - <property name="margin" > - <number>3</number> + <layout class="QVBoxLayout" name="frameLayout"> + <property name="margin"> + <number>0</number> </property> <item> - <layout class="QHBoxLayout" name="horizontalLayout" > + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QLabel" name="label" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text" > + <property name="text"> <string>My Value is:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> <item> - <widget class="QSpinBox" name="spinBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > + <widget class="QSpinBox" name="spinBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::WheelFocus</enum> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> - <property name="keyboardTracking" > + <property name="keyboardTracking"> <bool>false</bool> </property> </widget> @@ -208,85 +212,88 @@ </layout> </item> <item> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QScrollBar" name="horizontalScrollBar" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <layout class="QGridLayout" name="gridLayout"> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QScrollBar" name="horizontalScrollBar"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>0</width> <height>24</height> </size> </property> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QPushButton" name="pushButton_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > + <item row="1" column="0"> + <widget class="QPushButton" name="pushButton_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > - <string>Show Scroller</string> + <property name="text"> + <string>Show</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> - <property name="flat" > + <property name="flat"> <bool>false</bool> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QScrollBar" name="horizontalScrollBar_2" > - <property name="minimumSize" > + <item row="0" column="1"> + <widget class="QScrollBar" name="horizontalScrollBar_2"> + <property name="minimumSize"> <size> <width>0</width> <height>24</height> </size> </property> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QPushButton" name="pushButton" > - <property name="sizePolicy" > - <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > + <item row="1" column="1"> + <widget class="QPushButton" name="pushButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > - <string>Enable Scroller</string> + <property name="text"> + <string>Enable</string> </property> - <property name="checkable" > + <property name="checkable"> <bool>true</bool> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> - <property name="flat" > + <property name="flat"> <bool>false</bool> </property> </widget> @@ -297,14 +304,14 @@ </widget> </item> <item> - <spacer name="verticalSpacer" > - <property name="orientation" > + <spacer name="verticalSpacer"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeType" > + <property name="sizeType"> <enum>QSizePolicy::Expanding</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>0</height> @@ -313,13 +320,13 @@ </spacer> </item> <item> - <layout class="QHBoxLayout" > + <layout class="QHBoxLayout"> <item> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> @@ -328,11 +335,11 @@ </spacer> </item> <item> - <widget class="QPushButton" name="close" > - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> + <widget class="QPushButton" name="close"> + <property name="focusPolicy"> + <enum>Qt::StrongFocus</enum> </property> - <property name="text" > + <property name="text"> <string>Close</string> </property> </widget> @@ -342,7 +349,7 @@ </layout> </widget> <resources> - <include location="StyleDemo.qrc" /> + <include location="StyleDemo.qrc"/> </resources> <connections> <connection> @@ -351,13 +358,13 @@ <receiver>horizontalScrollBar_2</receiver> <slot>setValue(int)</slot> <hints> - <hint type="sourcelabel" > - <x>134</x> - <y>196</y> + <hint type="sourcelabel"> + <x>84</x> + <y>147</y> </hint> - <hint type="destinationlabel" > - <x>523</x> - <y>193</y> + <hint type="destinationlabel"> + <x>166</x> + <y>147</y> </hint> </hints> </connection> @@ -367,13 +374,13 @@ <receiver>horizontalScrollBar</receiver> <slot>setValue(int)</slot> <hints> - <hint type="sourcelabel" > - <x>577</x> - <y>199</y> + <hint type="sourcelabel"> + <x>166</x> + <y>147</y> </hint> - <hint type="destinationlabel" > - <x>127</x> - <y>207</y> + <hint type="destinationlabel"> + <x>84</x> + <y>147</y> </hint> </hints> </connection> @@ -383,13 +390,13 @@ <receiver>horizontalScrollBar_2</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > - <x>566</x> - <y>241</y> + <hint type="sourcelabel"> + <x>166</x> + <y>175</y> </hint> - <hint type="destinationlabel" > - <x>492</x> - <y>207</y> + <hint type="destinationlabel"> + <x>166</x> + <y>147</y> </hint> </hints> </connection> @@ -399,13 +406,13 @@ <receiver>horizontalScrollBar</receiver> <slot>setVisible(bool)</slot> <hints> - <hint type="sourcelabel" > - <x>123</x> - <y>239</y> + <hint type="sourcelabel"> + <x>84</x> + <y>175</y> </hint> - <hint type="destinationlabel" > - <x>123</x> - <y>184</y> + <hint type="destinationlabel"> + <x>84</x> + <y>147</y> </hint> </hints> </connection> @@ -415,13 +422,29 @@ <receiver>horizontalScrollBar_2</receiver> <slot>setValue(int)</slot> <hints> - <hint type="sourcelabel" > - <x>603</x> - <y>136</y> + <hint type="sourcelabel"> + <x>166</x> + <y>115</y> + </hint> + <hint type="destinationlabel"> + <x>166</x> + <y>147</y> + </hint> + </hints> + </connection> + <connection> + <sender>horizontalScrollBar_2</sender> + <signal>valueChanged(int)</signal> + <receiver>spinBox</receiver> + <slot>setValue(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>132</x> + <y>132</y> </hint> - <hint type="destinationlabel" > - <x>575</x> - <y>199</y> + <hint type="destinationlabel"> + <x>135</x> + <y>110</y> </hint> </hints> </connection> diff --git a/demos/embeddeddialogs/embeddeddialogs.pro b/demos/embeddeddialogs/embeddeddialogs.pro index a38e3e8..d9948a9 100644 --- a/demos/embeddeddialogs/embeddeddialogs.pro +++ b/demos/embeddeddialogs/embeddeddialogs.pro @@ -15,3 +15,5 @@ target.path = $$[QT_INSTALL_DEMOS]/embeddeddialogs sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.png *.jpg *.plist *.icns *.ico *.rc *.pro *.html *.doc images sources.path = $$[QT_INSTALL_DEMOS]/embeddeddialogs INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/gradients/gradients.pro b/demos/gradients/gradients.pro index 167572b..7789896 100644 --- a/demos/gradients/gradients.pro +++ b/demos/gradients/gradients.pro @@ -16,3 +16,5 @@ target.path = $$[QT_INSTALL_DEMOS]/gradients sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/gradients INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/interview/interview.pro b/demos/interview/interview.pro index c013755..0faa21f 100644 --- a/demos/interview/interview.pro +++ b/demos/interview/interview.pro @@ -16,3 +16,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES README *.pro images sources.path = $$[QT_INSTALL_DEMOS]/interview INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/macmainwindow/macmainwindow.pro b/demos/macmainwindow/macmainwindow.pro index f5165a7..cab3845 100644 --- a/demos/macmainwindow/macmainwindow.pro +++ b/demos/macmainwindow/macmainwindow.pro @@ -20,4 +20,6 @@ target.path = $$[QT_INSTALL_DEMOS]/macmainwindow sources.files = $$SOURCES *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/macmainwindow INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) } diff --git a/demos/mainwindow/mainwindow.pro b/demos/mainwindow/mainwindow.pro index 9853a55..87b42be 100644 --- a/demos/mainwindow/mainwindow.pro +++ b/demos/mainwindow/mainwindow.pro @@ -14,3 +14,4 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.png *.jpg *.pro sources.path = $$[QT_INSTALL_DEMOS]/mainwindow INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/mediaplayer/mediaplayer.pro b/demos/mediaplayer/mediaplayer.pro index c64abd9..ef07a3f 100644 --- a/demos/mediaplayer/mediaplayer.pro +++ b/demos/mediaplayer/mediaplayer.pro @@ -25,4 +25,6 @@ wince*{ DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout } +include($$QT_SOURCE_TREE/demos/demobase.pri) +symbian:TARGET.UID3 = 0xA000C613
\ No newline at end of file diff --git a/demos/pathstroke/pathstroke.pro b/demos/pathstroke/pathstroke.pro index 50b4de2..ce6ab3d 100644 --- a/demos/pathstroke/pathstroke.pro +++ b/demos/pathstroke/pathstroke.pro @@ -18,3 +18,6 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html sources.path = $$[QT_INSTALL_DEMOS]/pathstroke INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + +symbian:TARGET.UID3 = 0xA000A63E
\ No newline at end of file diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro index 163ed17..6d3cf7d 100644 --- a/demos/qtdemo/qtdemo.pro +++ b/demos/qtdemo/qtdemo.pro @@ -6,6 +6,8 @@ DESTDIR = $$DEMO_DESTDIR/bin OBJECTS_DIR = .obj MOC_DIR = .moc INSTALLS += target sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) QT += xml network contains(QT_CONFIG, opengl) { diff --git a/demos/shared/shared.pri b/demos/shared/shared.pri index b551595..1541fa7 100644 --- a/demos/shared/shared.pri +++ b/demos/shared/shared.pri @@ -16,5 +16,6 @@ contains(CONFIG, debug_and_release_target) { hpux-acc*:LIBS += $$SHARED_FOLDER/libdemo_shared.a hpuxi-acc*:LIBS += $$SHARED_FOLDER/libdemo_shared.a -!hpuxi-acc*:!hpux-acc*:LIBS += -ldemo_shared +symbian:LIBS += -ldemo_shared.lib +!hpuxi-acc*:!hpux-acc*:!symbian:LIBS += -ldemo_shared diff --git a/demos/shared/shared.pro b/demos/shared/shared.pro index cabce25..a5e0e70 100644 --- a/demos/shared/shared.pro +++ b/demos/shared/shared.pro @@ -29,5 +29,8 @@ target.path = $$[QT_INSTALL_DEMOS]/shared sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.pri images sources.path = $$[QT_INSTALL_DEMOS]/shared INSTALLS += sources + +include($$QT_SOURCE_TREE/demos/demobase.pri) !cross_compile:INSTALLS += target +symbian:TARGET.UID3 = 0xA000A63C diff --git a/demos/spreadsheet/spreadsheet.pro b/demos/spreadsheet/spreadsheet.pro index 6ed0016..102b75d 100644 --- a/demos/spreadsheet/spreadsheet.pro +++ b/demos/spreadsheet/spreadsheet.pro @@ -31,3 +31,4 @@ sources.files = $$SOURCES $$RESOURCES *.pro images $$HEADERS sources.path = $$[QT_INSTALL_DEMOS]/spreadsheet INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/sqlbrowser/sqlbrowser.pro b/demos/sqlbrowser/sqlbrowser.pro index 920e8a0..1334bc1 100644 --- a/demos/sqlbrowser/sqlbrowser.pro +++ b/demos/sqlbrowser/sqlbrowser.pro @@ -18,6 +18,8 @@ sources.files = $$SOURCES $$HEADERS $$FORMS *.pro sources.path = $$[QT_INSTALL_DEMOS]/sqlbrowser INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) + wince*: { DEPLOYMENT_PLUGIN += qsqlite } diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index bf57eab..bc8d44b 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -128,7 +128,9 @@ TextEdit::TextEdit(QWidget *parent) connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); +#ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); +#endif QString initialFile = ":/example.html"; const QStringList args = QCoreApplication::arguments(); @@ -259,7 +261,9 @@ void TextEdit::setupEditActions() a->setShortcut(QKeySequence::Paste); tb->addAction(a); menu->addAction(a); +#ifndef QT_NO_CLIPBOARD actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); +#endif } void TextEdit::setupTextActions() @@ -676,7 +680,9 @@ void TextEdit::cursorPositionChanged() void TextEdit::clipboardDataChanged() { +#ifndef QT_NO_CLIPBOARD actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty()); +#endif } void TextEdit::about() diff --git a/demos/textedit/textedit.pro b/demos/textedit/textedit.pro index 1ef4256..8b29a45 100644 --- a/demos/textedit/textedit.pro +++ b/demos/textedit/textedit.pro @@ -19,3 +19,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.doc images sources.path = $$[QT_INSTALL_DEMOS]/textedit INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) diff --git a/demos/undo/undo.pro b/demos/undo/undo.pro index e26d07c..a4257cd 100644 --- a/demos/undo/undo.pro +++ b/demos/undo/undo.pro @@ -15,3 +15,4 @@ sources.files = $$SOURCES $$HEADERS *.pro icons $$RESOURCES $$FORMS sources.path = $$[QT_INSTALL_DEMOS]/undo INSTALLS += target sources +include($$QT_SOURCE_TREE/demos/demobase.pri) |