From a551f78d117b1e576aab029a9b04feb1c47c7d65 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 22 Oct 2016 19:36:01 +0000 Subject: [PATCH] QUrl and qnamespace doc cleanups Signed-off-by: Ivailo Monev --- src/core/global/qnamespace.qdoc | 205 +++---------------------------- src/core/io/qurl.cpp | 42 +------ src/core/io/qurl.h | 4 +- src/gui/text/qtexthtmlparser.cpp | 2 +- 4 files changed, 27 insertions(+), 226 deletions(-) diff --git a/src/core/global/qnamespace.qdoc b/src/core/global/qnamespace.qdoc index 7770b37e0..e55bfe97e 100644 --- a/src/core/global/qnamespace.qdoc +++ b/src/core/global/qnamespace.qdoc @@ -120,10 +120,8 @@ \value AA_DontShowIconsInMenus Actions with the Icon property won't be shown in any menus unless specifically set by the - QAction::iconVisibleInMenu property. - Menus that are currently open or menus already created in the native - Mac OS X menubar \e{may not} pick up a change in this attribute. Changes - in the QAction::iconVisibleInMenu property will always be picked up. + QAction::iconVisibleInMenu property. Changes in the + QAction::iconVisibleInMenu property will always be picked up. \value AA_NativeWindows Ensures that widgets have native windows. @@ -131,24 +129,8 @@ widgets stay non-native unless specifically set by the Qt::WA_NativeWindow attribute. - \value AA_MacPluginApplication Stops the Qt mac application from doing - specific initializations that do not necessarily make sense when using Qt - to author a plugin. This includes avoiding loading our nib for the main - menu and not taking possession of the native menu bar. When setting this - attribute to true will also set the AA_DontUseNativeMenuBar attribute - to true. - \value AA_DontUseNativeMenuBar All menubars created while this attribute is - set to true won't be used as a native menubar (e.g, the menubar at - the top of the main screen on Mac OS X or at the bottom in Windows CE). - - \value AA_MacDontSwapCtrlAndMeta On Mac OS X by default, Qt swaps the - Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt - sends Meta, and whenever Meta is pressed Control is sent). When this - attribute is true, Qt will not do the flip. QKeySequence::StandardShortcuts - will also flip accordingly (i.e., QKeySequence::Copy will be - Command+C on the keyboard regardless of the value set, though what is output for - QKeySequence::toString(QKeySequence::PortableText) will be different). + set to true won't be used as a native menubar. \value AA_X11InitThreads Calls XInitThreads() as part of the QApplication construction in order to make Xlib calls thread-safe. This @@ -202,15 +184,6 @@ \omitvalue KeyboardModifierMask - \note On Mac OS X, the \c ControlModifier value corresponds to - the Command keys on the Macintosh keyboard, and the \c MetaModifier value - corresponds to the Control keys. The \c KeypadModifier value will also be set - when an arrow key is pressed as the arrow keys are considered part of the - keypad. - - \note On Windows Keyboards, Qt::MetaModifier and Qt::Key_Meta are mapped - to the Windows key. - \sa MouseButton Modifier */ @@ -220,10 +193,6 @@ This enum provides shorter names for the keyboard modifier keys supported by Qt. - \bold{Note:} On Mac OS X, the \c CTRL value corresponds to - the Command keys on the Macintosh keyboard, and the \c META value - corresponds to the Control keys. - \value SHIFT The Shift keys provided on all standard keyboards. \value META The Meta keys. \value CTRL The Ctrl keys. @@ -682,17 +651,6 @@ rendering operation for example. */ -/*! \enum Qt::GUIStyle - - \compat - - \value WindowsStyle - \value MotifStyle - \value MacStyle - \value Win3Style - \value PMStyle -*/ - /*! \enum Qt::UIEffect @@ -868,9 +826,9 @@ miscellaneous action keys (e.g. Escape, Enter, Backspace, PrintScreen) will stop key event compression, even if there are more compressible key events available. - Platforms other than Mac and X11 do not support this compression, - in which case turning it on will have no effect. - This is set/cleared by the widget's author. + Platforms other than X11 do not support this compression, in which + case turning it on will have no effect. This is set/cleared by the + widget's author. \value WA_LayoutOnEntireRect Indicates that the widget wants QLayout to operate on the entire QWidget::rect(), not only @@ -878,47 +836,7 @@ \value WA_LayoutUsesWidgetRect Ignore the layout item rect from the style when laying out this widget with QLayout. This makes a difference in - QMacStyle and QPlastiqueStyle for some widgets. - - \value WA_MacNoClickThrough When a widget that has this attribute set - is clicked, and its window is inactive, the click will make the window - active but won't be seen by the widget. Typical use of this attribute - is on widgets with "destructive" actions, such as a "Delete" button. - WA_MacNoClickThrough also applies to all child widgets of the widget - that has it set. - - \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip - should be opaque instead of transparent (the default). This attribute - is only applicable to Mac OS X and is set by the widget's author. - - \value WA_MacShowFocusRect Indicates that this widget should get a - QFocusFrame around it. Some widgets draw their own focus halo - regardless of this attribute. Not that the QWidget::focusPolicy - also plays the main role in whether something is given focus or - not, this only controls whether or not this gets the focus - frame. This attribute is only applicable to Mac OS X. - - \value WA_MacNormalSize Indicates the widget should have the - normal size for widgets in Mac OS X. This attribute is only - applicable to Mac OS X. - - \value WA_MacSmallSize Indicates the widget should have the small - size for widgets in Mac OS X. This attribute is only applicable to - Mac OS X. - - \value WA_MacMiniSize Indicates the widget should have the mini - size for widgets in Mac OS X. This attribute is only applicable to - Mac OS X. - - \value WA_MacVariableSize Indicates the widget can choose between - alternative sizes for widgets to avoid clipping. - This attribute is only applicable to Mac OS X. - - \value WA_MacBrushedMetal Indicates the widget should be drawn in - the brushed metal style as supported by the windowing system. This - attribute is only applicable to Mac OS X. - - \omitvalue WA_MacMetalStyle + QPlastiqueStyle for some widgets. \value WA_Mapped Indicates that the widget is mapped on screen. This is set/cleared by the Qt kernel. @@ -1001,9 +919,8 @@ QWidget::paintEngine() to return 0 and set this flag. \value WA_PaintOutsidePaintEvent Makes it possible to use QPainter to - paint on the widget outside \l{QWidget::paintEvent()}{paintEvent()}. This - flag is not supported on Windows, Mac OS X or Embedded Linux. We recommend - that you use it only when porting Qt 3 code to Qt 4. + paint on the widget outside \l{QWidget::paintEvent()}{paintEvent()}. + We recommend that you use it only when porting Qt 3 code to Qt 4. \value WA_PaintUnclipped Makes all painters operating on this widget unclipped. Children of this widget or other widgets in front of it do not @@ -1071,17 +988,13 @@ \warning This flag must \e never be set or cleared by the widget's author. \value WA_WindowModified Indicates that the window is marked as modified. - On some platforms this flag will do nothing, on others (including Mac OS X - and Windows) the window will take a modified appearance. This flag is set - or cleared by QWidget::setWindowModified(). + On some platforms this flag will do nothing, on others the window will + take a modified appearance. This flag is set or cleared by + QWidget::setWindowModified(). \value WA_WindowPropagation Makes a toplevel window inherit font and palette from its parent. - \value WA_MacAlwaysShowToolWindow On Mac OS X, show the tool window even - when the application is not active. By default, all tool windows are - hidden when the application is inactive. - \value WA_SetLocale Indicates the locale should be taken into consideration in the widget. @@ -1173,10 +1086,6 @@ has no effect on non-X11 platforms. \note Qt automatically sets this attribute on the feedback widget used during a drag. - \value WA_MacFrameworkScaled Enables resolution independence aware mode - on Mac when using Carbon. This attribute has no effect on Cocoa. - The attribute is off by default and can be enabled on a per-window basis. - \value WA_AcceptTouchEvents Allows touch events (see QTouchEvent) to be sent to the widget. Must be set on all widgets that can handle touch events. Without this attribute set, events from a @@ -1195,9 +1104,6 @@ ignoring changes to the display's orientation with respect to the user. \value WA_AutoOrientation Causes the widget to change orientation whenever the display changes orientation with respect to the user. - - \value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows - for this top level window. Only affects Cocoa builds of Qt for Mac OS X. \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent @@ -1234,9 +1140,7 @@ /*! \typedef Qt::HANDLE Platform-specific handle type for system objects. This is - equivalent to \c{void *} on Mac OS X and embedded Linux, - and to \c{unsigned long} on X11. On Windows it is the - DWORD returned by the Win32 function getCurrentThreadId(). + equivalent to \c{unsigned long} on X11. \warning Using this type is not portable. */ @@ -1902,9 +1806,7 @@ \value TabFocus the widget accepts focus by tabbing. \value ClickFocus the widget accepts focus by clicking. \value StrongFocus the widget accepts focus by both tabbing - and clicking. On Mac OS X this will also - be indicate that the widget accepts tab focus - when in 'Text/List focus mode'. + and clicking. \value WheelFocus like Qt::StrongFocus plus the widget accepts focus by using the mouse wheel. \value NoFocus the widget does not accept focus. @@ -1993,15 +1895,6 @@ system supports it, a tool window can be decorated with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint. - \br - \br - On Mac OS X, tool windows correspond to the - \l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating} - class of windows. This means that the window lives on a - level above normal windows; it impossible to put a normal - window on top of it. By default, tool windows will disappear - when the application is inactive. This can be controlled by - the Qt::WA_MacAlwaysShowToolWindow attribute. \value ToolTip Indicates that the widget is a tooltip. This is used internally to implement @@ -2048,9 +1941,8 @@ \value WindowTitleHint Gives the window a title bar. \value WindowSystemMenuHint Adds a window system menu, and - possibly a close button (for example on Mac). If you need to hide - or show a close button, it is more portable to use \c - WindowCloseButtonHint. + possibly a close button. If you need to hide or show a close button, + it is more portable to use \c WindowCloseButtonHint. \value WindowMinimizeButtonHint Adds a minimize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work. @@ -2068,9 +1960,6 @@ \value WindowContextHelpButtonHint Adds a context help button to dialogs. On some platforms this implies Qt::WindowSystemMenuHint for it to work. - \value MacWindowToolBarButtonHint On Mac OS X adds a tool bar button (i.e., - the oblong button that is on the top right of windows that have toolbars). - \value BypassGraphicsProxyWidget Prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the parent widget is already embedded. You can set this flag if you @@ -2091,8 +1980,7 @@ that on X11 this hint will work only in window managers that support _NET_WM_STATE_BELOW atom. If a window always on the bottom has a parent, the parent will also be left on - the bottom. This window hint is currently not implemented - for Mac OS X. + the bottom. \value WindowOkButtonHint Adds an OK button to the window decoration of a dialog. Only supported for Windows CE. @@ -2142,9 +2030,6 @@ \value WPaintClever No longer needed. \value WX11BypassWM Use Qt::X11BypassWindowManagerHint instead. - \value WWinOwnDC Use Qt::MSWindowsOwnDC instead. - \value WMacSheet Use Qt::Sheet instead. - \value WMacDrawer Use Qt::Drawer instead. \value WStyle_Splash Use Qt::SplashScreen instead. @@ -2155,7 +2040,6 @@ \value WStyle_Dialog Use Qt::Dialog instead. \value WStyle_NoBorderEx Use Qt::FramelessWindowHint instead. \value WResizeNoErase No longer needed. - \value WMacNoSheet No longer needed. \sa QWidget::windowFlags, {Window Flags Example} */ @@ -2172,58 +2056,10 @@ should be taken over by the target application, i.e., the source application should not delete the data. - \br - On X11 this value is used to do a move. - \br - TargetMoveAction is not used on the Mac. + \br + On X11 this value is used to do a move. */ -#if defined(Q_OS_WIN) && defined(QT3_SUPPORT) -/*! - \enum Qt::WindowsVersion - \compat - - \value WV_32s - \value WV_95 - \value WV_98 - \value WV_Me - \value WV_DOS_based - \value WV_NT - \value WV_2000 - \value WV_XP - \value WV_2003 - \value WV_NT_based - \value WV_CE - \value WV_CENET - \value WV_CE_based - \value WV_CE_5 - \value WV_CE_6 -*/ -#endif - -#if defined(Q_OS_MAC) && defined(QT3_SUPPORT) -/*! - \enum Qt::MacintoshVersion - \compat - - \value MV_Unknown Use QSysInfo::MV_Unknown instead. - \value MV_9 Use QSysInfo::MV_9 instead. - \value MV_10_DOT_0 Use QSysInfo::MV_10_0 instead. - \value MV_10_DOT_1 Use QSysInfo::MV_10_1 instead. - \value MV_10_DOT_2 Use QSysInfo::MV_10_2 instead. - \value MV_10_DOT_3 Use QSysInfo::MV_10_3 instead. - \value MV_10_DOT_4 Use QSysInfo::MV_10_4 instead. - - \value MV_CHEETAH Use QSysInfo::MV_10_0 instead. - \value MV_PUMA Use QSysInfo::MV_10_1 instead. - \value MV_JAGUAR Use QSysInfo::MV_10_2 instead. - \value MV_PANTHER Use QSysInfo::MV_10_3 instead. - \value MV_TIGER Use QSysInfo::MV_10_4 instead. - - \sa QSysInfo::MacVersion -*/ -#endif - /*! \typedef Qt::ToolBarDock \compat @@ -2723,8 +2559,7 @@ Qt::ElideMiddle is normally the most appropriate choice for URLs (e.g., "\l{http://bugreports.qt.io/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"), whereas Qt::ElideRight is appropriate - for other strings (e.g., - "\l{http://doc.qt.digia.com/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}"). + for other strings. \sa QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag QTabBar::elideMode */ diff --git a/src/core/io/qurl.cpp b/src/core/io/qurl.cpp index 4506ccad6..c988a8243 100644 --- a/src/core/io/qurl.cpp +++ b/src/core/io/qurl.cpp @@ -6184,22 +6184,10 @@ bool QUrl::isDetached() const */ QUrl QUrl::fromLocalFile(const QString &localFile) { + const QString deslashified = QDir::fromNativeSeparators(localFile); QUrl url; url.setScheme(QLatin1String("file")); - QString deslashified = QDir::fromNativeSeparators(localFile); - - // magic for drives on windows - if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) { - url.setPath(QLatin1Char('/') + deslashified); - // magic for shared drive on windows - } else if (deslashified.startsWith(QLatin1String("//"))) { - int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2); - url.setHost(deslashified.mid(2, indexOfPath - 2)); - if (indexOfPath > 2) - url.setPath(deslashified.right(deslashified.length() - indexOfPath)); - } else { - url.setPath(deslashified); - } + url.setPath(deslashified); return url; } @@ -6209,10 +6197,6 @@ QUrl QUrl::fromLocalFile(const QString &localFile) returned will use forward slashes, even if it was originally created from one with backslashes. - If this URL contains a non-empty hostname, it will be encoded in the - returned value in the form found on SMB networks (for example, - "//servername/path/to/file.txt"). - If this is a relative URL, in Qt 4.x this function returns the path to maintain backward compatability. This will change from 5.0 onwards. Then the path is returned only for URLs where the scheme is "file", and for @@ -6228,23 +6212,7 @@ QString QUrl::toLocalFile() const if (!isLocalFile() && !scheme().isEmpty()) return QString(); - QString tmp; - QString ourPath = path(); - - QMutexLocker lock(&d->mutex); // for d->host - - // magic for shared drive on windows - if (!d->host.isEmpty()) { - tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/') - ? QLatin1Char('/') + ourPath : ourPath); - } else { - tmp = ourPath; - // magic for drives on windows - if (ourPath.length() > 2 && ourPath.at(0) == QLatin1Char('/') && ourPath.at(2) == QLatin1Char(':')) - tmp.remove(0, 1); - } - - return tmp; + return path(); } /*! @@ -6576,13 +6544,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ QUrl QUrl::fromUserInput(const QString &userInput) { - QString trimmedString = userInput.trimmed(); + const QString trimmedString = userInput.trimmed(); // Check first for files, since on Windows drive letters can be interpretted as schemes if (QDir::isAbsolutePath(trimmedString)) return QUrl::fromLocalFile(trimmedString); - QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); + const QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode); // Check the most common case of a valid url with a scheme diff --git a/src/core/io/qurl.h b/src/core/io/qurl.h index 144d385ee..8186884f7 100644 --- a/src/core/io/qurl.h +++ b/src/core/io/qurl.h @@ -210,13 +210,11 @@ public: QString errorString() const; -protected: - private: void detach(QMutexLocker &locker); QUrlPrivate *d; public: - typedef QUrlPrivate * DataPtr; + typedef QUrlPrivate* DataPtr; inline DataPtr &data_ptr() { return d; } }; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 9892b4784..6604a7ba9 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -363,7 +363,7 @@ static const ushort windowsLatin1ExtendedCharacters[0xA0 - 0x80] = { 0x2018, // 0x91 0x2019, // 0x92 0x201C, // 0x93 - 0X201D, // 0x94 + 0x201D, // 0x94 0x2022, // 0x95 0x2013, // 0x96 0x2014, // 0x97