diff options
Diffstat (limited to 'examples/statemachine')
19 files changed, 141 insertions, 5 deletions
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/eventtransitions/eventtransitions.pro b/examples/statemachine/eventtransitions/eventtransitions.pro index 7e92cf2cff..c8b2213d67 100644 --- a/examples/statemachine/eventtransitions/eventtransitions.pro +++ b/examples/statemachine/eventtransitions/eventtransitions.pro @@ -5,3 +5,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/eventtransitions sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS eventtransitions.pro sources.path = $$[QT_INSTALL_EXAMPLES]/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.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/factorial/factorial.pro b/examples/statemachine/factorial/factorial.pro index 14a6833f08..aaab352b38 100644 --- a/examples/statemachine/factorial/factorial.pro +++ b/examples/statemachine/factorial/factorial.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/factorial sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS factorial.pro sources.path = $$[QT_INSTALL_EXAMPLES]/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.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/pingpong/pingpong.pro b/examples/statemachine/pingpong/pingpong.pro index 42eab6c2cf..8a2417e7cf 100644 --- a/examples/statemachine/pingpong/pingpong.pro +++ b/examples/statemachine/pingpong/pingpong.pro @@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/pingpong sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pingpong.pro sources.path = $$[QT_INSTALL_EXAMPLES]/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.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/rogue/rogue.pro b/examples/statemachine/rogue/rogue.pro index 15718540d8..9ef156423b 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]/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.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/trafficlight/trafficlight.pro b/examples/statemachine/trafficlight/trafficlight.pro index 684575ac1f..e85fef8242 100644 --- a/examples/statemachine/trafficlight/trafficlight.pro +++ b/examples/statemachine/trafficlight/trafficlight.pro @@ -5,3 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/trafficlight sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS trafficlight.pro sources.path = $$[QT_INSTALL_EXAMPLES]/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.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 diff --git a/examples/statemachine/twowaybutton/twowaybutton.pro b/examples/statemachine/twowaybutton/twowaybutton.pro index f6cbc57533..e6ea518fa9 100644 --- a/examples/statemachine/twowaybutton/twowaybutton.pro +++ b/examples/statemachine/twowaybutton/twowaybutton.pro @@ -5,3 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/twowaybutton sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS twowaybutton.pro sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/twowaybutton INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + |