diff options
author | mread <qt-info@nokia.com> | 2010-06-30 14:00:11 (GMT) |
---|---|---|
committer | mread <qt-info@nokia.com> | 2010-07-01 08:34:47 (GMT) |
commit | fabf804b147892abb0e8aeb49d1753359ea5e56e (patch) | |
tree | ea9d514be08bc64e2848b0a7d1e87f8eaf0a0709 /src/gui/s60framework | |
parent | cb2b4a12ac17adf56074d3630efe4feb50ae0e2b (diff) | |
download | Qt-fabf804b147892abb0e8aeb49d1753359ea5e56e.zip Qt-fabf804b147892abb0e8aeb49d1753359ea5e56e.tar.gz Qt-fabf804b147892abb0e8aeb49d1753359ea5e56e.tar.bz2 |
Avkon removal configured with -no-s60
Avkon dependencies can be configured out with the -no-s60 configure
flag, conversely Qt on Symbian will use Avkon if -s60 is configured.
These changes are intended to keep or introduce binary compatibility
between the s60 and no-s60 configurations. To do this, it has been
necessary to introduce stub equivalents of the CAknAppUi related
classes into the no-s60 configuration, and override all Avkon framework
virtual functions in the QS60Main... classes.
Other than that, these changes are mostly just correcting the use of
the Q_WS_S60 flag so that it only refers to Avkon dependencies.
Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/s60framework')
-rw-r--r-- | src/gui/s60framework/qs60mainapplication.cpp | 23 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainapplication.h | 20 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui.cpp | 131 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui.h | 75 | ||||
-rw-r--r-- | src/gui/s60framework/qs60maindocument.cpp | 22 | ||||
-rw-r--r-- | src/gui/s60framework/qs60maindocument.h | 20 | ||||
-rw-r--r-- | src/gui/s60framework/s60framework.pri | 22 |
7 files changed, 266 insertions, 47 deletions
diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 41ac1a8..0f9367e 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -71,17 +71,17 @@ _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L". The QS60MainApplication provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknApplication class from + used in the exact same way as the \c CEikApplication class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknApplication, the class should be modified to - inherit from this class instead of \c CAknApplication. Then the + functions in \c CEikApplication, the class should be modified to + inherit from this class instead of \c CEikApplication. Then the application can choose to override only certain functions. To make Qt use the custom application objects, pass a factory function to \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}. - For more information on \c CAknApplication, please see the S60 documentation. + For more information on \c CEikApplication, please see the S60 documentation. Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian leaves. @@ -136,4 +136,19 @@ TFileName QS60MainApplication::ResourceFileName() const return KNullDesC(); } +void QS60MainApplication::PreDocConstructL() +{ + QS60MainApplicationBase::PreDocConstructL(); +} + +CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const +{ + return QS60MainApplicationBase::OpenIniFileLC(aFs); +} + +void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) +{ + QS60MainApplicationBase::NewAppServerL(aAppServer); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h index 997f30f..cb22e68 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/gui/s60framework/qs60mainapplication.h @@ -44,9 +44,15 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include <aknapp.h> +typedef CAknApplication QS60MainApplicationBase; +#else +#include <eikapp.h> +typedef CEikApplication QS60MainApplicationBase; +#endif QT_BEGIN_HEADER @@ -54,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase { public: QS60MainApplication(); @@ -65,6 +71,14 @@ public: virtual TFileName ResourceFileName() const; +public: + + virtual void PreDocConstructL(); + + virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const; + + virtual void NewAppServerL(CApaAppServer *&aAppServer); + protected: virtual CApaDocument *CreateDocumentL(); @@ -74,6 +88,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index ce13de8..40c2d03 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -41,20 +41,25 @@ // INCLUDE FILES #include <exception> +#include <qglobal.h> +#ifdef Q_WS_S60 #include <avkon.hrh> #include <eikmenub.h> #include <eikmenup.h> +#include <avkon.rsg> +#endif #include <barsread.h> #include <qconfig.h> -#if defined(QT_LIBINFIX_UNQUOTED) +#ifdef Q_WS_S60 +# if defined(QT_LIBINFIX_UNQUOTED) // Two level macro needed for proper expansion of libinfix -# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg> -# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) -# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) -#else -# include <s60main.rsg> +# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg> +# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) +# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) +# else +# include <s60main.rsg> +# endif #endif -#include <avkon.rsg> #include "qs60mainappui.h" #include <QtGui/qapplication.h> @@ -115,14 +120,16 @@ void QS60MainAppUi::ConstructL() // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file // even these flags are defined - TInt flags = CAknAppUi::EAknEnableSkin - | CAknAppUi::ENoScreenFurniture - | CAknAppUi::ENonStandardResourceFile; + TInt flags = CEikAppUi::ENoScreenFurniture + | CEikAppUi::ENonStandardResourceFile; +#ifdef Q_WS_S60 + flags |= CAknAppUi::EAknEnableSkin; // After 5th Edition S60, native side supports animated wallpapers. // However, there is no support for that feature on Qt side, so indicate to // native UI framework that this application will not support background animations. if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) flags |= KAknDisableAnimationBackground; +#endif BaseConstructL(flags); } @@ -168,7 +175,7 @@ void QS60MainAppUi::HandleCommandL(TInt command) */ void QS60MainAppUi::HandleResourceChangeL(TInt type) { - CAknAppUi::HandleResourceChangeL(type); + QS60MainAppUiBase::HandleResourceChangeL(type); if (qApp) { QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type); @@ -185,7 +192,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) * If you override this function, you should call the base class implementation if you do not * handle the event. */ -void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destination) +void QS60MainAppUi::HandleWsEventL(const TWsEvent &wsEvent, CCoeControl *destination) { int result = 0; if (qApp) { @@ -196,7 +203,7 @@ void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destina } if (result <= 0) - CAknAppUi::HandleWsEventL(wsEvent, destination); + QS60MainAppUiBase::HandleWsEventL(wsEvent, destination); } @@ -236,6 +243,7 @@ void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menu */ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) { +#ifdef Q_WS_S60 if (resourceId == R_QT_WRAPPERAPP_MENU) { if (menuPane->NumberOfItemsInPane() <= 1) QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); @@ -245,6 +253,9 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); } +#else + QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane); +#endif } /*! @@ -255,16 +266,104 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) * * If you override this function, you should call the base class implementation as well. */ -void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) +void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenuType menuType) { +#ifdef Q_WS_S60 if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) { if (menuType == EMenuPane) DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); else DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); - } else { - CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType); + } else +#endif + { + QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType); } } +void QS60MainAppUi::Exit() +{ + QS60MainAppUiBase::Exit(); +} + +void QS60MainAppUi::SetFadedL(TBool aFaded) +{ + QS60MainAppUiBase::SetFadedL(aFaded); +} + +TRect QS60MainAppUi::ApplicationRect() const +{ + return QS60MainAppUiBase::ApplicationRect(); +} + +void QS60MainAppUi::HandleScreenDeviceChangedL() +{ + QS60MainAppUiBase::HandleScreenDeviceChangedL(); +} + +void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); +} + +TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) +{ + return QS60MainAppUiBase::MopSupplyObject(aId); +} + +void QS60MainAppUi::ProcessCommandL(TInt aCommand) +{ + QS60MainAppUiBase::ProcessCommandL(aCommand); +} + +TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) +{ + return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); +} + +void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) +{ + QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); +} + +void QS60MainAppUi::PrepareToExit() +{ + QS60MainAppUiBase::PrepareToExit(); +} + +void QS60MainAppUi::HandleTouchPaneSizeChange() +{ + QS60MainAppUiBase::HandleTouchPaneSizeChange(); +} + +void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleSystemEventL(aEvent); +} + +void QS60MainAppUi::Reserved_MtsmPosition() +{ + QS60MainAppUiBase::Reserved_MtsmPosition(); +} + +void QS60MainAppUi::Reserved_MtsmObject() +{ + QS60MainAppUiBase::Reserved_MtsmObject(); +} + +void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) +{ + QS60MainAppUiBase::HandleForegroundEventL(aForeground); +} + +#ifndef Q_WS_S60 + +void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {} +void QS60StubAknAppUi::HandleTouchPaneSizeChange() {} +void QS60StubAknAppUi::HandleStatusPaneSizeChange() {} +void QS60StubAknAppUi::Reserved_MtsmPosition() {} +void QS60StubAknAppUi::Reserved_MtsmObject() {} + +#endif + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h index dcc72d1..796059f 100644 --- a/src/gui/s60framework/qs60mainappui.h +++ b/src/gui/s60framework/qs60mainappui.h @@ -44,9 +44,55 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include <aknappui.h> +typedef CAknAppUi QS60MainAppUiBase; +#else +#include <eikappui.h> +// these stub classes simulate the structure of CAknAppUi, to help binary compatibility between Qt configured with and without S60/Avkon +class QS60StubAknAppUiBase : public CEikAppUi +{ +private: + int qS60StubAknAppUiBaseSpace[4]; +}; + +class QS60StubMEikStatusPaneObserver +{ +public: + virtual void HandleStatusPaneSizeChange() = 0; +}; + +class QS60StubMAknTouchPaneObserver +{ +public: + virtual void HandleTouchPaneSizeChange() = 0; +}; + +class QS60StubAknAppUi : public QS60StubAknAppUiBase, QS60StubMEikStatusPaneObserver, + public MCoeViewDeactivationObserver, + public QS60StubMAknTouchPaneObserver +{ +public: // MCoeViewDeactivationObserver + virtual void HandleViewDeactivation(const TVwsViewId&, const TVwsViewId &); + +public: // from MAknTouchPaneObserver + virtual void HandleTouchPaneSizeChange(); + +protected: // from MEikStatusPaneObserver + virtual void HandleStatusPaneSizeChange(); + +protected: // from CAknAppUi + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + +private: + int qS60StubAknAppUiSpace[4]; +}; + +typedef QS60StubAknAppUi QS60MainAppUiBase; +#endif QT_BEGIN_HEADER @@ -54,7 +100,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase { public: QS60MainAppUi(); @@ -63,7 +109,7 @@ public: virtual void ConstructL(); - virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void RestoreMenuL(CCoeControl *menuWindow,TInt resourceId,TMenuType menuType); virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); @@ -74,13 +120,32 @@ public: virtual void HandleStatusPaneSizeChange(); protected: - virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); + virtual void HandleWsEventL(const TWsEvent &event, CCoeControl *destination); + +public: + virtual void Exit(); + virtual void SetFadedL(TBool aFaded); + virtual TRect ApplicationRect() const; + virtual void ProcessCommandL(TInt aCommand); + virtual TErrorHandlerResponse HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText); + virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId); + virtual void PrepareToExit(); + virtual void HandleTouchPaneSizeChange(); + +protected: + virtual void HandleScreenDeviceChangedL(); + virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent); + virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + virtual void HandleSystemEventL(const TWsEvent &aEvent); + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + virtual void HandleForegroundEventL(TBool aForeground); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 487e067..ed33a41 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE The QS60MainDocument provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknDocument class from + used in the exact same way as the \c CEikDocument class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknDocument, the class should be modified to - inherit from this class instead of \c CAknDocument. Then the + functions in \c CEikDocument, the class should be modified to + inherit from this class instead of \c CEikDocument. Then the application can choose to override only certain functions. - For more information on \c CAknDocument, please see the S60 + For more information on \c CEikDocument, please see the S60 documentation. Unlike other Qt classes, QS60MainDocument behaves like an S60 class, @@ -79,8 +79,8 @@ QT_BEGIN_NAMESPACE * * \a mainApplication should contain a pointer to a QS60MainApplication instance. */ -QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) - : CAknDocument(mainApplication) +QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication) + : QS60MainDocumentBase(mainApplication) { // No implementation required } @@ -105,4 +105,14 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi)); } +CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) +{ + return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); +} + +void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) +{ + QS60MainDocumentBase::OpenFileL(aFileStore, aFile); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 553675f..2f0564f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -44,9 +44,15 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN -#include <AknDoc.h> +#ifdef Q_WS_S60 +#include <akndoc.h> +typedef CAknDocument QS60MainDocumentBase; +#else +#include <eikdoc.h> +typedef CEikDocument QS60MainDocumentBase; +#endif class CEikApplication; @@ -58,7 +64,7 @@ QT_MODULE(Gui) class QS60MainAppUi; -class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase { public: @@ -69,12 +75,18 @@ public: public: virtual CEikAppUi *CreateAppUiL(); + +public: + + virtual CFileStore *OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs); + + virtual void OpenFileL(CFileStore *&aFileStore, RFile &aFile); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9d89dc..edbacc0 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,16 +1,20 @@ +contains(QT_CONFIG, s60) { # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource # file is always compiled for WINSCW -minimalAppResource31 = \ - "SOURCEPATH s60framework" \ - "START RESOURCE s60main.rss" \ - "TARGET s60main$${QT_LIBINFIX}" \ - "HEADER" \ - "TARGETPATH /resource/apps" \ - "END" -MMP_RULES += minimalAppResource31 -SYMBIAN_RESOURCES += s60framework/s60main.rss + minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "TARGET s60main$${QT_LIBINFIX}" \ + "HEADER" \ + "TARGETPATH /resource/apps" \ + "END" + + MMP_RULES += minimalAppResource31 + + SYMBIAN_RESOURCES += s60framework/s60main.rss +} SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ |