diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-01 09:36:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-01 09:36:18 (GMT) |
commit | 8bbb28f2d5f6a53f94f23f3ac86f5270143795ab (patch) | |
tree | 813c9d5e20af13d6f58d19262c31ee6fd475608c | |
parent | 901bee3cbad3fcf52465d72cd257b4dd87e5b049 (diff) | |
parent | 3d50a8049b20e01b8a2cb9b954b14302dc6144c6 (diff) | |
download | Qt-8bbb28f2d5f6a53f94f23f3ac86f5270143795ab.zip Qt-8bbb28f2d5f6a53f94f23f3ac86f5270143795ab.tar.gz Qt-8bbb28f2d5f6a53f94f23f3ac86f5270143795ab.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Added .condition modifier to SUBDIRS.
Added orientation change support for show/showNormal widgets in S60.
Added fullscreen support to softkeys in Symbian.
-rw-r--r-- | doc/src/development/qmake-manual.qdoc | 28 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_qmake-manual.qdoc | 14 | ||||
-rw-r--r-- | examples/widgets/softkeys/softkeys.cpp | 38 | ||||
-rw-r--r-- | examples/widgets/softkeys/softkeys.h | 19 | ||||
-rw-r--r-- | examples/widgets/windowflags/controllerwindow.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 13 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 8 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 39 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_s60.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 35 |
11 files changed, 184 insertions, 30 deletions
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index b3d6f72..3157536 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2968,6 +2968,34 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 51 + It is possible to modify this default behavior of \c SUBDIRS by giving + additional modifiers to \c SUBDIRS elements. Supported modifiers are: + + \table + \header \o Modifier \o Effect + \row \o .subdir \o Use the specified subdirectory instead of \c SUBDIRS value. + \row \o .file \o Specify the subproject \c pro file explicitly. Cannot be + used in conjunction with \c .subdir modifier. + \row \o .condition \o Specifies a \c bld.inf define that must be true for + subproject to be built. Available only on Symbian platform. + \row \o .depends \o This subproject depends on specified subproject. + Available only on platforms that use makefiles. + \row \o .makefile \o The makefile of subproject. + Available only on platforms that use makefiles. + \row \o .target \o Base string used for makefile targets related to this + subproject. + Available only on platforms that use makefiles. + \endtable + + For example, define two subdirectories, both of which reside in a different directory + than the \c SUBDIRS value, and one of the subdirectories must be built before the other: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 149 + + For example, define a subdirectory that is only build for emulator builds in Qt for Symbian: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150 + \target TARGET \section1 TARGET diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 5a04420..e8c00d3 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -982,3 +982,17 @@ MYVARIABLES = LIB addMMPRules(MYCONDITIONS, MYVARIABLES) //! [148] + +//! [149] +SUBDIRS += my_executable my_library +my_executable.subdir = app +my_executable.depends = my_library +my_library.subdir = lib +//! [149] + +//! [150] +symbian { + SUBDIRS += emulator_dll + emulator_dll.condition = WINSCW +} +//! [150] diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp index cbd227c9..e5c2e73 100644 --- a/examples/widgets/softkeys/softkeys.cpp +++ b/examples/widgets/softkeys/softkeys.cpp @@ -70,6 +70,12 @@ MainWindow::MainWindow(QWidget *parent) toggleButton->setContextMenuPolicy(Qt::NoContextMenu); toggleButton->setCheckable(true); + modeButton = new QPushButton(tr("Loop SK window type"), this); + modeButton->setContextMenuPolicy(Qt::NoContextMenu); + + modeLabel = new QLabel(tr("Normal maximized"), this); + modeLabel->setContextMenuPolicy(Qt::NoContextMenu); + pushButton = new QPushButton(tr("File Dialog"), this); pushButton->setContextMenuPolicy(Qt::NoContextMenu); @@ -87,6 +93,8 @@ MainWindow::MainWindow(QWidget *parent) layout->addWidget(toggleButton, 2, 0); layout->addWidget(pushButton, 2, 1); layout->addWidget(comboBox, 3, 0, 1, 2); + layout->addWidget(modeButton, 4, 0, 1, 2); + layout->addWidget(modeLabel, 5, 0, 1, 2); central->setLayout(layout); fileMenu = menuBar()->addMenu(tr("&File")); @@ -97,6 +105,7 @@ MainWindow::MainWindow(QWidget *parent) connect(pushButton, SIGNAL(clicked()), this, SLOT(openDialog())); connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication())); connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys())); + connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode())); pushButton->setFocus(); } @@ -133,6 +142,35 @@ void MainWindow::setCustomSoftKeys() } } +void MainWindow::setMode() +{ + if(isMaximized()) { + showFullScreen(); + modeLabel->setText(tr("Normal Fullscreen")); + } else { + Qt::WindowFlags flags = windowFlags(); + if(flags & Qt::WindowSoftkeysRespondHint) { + flags |= Qt::WindowSoftkeysVisibleHint; + flags &= ~Qt::WindowSoftkeysRespondHint; + setWindowFlags(flags); // Hides visible window + showFullScreen(); + modeLabel->setText(tr("Fullscreen with softkeys")); + } else if(flags & Qt::WindowSoftkeysVisibleHint) { + flags &= ~Qt::WindowSoftkeysVisibleHint; + flags &= ~Qt::WindowSoftkeysRespondHint; + setWindowFlags(flags); // Hides visible window + showMaximized(); + modeLabel->setText(tr("Normal Maximized")); + } else { + flags &= ~Qt::WindowSoftkeysVisibleHint; + flags |= Qt::WindowSoftkeysRespondHint; + setWindowFlags(flags); // Hides visible window + showFullScreen(); + modeLabel->setText(tr("Fullscreen with SK respond")); + } + } +} + void MainWindow::exitApplication() { qApp->exit(); diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h index bae31e7..d533484 100644 --- a/examples/widgets/softkeys/softkeys.h +++ b/examples/widgets/softkeys/softkeys.h @@ -57,21 +57,24 @@ private slots: void okPressed(); void cancelPressed(); void setCustomSoftKeys(); + void setMode(); public: MainWindow(QWidget *parent = 0); ~MainWindow(); private: QGridLayout *layout; QWidget *central; - QTextEdit* textEditor; + QTextEdit *textEditor; QLabel *infoLabel; - QPushButton* toggleButton; - QPushButton* pushButton; - QMenu* fileMenu; - QAction* addSoftKeysAct; - QAction* exit; - QAction* ok; - QAction* cancel; + QPushButton *toggleButton; + QPushButton *pushButton; + QPushButton *modeButton; + QLabel *modeLabel; + QMenu *fileMenu; + QAction *addSoftKeysAct; + QAction *exit; + QAction *ok; + QAction *cancel; }; //! [0] diff --git a/examples/widgets/windowflags/controllerwindow.cpp b/examples/widgets/windowflags/controllerwindow.cpp index 0277794..a1e5455 100644 --- a/examples/widgets/windowflags/controllerwindow.cpp +++ b/examples/widgets/windowflags/controllerwindow.cpp @@ -58,7 +58,7 @@ ControllerWindow::ControllerWindow() bottomLayout->addStretch(); bottomLayout->addWidget(quitButton); - QVBoxLayout *mainLayout = new QVBoxLayout; + QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(typeGroupBox); mainLayout->addWidget(hintsGroupBox); mainLayout->addLayout(bottomLayout); @@ -149,7 +149,7 @@ void ControllerWindow::createTypeGroupBox() splashScreenRadioButton = createRadioButton(tr("Splash screen")); windowRadioButton->setChecked(true); - QGridLayout *layout = new QGridLayout; + QVBoxLayout *layout = new QGridLayout; layout->addWidget(windowRadioButton, 0, 0); layout->addWidget(dialogRadioButton, 1, 0); layout->addWidget(sheetRadioButton, 2, 0); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index b5a0696..9ade699 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1317,6 +1317,10 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy fixedItem = item; } + QString condition; + if (!project->isEmpty(item + ".condition")) + condition = project->first(item + ".condition"); + QFileInfo subdir(fileInfo(fixedItem)); QString relativePath = directory.relativeFilePath(fixedItem); QString subdirFileName = subdir.completeBaseName(); @@ -1345,9 +1349,16 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy bldinfDefine = bldinfDefine.toUpper(); removeSpecialCharacters(bldinfDefine); + if (!condition.isEmpty()) + t << "#if defined(" << condition << ")" << endl; + t << "#ifndef " << bldinfDefine << endl; t << "\t#include \"" << bldinfFilename << "\"" << endl; - t << "#endif // " << bldinfDefine << endl; + t << "#endif" << endl; + + if (!condition.isEmpty()) + t << "#endif" << endl; + } // Add supported project platforms diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 177bee4..bc8d452 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -299,7 +299,9 @@ public: MacWindowToolBarButtonHint = 0x10000000, BypassGraphicsProxyWidget = 0x20000000, WindowOkButtonHint = 0x00080000, - WindowCancelButtonHint = 0x00100000 + WindowCancelButtonHint = 0x00100000, + WindowSoftkeysVisibleHint = 0x40000000, + WindowSoftkeysRespondHint = 0x80000000 #ifdef QT3_SUPPORT , diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 392ece3..6968773 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2146,6 +2146,14 @@ \value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog. Only supported for Windows CE. + \value WindowSoftkeysVisibleHint Makes softkeys visible when widget is fullscreen. + Only supported for Symbian. + + \value WindowSoftkeysRespondHint Makes softkeys to receive key events even + when invisible. With this hint the softkey actions are triggered + even the softkeys are invisible i.e. the window is displayed with + \c showFullscreen(). Only supported for Symbian. + \value WindowType_Mask A mask for extracting the window type part of the window flags. diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 2eecd56..2a90ba6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -597,9 +597,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, keyEvent.iCode); int keyCode; - if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used - keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); - } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { + if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used + keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); + } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { // Normal characters keys. keyCode = s60Keysym; } else { @@ -966,13 +966,26 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. - CEikStatusPane* statusPane = S60->statusPane(); - CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); + CEikStatusPane *statusPane = S60->statusPane(); + CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); if (statusPane) statusPane->MakeVisible(visible); - if (buttonGroup) - buttonGroup->MakeVisible(visible); + if (buttonGroup) { + // Visibility + const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; + const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; + buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint)); + + // Responsiviness + CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup + TUint cbaFlags = cba->ButtonGroupFlags(); + if(qwidget->windowFlags() & Qt::WindowSoftkeysRespondHint) + cbaFlags |= EAknCBAFlagRespondWhenInvisible; + else + cbaFlags &= ~EAknCBAFlagRespondWhenInvisible; + cba->SetButtonGroupFlags(cbaFlags); + } #endif } else if (QApplication::activeWindow() == qwidget->window()) { if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { @@ -1016,6 +1029,16 @@ void QSymbianControl::HandleResourceChange(int resourceType) } else if (qwidget->isMaximized()) { TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); SetExtent(r.iTl, r.Size()); + } else if (!qwidget->isMinimized()){ // Normal geometry + if (!qwidget->testAttribute(Qt::WA_Resized)) { + qwidget->adjustSize(); + qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize + } + if (!qwidget->testAttribute(Qt::WA_Moved)) { + TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + SetPosition(r.iTl); + qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position + } } break; } @@ -1229,7 +1252,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) S60->avkonComponentsSupportTransparency = (value==1) ? true : false; } } -#endif +#endif if (touch) { QApplicationPrivate::navigationMode = Qt::NavigationModeNone; diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 8ac1e31..2a1ecc5 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -73,11 +73,21 @@ bool QSoftKeyManagerPrivateS60::skipCbaUpdate() // Lets not update softkeys if // 1. We don't have application panes, i.e. cba // 2. Our CBA is not active, i.e. S60 native dialog or menu with custom CBA is shown + // 2.1. Except if thre is no current CBA at all and WindowSoftkeysRespondHint is set + // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before // menu/dialog CBA is actually displayed i.e. it is being costructed. CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer(); + // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current(); - if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || appUiCba != currentCba) { + // Check if softkey need to be update even they are not visible + bool cbaRespondsWhenInvisible = false; + QWidget *window = QApplication::activeWindow(); + if (window && (window->windowFlags() & Qt::WindowSoftkeysRespondHint)) + cbaRespondsWhenInvisible = true; + + if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) + || (appUiCba != currentCba && !cbaRespondsWhenInvisible)) { return true; } return false; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index ebd289c..7bbc142 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1042,7 +1042,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate) Q_D(QWidget); Qt::WindowStates oldstate = windowState(); - if (oldstate == newstate) + + const TBool isFullscreen = newstate & Qt::WindowFullScreen; + const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint; + const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false; + const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible); + + if (oldstate == newstate && !softkeyVisibilityChange) return; if (isWindow()) { @@ -1058,16 +1064,27 @@ void QWidget::setWindowState(Qt::WindowStates newstate) #ifdef Q_WS_S60 // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. - // The window decoration visibility has to be changed before doing actual window state - // change since in that order the availableGeometry will return directly the right size and + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and // we will avoid unnecessarty redraws - CEikStatusPane* statusPane = S60->statusPane(); - CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + CEikStatusPane *statusPane = S60->statusPane(); + CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); + TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); if (statusPane) statusPane->MakeVisible(visible); - if (buttonGroup) - buttonGroup->MakeVisible(visible); + if (buttonGroup) { + // Visibility + buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested)); + + // Responsiviness + CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup + TUint cbaFlags = cba->ButtonGroupFlags(); + if(windowFlags() & Qt::WindowSoftkeysRespondHint) + cbaFlags |= EAknCBAFlagRespondWhenInvisible; + else + cbaFlags &= ~EAknCBAFlagRespondWhenInvisible; + cba->SetButtonGroupFlags(cbaFlags); + } #endif // Q_WS_S60 createWinId(); @@ -1080,7 +1097,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; if (newstate & Qt::WindowFullScreen) - setGeometry(qApp->desktop()->screenGeometry(this)); + setGeometry(qApp->desktop()->availableGeometry(this)); else if (newstate & Qt::WindowMaximized) setGeometry(qApp->desktop()->availableGeometry(this)); else |