Commit 42e3cf25b747a4efc96b098ff942101652aea840
- Diff rendering mode:
- inline
- side by side
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - main.cpp | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <QApplication> | ||
| 9 | |||
| 10 | #include "mainwindow.h" | ||
| 11 | |||
| 12 | int main(int argc, char *argv[]) | ||
| 13 | { | ||
| 14 | QApplication app(argc, argv); | ||
| 15 | |||
| 16 | MainWindow mw; | ||
| 17 | mw.show(); | ||
| 18 | |||
| 19 | return app.exec(); | ||
| 20 | } |
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - mainwindow.cpp | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "mainwindow.h" | ||
| 9 | |||
| 10 | #include <QPushButton> | ||
| 11 | #include <QMenuBar> | ||
| 12 | |||
| 13 | using Maemo::Portrait; | ||
| 14 | using Maemo::Landscape; | ||
| 15 | |||
| 16 | MainWindow::MainWindow(QWidget *parent) : | ||
| 17 | QMainWindow(parent) | ||
| 18 | { | ||
| 19 | landscape = true; | ||
| 20 | |||
| 21 | orientation = new Maemo::QOrientationCapability(this, false); | ||
| 22 | |||
| 23 | button = new QPushButton(tr("Click to flip screen"), this); | ||
| 24 | |||
| 25 | connect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 26 | |||
| 27 | createActions(); | ||
| 28 | createMenu(); | ||
| 29 | |||
| 30 | setCentralWidget(button); | ||
| 31 | |||
| 32 | notification = new Maemo::QNotifications(this); | ||
| 33 | notification->showSystemNote("This is a system note."); | ||
| 34 | } | ||
| 35 | |||
| 36 | void MainWindow::flip() | ||
| 37 | { | ||
| 38 | if(landscape) { | ||
| 39 | orientation->setOrientation(Portrait); | ||
| 40 | landscape = false; | ||
| 41 | } | ||
| 42 | else { | ||
| 43 | orientation->setOrientation(Landscape); | ||
| 44 | landscape = true; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | void MainWindow::toggleOrientationChangeMode() | ||
| 49 | { | ||
| 50 | if(orientation->isListeningOrientationChanges()) { | ||
| 51 | orientation->setListeningForOrientationChanges(false); | ||
| 52 | orientationChangeModeAction->setText(tr("Enable automatic orientation changing")); | ||
| 53 | connect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 54 | button->setText(tr("Click to flip screen")); | ||
| 55 | } | ||
| 56 | else { | ||
| 57 | orientation->setListeningForOrientationChanges(true); | ||
| 58 | orientationChangeModeAction->setText(tr("Disable automatic orientation changing")); | ||
| 59 | disconnect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 60 | button->setText(tr("Rotate device to flip screen")); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | void MainWindow::createActions() | ||
| 65 | { | ||
| 66 | quitAction = new QAction(tr("Quit"), this); | ||
| 67 | connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); | ||
| 68 | |||
| 69 | orientationChangeModeAction = new QAction(tr("Enable automatic orientation changing"), this); | ||
| 70 | connect(orientationChangeModeAction, SIGNAL(triggered()), this, SLOT(toggleOrientationChangeMode())); | ||
| 71 | } | ||
| 72 | |||
| 73 | void MainWindow::createMenu() | ||
| 74 | { | ||
| 75 | menu = menuBar()->addMenu("fremantle"); | ||
| 76 | |||
| 77 | menu->addAction(orientationChangeModeAction); | ||
| 78 | menu->addAction(quitAction); | ||
| 79 | } |
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - mainwindow.h | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef MAINWINDOW_H | ||
| 9 | #define MAINWINDOW_H | ||
| 10 | |||
| 11 | #include <QMainWindow> | ||
| 12 | |||
| 13 | #include <qmaemo-ext/widget/qorientationcapability.h> | ||
| 14 | #include <qmaemo-ext/notifications/qnotification.h> | ||
| 15 | |||
| 16 | class QPushButton; | ||
| 17 | class QMenu; | ||
| 18 | |||
| 19 | class MainWindow : public QMainWindow | ||
| 20 | { | ||
| 21 | Q_OBJECT | ||
| 22 | |||
| 23 | public: | ||
| 24 | MainWindow(QWidget *parent = 0); | ||
| 25 | |||
| 26 | public slots: | ||
| 27 | void flip(); | ||
| 28 | void toggleOrientationChangeMode(); | ||
| 29 | |||
| 30 | private: | ||
| 31 | void createMenu(); | ||
| 32 | void createActions(); | ||
| 33 | |||
| 34 | QPushButton *button; | ||
| 35 | Maemo::QOrientationCapability *orientation; | ||
| 36 | bool landscape; | ||
| 37 | QMenu *menu; | ||
| 38 | QAction *quitAction; | ||
| 39 | QAction *orientationChangeModeAction; | ||
| 40 | Maemo::QNotifications *notification; | ||
| 41 | }; | ||
| 42 | #endif |
|   | |||
| 1 | TEMPLATE = app | ||
| 2 | TARGET = | ||
| 3 | DEPENDPATH += . | ||
| 4 | INCLUDEPATH += . | ||
| 5 | |||
| 6 | # Input | ||
| 7 | HEADERS += mainwindow.h | ||
| 8 | SOURCES += main.cpp mainwindow.cpp | ||
| 9 | |||
| 10 | LIBS += -lQHildon-WidgetCapabilities -lQHildon-Notifications |
|   | |||
| 1 | qmaemo-ext-libs-examples (0.1-1-maemo0) unstable; urgency=low | ||
| 2 | |||
| 3 | * Initial release | ||
| 4 | |||
| 5 | -- Timo Härkönen <timop.harkonen@gmail.com> Thu, 22 Oct 2009 19:50:23 +0300 |
|   | |||
| 1 | 5 |
|   | |||
| 1 | Source: qmaemo-ext-libs-examples | ||
| 2 | Section: user/other | ||
| 3 | Priority: optional | ||
| 4 | Maintainer: Timo Härkönen <timop.harkonen@gmail.com> | ||
| 5 | Build-Depends: debhelper (>= 5), libqt4-dev, libqt4-gui, libqt4-core, libqt4-dbus, mce-dev, libx11-dev, libhildon1-dev, qhildon-widgetcapabilities, qhildon-notifications, qhildon-systemcapabilities, qmaemo-ext-libs-dev | ||
| 6 | Standards-Version: 3.7.2 | ||
| 7 | |||
| 8 | Package: qmaemo-ext-libs-example | ||
| 9 | Architecture: any | ||
| 10 | Depends: libqt4-gui, libqt4-core, libqt4-dbus, qhildon-widgetcapabilities, qhildon-notifications, qhildon-systemcapabilities | ||
| 11 | Description: Example application using Qt Maemo extra libraries |
|   | |||
| 1 | This package was debianized by Timo Harkonen <timop.harkonen@gmail.com> on | ||
| 2 | Thu, 22 Oct 2009 19:50:23 +0300. | ||
| 3 | |||
| 4 | It was downloaded from <fill in http/ftp site> | ||
| 5 | |||
| 6 | Upstream Author: <put author(s) name and email here> | ||
| 7 | |||
| 8 | Copyright: <put the year(s) of the copyright, and the names of the | ||
| 9 | copyright holder(s) here> | ||
| 10 | |||
| 11 | License: | ||
| 12 | |||
| 13 | This package is free software; you can redistribute it and/or | ||
| 14 | modify it under the terms of the GNU Lesser General Public | ||
| 15 | License as published by the Free Software Foundation; either | ||
| 16 | version 2 of the License, or (at your option) any later version. | ||
| 17 | |||
| 18 | This package is distributed in the hope that it will be useful, | ||
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 21 | Lesser General Public License for more details. | ||
| 22 | |||
| 23 | You should have received a copy of the GNU Lesser General Public | ||
| 24 | License along with this package; if not, write to the Free Software | ||
| 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 26 | |||
| 27 | On Debian systems, the complete text of the GNU Lesser General | ||
| 28 | Public License can be found in `/usr/share/common-licenses/LGPL'. | ||
| 29 | |||
| 30 | |||
| 31 | The Debian packaging is (C) 2009, unknown <maintainer@email.org> and | ||
| 32 | is licensed under the GPL, see `/usr/share/common-licenses/GPL'. | ||
| 33 | |||
| 34 | |||
| 35 | # Please also look if there are files or directories which have a | ||
| 36 | # different copyright/license attached and list them here |
|   | |||
| 1 | #!/usr/bin/make -f | ||
| 2 | APPNAME := qmaemo-ext-libs-examples | ||
| 3 | |||
| 4 | builddir: | ||
| 5 | mkdir -p builddir | ||
| 6 | |||
| 7 | builddir/Makefile: builddir | ||
| 8 | cd builddir && qmake PREFIX=/usr ../$(APPNAME).pro | ||
| 9 | |||
| 10 | build: build-stamp | ||
| 11 | |||
| 12 | build-stamp: builddir/Makefile | ||
| 13 | dh_testdir | ||
| 14 | #compile the package | ||
| 15 | cd builddir && $(MAKE) | ||
| 16 | touch $@ | ||
| 17 | |||
| 18 | clean: | ||
| 19 | dh_testdir | ||
| 20 | dh_testroot | ||
| 21 | rm -f build-stamp | ||
| 22 | rm -rf buiddir | ||
| 23 | dh_clean | ||
| 24 | |||
| 25 | install: build | ||
| 26 | dh_installdirs | ||
| 27 | dh_testdir | ||
| 28 | dh_testroot | ||
| 29 | dh_clean -k | ||
| 30 | cd builddir && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/qmaemo-ext-libs-example/ install | ||
| 31 | |||
| 32 | binary-indep: build | ||
| 33 | #nothing to do | ||
| 34 | |||
| 35 | binary-arch: build install | ||
| 36 | dh_testdir | ||
| 37 | dh_testroot | ||
| 38 | dh_installdocs | ||
| 39 | dh_installexamples | ||
| 40 | dh_installman | ||
| 41 | dh_link | ||
| 42 | dh_strip | ||
| 43 | dh_compress | ||
| 44 | dh_fixperms | ||
| 45 | dh_installdeb | ||
| 46 | dh_shlibdeps | ||
| 47 | dh_gencontrol | ||
| 48 | dh_md5sums | ||
| 49 | dh_builddeb | ||
| 50 | |||
| 51 | binary: binary-indep binary-arch | ||
| 52 | .PHONY: build clean binary-indep binary-arch binary install configure |
|   | |||
| 1 | TEMPLATE = subdirs | ||
| 2 | SUBDIRS += src |
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - main.cpp | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <QApplication> | ||
| 9 | |||
| 10 | #include "mainwindow.h" | ||
| 11 | |||
| 12 | int main(int argc, char *argv[]) | ||
| 13 | { | ||
| 14 | QApplication app(argc, argv); | ||
| 15 | |||
| 16 | MainWindow mw; | ||
| 17 | mw.show(); | ||
| 18 | |||
| 19 | return app.exec(); | ||
| 20 | } |
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - mainwindow.cpp | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "mainwindow.h" | ||
| 9 | |||
| 10 | #include <QPushButton> | ||
| 11 | #include <QMenuBar> | ||
| 12 | #include <QVBoxLayout> | ||
| 13 | #include <QHBoxLayout> | ||
| 14 | |||
| 15 | using Maemo::Portrait; | ||
| 16 | using Maemo::Landscape; | ||
| 17 | |||
| 18 | MainWindow::MainWindow(QWidget *parent) : | ||
| 19 | QMainWindow(parent) | ||
| 20 | { | ||
| 21 | landscape = true; | ||
| 22 | |||
| 23 | widget = new QWidget(this); | ||
| 24 | |||
| 25 | orientation = new Maemo::QOrientationCapability(this, false); | ||
| 26 | notification = new Maemo::QNotifications(this); | ||
| 27 | |||
| 28 | bannerButton = new QPushButton(tr("Show banner"), this); | ||
| 29 | noteButton = new QPushButton(tr("Show note"), this); | ||
| 30 | |||
| 31 | buttonLayout = new QHBoxLayout; | ||
| 32 | buttonLayout->addWidget(bannerButton); | ||
| 33 | buttonLayout->addWidget(noteButton); | ||
| 34 | |||
| 35 | button = new QPushButton(tr("Flip screen"), this); | ||
| 36 | |||
| 37 | mainLayout = new QVBoxLayout; | ||
| 38 | mainLayout->addWidget(button); | ||
| 39 | mainLayout->addLayout(buttonLayout); | ||
| 40 | |||
| 41 | widget->setLayout(mainLayout); | ||
| 42 | |||
| 43 | connect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 44 | connect(noteButton, SIGNAL(clicked()), this, SLOT(showNote())); | ||
| 45 | connect(bannerButton, SIGNAL(clicked()), this, SLOT(showBanner())); | ||
| 46 | |||
| 47 | createActions(); | ||
| 48 | createMenu(); | ||
| 49 | |||
| 50 | setCentralWidget(widget); | ||
| 51 | } | ||
| 52 | |||
| 53 | void MainWindow::flip() | ||
| 54 | { | ||
| 55 | if(landscape) { | ||
| 56 | orientation->setOrientation(Portrait); | ||
| 57 | landscape = false; | ||
| 58 | } | ||
| 59 | else { | ||
| 60 | orientation->setOrientation(Landscape); | ||
| 61 | landscape = true; | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | void MainWindow::toggleOrientationChangeMode() | ||
| 66 | { | ||
| 67 | if(orientation->isListeningOrientationChanges()) { | ||
| 68 | orientation->setListeningForOrientationChanges(false); | ||
| 69 | orientationChangeModeAction->setText(tr("Enable automatic orientation changing")); | ||
| 70 | connect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 71 | button->setText(tr("Flip screen")); | ||
| 72 | } | ||
| 73 | else { | ||
| 74 | orientation->setListeningForOrientationChanges(true); | ||
| 75 | orientationChangeModeAction->setText(tr("Disable automatic orientation changing")); | ||
| 76 | disconnect(button, SIGNAL(clicked()), this, SLOT(flip())); | ||
| 77 | button->setText(tr("Rotate device to flip screen")); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | void MainWindow::createActions() | ||
| 82 | { | ||
| 83 | quitAction = new QAction(tr("Quit"), this); | ||
| 84 | connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); | ||
| 85 | |||
| 86 | orientationChangeModeAction = new QAction(tr("Enable automatic orientation changing"), this); | ||
| 87 | connect(orientationChangeModeAction, SIGNAL(triggered()), this, SLOT(toggleOrientationChangeMode())); | ||
| 88 | } | ||
| 89 | |||
| 90 | void MainWindow::createMenu() | ||
| 91 | { | ||
| 92 | menu = menuBar()->addMenu("fremantle"); | ||
| 93 | |||
| 94 | menu->addAction(orientationChangeModeAction); | ||
| 95 | menu->addAction(quitAction); | ||
| 96 | } | ||
| 97 | |||
| 98 | void MainWindow::showNote() | ||
| 99 | { | ||
| 100 | notification->showSystemNote("This is a system note."); | ||
| 101 | } | ||
| 102 | |||
| 103 | void MainWindow::showBanner() | ||
| 104 | { | ||
| 105 | notification->showBanner("This is a Hildon banner."); | ||
| 106 | } |
|   | |||
| 1 | /* | ||
| 2 | Maemo Orientation Example - mainwindow.h | ||
| 3 | |||
| 4 | Author(s): | ||
| 5 | Timo Härkönen | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef MAINWINDOW_H | ||
| 9 | #define MAINWINDOW_H | ||
| 10 | |||
| 11 | #include <QMainWindow> | ||
| 12 | |||
| 13 | #include <qmaemo-ext/widget/qorientationcapability.h> | ||
| 14 | #include <qmaemo-ext/notifications/qnotification.h> | ||
| 15 | |||
| 16 | class QPushButton; | ||
| 17 | class QMenu; | ||
| 18 | class QVBoxLayout; | ||
| 19 | class QHBoxLayout; | ||
| 20 | |||
| 21 | class MainWindow : public QMainWindow | ||
| 22 | { | ||
| 23 | Q_OBJECT | ||
| 24 | |||
| 25 | public: | ||
| 26 | MainWindow(QWidget *parent = 0); | ||
| 27 | |||
| 28 | public slots: | ||
| 29 | void flip(); | ||
| 30 | void toggleOrientationChangeMode(); | ||
| 31 | void showBanner(); | ||
| 32 | void showNote(); | ||
| 33 | |||
| 34 | private: | ||
| 35 | void createMenu(); | ||
| 36 | void createActions(); | ||
| 37 | |||
| 38 | QPushButton *button; | ||
| 39 | QPushButton *noteButton; | ||
| 40 | QPushButton *bannerButton; | ||
| 41 | QWidget *widget; | ||
| 42 | QVBoxLayout *mainLayout; | ||
| 43 | QHBoxLayout *buttonLayout; | ||
| 44 | Maemo::QOrientationCapability *orientation; | ||
| 45 | bool landscape; | ||
| 46 | QMenu *menu; | ||
| 47 | QAction *quitAction; | ||
| 48 | QAction *orientationChangeModeAction; | ||
| 49 | Maemo::QNotifications *notification; | ||
| 50 | }; | ||
| 51 | #endif |
|   | |||
| 1 | [Desktop Entry] | ||
| 2 | Encoding=UTF-8 | ||
| 3 | Version=0.1 | ||
| 4 | Type=Application | ||
| 5 | Name=Maemo Qt Extra | ||
| 6 | Exec=/usr/bin/qmaemo-ext-libs-example | ||
| 7 | X-HildonDesk-ShowInToolbar=true | ||
| 8 | X-Osso-Type=application/x-executable |
qt-maemo-extra/src/qmaemo-ext-libs-examples/src/qmaemo-ext-libs-example/qmaemo-ext-libs-example.pro
(16 / 0)
|   | |||
| 1 | TEMPLATE = app | ||
| 2 | TARGET = | ||
| 3 | DEPENDPATH += . | ||
| 4 | INCLUDEPATH += . | ||
| 5 | |||
| 6 | # Input | ||
| 7 | HEADERS += mainwindow.h | ||
| 8 | SOURCES += main.cpp mainwindow.cpp | ||
| 9 | |||
| 10 | LIBS += -lQHildon-WidgetCapabilities -lQHildon-Notifications | ||
| 11 | |||
| 12 | desktop.files = qmaemo-ext-libs-example.desktop | ||
| 13 | desktop.path = /usr/share/applications/hildon/ | ||
| 14 | |||
| 15 | target.path = /usr/bin/ | ||
| 16 | INSTALLS += target desktop |
|   | |||
| 1 | TEMPLATE = subdirs | ||
| 2 | SUBDIRS += qmaemo-ext-libs-example |

