From 45ecee79def92e6d1e1dd4cd29f3d782105a31a7 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 5 Oct 2016 03:54:38 +0000 Subject: [PATCH] mostly mac/win cruft removal Signed-off-by: Ivailo Monev --- src/designer/shared/dialoggui.cpp | 1 - src/gui/image/qimage.cpp | 15 ------- src/gui/inputmethod/qinputcontextfactory.cpp | 22 ---------- src/gui/painting/qgraphicssystemfactory.cpp | 2 +- src/gui/text/qtextlayout.cpp | 11 +---- src/gui/util/qdesktopservices.cpp | 4 -- src/gui/widgets/qlinecontrol.cpp | 4 +- src/gui/widgets/qmenu.cpp | 41 ++----------------- src/gui/widgets/qworkspace.cpp | 61 +++++----------------------- 9 files changed, 18 insertions(+), 143 deletions(-) diff --git a/src/designer/shared/dialoggui.cpp b/src/designer/shared/dialoggui.cpp index 5cb389684..98b925994 100644 --- a/src/designer/shared/dialoggui.cpp +++ b/src/designer/shared/dialoggui.cpp @@ -215,7 +215,6 @@ QString DialogGui::getSaveFileName(QWidget *parent, const QString &caption, cons void DialogGui::initializeImageFileDialog(QFileDialog &fileDialog, QFileDialog::Options options, QFileDialog::FileMode fm) { fileDialog.setConfirmOverwrite( !(options & QFileDialog::DontConfirmOverwrite) ); - fileDialog.setResolveSymlinks( !(options & QFileDialog::DontResolveSymlinks) ); fileDialog.setIconProvider(ensureIconProvider()); fileDialog.setFileMode(fm); } diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index cc852d93b..d21495259 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5000,21 +5000,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth dptr++; } break; -# if defined(Q_WS_WIN) - case QT_XFORM_TYPE_WINDOWSPIXMAP: - while (dptr < maxp) { - IWX_PIX(128); - IWX_PIX(64); - IWX_PIX(32); - IWX_PIX(16); - IWX_PIX(8); - IWX_PIX(4); - IWX_PIX(2); - IWX_PIX(1); - dptr++; - } - break; -# endif } } m21ydx += m21; diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index 7e1cd48d9..37a8d68ce 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -159,12 +159,6 @@ QStringList QInputContextFactory::keys() #if defined(Q_WS_X11) && !defined(QT_NO_XIM) result << QLatin1String("xim"); #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_XIM) - result << QLatin1String("win"); -#endif -#if defined(Q_WS_MAC) - result << QLatin1String("mac"); -#endif #ifndef QT_NO_LIBRARY result += inputloader()->keys(); #endif // QT_NO_LIBRARY @@ -193,14 +187,6 @@ QStringList QInputContextFactory::languages( const QString &key ) if (key == QLatin1String("xim")) return QStringList(QString()); #endif -#if defined(Q_WS_WIN) - if (key == QLatin1String("win")) - return QStringList(QString()); -#endif -#if defined(Q_WS_MAC) - if (key == QLatin1String("mac")) - return QStringList(QString()); -#endif #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) Q_UNUSED(key); #else @@ -248,14 +234,6 @@ QString QInputContextFactory::description( const QString &key ) if (key == QLatin1String("xim")) return QInputContext::tr( "XIM input method" ); #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_XIM) - if (key == QLatin1String("win")) - return QInputContext::tr( "Windows input method" ); -#endif -#if defined(Q_WS_MAC) - if (key == QLatin1String("mac")) - return QInputContext::tr( "Mac OS X input method" ); -#endif #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) Q_UNUSED(key); #else diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index df09c038e..28416ece5 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -64,7 +64,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) if (system.isEmpty()) { system = QLatin1String("opengl"); } -#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) || defined(Q_WS_X11) +#elif defined (QT_GRAPHICSSYSTEM_RASTER) || defined(Q_WS_X11) if (system.isEmpty()) { system = QLatin1String("raster"); } diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 37268da2e..1db0914af 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1882,9 +1882,7 @@ void QTextLine::layout_helper(int maxGlyphs) // expand the text beyond the edge. if (sb_or_ws|breakany) { QFixed rightBearing = lbh.rightBearing; // store previous right bearing -#if !defined(Q_WS_MAC) if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) -#endif lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { // we are too wide, fix right bearing @@ -2203,14 +2201,7 @@ QList QTextLine::glyphs(int from, int length) const fontD->fontEngine = fontEngine; fontD->fontEngine->ref.ref(); -#if defined(Q_WS_WIN) - if (fontEngine->supportsSubPixelPositions()) - fontD->hintingPreference = QFont::PreferVerticalHinting; - else - fontD->hintingPreference = QFont::PreferFullHinting; -#elif defined(Q_WS_MAC) - fontD->hintingPreference = QFont::PreferNoHinting; -#elif !defined(QT_NO_FREETYPE) +#if !defined(QT_NO_FREETYPE) if (fontEngine->type() == QFontEngine::Freetype) { QFontEngineFT *freeTypeEngine = static_cast(fontEngine); switch (freeTypeEngine->defaultHintStyle()) { diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 0f33c2ac7..9b9f75645 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -49,10 +49,6 @@ #include "qdesktopservices_blackberry.cpp" #elif defined(Q_WS_X11) #include "qdesktopservices_x11.cpp" -#elif defined(Q_WS_WIN) -#include "qdesktopservices_win.cpp" -#elif defined(Q_WS_MAC) -#include "qdesktopservices_mac.cpp" #endif #include diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 64c97d1cc..4f9bb09a1 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1725,7 +1725,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) end(1); } else if (event == QKeySequence::MoveToNextChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) +#if defined(QT_NO_COMPLETER) if (hasSelectedText()) { #else if (hasSelectedText() && m_completer @@ -1740,7 +1740,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); } else if (event == QKeySequence::MoveToPreviousChar) { -#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) +#if defined(QT_NO_COMPLETER) if (hasSelectedText()) { #else if (hasSelectedText() && m_completer diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 1c3e79102..faecc7597 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -164,31 +164,21 @@ int QMenuPrivate::scrollerHeight() const //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(const QWidget *widget) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(widget); -#elif defined Q_WS_X11 +#if defined Q_WS_X11 if (X11->desktopEnvironment == DE_KDE) return QApplication::desktop()->screenGeometry(widget); - else - return QApplication::desktop()->availableGeometry(widget); -#else - return QApplication::desktop()->availableGeometry(widget); #endif + return QApplication::desktop()->availableGeometry(widget); } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(screen); -#elif defined Q_WS_X11 +#if defined Q_WS_X11 if (X11->desktopEnvironment == DE_KDE) return QApplication::desktop()->screenGeometry(screen); - else - return QApplication::desktop()->availableGeometry(screen); -#else - return QApplication::desktop()->availableGeometry(screen); #endif + return QApplication::desktop()->availableGeometry(screen); } QList > QMenuPrivate::calcCausedStack() const @@ -398,10 +388,6 @@ QRect QMenuPrivate::actionRect(QAction *act) const return actionRects.at(index); } -#if defined(Q_WS_MAC) -static const qreal MenuFadeTimeInSec = 0.150; -#endif - void QMenuPrivate::hideUpToMenuBar() { Q_Q(QMenu); @@ -426,14 +412,6 @@ void QMenuPrivate::hideUpToMenuBar() } else { caused = 0; } } -#if defined(Q_WS_MAC) - if (fadeMenus) { - QEventLoop eventLoop; - QTimer::singleShot(int(MenuFadeTimeInSec * 1000), &eventLoop, SLOT(quit())); - QMacWindowFader::currentFader()->performFade(); - eventLoop.exec(); - } -#endif } setCurrentAction(0); } @@ -468,15 +446,6 @@ void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister) // Should be something like: q->transitionWindow(Qt::FadeOutTransition, MenuFadeTimeInSec); // Hopefully we'll integrate qt/research/windowtransitions into main before 4.4. // Talk to Richard, Trenton or Bjoern. -#if defined(Q_WS_MAC) - if (justRegister) { - QMacWindowFader::currentFader()->setFadeDuration(MenuFadeTimeInSec); - QMacWindowFader::currentFader()->registerWindowToFade(menu); - } else { - macWindowFade(qt_mac_window_for(menu), MenuFadeTimeInSec); - } - -#endif // Q_WS_MAC } aboutToHide = false; menu->blockSignals(false); @@ -2383,12 +2352,10 @@ void QMenu::keyPressEvent(QKeyEvent *e) else if (key == Qt::Key_Right) key = Qt::Key_Left; } -#ifndef Q_WS_MAC if (key == Qt::Key_Tab) //means down key = Qt::Key_Down; if (key == Qt::Key_Backtab) //means up key = Qt::Key_Up; -#endif bool key_consumed = false; switch(key) { diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index c5dedce7f..262df33a4 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -367,62 +367,21 @@ QWorkspaceTitleBar::~QWorkspaceTitleBar() { } - -#ifdef Q_WS_WIN -static inline QRgb colorref2qrgb(COLORREF col) -{ - return qRgb(GetRValue(col),GetGValue(col),GetBValue(col)); -} -#endif - void QWorkspaceTitleBarPrivate::readColors() { Q_Q(QWorkspaceTitleBar); QPalette pal = q->palette(); - bool colorsInitialized = false; - -#ifdef Q_WS_WIN // ask system properties on windows -#ifndef SPI_GETGRADIENTCAPTIONS -#define SPI_GETGRADIENTCAPTIONS 0x1008 -#endif -#ifndef COLOR_GRADIENTACTIVECAPTION -#define COLOR_GRADIENTACTIVECAPTION 27 -#endif -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif - if (QApplication::desktopSettingsAware()) { - pal.setColor(QPalette::Active, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION))); - pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION))); - pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); - pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); - - colorsInitialized = true; - BOOL gradient = false; - SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0); - - if (gradient) { - pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); - pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); - } else { - pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight)); - pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight)); - } - } -#endif // Q_WS_WIN - if (!colorsInitialized) { - pal.setColor(QPalette::Active, QPalette::Highlight, - pal.color(QPalette::Active, QPalette::Highlight)); - pal.setColor(QPalette::Active, QPalette::Base, - pal.color(QPalette::Active, QPalette::Highlight)); - pal.setColor(QPalette::Inactive, QPalette::Highlight, - pal.color(QPalette::Inactive, QPalette::Dark)); - pal.setColor(QPalette::Inactive, QPalette::Base, - pal.color(QPalette::Inactive, QPalette::Dark)); - pal.setColor(QPalette::Inactive, QPalette::HighlightedText, - pal.color(QPalette::Inactive, QPalette::Window)); - } + pal.setColor(QPalette::Active, QPalette::Highlight, + pal.color(QPalette::Active, QPalette::Highlight)); + pal.setColor(QPalette::Active, QPalette::Base, + pal.color(QPalette::Active, QPalette::Highlight)); + pal.setColor(QPalette::Inactive, QPalette::Highlight, + pal.color(QPalette::Inactive, QPalette::Dark)); + pal.setColor(QPalette::Inactive, QPalette::Base, + pal.color(QPalette::Inactive, QPalette::Dark)); + pal.setColor(QPalette::Inactive, QPalette::HighlightedText, + pal.color(QPalette::Inactive, QPalette::Window)); q->setPalette(pal); q->setActive(act); -- 2.11.0