From 0748751c9f097d9d866605306bbdd4b96e2a5c4e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 27 Apr 2011 19:16:41 +0200 Subject: Squashed commit of the changes from the mobile-examples repository (4.7-generated-declarative branch). --- examples/statemachine/eventtransitions/eventtransitions.pro | 5 +++++ examples/statemachine/eventtransitions/main.cpp | 11 ++++++++++- examples/statemachine/factorial/factorial.pro | 5 +++++ examples/statemachine/pingpong/pingpong.pro | 5 +++++ examples/statemachine/rogue/main.cpp | 4 ++++ examples/statemachine/rogue/movementtransition.h | 7 ++++++- examples/statemachine/rogue/rogue.pro | 3 +++ examples/statemachine/rogue/window.cpp | 12 +++++++++--- examples/statemachine/rogue/window.h | 5 +++++ examples/statemachine/trafficlight/main.cpp | 9 +++++++++ examples/statemachine/trafficlight/trafficlight.pro | 4 ++++ examples/statemachine/twowaybutton/main.cpp | 6 ++++++ examples/statemachine/twowaybutton/twowaybutton.pro | 4 ++++ 13 files changed, 75 insertions(+), 5 deletions(-) (limited to 'examples/statemachine') diff --git a/examples/statemachine/eventtransitions/eventtransitions.pro b/examples/statemachine/eventtransitions/eventtransitions.pro index 646c90a07d..8b77bb25a1 100644 --- a/examples/statemachine/eventtransitions/eventtransitions.pro +++ b/examples/statemachine/eventtransitions/eventtransitions.pro @@ -5,3 +5,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/eventtransitions sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS eventtransitions.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/eventtransitions INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/statemachine/eventtransitions/main.cpp b/examples/statemachine/eventtransitions/main.cpp index 5391057992..5c0eb8218b 100644 --- a/examples/statemachine/eventtransitions/main.cpp +++ b/examples/statemachine/eventtransitions/main.cpp @@ -48,7 +48,12 @@ public: : QWidget(parent) { QPushButton *button = new QPushButton(this); - button->setGeometry(QRect(100, 100, 100, 100)); + button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(button); + layout->setContentsMargins(80, 80, 80, 80); + setLayout(layout); //! [0] //! [1] @@ -103,7 +108,11 @@ int main(int argc, char **argv) QApplication app(argc, argv); Window window; window.resize(300, 300); +#if defined(Q_OS_SYMBIAN) + window.showMaximized(); +#else window.show(); +#endif return app.exec(); } diff --git a/examples/statemachine/factorial/factorial.pro b/examples/statemachine/factorial/factorial.pro index 4291d43306..012e175e3b 100644 --- a/examples/statemachine/factorial/factorial.pro +++ b/examples/statemachine/factorial/factorial.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/factorial sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS factorial.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/factorial INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/statemachine/pingpong/pingpong.pro b/examples/statemachine/pingpong/pingpong.pro index 9d2b17fc9e..9ee782c1de 100644 --- a/examples/statemachine/pingpong/pingpong.pro +++ b/examples/statemachine/pingpong/pingpong.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/pingpong sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pingpong.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/pingpong INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/statemachine/rogue/main.cpp b/examples/statemachine/rogue/main.cpp index 71c2c69470..dc8783c67e 100644 --- a/examples/statemachine/rogue/main.cpp +++ b/examples/statemachine/rogue/main.cpp @@ -47,7 +47,11 @@ int main(int argv, char **args) QApplication app(argv, args); Window window; +#if defined(Q_OS_SYMBIAN) + window.showMaximized(); +#else window.show(); +#endif return app.exec(); } diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h index 1153b7508d..be15e38647 100644 --- a/examples/statemachine/rogue/movementtransition.h +++ b/examples/statemachine/rogue/movementtransition.h @@ -68,7 +68,8 @@ protected: int key = keyEvent->key(); return key == Qt::Key_2 || key == Qt::Key_8 || key == Qt::Key_6 || - key == Qt::Key_4; + key == Qt::Key_4 || key == Qt::Key_Down || key == Qt::Key_Up || + key == Qt::Key_Right || key == Qt::Key_Left; } return false; } @@ -81,15 +82,19 @@ protected: int key = keyEvent->key(); switch (key) { + case Qt::Key_Left: case Qt::Key_4: window->movePlayer(Window::Left); break; + case Qt::Key_Up: case Qt::Key_8: window->movePlayer(Window::Up); break; + case Qt::Key_Right: case Qt::Key_6: window->movePlayer(Window::Right); break; + case Qt::Key_Down: case Qt::Key_2: window->movePlayer(Window::Down); break; diff --git a/examples/statemachine/rogue/rogue.pro b/examples/statemachine/rogue/rogue.pro index 6ab613bea9..c4fcfe9cfe 100644 --- a/examples/statemachine/rogue/rogue.pro +++ b/examples/statemachine/rogue/rogue.pro @@ -9,3 +9,6 @@ sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/rogue INSTALLS += target sources +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/statemachine/rogue/window.cpp b/examples/statemachine/rogue/window.cpp index 39f5aa65d9..f40b7a020e 100644 --- a/examples/statemachine/rogue/window.cpp +++ b/examples/statemachine/rogue/window.cpp @@ -52,16 +52,22 @@ Window::Window() QFontDatabase database; QFont font; - if (database.families().contains("Monospace")) - font = QFont("Monospace", 12); + if (database.families().contains("Monospace")) { + font = QFont("Monospace"); + } else { foreach (QString family, database.families()) { if (database.isFixedPitch(family)) { - font = QFont(family, 12); + font = QFont(family); break; } } } +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR) + font.setPointSize(5); +#else + font.setPointSize(12); +#endif setFont(font); //![1] diff --git a/examples/statemachine/rogue/window.h b/examples/statemachine/rogue/window.h index 025ec79600..bdadad463d 100644 --- a/examples/statemachine/rogue/window.h +++ b/examples/statemachine/rogue/window.h @@ -49,8 +49,13 @@ class QStateMachine; class QTransition; QT_END_NAMESPACE +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR) +#define WIDTH 43 +#define HEIGHT 14 +#else #define WIDTH 35 #define HEIGHT 20 +#endif //![0] class Window : public QWidget diff --git a/examples/statemachine/trafficlight/main.cpp b/examples/statemachine/trafficlight/main.cpp index 23cd34833a..c20e05926f 100644 --- a/examples/statemachine/trafficlight/main.cpp +++ b/examples/statemachine/trafficlight/main.cpp @@ -88,6 +88,9 @@ public: : QWidget(parent) { QVBoxLayout *vbox = new QVBoxLayout(this); +#ifdef Q_WS_MAEMO_5 + vbox->setContentsMargins(320, 0, 320, 0); +#endif m_red = new LightWidget(Qt::red); vbox->addWidget(m_red); m_yellow = new LightWidget(Qt::yellow); @@ -174,8 +177,14 @@ int main(int argc, char **argv) QApplication app(argc, argv); TrafficLight widget; +#if defined(Q_OS_SYMBIAN) + widget.showMaximized(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + widget.show(); +#else widget.resize(110, 300); widget.show(); +#endif return app.exec(); } diff --git a/examples/statemachine/trafficlight/trafficlight.pro b/examples/statemachine/trafficlight/trafficlight.pro index f6aab8d6e5..4b77bcb8e9 100644 --- a/examples/statemachine/trafficlight/trafficlight.pro +++ b/examples/statemachine/trafficlight/trafficlight.pro @@ -5,3 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/trafficlight sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS trafficlight.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/trafficlight INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp index 6b9ce1fe55..47343ce494 100644 --- a/examples/statemachine/twowaybutton/main.cpp +++ b/examples/statemachine/twowaybutton/main.cpp @@ -74,8 +74,14 @@ int main(int argc, char **argv) //! [4] //! [5] +#if defined(Q_OS_SYMBIAN) + button.showMaximized(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + button.show(); +#else button.resize(100, 50); button.show(); +#endif return app.exec(); } //! [5] diff --git a/examples/statemachine/twowaybutton/twowaybutton.pro b/examples/statemachine/twowaybutton/twowaybutton.pro index 212ba501d7..d9d8941750 100644 --- a/examples/statemachine/twowaybutton/twowaybutton.pro +++ b/examples/statemachine/twowaybutton/twowaybutton.pro @@ -5,3 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/twowaybutton sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS twowaybutton.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/twowaybutton INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + -- cgit v1.2.3 From 0cbcc61ef35b9bce1d65d048853c79004b755b87 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 11 May 2011 17:35:46 +0200 Subject: Squashed commit of changes from the 4.8-temp branch. --- .../statemachine/eventtransitions/eventtransitions.desktop | 11 +++++++++++ examples/statemachine/factorial/factorial.desktop | 11 +++++++++++ examples/statemachine/pingpong/pingpong.desktop | 11 +++++++++++ examples/statemachine/rogue/rogue.desktop | 11 +++++++++++ examples/statemachine/trafficlight/trafficlight.desktop | 11 +++++++++++ examples/statemachine/twowaybutton/twowaybutton.desktop | 11 +++++++++++ 6 files changed, 66 insertions(+) create mode 100644 examples/statemachine/eventtransitions/eventtransitions.desktop create mode 100644 examples/statemachine/factorial/factorial.desktop create mode 100644 examples/statemachine/pingpong/pingpong.desktop create mode 100644 examples/statemachine/rogue/rogue.desktop create mode 100644 examples/statemachine/trafficlight/trafficlight.desktop create mode 100644 examples/statemachine/twowaybutton/twowaybutton.desktop (limited to 'examples/statemachine') diff --git a/examples/statemachine/eventtransitions/eventtransitions.desktop b/examples/statemachine/eventtransitions/eventtransitions.desktop new file mode 100644 index 0000000000..c1bceb2240 --- /dev/null +++ b/examples/statemachine/eventtransitions/eventtransitions.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Event Transitions +Exec=/opt/usr/bin/eventtransitions +Icon=eventtransitions +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/factorial/factorial.desktop b/examples/statemachine/factorial/factorial.desktop new file mode 100644 index 0000000000..41b27227f9 --- /dev/null +++ b/examples/statemachine/factorial/factorial.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Factorial States +Exec=/opt/usr/bin/factorial +Icon=factorial +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/pingpong/pingpong.desktop b/examples/statemachine/pingpong/pingpong.desktop new file mode 100644 index 0000000000..79646a2cc8 --- /dev/null +++ b/examples/statemachine/pingpong/pingpong.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Ping Pong States +Exec=/opt/usr/bin/pingpong +Icon=pingpong +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/rogue/rogue.desktop b/examples/statemachine/rogue/rogue.desktop new file mode 100644 index 0000000000..71ca4b6511 --- /dev/null +++ b/examples/statemachine/rogue/rogue.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Rogue +Exec=/opt/usr/bin/rogue +Icon=rogue +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/trafficlight/trafficlight.desktop b/examples/statemachine/trafficlight/trafficlight.desktop new file mode 100644 index 0000000000..8a5cc1673b --- /dev/null +++ b/examples/statemachine/trafficlight/trafficlight.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Traffic Light +Exec=/opt/usr/bin/trafficlight +Icon=trafficlight +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/twowaybutton/twowaybutton.desktop b/examples/statemachine/twowaybutton/twowaybutton.desktop new file mode 100644 index 0000000000..9dd0918937 --- /dev/null +++ b/examples/statemachine/twowaybutton/twowaybutton.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Two-way Button +Exec=/opt/usr/bin/twowaybutton +Icon=twowaybutton +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable -- cgit v1.2.3