OSDN Git Service

get rid of QClipboard and QDropEvent compat
authorIvailo Monev <xakepa10@gmail.com>
Mon, 18 Jul 2016 06:12:29 +0000 (06:12 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 18 Jul 2016 06:12:29 +0000 (06:12 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/dialogs/qprintdialog.qdoc [deleted file]
src/gui/kernel/qclipboard.cpp
src/gui/kernel/qclipboard.h
src/gui/kernel/qclipboard_p.h [deleted file]
src/gui/kernel/qclipboard_x11.cpp
src/gui/kernel/qevent.cpp
src/gui/kernel/qevent.h
src/gui/kernel/qwidget_x11.cpp

diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/gui/dialogs/qprintdialog.qdoc
deleted file mode 100644 (file)
index b61b639..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file.  Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef QT3_SUPPORT
-/*!
-    \fn QPrinter *QPrintDialog::printer() const
-
-    Returns a pointer to the printer this dialog configures, or 0 if
-    this dialog does not operate on any printer.
-
-    This function is available for Unix platforms only.
-*/
-
-/*!
-    \fn void QPrintDialog::setPrinter(QPrinter *printer, bool pickupSettings)
-
-    Sets this dialog to configure printer \a printer, or no printer if \a printer
-    is null. If \a pickupSettings is true, the dialog reads most of
-    its settings from \a printer. If \a pickupSettings is false (the
-    default) the dialog keeps its old settings.
-
-    This function is available for Unix platforms only.
-*/
-
-/*!
-    \fn void QPrintDialog::addButton(QPushButton *button)
-
-    Adds the \a button to the layout of the print dialog. The added
-    buttons are arranged from the left to the right below the
-    last groupbox of the printdialog.
-
-    This function is available for Unix platforms only.
-*/
-#endif
index 859fa51..46c6d91 100644 (file)
@@ -46,7 +46,6 @@
 #include "qapplication.h"
 #include "qapplication_p.h"
 #include "qpixmap.h"
-#include "qclipboard_p.h"
 #include "qvariant.h"
 #include "qbuffer.h"
 #include "qimage.h"
@@ -156,7 +155,7 @@ QT_BEGIN_NAMESPACE
 */
 
 QClipboard::QClipboard(QObject *parent)
-    : QObject(*new QClipboardPrivate, parent)
+    : QObject(parent)
 {
     // nothing
 }
@@ -574,55 +573,6 @@ void QClipboard::emitChanged(Mode mode)
     emit changed(mode);
 }
 
-const char* QMimeDataWrapper::format(int n) const
-{
-    if (formats.isEmpty()) {
-        QStringList fmts = data->formats();
-        for (int i = 0; i < fmts.size(); ++i)
-            formats.append(fmts.at(i).toLatin1());
-    }
-    if (n < 0 || n >= formats.size())
-        return 0;
-    return formats.at(n).data();
-}
-
-QByteArray QMimeDataWrapper::encodedData(const char *format) const
-{
-    if (QLatin1String(format) != QLatin1String("application/x-qt-image")){
-        return data->data(QLatin1String(format));
-    } else{
-        QVariant variant = data->imageData();
-        QImage img = qvariant_cast<QImage>(variant);
-        QByteArray ba;
-        QBuffer buffer(&ba);
-        buffer.open(QIODevice::WriteOnly);
-        img.save(&buffer, "PNG");
-        return ba;
-    }
-}
-
-QVariant QMimeSourceWrapper::retrieveData(const QString &mimetype, QVariant::Type) const
-{
-    return source->encodedData(mimetype.toLatin1());
-}
-
-bool QMimeSourceWrapper::hasFormat(const QString &mimetype) const
-{
-    return source->provides(mimetype.toLatin1());
-}
-
-QStringList QMimeSourceWrapper::formats() const
-{
-    QStringList fmts;
-    int i = 0;
-    const char *fmt;
-    while ((fmt = source->format(i))) {
-        fmts.append(QLatin1String(fmt));
-        ++i;
-    }
-    return fmts;
-}
-
 #endif // QT_NO_CLIPBOARD
 
 QT_END_NAMESPACE
index 69fc806..3144d38 100644 (file)
@@ -51,17 +51,13 @@ QT_BEGIN_NAMESPACE
 
 #ifndef QT_NO_CLIPBOARD
 
-class QMimeSource;
 class QMimeData;
 class QImage;
 class QPixmap;
 
-class QClipboardPrivate;
-
 class Q_GUI_EXPORT QClipboard : public QObject
 {
     Q_OBJECT
-    Q_DECLARE_PRIVATE(QClipboard)
 private:
     QClipboard(QObject *parent);
     ~QClipboard();
@@ -103,7 +99,6 @@ protected:
     friend class QApplication;
     friend class QApplicationPrivate;
     friend class QDragManager;
-    friend class QMimeSource;
 
 private:
     Q_DISABLE_COPY(QClipboard)
diff --git a/src/gui/kernel/qclipboard_p.h b/src/gui/kernel/qclipboard_p.h
deleted file mode 100644 (file)
index 2fd99d7..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCLIPBOARD_P_H
-#define QCLIPBOARD_P_H
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the Qt API.  It exists purely as an
-// implementation detail.  This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qobject_p.h"
-#include "QtGui/qmime.h"
-#include "QtGui/qclipboard.h"
-
-QT_BEGIN_NAMESPACE
-
-class QClipboardPrivate;
-
-class QMimeDataWrapper : public QMimeSource
-{
-public:
-    QMimeDataWrapper() {}
-
-    const char* format(int n) const;
-    QByteArray encodedData(const char*) const;
-
-    mutable QList<QByteArray> formats;
-    const QMimeData *data;
-};
-
-class QMimeSourceWrapper : public QMimeData
-{
-public:
-    QMimeSourceWrapper(QClipboardPrivate *priv, QClipboard::Mode m);
-    ~QMimeSourceWrapper();
-
-    bool hasFormat(const QString &mimetype) const;
-    QStringList formats() const;
-
-protected:
-    QVariant retrieveData(const QString &mimetype, QVariant::Type) const;
-private:
-    QClipboardPrivate *d;
-    QClipboard::Mode mode;
-    QMimeSource *source;
-};
-
-
-class QClipboardPrivate : public QObjectPrivate
-{
-public:
-    QClipboardPrivate() : QObjectPrivate() {
-        for (int i = 0; i <= QClipboard::LastMode; ++i) {
-            compat_data[i] = 0;
-            wrapper[i] = new QMimeDataWrapper();
-        }
-    }
-    ~QClipboardPrivate() {
-        for (int i = 0; i <= QClipboard::LastMode; ++i) {
-            delete wrapper[i];
-            delete compat_data[i];
-        }
-    }
-
-    mutable QMimeDataWrapper *wrapper[QClipboard::LastMode + 1];
-    mutable QMimeSource *compat_data[QClipboard::LastMode + 1];
-};
-
-inline QMimeSourceWrapper::QMimeSourceWrapper(QClipboardPrivate *priv, QClipboard::Mode m)
-    : QMimeData()
-{
-    d = priv;
-    mode = m;
-    source = d->compat_data[mode];
-}
-
-inline QMimeSourceWrapper::~QMimeSourceWrapper()
-{
-    if (d->compat_data[mode] == source)
-        d->compat_data[mode] = 0;
-    delete source;
-}
-
-QT_END_NAMESPACE
-
-#endif // QCLIPBOARD_P_H
index 77a8b52..e9606c3 100644 (file)
@@ -57,7 +57,6 @@
 #include "qplatformdefs.h"
 
 #include "qclipboard.h"
-#include "qclipboard_p.h"
 
 #ifndef QT_NO_CLIPBOARD
 
@@ -428,7 +427,7 @@ static Bool qt_init_timestamp_scanner(Display*, XEvent *event, XPointer arg)
 #endif
 
 QClipboard::QClipboard(QObject *parent)
-    : QObject(*new QClipboardPrivate, parent)
+    : QObject(parent)
 {
     // create desktop widget since we need it to get PropertyNotify or
     // XFixesSelectionNotify events when someone changes the
index 8a25b25..8308722 100644 (file)
@@ -2124,64 +2124,6 @@ QDropEvent::~QDropEvent()
 }
 
 /*!
-    \compat
-    Returns a byte array containing the drag's data, in \a format.
-
-    data() normally needs to get the data from the drag source, which
-    is potentially very slow, so it's advisable to call this function
-    only if you're sure that you will need the data in that
-    particular \a format.
-
-    The resulting data will have a size of 0 if the format was not
-    available.
-
-    \sa format() QByteArray::size()
-*/
-
-QByteArray QDropEvent::encodedData(const char *format) const
-{
-    return mdata->data(QLatin1String(format));
-}
-
-/*!
-    \compat
-    Returns a string describing one of the available data types for
-    this drag. Common examples are "text/plain" and "image/gif".
-    If \a n is less than zero or greater than the number of available
-    data types, format() returns 0.
-
-    This function is provided mainly for debugging. Most drop targets
-    will use provides().
-
-    \sa data() provides()
-*/
-
-const char* QDropEvent::format(int n) const
-{
-    if (fmts.isEmpty()) {
-        QStringList formats = mdata->formats();
-        for (int i = 0; i < formats.size(); ++i)
-            fmts.append(formats.at(i).toLatin1());
-    }
-    if (n < 0 || n >= fmts.size())
-        return 0;
-    return fmts.at(n).constData();
-}
-
-/*!
-    \compat
-    Returns true if this event provides format \a mimeType; otherwise
-    returns false.
-
-    \sa data()
-*/
-
-bool QDropEvent::provides(const char *mimeType) const
-{
-    return mdata->formats().contains(QLatin1String(mimeType));
-}
-
-/*!
     If the source of the drag operation is a widget in this
     application, this function returns that source; otherwise it
     returns 0. The source of the operation is the first parameter to
index ecfe724..a370998 100644 (file)
@@ -420,9 +420,6 @@ private:
 class QMimeData;
 
 class Q_GUI_EXPORT QDropEvent : public QEvent
-// QT3_SUPPORT
-                              , public QMimeSource
-// END QT3_SUPPORT
 {
 public:
     QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
@@ -443,13 +440,6 @@ public:
     QWidget* source() const;
     inline const QMimeData *mimeData() const { return mdata; }
 
-// QT3_SUPPORT
-    const char* format(int n = 0) const;
-    QByteArray encodedData(const char*) const;
-    bool provides(const char*) const;
-// END QT3_SUPPORT
-
-
 protected:
     friend class QApplication;
     QPoint p;
@@ -459,7 +449,6 @@ protected:
     Qt::DropAction drop_action;
     Qt::DropAction default_action;
     const QMimeData *mdata;
-    mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
 };
 
 
index 989af21..d6e1882 100644 (file)
@@ -1167,7 +1167,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
     // destroyed when emitting the child remove event below. See QWorkspace.
     if (wasCreated && old_winid) {
         XUnmapWindow(X11->display, old_winid);
-        if (!old_xinfo.screen() != xinfo.screen())
+        if (old_xinfo.screen() != xinfo.screen())
             XReparentWindow(X11->display, old_winid, RootWindow(X11->display, xinfo.screen()), 0, 0);
     }
     if (topData) {