diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index 07d120a7e..29b2fe4d1 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -64,11 +64,6 @@ #include "qdialogbuttonbox.h" #include "qguiplatformplugin_p.h" - -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) -# define QT_SMALL_COLORDIALOG -#endif - QT_BEGIN_NAMESPACE //////////// QWellArray BEGIN @@ -1096,32 +1091,9 @@ QColorShower::QColorShower(QColorDialog *parent) gl->setMargin(gl->spacing()); lab = new QColorShowLabel(this); -#ifdef QT_SMALL_COLORDIALOG -# if defined Q_WS_MAEMO_5 - const bool nonTouchUI = false; -# endif -#endif - -#ifndef Q_WS_WINCE -#ifdef QT_SMALL_COLORDIALOG - lab->setMinimumHeight(60); -#endif lab->setMinimumWidth(60); -#else - lab->setMinimumWidth(20); -#endif -// In S60, due to small screen and different screen layouts need to re-arrange the widgets. -// For QVGA screens only the comboboxes and color label are visible. -// For nHD screens only color and luminence pickers and color label are visible. -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lab, 0, 0, -1, 1); -#else - if (nonTouchUI) - gl->addWidget(lab, 0, 0, 1, -1); - else - gl->addWidget(lab, 0, 0, -1, 1); -#endif connect(lab, SIGNAL(colorDropped(QRgb)), this, SIGNAL(newCol(QRgb))); connect(lab, SIGNAL(colorDropped(QRgb)), this, SLOT(setRgb(QRgb))); @@ -1132,18 +1104,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblHue->setBuddy(hEd); #endif lblHue->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblHue, 0, 1); gl->addWidget(hEd, 0, 2); -#else - if (nonTouchUI) { - gl->addWidget(lblHue, 1, 0); - gl->addWidget(hEd, 2, 0); - } else { - lblHue->hide(); - hEd->hide(); - } -#endif sEd = new QColSpinBox(this); lblSat = new QLabel(this); @@ -1151,18 +1113,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblSat->setBuddy(sEd); #endif lblSat->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblSat, 1, 1); gl->addWidget(sEd, 1, 2); -#else - if (nonTouchUI) { - gl->addWidget(lblSat, 1, 1); - gl->addWidget(sEd, 2, 1); - } else { - lblSat->hide(); - sEd->hide(); - } -#endif vEd = new QColSpinBox(this); lblVal = new QLabel(this); @@ -1170,18 +1122,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblVal->setBuddy(vEd); #endif lblVal->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblVal, 2, 1); gl->addWidget(vEd, 2, 2); -#else - if (nonTouchUI) { - gl->addWidget(lblVal, 1, 2); - gl->addWidget(vEd, 2, 2); - } else { - lblVal->hide(); - vEd->hide(); - } -#endif rEd = new QColSpinBox(this); lblRed = new QLabel(this); @@ -1189,18 +1131,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblRed->setBuddy(rEd); #endif lblRed->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblRed, 0, 3); gl->addWidget(rEd, 0, 4); -#else - if (nonTouchUI) { - gl->addWidget(lblRed, 3, 0); - gl->addWidget(rEd, 4, 0); - } else { - lblRed->hide(); - rEd->hide(); - } -#endif gEd = new QColSpinBox(this); lblGreen = new QLabel(this); @@ -1208,18 +1140,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblGreen->setBuddy(gEd); #endif lblGreen->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblGreen, 1, 3); gl->addWidget(gEd, 1, 4); -#else - if (nonTouchUI) { - gl->addWidget(lblGreen, 3, 1); - gl->addWidget(gEd, 4, 1); - } else { - lblGreen->hide(); - gEd->hide(); - } -#endif bEd = new QColSpinBox(this); lblBlue = new QLabel(this); @@ -1227,18 +1149,8 @@ QColorShower::QColorShower(QColorDialog *parent) lblBlue->setBuddy(bEd); #endif lblBlue->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(lblBlue, 2, 3); gl->addWidget(bEd, 2, 4); -#else - if (nonTouchUI) { - gl->addWidget(lblBlue, 3, 2); - gl->addWidget(bEd, 4, 2); - } else { - lblBlue->hide(); - bEd->hide(); - } -#endif alphaEd = new QColSpinBox(this); alphaLab = new QLabel(this); @@ -1246,18 +1158,8 @@ QColorShower::QColorShower(QColorDialog *parent) alphaLab->setBuddy(alphaEd); #endif alphaLab->setAlignment(Qt::AlignRight|Qt::AlignVCenter); -#if !defined(QT_SMALL_COLORDIALOG) gl->addWidget(alphaLab, 3, 1, 1, 3); gl->addWidget(alphaEd, 3, 4); -#else - if (nonTouchUI) { - gl->addWidget(alphaLab, 1, 3, 3, 1); - gl->addWidget(alphaEd, 4, 3); - } else { - alphaLab->hide(); - alphaEd->hide(); - } -#endif alphaEd->hide(); alphaLab->hide(); @@ -1491,15 +1393,10 @@ void QColorDialogPrivate::init(const QColor &initial) leftLay = 0; -#if defined(Q_WS_WINCE) || defined(QT_SMALL_COLORDIALOG) - smallDisplay = true; - const int lumSpace = 20; -#else // small displays (e.g. PDAs) cannot fit the full color dialog, // so just use the color picker. smallDisplay = (QApplication::desktop()->width() < 480 || QApplication::desktop()->height() < 350); const int lumSpace = topLay->spacing() / 2; -#endif if (!smallDisplay) { leftLay = new QVBoxLayout; @@ -1521,12 +1418,6 @@ void QColorDialogPrivate::init(const QColor &initial) } #endif -#if defined(QT_SMALL_COLORDIALOG) -# if defined(Q_WS_MAEMO_5) - const bool nonTouchUI = false; -# endif -#endif - if (!smallDisplay) { standard = new QColorWell(q, 6, 8, stdrgb); lblBasicColors = new QLabel(q); @@ -1557,16 +1448,8 @@ void QColorDialogPrivate::init(const QColor &initial) leftLay->addWidget(addCusBt); } else { // better color picker size for small displays -#if defined(QT_SMALL_COLORDIALOG) - QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); - pWidth = pHeight = qMin(screenSize.width(), screenSize.height()); - pHeight -= 20; - if(screenSize.height() > screenSize.width()) - pWidth -= 20; -#else pWidth = 150; pHeight = 100; -#endif custom = 0; standard = 0; } @@ -1583,34 +1466,13 @@ void QColorDialogPrivate::init(const QColor &initial) cp->setFrameStyle(QFrame::Panel + QFrame::Sunken); -#if defined(QT_SMALL_COLORDIALOG) - if (!nonTouchUI) { - pickLay->addWidget(cp); - cLay->addSpacing(lumSpace); - } else { - cp->hide(); - } -#else cLay->addSpacing(lumSpace); cLay->addWidget(cp); -#endif cLay->addSpacing(lumSpace); lp = new QColorLuminancePicker(q); -#if defined(QT_SMALL_COLORDIALOG) - QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); - const int minDimension = qMin(screenSize.height(), screenSize.width()); - //set picker to be finger-usable - int pickerWidth = !nonTouchUI ? minDimension/9 : minDimension/12; - lp->setFixedWidth(pickerWidth); - if (!nonTouchUI) - pickLay->addWidget(lp); - else - lp->hide(); -#else lp->setFixedWidth(20); pickLay->addWidget(lp); -#endif QObject::connect(cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int))); QObject::connect(lp, SIGNAL(newHsv(int,int,int)), q, SLOT(_q_newHsv(int,int,int))); @@ -1621,13 +1483,7 @@ void QColorDialogPrivate::init(const QColor &initial) QObject::connect(cs, SIGNAL(newCol(QRgb)), q, SLOT(_q_newColorTypedIn(QRgb))); QObject::connect(cs, SIGNAL(currentColorChanged(QColor)), q, SIGNAL(currentColorChanged(QColor))); -#if defined(QT_SMALL_COLORDIALOG) - if (!nonTouchUI) - pWidth -= cp->size().width(); - topLay->addWidget(cs); -#else rightLay->addWidget(cs); -#endif buttons = new QDialogButtonBox(q); mainLay->addWidget(buttons); @@ -1640,10 +1496,6 @@ void QColorDialogPrivate::init(const QColor &initial) retranslateStrings(); -#ifdef Q_WS_MAC - delegate = 0; -#endif - q->setCurrentColor(initial); } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index ffb69101a..4f18c9725 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -108,42 +108,21 @@ #include "qlibrary.h" #endif -#ifdef Q_WS_WINCE #include "qdatetime.h" -#include "qguifunctions_wince.h" -extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp -extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp -extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp -#endif - -#include "qdatetime.h" - -#ifdef QT_MAC_USE_COCOA -#include -#endif //#define ALIEN_DEBUG static void initResources() { -#if defined(Q_WS_WINCE) - Q_INIT_RESOURCE_EXTERN(qstyle_wince) - Q_INIT_RESOURCE(qstyle_wince); -#else Q_INIT_RESOURCE_EXTERN(qstyle) Q_INIT_RESOURCE(qstyle); -#endif Q_INIT_RESOURCE_EXTERN(qmessagebox) Q_INIT_RESOURCE(qmessagebox); #if !defined(QT_NO_PRINTDIALOG) Q_INIT_RESOURCE_EXTERN(qprintdialog) Q_INIT_RESOURCE(qprintdialog); #endif -#ifdef Q_WS_MAC - Q_INIT_RESOURCE_EXTERN(macresources) - Q_INIT_RESOURCE(macresources); -#endif } QT_BEGIN_NAMESPACE @@ -156,14 +135,7 @@ QApplicationPrivate *QApplicationPrivate::self = 0; QInputContext *QApplicationPrivate::inputContext = 0; bool QApplicationPrivate::quitOnLastWindowClosed = true; - - -#ifdef Q_WS_WINCE -int QApplicationPrivate::autoMaximizeThreshold = -1; -bool QApplicationPrivate::autoSipEnabled = false; -#else bool QApplicationPrivate::autoSipEnabled = true; -#endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags) : QCoreApplicationPrivate(argc, argv, flags) @@ -182,14 +154,11 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T gestureWidget = 0; #endif // QT_NO_GESTURES -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) move_cursor = 0; copy_cursor = 0; link_cursor = 0; #endif -#if defined(Q_WS_WIN) - ignore_cursor = 0; -#endif if (!self) self = this; @@ -859,17 +828,6 @@ void QApplicationPrivate::initialize() if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) q->setAttribute(Qt::AA_NativeWindows); -#ifdef Q_WS_WINCE -#ifdef QT_AUTO_MAXIMIZE_THRESHOLD - autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; -#else - if (qt_wince_is_mobile()) - autoMaximizeThreshold = 50; - else - autoMaximizeThreshold = -1; -#endif //QT_AUTO_MAXIMIZE_THRESHOLD -#endif //Q_WS_WINCE - // Set up which span functions should be used in raster engine... qInitDrawhelperAsm(); @@ -989,14 +947,11 @@ QApplication::~QApplication() qt_clipboard = 0; #endif -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) delete d->move_cursor; d->move_cursor = 0; delete d->copy_cursor; d->copy_cursor = 0; delete d->link_cursor; d->link_cursor = 0; #endif -#if defined(Q_WS_WIN) - delete d->ignore_cursor; d->ignore_cursor = 0; -#endif delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; @@ -1220,18 +1175,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis The default is platform dependent. */ -#ifdef Q_WS_WINCE -void QApplication::setAutoMaximizeThreshold(const int threshold) -{ - QApplicationPrivate::autoMaximizeThreshold = threshold; -} - -int QApplication::autoMaximizeThreshold() const -{ - return QApplicationPrivate::autoMaximizeThreshold; -} -#endif - void QApplication::setAutoSipEnabled(const bool enabled) { QApplicationPrivate::autoSipEnabled = enabled; @@ -2236,9 +2179,6 @@ bool QApplication::event(QEvent *e) } else if(e->type() == QEvent::LanguageChange) { #ifndef QT_NO_TRANSLATION setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); -#endif -#if defined(QT_MAC_USE_COCOA) - qt_mac_post_retranslateAppMenu(); #endif QWidgetList list = topLevelWidgets(); for (int i = 0; i < list.size(); ++i) { @@ -2246,7 +2186,6 @@ bool QApplication::event(QEvent *e) if (!(w->windowType() == Qt::Desktop)) postEvent(w, new QEvent(QEvent::LanguageChange)); } -#ifndef Q_OS_WIN } else if (e->type() == QEvent::LocaleChange) { // on Windows the event propagation is taken care by the // WM_SETTINGCHANGE event handler. @@ -2258,7 +2197,6 @@ bool QApplication::event(QEvent *e) w->d_func()->setLocale_helper(QLocale(), true); } } -#endif } else if (e->type() == QEvent::Timer) { QTimerEvent *te = static_cast(e); Q_ASSERT(te != 0); @@ -2350,9 +2288,7 @@ void QApplication::setActiveWindow(QWidget* act) } } -#if !defined(Q_WS_MAC) QWidget *previousActiveWindow = QApplicationPrivate::active_window; -#endif QApplicationPrivate::active_window = window; if (QApplicationPrivate::active_window) { @@ -2374,12 +2310,10 @@ void QApplication::setActiveWindow(QWidget* act) QEvent windowActivate(QEvent::WindowActivate); QEvent windowDeactivate(QEvent::WindowDeactivate); -#if !defined(Q_WS_MAC) if (!previousActiveWindow) { QEvent appActivate(QEvent::ApplicationActivate); sendSpontaneousEvent(qApp, &appActivate); } -#endif for (int i = 0; i < toBeActivated.size(); ++i) { QWidget *w = toBeActivated.at(i); @@ -2387,25 +2321,16 @@ void QApplication::setActiveWindow(QWidget* act) sendSpontaneousEvent(w, &activationChange); } -#ifdef QT_MAC_USE_COCOA - // In case the user clicked on a child window, we need to - // reestablish the stacking order of the window so - // it pops in front of other child windows in cocoa: - qt_cocoaStackChildWindowOnTopOfOtherChildren(window); -#endif - for(int i = 0; i < toBeDeactivated.size(); ++i) { QWidget *w = toBeDeactivated.at(i); sendSpontaneousEvent(w, &windowDeactivate); sendSpontaneousEvent(w, &activationChange); } -#if !defined(Q_WS_MAC) if (!QApplicationPrivate::active_window) { QEvent appDeactivate(QEvent::ApplicationDeactivate); sendSpontaneousEvent(qApp, &appDeactivate); } -#endif if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode() // then focus events @@ -2551,7 +2476,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { for (int i = 0; i < leaveList.size(); ++i) { w = leaveList.at(i); if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) if (leaveAfterRelease == w) leaveAfterRelease = 0; #endif @@ -2626,9 +2551,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { } else #endif { -#if defined(Q_WS_WIN) - qt_win_set_cursor(cursorWidget, true); -#elif defined(Q_WS_X11) +#if defined(Q_WS_X11) qt_x11_enforce_cursor(cursorWidget, true); #endif } @@ -2664,12 +2587,6 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget) return false; w = w->parentWidget(); } -#ifdef Q_WS_WIN - if ((widget->testAttribute(Qt::WA_WState_Created) || widget->data->winid) - && (modalWidget->testAttribute(Qt::WA_WState_Created) || modalWidget->data->winid) - && IsChild(modalWidget->data->winid, widget->data->winid)) - return false; -#endif } Qt::WindowModality windowModality = modalWidget->windowModality(); @@ -2932,7 +2849,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) /* This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing @@ -2987,7 +2904,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); #endif // QT_NO_CURSOR } -#endif // Q_WS_WIN || Q_WS_X11 || Q_WS_MAC +#endif // Q_WS_X11 /*! Returns the desktop widget (also called the root window). @@ -4240,14 +4157,12 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) if (receiver->isWidgetType()) { QWidget *widget = static_cast(receiver); -#if !defined(Q_WS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) // toggle HasMouse widget state on enter and leave if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window())) widget->setAttribute(Qt::WA_UnderMouse, true); else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) widget->setAttribute(Qt::WA_UnderMouse, false); -#endif if (QLayout *layout=widget->d_func()->layout) { layout->widgetEvent(e); @@ -4556,174 +4471,6 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) \sa isPhase2() */ -/***************************************************************************** - Stubbed session management support - *****************************************************************************/ -#ifndef QT_NO_SESSIONMANAGER -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) - -#if defined(Q_OS_WINCE) -HRESULT qt_CoCreateGuid(GUID* guid) -{ - // We will use the following information to create the GUID - // 1. absolute path to application - wchar_t tempFilename[MAX_PATH]; - if (!GetModuleFileName(0, tempFilename, MAX_PATH)) - return S_FALSE; - unsigned int hash = qHash(QString::fromWCharArray(tempFilename)); - guid->Data1 = hash; - // 2. creation time of file - QFileInfo info(QString::fromWCharArray(tempFilename)); - guid->Data2 = qHash(info.created().toTime_t()); - // 3. current system time - guid->Data3 = qHash(QDateTime::currentDateTime().toTime_t()); - return S_OK; -} -#if !defined(OLE32_MCOMGUID) || defined(QT_WINCE_FORCE_CREATE_GUID) -#define CoCreateGuid qt_CoCreateGuid -#endif - -#endif - -class QSessionManagerPrivate : public QObjectPrivate -{ -public: - QStringList restartCommand; - QStringList discardCommand; - QString sessionId; - QString sessionKey; - QSessionManager::RestartHint restartHint; -}; - -QSessionManager* qt_session_manager_self = 0; -QSessionManager::QSessionManager(QApplication * app, QString &id, QString &key) - : QObject(*new QSessionManagerPrivate, app) -{ - Q_D(QSessionManager); - setObjectName(QLatin1String("qt_sessionmanager")); - qt_session_manager_self = this; -#if defined(Q_WS_WIN) - wchar_t guidstr[40]; - GUID guid; - CoCreateGuid(&guid); - StringFromGUID2(guid, guidstr, 40); - id = QString::fromWCharArray(guidstr); - CoCreateGuid(&guid); - StringFromGUID2(guid, guidstr, 40); - key = QString::fromWCharArray(guidstr); -#endif - d->sessionId = id; - d->sessionKey = key; - d->restartHint = RestartIfRunning; -} - -QSessionManager::~QSessionManager() -{ - qt_session_manager_self = 0; -} - -QString QSessionManager::sessionId() const -{ - Q_D(const QSessionManager); - return d->sessionId; -} - -QString QSessionManager::sessionKey() const -{ - Q_D(const QSessionManager); - return d->sessionKey; -} - - -#if defined(Q_WS_X11) || defined(Q_WS_MAC) -void* QSessionManager::handle() const -{ - return 0; -} -#endif - -#if !defined(Q_WS_WIN) -bool QSessionManager::allowsInteraction() -{ - return true; -} - -bool QSessionManager::allowsErrorInteraction() -{ - return true; -} -void QSessionManager::release() -{ -} - -void QSessionManager::cancel() -{ -} -#endif - - -void QSessionManager::setRestartHint(QSessionManager::RestartHint hint) -{ - Q_D(QSessionManager); - d->restartHint = hint; -} - -QSessionManager::RestartHint QSessionManager::restartHint() const -{ - Q_D(const QSessionManager); - return d->restartHint; -} - -void QSessionManager::setRestartCommand(const QStringList& command) -{ - Q_D(QSessionManager); - d->restartCommand = command; -} - -QStringList QSessionManager::restartCommand() const -{ - Q_D(const QSessionManager); - return d->restartCommand; -} - -void QSessionManager::setDiscardCommand(const QStringList& command) -{ - Q_D(QSessionManager); - d->discardCommand = command; -} - -QStringList QSessionManager::discardCommand() const -{ - Q_D(const QSessionManager); - return d->discardCommand; -} - -void QSessionManager::setManagerProperty(const QString&, const QString&) -{ -} - -void QSessionManager::setManagerProperty(const QString&, const QStringList&) -{ -} - -bool QSessionManager::isPhase2() const -{ - return false; -} - -void QSessionManager::requestPhase2() -{ -} - -#endif -#endif // QT_NO_SESSIONMANAGER - -/*! - \fn Qt::MacintoshVersion QApplication::macVersion() - - Use QSysInfo::MacintoshVersion instead. -*/ - /*! \fn bool QApplication::hasGlobalMouseTracking() @@ -5186,7 +4933,7 @@ QInputContext *QApplication::inputContext() const //Returns the current platform used by keyBindings uint QApplicationPrivate::currentPlatform(){ - uint platform = KB_Win; + uint platform = KB_None; #if defined Q_WS_X11 platform = KB_X11; if (X11->desktopEnvironment == DE_KDE) @@ -5621,17 +5368,12 @@ QGestureManager* QGestureManager::instance() // These pixmaps approximate the images in the Windows User Interface Guidelines. // XPM -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) static const char * const move_xpm[] = { "11 20 3 1", ". c None", -#if defined(Q_WS_WIN) -"a c #000000", -"X c #FFFFFF", // Windows cursor is traditionally white -#else "a c #FFFFFF", "X c #000000", // X11 cursor is traditionally black -#endif "aa.........", "aXa........", "aXXa.......", @@ -5653,73 +5395,12 @@ static const char * const move_xpm[] = { ".......aXXa", "........aa."}; -#ifdef Q_WS_WIN -/* XPM */ -static const char * const ignore_xpm[] = { -"24 30 3 1", -". c None", -"a c #000000", -"X c #FFFFFF", -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa.....XXXX.....", -".......aXXa..XXaaaaXX...", -".......aXXa.XaaaaaaaaX..", -"........aa.XaaaXXXXaaaX.", -"...........XaaaaX..XaaX.", -"..........XaaXaaaX..XaaX", -"..........XaaXXaaaX.XaaX", -"..........XaaX.XaaaXXaaX", -"..........XaaX..XaaaXaaX", -"...........XaaX..XaaaaX.", -"...........XaaaXXXXaaaX.", -"............XaaaaaaaaX..", -".............XXaaaaXX...", -"...............XXXX....."}; -#endif - /* XPM */ static const char * const copy_xpm[] = { "24 30 3 1", ". c None", "a c #000000", "X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else "XX......................", "XaX.....................", "XaaX....................", @@ -5740,7 +5421,6 @@ static const char * const copy_xpm[] = { ".......XaaX.............", ".......XaaX.............", "........XX...aaaaaaaaaaa", -#endif ".............aXXXXXXXXXa", ".............aXXXXXXXXXa", ".............aXXXXaXXXXa", @@ -5758,28 +5438,6 @@ static const char * const link_xpm[] = { ". c None", "a c #000000", "X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else "XX......................", "XaX.....................", "XaaX....................", @@ -5800,7 +5458,6 @@ static const char * const link_xpm[] = { ".......XaaX.............", ".......XaaX.............", "........XX...aaaaaaaaaaa", -#endif ".............aXXXXXXXXXa", ".............aXXXaaaaXXa", ".............aXXXXaaaXXa", @@ -5811,18 +5468,15 @@ static const char * const link_xpm[] = { ".............aXXXaXXXXXa", ".............aXXXXXXXXXa", ".............aaaaaaaaaaa"}; -#endif // defined(Q_WS_X11) || defined(Q_WS_WIN) +#endif // defined(Q_WS_X11) QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) { -#if defined(Q_WS_X11) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) if (!move_cursor) { move_cursor = new QPixmap((const char **)move_xpm); copy_cursor = new QPixmap((const char **)copy_xpm); link_cursor = new QPixmap((const char **)link_xpm); -#ifdef Q_WS_WIN - ignore_cursor = new QPixmap((const char **)ignore_xpm); -#endif } switch (cshape) { @@ -5832,10 +5486,6 @@ QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) return *copy_cursor; case Qt::DragLinkCursor: return *link_cursor; -#ifdef Q_WS_WIN - case Qt::ForbiddenCursor: - return *ignore_cursor; -#endif default: break; } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e32e000c2..865d95b88 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -88,16 +88,6 @@ extern bool qt_is_gui_used; extern QClipboard *qt_clipboard; #endif -#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) -extern QSysInfo::WinVersion qt_winver; -enum { QT_TABLET_NPACKETQSIZE = 128 }; -# ifdef Q_OS_WINCE - extern DWORD qt_cever; -# endif -#elif defined (Q_OS_MAC) -extern QSysInfo::MacVersion qt_macver; -#endif - #ifndef QT_NO_TABLET struct QTabletDeviceData { @@ -212,14 +202,12 @@ public: #endif enum KeyPlatform { - KB_Win = 1, - KB_Mac = 2, - KB_X11 = 4, - KB_KDE = 8, + KB_None = 2, + KB_X11 = 4, + KB_KDE = 8, KB_Gnome = 16, - KB_CDE = 32, - KB_S60 = 64, - KB_All = 0xffff + KB_CDE = 32, + KB_All = 0xffff }; static uint currentPlatform(); diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 46c6d9128..325db77f5 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -161,7 +161,6 @@ QClipboard::QClipboard(QObject *parent) } #endif -#ifndef Q_WS_WIN32 /*! \internal @@ -173,7 +172,6 @@ QClipboard::QClipboard(QObject *parent) QClipboard::~QClipboard() { } -#endif /*! \fn void QClipboard::changed(QClipboard::Mode mode) diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 8ff1c7c0d..5a925fcf4 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -52,9 +52,6 @@ QT_BEGIN_NAMESPACE class QVariant; -/* - ### The fake cursor has to go first with old qdoc. -*/ #ifdef QT_NO_CURSOR class Q_GUI_EXPORT QCursor @@ -67,18 +64,12 @@ private: QCursor(); }; -#endif // QT_NO_CURSOR - -#ifndef QT_NO_CURSOR +#else // QT_NO_CURSOR class QCursorData; class QBitmap; class QPixmap; -#if defined(Q_WS_MAC) -void qt_mac_set_cursor(const QCursor *c); -#endif - class Q_GUI_EXPORT QCursor { public: @@ -106,26 +97,15 @@ public: static QPoint pos(); static void setPos(int x, int y); inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); } - -#if defined(Q_WS_WIN) - HCURSOR handle() const; - QCursor(HCURSOR cursor); -#elif defined(Q_WS_X11) +#if defined(Q_WS_X11) Qt::HANDLE handle() const; QCursor(Qt::HANDLE cursor); static int x11Screen(); -#elif defined(Q_WS_MAC) - Qt::HANDLE handle() const; #endif private: QCursorData *d; -#if defined(Q_WS_MAC) - friend void *qt_mac_nsCursorForQCursor(const QCursor &c); - friend void qt_mac_set_cursor(const QCursor *c); - friend void qt_mac_updateCursorWithWidgetUnderMouse(QWidget *widgetUnderMouse); -#endif }; diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index b68272ba4..67faf8929 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -58,21 +58,12 @@ #include "QtCore/qnamespace.h" #include "QtGui/qpixmap.h" -# if defined (Q_WS_MAC) -# include "qt_mac_p.h" -# elif defined(Q_WS_X11) +#if defined(Q_WS_X11) # include "qt_x11_p.h" -# elif defined(Q_WS_WIN) -# include "QtCore/qt_windows.h" #endif QT_BEGIN_NAMESPACE -#if defined (Q_WS_MAC) -void *qt_mac_nsCursorForQCursor(const QCursor &c); -class QMacAnimateCursor; -#endif - class QBitmap; class QCursorData { public: @@ -87,29 +78,10 @@ public: QBitmap *bm, *bmm; QPixmap pixmap; short hx, hy; -#if defined (Q_WS_MAC) - int mId; -#endif -#if defined (Q_WS_WIN) - HCURSOR hcurs; -#elif defined (Q_WS_X11) +#if defined (Q_WS_X11) XColor fg, bg; Cursor hcurs; Pixmap pm, pmm; -#elif defined (Q_WS_MAC) - enum { TYPE_None, TYPE_ImageCursor, TYPE_ThemeCursor } type; - union { - struct { - uint my_cursor:1; - void *nscursor; - } cp; - struct { - QMacAnimateCursor *anim; - ThemeCursor curs; - } tc; - } curs; - void initCursorFromBitmap(); - void initCursorFromPixmap(); #endif static bool initialized; void update(); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 1f13f7f90..fa608a801 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -643,41 +643,32 @@ static const struct { const QKeyBinding QKeySequencePrivate::keyBindings[] = { // StandardKey Priority Key Sequence Platforms - {QKeySequence::Back, 0, Qt::Key_Backspace, QApplicationPrivate::KB_Win}, {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QApplicationPrivate::KB_All}, {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QApplicationPrivate::KB_All}, {QKeySequence::Delete, 1, Qt::Key_Delete, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QApplicationPrivate::KB_X11}, + {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QApplicationPrivate::KB_X11}, {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QApplicationPrivate::KB_All}, {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QApplicationPrivate::KB_All}, {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, QApplicationPrivate::KB_All}, {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, QApplicationPrivate::KB_All}, {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QApplicationPrivate::KB_All}, {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QApplicationPrivate::KB_All}, - {QKeySequence::HelpContents, 0, Qt::Key_F1, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::HelpContents, 0, Qt::Key_F2, QApplicationPrivate::KB_S60}, + {QKeySequence::HelpContents, 0, Qt::Key_F1, QApplicationPrivate::KB_X11}, {QKeySequence::FindNext, 0, Qt::Key_F3, QApplicationPrivate::KB_X11}, - {QKeySequence::FindNext, 1, Qt::Key_F3, QApplicationPrivate::KB_Win}, - {QKeySequence::Refresh, 0, Qt::Key_F5, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, + {QKeySequence::Refresh, 0, Qt::Key_F5, QApplicationPrivate::KB_X11}, {QKeySequence::Undo, 0, Qt::Key_F14, QApplicationPrivate::KB_X11}, //Undo on sun keyboards {QKeySequence::Copy, 0, Qt::Key_F16, QApplicationPrivate::KB_X11}, //Copy on sun keyboards {QKeySequence::Paste, 0, Qt::Key_F18, QApplicationPrivate::KB_X11}, //Paste on sun keyboards {QKeySequence::Cut, 0, Qt::Key_F20, QApplicationPrivate::KB_X11}, //Cut on sun keyboards {QKeySequence::PreviousChild, 0, Qt::Key_Back, QApplicationPrivate::KB_All}, {QKeySequence::NextChild, 0, Qt::Key_Forward, QApplicationPrivate::KB_All}, - {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_Win}, - {QKeySequence::Delete, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_S60}, {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QApplicationPrivate::KB_All}, {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QApplicationPrivate::KB_All}, - {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, //## Check if this should work on mac - {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Mac}, + {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_X11}, + {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QApplicationPrivate::KB_X11}, //## Check if this should work on mac + {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_X11}, + {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_X11}, {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_All}, {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_All}, {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_All}, @@ -686,110 +677,52 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, QApplicationPrivate::KB_All}, {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, QApplicationPrivate::KB_All}, {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_X11}, - {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_Win}, {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QApplicationPrivate::KB_All}, {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_KDE}, - {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_Mac}, {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QApplicationPrivate::KB_All}, {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QApplicationPrivate::KB_KDE}, - {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, QApplicationPrivate::KB_All}, {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, QApplicationPrivate::KB_All}, {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, QApplicationPrivate::KB_All}, {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, QApplicationPrivate::KB_X11}, //emacs (line edit only) {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, QApplicationPrivate::KB_All}, - {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, QApplicationPrivate::KB_Win}, - {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QApplicationPrivate::KB_Win}, + {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QApplicationPrivate::KB_Gnome}, {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QApplicationPrivate::KB_Gnome}, {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, QApplicationPrivate::KB_All}, {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, QApplicationPrivate::KB_X11}, //emacs (line edit only) {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QApplicationPrivate::KB_All}, {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QApplicationPrivate::KB_All}, {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QApplicationPrivate::KB_All}, - {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_KDE | QApplicationPrivate::KB_Mac}, - {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, + {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_KDE}, + {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_Gnome}, {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_KDE}, {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QApplicationPrivate::KB_All}, {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, QApplicationPrivate::KB_All}, {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, QApplicationPrivate::KB_All}, {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, QApplicationPrivate::KB_All}, - {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac}, + {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_X11}, {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All}, - {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60}, {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All}, - {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, QApplicationPrivate::KB_Mac}, //different priority from above - {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Win}, - {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, QApplicationPrivate::KB_Win}, - {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win}, + {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QApplicationPrivate::KB_X11}, + {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QApplicationPrivate::KB_X11}, + {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QApplicationPrivate::KB_X11}, + {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QApplicationPrivate::KB_X11}, + {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QApplicationPrivate::KB_X11}, + {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QApplicationPrivate::KB_X11}, + {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_X11}, + {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_X11}, + {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Gnome}, {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE}, - {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above + {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome}, + {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_X11}, + {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_X11}, {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_X11}, - {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac }, - {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac }, - {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QApplicationPrivate::KB_Win}, - {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, QApplicationPrivate::KB_Win}, - {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, QApplicationPrivate::KB_Mac}, - {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, QApplicationPrivate::KB_Mac}, - {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, QApplicationPrivate::KB_Mac }, - {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,QApplicationPrivate::KB_Win}, - {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, QApplicationPrivate::KB_Mac}, - {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, QApplicationPrivate::KB_Mac}, - {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, QApplicationPrivate::KB_Mac}, - {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac} + {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_X11}, + {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_X11}, + {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_X11}, + {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_X11}, + {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QApplicationPrivate::KB_X11}, + {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QApplicationPrivate::KB_X11}, }; const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding)); diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 145b24576..7a6565041 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -116,41 +116,6 @@ static inline void qt_flush(QWidget *widget, const QRegion ®ion, QWindowSurfa } #ifndef QT_NO_PAINT_DEBUG -#ifdef Q_WS_WIN -static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec) -{ - HBRUSH brush; - static int i = 0; - switch (i) { - case 0: - brush = CreateSolidBrush(RGB(255, 255, 0)); - break; - case 1: - brush = CreateSolidBrush(RGB(255, 200, 55)); - break; - case 2: - brush = CreateSolidBrush(RGB(200, 255, 55)); - break; - case 3: - brush = CreateSolidBrush(RGB(200, 200, 0)); - break; - } - i = (i + 1) & 3; - - HDC hdc = widget->getDC(); - - const QVector &rects = region.rects(); - foreach (QRect rect, rects) { - RECT winRect; - SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); - FillRect(hdc, &winRect, brush); - } - - widget->releaseDC(hdc); - ::Sleep(msec); -} -#endif - void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) { QRegion paintRegion = toBePainted; @@ -164,10 +129,6 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa widget = nativeParent; } -#ifdef Q_WS_WIN - Q_UNUSED(unclipped); - showYellowThing_win(widget, paintRegion, msec); -#else //flags to fool painter bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped); if (unclipped && !widget->d_func()->paintOnScreen()) @@ -214,11 +175,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa pe->setSystemClip(QRegion()); QApplication::syncX(); - -#if defined(Q_OS_UNIX) ::usleep(1000 * msec); -#endif -#endif // Q_WS_WIN } bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) @@ -646,12 +603,6 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty()) return; -#if defined(Q_WS_MAC) - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - dirtyOnScreen += region.translated(topLevelOffset); - return; -#endif - // Top-level. if (widget == tlw) { if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) @@ -1436,12 +1387,6 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) && (usesDoubleBufferedGLContext || q->autoFillBackground()); QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); -#ifdef Q_WS_MAC - // No difference between update() and repaint() on the Mac. - update_sys(toBePainted); - return; -#endif - toBePainted &= clipRect(); clipToEffectiveMask(toBePainted); if (toBePainted.isEmpty()) diff --git a/src/gui/painting/qcolormap.h b/src/gui/painting/qcolormap.h index c4873648b..bf4cb1948 100644 --- a/src/gui/painting/qcolormap.h +++ b/src/gui/painting/qcolormap.h @@ -80,10 +80,6 @@ public: const QVector colormap() const; -#ifdef Q_WS_WIN - static HPALETTE hPal(); -#endif - private: QColormap(); QColormapPrivate *d; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 1bf7f57b6..238983d43 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -76,10 +76,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -extern HDC shared_dc(); -#endif - #ifdef Q_WS_X11 extern const QX11Info *qt_x11Info(const QPaintDevice *pd); #endif @@ -151,11 +147,6 @@ Q_GUI_EXPORT int qt_defaultDpiX() #ifdef Q_WS_X11 return QX11Info::appDpiX(); -#elif defined(Q_WS_WIN) - return GetDeviceCaps(shared_dc(),LOGPIXELSX); -#elif defined(Q_WS_MAC) - extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp - return qt_mac_defaultDpi_x(); #endif // Q_WS_X11 } @@ -166,11 +157,6 @@ Q_GUI_EXPORT int qt_defaultDpiY() #ifdef Q_WS_X11 return QX11Info::appDpiY(); -#elif defined(Q_WS_WIN) - return GetDeviceCaps(shared_dc(),LOGPIXELSY); -#elif defined(Q_WS_MAC) - extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp - return qt_mac_defaultDpi_y(); #endif // Q_WS_X11 } @@ -190,9 +176,6 @@ QFontPrivate::QFontPrivate() else screen = 0; #endif -#ifdef Q_WS_WIN - hdc = 0; -#endif } QFontPrivate::QFontPrivate(const QFontPrivate &other) @@ -203,9 +186,6 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other) letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing), scFont(other.scFont) { -#ifdef Q_WS_WIN - hdc = other.hdc; -#endif if (scFont && scFont != this) scFont->ref.ref(); } @@ -222,12 +202,6 @@ QFontPrivate::~QFontPrivate() extern QMutex *qt_fontdatabase_mutex(); -#if !defined(Q_WS_MAC) -#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engines[script] -#else -#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engine -#endif - QFontEngine *QFontPrivate::engineForScript(int script) const { QMutexLocker locker(qt_fontdatabase_mutex()); @@ -239,9 +213,9 @@ QFontEngine *QFontPrivate::engineForScript(int script) const delete engineData; engineData = 0; } - if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script)) + if (!engineData || !engineData->engines[script]) QFontDatabase::load(this, script); - return QT_FONT_ENGINE_FROM_DATA(engineData, script); + return engineData->engines[script]; } void QFontPrivate::alterCharForCapitalization(QChar &c) const { @@ -344,26 +318,16 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() : ref(1), fontCache(QFontCache::instance()) { -#if !defined(Q_WS_MAC) memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *)); -#else - engine = 0; -#endif } QFontEngineData::~QFontEngineData() { -#if !defined(Q_WS_MAC) for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { if (engines[i] && !engines[i]->ref.deref()) delete engines[i]; engines[i] = 0; } -#else - if (engine && !engine->ref.deref()) - delete engine; - engine = 0; -#endif // Q_WS_X11 || Q_WS_WIN || Q_WS_MAC } @@ -688,10 +652,6 @@ QFont::QFont(const QFont &font, QPaintDevice *pd) } else { d = font.d.data(); } -#ifdef Q_WS_WIN - if (pd->devType() == QInternal::Printer && pd->getDC()) - d->hdc = pd->getDC(); -#endif } /*! @@ -1833,13 +1793,6 @@ static void initFontSubst() "times new roman", "times", "courier new", "courier", "sans serif", "helvetica", -#elif defined(Q_WS_MAC) - ".lucida grande ui", "lucida grande", -#elif defined(Q_WS_WIN) - "times", "times new roman", - "courier", "courier new", - "helvetica", "arial", - "sans serif", "arial", #endif 0, 0 @@ -2507,16 +2460,6 @@ bool QFontInfo::fixedPitch() const { QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); Q_ASSERT(engine != 0); -#ifdef Q_OS_MAC - if (!engine->fontDef.fixedPitchComputed) { - QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') }; - QGlyphLayoutArray<2> g; - int l = 2; - engine->stringToCMap(ch, 2, &g, &l, 0); - engine->fontDef.fixedPitch = g.advances_x[0] == g.advances_x[1]; - engine->fontDef.fixedPitchComputed = true; - } -#endif return engine->fontDef.fixedPitch; } @@ -2767,71 +2710,6 @@ void QFontCache::decreaseCost(uint cost) cost, total_cost, max_cost); } -#if defined(Q_WS_WIN) -void QFontCache::cleanupPrinterFonts() -{ - FC_DEBUG("QFontCache::cleanupPrinterFonts"); - - { - FC_DEBUG(" CLEAN engine data:"); - - // clean out all unused engine data - EngineDataCache::Iterator it = engineDataCache.begin(), - end = engineDataCache.end(); - while (it != end) { - if (it.key().screen == 0) { - ++it; - continue; - } - - if (it.value()->ref > 1) { - for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { - if (it.value()->engines[i] && !it.value()->engines[i]->ref.deref()) - delete it.value()->engines[i]; - it.value()->engines[i] = 0; - } - ++it; - } else { - - EngineDataCache::Iterator rem = it++; - - decreaseCost(sizeof(QFontEngineData)); - - FC_DEBUG(" %p", rem.value()); - - if (!rem.value()->ref.deref()) - delete rem.value(); - engineDataCache.erase(rem); - } - } - } - - EngineCache::Iterator it = engineCache.begin(), - end = engineCache.end(); - while(it != end) { - if (it.value().data->ref != 1 || it.key().screen == 0) { - ++it; - continue; - } - - FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", - it.value().data, it.value().timestamp, it.value().hits, - int(it.value().data->ref), it.value().data->cache_count, - it.value().data->name()); - - if (--it.value().data->cache_count == 0) { - FC_DEBUG(" DELETE: last occurrence in cache"); - - decreaseCost(it.value().data->cache_cost); - if (!it.value().data->ref.deref()) - delete it.value().data; - } - - engineCache.erase(it++); - } -} -#endif - void QFontCache::timerEvent(QTimerEvent *) { FC_DEBUG("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", @@ -2863,14 +2741,14 @@ void QFontCache::timerEvent(QTimerEvent *) #ifdef QFONTCACHE_DEBUG FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref)); -# if defined(Q_WS_X11) || defined(Q_WS_WIN) +# if defined(Q_WS_X11) // print out all engines for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { if (! it.value()->engines[i]) continue; FC_DEBUG(" contains %p", it.value()->engines[i]); } -# endif // Q_WS_X11 || Q_WS_WIN +# endif // Q_WS_X11 #endif // QFONTCACHE_DEBUG if (it.value()->ref > 1) diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 6e91ff66c..ec071e3a7 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -244,14 +244,7 @@ public: { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; } #endif -#ifdef Q_WS_WIN - HFONT handle() const; -#else // !Q_WS_WIN Qt::HANDLE handle() const; -#endif // Q_WS_WIN -#ifdef Q_WS_MAC - quint32 macFontID() const; -#endif #if defined(Q_WS_X11) FT_Face freetypeFace() const; #endif diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 4b861447e..94c6d458c 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -180,10 +180,6 @@ public: int dpi; int screen; -#ifdef Q_WS_WIN - HDC hdc; -#endif - uint rawMode : 1; uint underline : 1; uint overline : 1; @@ -266,10 +262,6 @@ public: QFontEngine *findEngine(const Key &key); void insertEngine(const Key &key, QFontEngine *engine); -#if defined(Q_WS_WIN) - void cleanupPrinterFonts(); -#endif - private: void increaseCost(uint cost); void decreaseCost(uint cost); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1ed4c4b1b..8ca72a991 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -705,7 +705,7 @@ int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) } -#if (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) @@ -863,14 +863,10 @@ QMutex *qt_fontdatabase_mutex() QT_BEGIN_INCLUDE_NAMESPACE #if defined(Q_WS_X11) # include "qfontdatabase_x11.h" -#elif defined(Q_WS_MAC) -# include "qfontdatabase_mac.h" -#elif defined(Q_WS_WIN) -# include "qfontdatabase_win.h" #endif QT_END_INCLUDE_NAMESPACE -#if !defined(Q_WS_X11) && !defined(Q_WS_MAC) +#if !defined(Q_WS_X11) QString QFontDatabase::resolveFontFamilyAlias(const QString &family) { return family; @@ -1206,11 +1202,7 @@ static void match(int script, const QFontDef &request, test.familyIndex = x; if (!family_name.isEmpty() - && test.family->name.compare(family_name, Qt::CaseInsensitive) != 0 -#ifdef Q_WS_WIN - && test.family->english_name.compare(family_name, Qt::CaseInsensitive) != 0 -#endif - ) + && test.family->name.compare(family_name, Qt::CaseInsensitive) != 0) continue; if (family_name.isEmpty()) @@ -1690,13 +1682,6 @@ bool QFontDatabase::isScalable(const QString &family, QList QFontDatabase::pointSizes(const QString &family, const QString &styleName) { -#if defined(Q_WS_WIN) - // windows and macosx are always smoothly scalable - Q_UNUSED(family); - Q_UNUSED(styleName); - return standardSizes(); -#else - bool smoothScalable = false; QString familyName, foundryName; parseFontName(family, foundryName, familyName); @@ -1725,8 +1710,7 @@ QList QFontDatabase::pointSizes(const QString &family, if (!style) continue; if (style->smoothScalable) { - smoothScalable = true; - goto end; + return standardSizes(); } for (int l = 0; l < style->count; l++) { const QtFontSize *size = style->pixelSizes + l; @@ -1739,13 +1723,9 @@ QList QFontDatabase::pointSizes(const QString &family, } } } - end: - if (smoothScalable) - return standardSizes(); qSort(sizes); return sizes; -#endif } /*! diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 5a30be408..1de35e66b 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -52,16 +52,9 @@ #include "qboxlayout.h" #include "qpainter.h" #include "qmargins.h" - #include "qabstractscrollarea_p.h" -#include - -#include - -#ifdef Q_WS_MAC -#include -#include -#endif +#include "qwidget.h" +#include "qapplication_p.h" QT_BEGIN_NAMESPACE @@ -160,9 +153,6 @@ QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) -#ifdef Q_WS_WIN - , singleFingerPanEnabled(false) -#endif { } @@ -294,63 +284,19 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); -#ifndef Q_WS_MAC #ifndef QT_NO_GESTURES viewport->grabGesture(Qt::PanGesture); #endif -#endif } -#ifdef Q_WS_WIN -void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) -{ - singleFingerPanEnabled = on; - QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); - if (dd) - dd->winSetupGestures(); -} -#endif // Q_WS_WIN - void QAbstractScrollAreaPrivate::layoutChildren() { Q_Q(QAbstractScrollArea); - bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn - || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); + const bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn + || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); - bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn - || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); - -#ifdef Q_WS_MAC - QWidget * const window = q->window(); - - // Use small scroll bars for tool windows, to match the native size grip. - bool hbarIsSmall = hbar->testAttribute(Qt::WA_MacSmallSize); - bool vbarIsSmall = vbar->testAttribute(Qt::WA_MacSmallSize); - const Qt::WindowType windowType = window->windowType(); - if (windowType == Qt::Tool) { - if (!hbarIsSmall) { - hbar->setAttribute(Qt::WA_MacMiniSize, false); - hbar->setAttribute(Qt::WA_MacNormalSize, false); - hbar->setAttribute(Qt::WA_MacSmallSize, true); - } - if (!vbarIsSmall) { - vbar->setAttribute(Qt::WA_MacMiniSize, false); - vbar->setAttribute(Qt::WA_MacNormalSize, false); - vbar->setAttribute(Qt::WA_MacSmallSize, true); - } - } else { - if (hbarIsSmall) { - hbar->setAttribute(Qt::WA_MacMiniSize, false); - hbar->setAttribute(Qt::WA_MacNormalSize, false); - hbar->setAttribute(Qt::WA_MacSmallSize, false); - } - if (vbarIsSmall) { - vbar->setAttribute(Qt::WA_MacMiniSize, false); - vbar->setAttribute(Qt::WA_MacNormalSize, false); - vbar->setAttribute(Qt::WA_MacSmallSize, false); - } - } -#endif + const bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn + || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); const int hsbExt = hbar->sizeHint().height(); const int vsbExt = vbar->sizeHint().width(); @@ -363,30 +309,6 @@ void QAbstractScrollAreaPrivate::layoutChildren() const bool hasCornerWidget = (cornerWidget != 0); -// If the scroll bars are at the very right and bottom of the window we -// move their positions to be aligned with the size grip. -#ifdef Q_WS_MAC - // Check if a native sizegrip is present. - bool hasMacReverseSizeGrip = false; - bool hasMacSizeGrip = false; - bool nativeGripPresent = false; - if (q->testAttribute(Qt::WA_WState_Created)) - nativeGripPresent = qt_mac_checkForNativeSizeGrip(q); - - if (nativeGripPresent) { - // Look for a native size grip at the visual window bottom right and at the - // absolute window bottom right. In reverse mode, the native size grip does not - // swich side, so we need to check if it is on the "wrong side". - const QPoint scrollAreaBottomRight = q->mapTo(window, widgetRect.bottomRight() - QPoint(frameWidth, frameWidth)); - const QPoint windowBottomRight = window->rect().bottomRight(); - const QPoint visualWindowBottomRight = QStyle::visualPos(opt.direction, opt.rect, windowBottomRight); - const QPoint offset = windowBottomRight - scrollAreaBottomRight; - const QPoint visualOffset = visualWindowBottomRight - scrollAreaBottomRight; - hasMacSizeGrip = (visualOffset.manhattanLength() < vsbExt); - hasMacReverseSizeGrip = (hasMacSizeGrip == false && (offset.manhattanLength() < hsbExt)); - } -#endif - QPoint cornerOffset(needv ? vsbExt : 0, needh ? hsbExt : 0); QRect controlsRect; QRect viewportRect; @@ -416,12 +338,6 @@ void QAbstractScrollAreaPrivate::layoutChildren() if (hasCornerWidget && (needv || needh)) cornerOffset = extPoint; -#ifdef Q_WS_MAC - // Also move the scroll bars if they are covered by the native Mac size grip. - if (hasMacSizeGrip) - cornerOffset = extPoint; -#endif - // The corner point is where the scroll bar rects, the corner widget rect and the // viewport rect meets. const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset); @@ -429,31 +345,14 @@ void QAbstractScrollAreaPrivate::layoutChildren() // Some styles paints the corner if both scorllbars are showing and there is // no corner widget. Also, on the Mac we paint if there is a native // (transparent) sizegrip in the area where a corner widget would be. - if ((needv && needh && hasCornerWidget == false) - || ((needv || needh) -#ifdef Q_WS_MAC - && hasMacSizeGrip -#endif - ) - ) { + if ((needv && needh && hasCornerWidget == false) || needv || needh) { cornerPaintingRect = QStyle::visualRect(opt.direction, opt.rect, QRect(cornerPoint, extSize)); } else { cornerPaintingRect = QRect(); } -#ifdef Q_WS_MAC - if (hasMacReverseSizeGrip) - reverseCornerPaintingRect = QRect(controlsRect.bottomRight() + QPoint(1, 1) - extPoint, extSize); - else - reverseCornerPaintingRect = QRect(); -#endif - if (needh) { QRect horizontalScrollBarRect(QPoint(controlsRect.left(), cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); -#ifdef Q_WS_MAC - if (hasMacReverseSizeGrip) - horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0); -#endif scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); scrollBarContainers[Qt::Horizontal]->raise(); } @@ -547,10 +446,8 @@ void QAbstractScrollArea::setViewport(QWidget *widget) d->viewport->setParent(this); d->viewport->setFocusProxy(this); d->viewport->installEventFilter(d->viewportFilter.data()); -#ifndef Q_WS_MAC #ifndef QT_NO_GESTURES d->viewport->grabGesture(Qt::PanGesture); -#endif #endif d->layoutChildren(); if (isVisible()) @@ -931,13 +828,6 @@ bool QAbstractScrollArea::event(QEvent *e) QPainter p(this); style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); } -#ifdef Q_WS_MAC - if (d->reverseCornerPaintingRect.isValid()) { - option.rect = d->reverseCornerPaintingRect; - QPainter p(this); - style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); - } -#endif } QFrame::paintEvent((QPaintEvent*)e); break; @@ -1322,13 +1212,6 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); -#ifdef Q_WS_WIN - // Need to re-subscribe to gestures as the content changes to make sure we - // enable/disable panning when needed. - QWidgetPrivate *dd = static_cast(QObjectPrivate::get(viewport)); - if (dd) - dd->winSetupGestures(); -#endif // Q_WS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index 1b69bbf2a..daef3080d 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -99,11 +99,6 @@ public: inline bool viewportEvent(QEvent *event) { return q_func()->viewportEvent(event); } QScopedPointer viewportFilter; - -#ifdef Q_WS_WIN - bool singleFingerPanEnabled; - void setSingleFingerPanEnabled(bool on = true); -#endif }; class QAbstractScrollAreaFilter : public QObject diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 4c5318420..dfeecca6f 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1157,8 +1157,6 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event) /*! - \internal - Used when acceleration is turned on. We need to get the keyboard auto repeat rate from OS. This value is used as argument when starting acceleration related timers. @@ -1168,15 +1166,7 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event) Remember that time value should be given in msecs. */ -static int getKeyboardAutoRepeatRate() { - int ret = 30; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - DWORD time; - if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE) - ret = static_cast(1000 / static_cast(time)); // msecs -#endif - return ret; // msecs -} +static const int keyboardAutoRepeatRate = 30; /*! \reimp @@ -1191,7 +1181,7 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event) killTimer(d->spinClickThresholdTimerId); d->spinClickThresholdTimerId = -1; d->effectiveSpinRepeatRate = d->buttonState & Keyboard - ? getKeyboardAutoRepeatRate() + ? keyboardAutoRepeatRate : d->spinClickTimerInterval; d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate); doStep = true; diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index dcfa0b422..7f657dbcd 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -221,16 +221,11 @@ void QComboBoxPrivate::_q_modelDestroyed() //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QComboBoxPrivate::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); } bool QComboBoxPrivate::updateHoverControl(const QPoint &pos) @@ -2471,21 +2466,11 @@ void QComboBox::showPopup() const bool updatesEnabled = container->updatesEnabled(); #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_EFFECTS) - bool scrollDown = (listRect.topLeft() == below); - if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) - && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) - qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150); -#endif - -// Don't disable updates on Mac OS X. Windows are displayed immediately on this platform, -// which means that the window will be visible before the call to container->show() returns. -// If updates are disabled at this point we'll miss our chance at painting the popup -// menu before it's shown, causing flicker since the window then displays the standard gray -// background. -#ifndef Q_WS_MAC +// indows are displayed immediately on this platform, which means that the window will +// be visible before the call to container->show() returns. If updates are disabled at +// this point we'll miss our chance at painting the popup menu before it's shown, causing +// flicker since the window then displays the standard gray background. container->setUpdatesEnabled(false); -#endif container->raise(); container->show(); @@ -2546,13 +2531,7 @@ void QComboBox::hidePopup() } // Fade out. - bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide); - if (needFade) { -#if defined(Q_WS_MAC) - macWindowFade(qt_mac_window_for(d->container)); -#endif // Q_WS_MAC - // Other platform implementations welcome :-) - } + const bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide); d->model->blockSignals(false); d->container->itemView()->blockSignals(false); d->container->blockSignals(false);