diff options
author | Jussi Lind <jussi.lind@nokia.com> | 2010-06-08 16:58:05 +0300 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@nokia.com> | 2010-06-10 16:32:53 +0300 |
commit | fedae754092ddbda7aa63339ab114cb75280d370 (patch) | |
tree | 6a8373f8dee339aab51087bd4b05997ad5edd953 /examples | |
parent | 6c5892778473dee5648b4d9b7895213a09b82297 (diff) |
Changes: Obsolete stuff removed from lifecycle example, lifecycle.pro cleaned up
RevBy: Antti Kervinen
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lifecycle/lifecycle.pro | 74 | ||||
-rw-r--r-- | examples/lifecycle/lifecycleapplication.cpp | 56 | ||||
-rw-r--r-- | examples/lifecycle/lifecycleapplication.h | 47 | ||||
-rw-r--r-- | examples/lifecycle/main.cpp | 57 | ||||
-rw-r--r-- | examples/lifecycle/style/lifecycle.conf | 0 |
5 files changed, 16 insertions, 218 deletions
diff --git a/examples/lifecycle/lifecycle.pro b/examples/lifecycle/lifecycle.pro index 29b4d4f9..9a459f2f 100644 --- a/examples/lifecycle/lifecycle.pro +++ b/examples/lifecycle/lifecycle.pro @@ -1,70 +1,14 @@ -MROOT = ../.. -include($$MROOT/mkspecs/common.pri) - -MLIB = $$MROOT/lib -MSRC = $$MROOT/src -MSRCINCLUDE = $$MSRC/include -MSFWINCLUDE = $$MROOT/servicefw/include -INCLUDEPATH += . \ - $$MSRCINCLUDE \ - $$MSRC -QMAKE_LIBDIR += $$MLIB -win32|macx { - macx { - QMAKE_LFLAGS += -F../../lib - LIBS += -framework \ - meegotouchcore - } - win32:LIBS += -lmeegotouchcore0 -} -else:LIBS += -lmeegotouchcore - TEMPLATE = app -TARGET = lifecycle -target.path = /usr/bin -OBJECTS_DIR = ./.obj -MOC_DIR = ./.moc -DEPENDPATH += $$INCLUDEPATH -CONFIG += qt \ - qdbus -CONFIG -= app_bundle -QT += svg \ - dbus -SOURCES += main.cpp \ - mainpage.cpp \ - anotherpage.cpp \ - containerpage.cpp \ - lifecycleapplication.cpp -HEADERS += mainpage.h \ - anotherpage.h \ - containerpage.h \ - lifecycleapplication.h +TARGET = lifecycle +CONFIG += meegotouch +SOURCES += main.cpp mainpage.cpp anotherpage.cpp containerpage.cpp +HEADERS += mainpage.h anotherpage.h containerpage.h -# to update the .pm files automatically when running "make" -# include(../../updateqm.pri) -# LifeCycle Demo UI style definition -view_configuration.path = $$M_THEME_DIR/../lifecycle/themes -view_configuration.files = style/lifecycle.conf -style_images.path = $$M_THEME_DIR/../lifecycle/themes/images -style_images.files = images/*.png \ - images/*.jpg -style_svg.path = $$M_THEME_DIR/../lifecycle/themes/svg -style_svg.files = images/*.svg -contacts.path = $$M_THEME_DIR/../lifecycle/themes/images/contacts -contacts.files = images/contacts/* -desktop_entry.path = /usr/share/applications +target.path = /usr/bin +desktop_entry.path = /usr/share/applications desktop_entry.files = lifecycle.desktop -services.target = .dummy -services.commands = touch \ - $$services.target -services.path = /usr/share/dbus-1/services -services.files = com.nokia.lifecycle.service -DEFINES += CONTACTS_DIR=\"\\\"$$contacts.path/\\\"\" +services.path = /usr/share/dbus-1/services +services.files = com.nokia.lifecycle.service # Install instructions -INSTALLS += target \ - style_images \ - style_svg \ - view_configuration \ - desktop_entry \ - services +INSTALLS += target desktop_entry services diff --git a/examples/lifecycle/lifecycleapplication.cpp b/examples/lifecycle/lifecycleapplication.cpp deleted file mode 100644 index 0aa6cd1e..00000000 --- a/examples/lifecycle/lifecycleapplication.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (directui@nokia.com) -** -** This file is part of libmeegotouch. -** -** If you have questions regarding the use of this file, please contact -** Nokia at directui@nokia.com. -** -** This library is free software; you can redistribute it and/or -** modify it 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. -** -****************************************************************************/ - -#include "lifecycleapplication.h" -#include <QTimer> -#include <MInfoBanner> - -LifeCycleApplication::LifeCycleApplication(int &argc, char **argv, const QString &appIdentifier, MApplicationService *service) - : MApplication(argc, argv, appIdentifier, service), m_bHandleSignal(true) -{ - connect(this, SIGNAL(memoryLow()), SLOT(releaseMemoryHandler())); -} - -LifeCycleApplication::~LifeCycleApplication() -{} - -void LifeCycleApplication::releaseMemory() -{ - if (!m_bHandleSignal) { - showReleaseMemory(QString("<b>System memory low, virtual method handler</b>")); - } -} - -void LifeCycleApplication::showReleaseMemory(QString message) -{ - MInfoBanner *infoBanner = new MInfoBanner(MInfoBanner::Information); - infoBanner->setBodyText(message); - infoBanner->setIconID("Icon-close"); - infoBanner->appear(MSceneWindow::DestroyWhenDone); - QTimer::singleShot(5000, infoBanner, SLOT(disappear())); -} - - -void LifeCycleApplication::releaseMemoryHandler() -{ - if (m_bHandleSignal) { - showReleaseMemory(QString("<b>System memory low, signal handler </b>")); - m_bHandleSignal = false; - } -} diff --git a/examples/lifecycle/lifecycleapplication.h b/examples/lifecycle/lifecycleapplication.h deleted file mode 100644 index aede2aa1..00000000 --- a/examples/lifecycle/lifecycleapplication.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (directui@nokia.com) -** -** This file is part of libmeegotouch. -** -** If you have questions regarding the use of this file, please contact -** Nokia at directui@nokia.com. -** -** This library is free software; you can redistribute it and/or -** modify it 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. -** -****************************************************************************/ - -#ifndef LIFECYCLEAPPLICATION_H -#define LIFECYCLEAPPLICATION_H - -#include <QObject> -#include <MApplication> - -class LifeCycleApplication : public MApplication -{ - Q_OBJECT - -public: - - bool m_bHandleSignal; - - LifeCycleApplication(int &argc, char **argv, const QString &appIdentifier, MApplicationService *service); - - virtual ~LifeCycleApplication(); - virtual void releaseMemory(); - -private: - - void showReleaseMemory(QString message); - -private slots: - void releaseMemoryHandler(); - -}; -#endif // LIFECYCLEAPPLICATION_H diff --git a/examples/lifecycle/main.cpp b/examples/lifecycle/main.cpp index cd2f8a97..764de27d 100644 --- a/examples/lifecycle/main.cpp +++ b/examples/lifecycle/main.cpp @@ -17,45 +17,16 @@ ** ****************************************************************************/ -#include <QProcess> -#include <QStringList> - #include <MApplication> -#include <MApplicationService> -#include <MApplicationIfAdaptor> #include <MApplicationWindow> #include <MApplicationPage> -#include <MAction> -#include <MLocale> -#include <signal.h> #include "mainpage.h" -#include "lifecycleapplication.h" - -void emitMemorySignal(int sig); - -MApplication *App; -int requestCounter = 0; - -class MyApplicationService: public MApplicationService -{ -public: - MyApplicationService(QObject *parent = 0) : - MApplicationService("com.nokia.lifecycle", parent) - {} - - void handleServiceRegistrationFailure() { - qDebug() << "MyApplicationService::handleServiceRegistrationFailure()"; - - incrementAndRegister(); - } -}; - int main(int argc, char **argv) { - LifeCycleApplication app(argc, argv, "lifecycle", new MyApplicationService()); - LifeCycleApplication::setPrestartMode(M::LazyShutdown); + MApplication app(argc, argv); + MApplication::setPrestartMode(M::LazyShutdown); MApplicationWindow window; window.show(); @@ -63,29 +34,15 @@ int main(int argc, char **argv) MainPage mainPage; mainPage.appear(); - (void) signal(SIGINT, emitMemorySignal); - App = &app; - - // Run activateWidgets() here to setup things if app is NOT prestarted, otherwise - // connect it to prestartReleased() -signal from MApplication so that it's run - // at the time when the window is really being shown to the user. - + // Run activateWidgets() here to setup things if app is NOT prestarted now if (!app.isPrestarted()) { mainPage.activateWidgets(); - } else { - app.connect(&app, SIGNAL(prestartReleased()), &mainPage, SLOT(activateWidgets())); - app.connect(&app, SIGNAL(prestartRestored()), &mainPage, SLOT(deactivateWidgets())); } + + // Connect to prestart signals + app.connect(&app, SIGNAL(prestartReleased()), &mainPage, SLOT(activateWidgets())); + app.connect(&app, SIGNAL(prestartRestored()), &mainPage, SLOT(deactivateWidgets())); return app.exec(); } -void emitMemorySignal(int) -{ - // memory signal cannot be emitted in the current setting. - requestCounter++; - - if (requestCounter >= 2) { - (void) signal(SIGINT, SIG_DFL); - } -} diff --git a/examples/lifecycle/style/lifecycle.conf b/examples/lifecycle/style/lifecycle.conf deleted file mode 100644 index e69de29b..00000000 --- a/examples/lifecycle/style/lifecycle.conf +++ /dev/null |