summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.mm
Commit message (Collapse)AuthorAgeFilesLines
* Expose QPA API under qpa/*Girish Ramakrishnan2012-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += <module>-private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Port QMacPrintEngine and QCoreGraphicsPaintEngine from Qt 4 to Qt 5Bradley T. Hughes2012-03-151-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy qprintengine_mac_p.h, qprintengine_mac.mm, qpaintengine_mac_p.h, and qpaintengine_mac.cpp (as qpaintengine_mac.mm) from src/gui/painting/ in the 4.8 branch of http://git.gitorious.org/qt/qt.git at commit e6bd33d4aef0e4538d7918e7ab130624c911b553. The following changes are necessary to port these files to the Qt 5 API: - The copyright notice on these files has been updated to match the header.LGPL template. - Fix #includes for qprintengine_mac* and qpaintengine_mac*, as some headers have moved in Qt 5. - Remove extern forward declarations for functions that no longer exist. - Remove friend declarations for classes/functions that are not part of the Cocoa platform plugin. - Remove QT_MAC_USE_COCOA blocks. Qt is always using Cocoa now, there is no need to keep the non-Cocoa code paths anymore. The QMacPrintEngine::shouldSuppressStatus() method was also removed, since it is no longer used. - Do not use Qt::UniteClip, it was removed in commit 01b72952c38b9193138eabdab6bdab632cd75ebd - Use QCocoaAutoReleasePool in qprintengine_mac.mm - Use QPlatformPrintSupport::convert*() functions in QMacPrintEngine, since we cannot use non-exported functions from QtPrintSupport in the Cocoa plugin. - Use qt_mac_image_to_cg_image() to convert QPixmap to CGImageRef. First convert QPixmap to QImage (cheap, since the Cocoa platform plugin uses QRasterPlatformPixmap), and then convert the QImage to CFImageRef using the existing helper function. - Copy qt_mac_cg_context() to the Cocoa platform plugin from qmacstyle_mac.mm, adding a note at each location about the duplication. - Add qt_mac_QRegionToHIMutableShape() helper. Adapt the Qt 4.x code for QRegion::toHIMutableShape(), and use this in QCoreGraphicsPaintEngine. - Add qt_mac_drawCGImage() and qt_mac_get_scalefactor() helper. These functions are copied directly from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. - Add qt_mac_create_imagemask() helper in qpaintengine_mac.cpp. This helper is based on the function with the same name from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. The correctness of the implementation has not yet been verified. Since these files use the QPrinter API from QtPrintSupport, the Cocoa plugin now needs to link to that library as well. Change-Id: I90b9bbe201327489ef9e1b3294e68e91ddda27bd Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Input method on MacTasuku Suzuki2012-03-121-0/+19
| | | | | | | | Restore input method implimentation in Qt4 Task-number: QTBUG-23867 Change-Id: I5d405ccc8b0a73c399d992f6474a0cc38d191157 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Implement Drag-and-Drop.Friedemann Kleint2012-03-071-0/+58
| | | | | | | | | | Implement drag and drop support for drags originating from outside Qt. Port mime and pasteboard code from Qt 4. Use QSimpleDrag from from platform support to implement internal Qt drags. Change-Id: I5b664a95ebb00f48de2bd21c24dfb579af16123e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove QPlatformIntegration/QPlatformTheme from QGuiAppPrivate.Friedemann Kleint2012-02-201-0/+1
| | | | | | | Forward-declare instead. Change-Id: I3851994e8bc05b389e94e948478339ba33d521c1 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Move QString <-> NSString conversion to QtCoreMorten Johan Sorvig2012-02-021-1/+1
| | | | | | | | | | | | | | | | Add (private) API to QCFString: static QString toQString(NSString *) static NSString *toNSString(const QString &) Add implementation to qcore_mac_objc.mm. Keep the mac_cpp since it's used for building qmake as well as bootstrapping. Replace usage of NSString conversion functions in the cocoa and corewlan plugin with QCFString. Change-Id: I9f34edd5231255aef9d8d6e9a60306174bb279b3 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Avoid non-standard indentation of license headers.Jason McDonald2012-01-301-39/+39
| | | | | | | | The strange indentation has made maintenance of license headers difficult on several occasions. Change-Id: Ib29a7e5275e2c7a2c13a3f32fd2479f34d3353ca Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't crash during QApplication constructionBradley T. Hughes2012-01-121-1/+2
| | | | | | | | | | | | The QCoreApplication::init() function calls the virtual QCoreApplicationPrivate::createEventDispatcher(), which for QApplication, also creates the plaform integration. Unfortunately, the Cocoa menubar integration uses qApp before QApplication is constructed, causing a crash. Circumvent this by using QGuiApplicationPrivate directly. Change-Id: Ib36f628641761e70f9e9e39dd23e70e7537a165b Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Fix key codes on mac.Zeno Albisser2012-01-101-1/+1
| | | | | | | Qt key codes match the unicode character in upper case format. Change-Id: I92b43463921e71f2607e569ba7ee23d6f844c50a Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fixed Qtbase OSX specific namespace compilation.Toby Tomkins2011-11-291-0/+3
| | | | | | Change-Id: Idacfa679df7aa6417f8017f80928907830d15df2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cocoa: Set correct child window geometry.Morten Sorvig2011-10-271-0/+7
| | | | | | | | | Remote globalGeometry which was completely wrong, replace with flipRect which converts from Qt screen coordinates to OS X screen coordinates. Change-Id: Ie560cb7c2266fe779da8a44a35596d2d12af77f5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Implement propagateSizeHints.Morten Sorvig2011-10-271-0/+4
| | | | | Change-Id: Idc1244ffbf975972f01d9ee48092500a72739d37 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: Fix spelling errors in comments.Morten Sorvig2011-10-031-1/+1
| | | | | | | | | | This could be the basis for a "english spelling for norwegians" course. Change-Id: I1d6de11b6673ec0a8ba3c2ff12dd8472fb467703 Reviewed-on: http://codereview.qt-project.org/5691 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Cocoa: QMenu refactor.Morten Sorvig2011-09-071-0/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Make plain executables foreground processes.Morten Sorvig2011-08-291-0/+120
Non-bundled executables are started as background processes which does not have a dock icon or a task switcher entry. This is generally not what we want for Qt gui applications so change the process type. Change-Id: I0d29eb9b70655e95bc0b9500803fbf3955d264e4 Reviewed-on: http://codereview.qt.nokia.com/3387 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>