OSDN Git Service

remove ColorSpec, setColorSpec() and colorSpec()
authorIvailo Monev <xakepa10@gmail.com>
Sun, 12 Jun 2016 02:20:31 +0000 (02:20 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 12 Jun 2016 02:20:31 +0000 (02:20 +0000)
upstream commits:
https://github.com/qtproject/qtbase/commit/c10a1c8f14c519024cdc6f0ee3fae64263979635

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication.h
src/gui/kernel/qapplication_mac.mm
src/gui/kernel/qapplication_x11.cpp
src/gui/painting/qcolormap_x11.cpp

index 16ddc74..e751936 100644 (file)
@@ -248,9 +248,6 @@ QApplicationPrivate::~QApplicationPrivate()
                 encapsulated in a QStyle object. This can be changed at runtime
                 with setStyle().
 
-            \o  It specifies how the application is to allocate colors. See
-                setColorSpec() for details.
-
             \o  It provides localization of strings that are visible to the
                 user via translate().
 
@@ -327,12 +324,6 @@ QApplicationPrivate::~QApplicationPrivate()
             setStyle().
 
         \row
-        \o  Color usage
-        \o  colorSpec(),
-            setColorSpec(),
-            qwsSetCustomColors().
-
-        \row
         \o  Text handling
         \o  installTranslator(),
             removeTranslator()
@@ -388,18 +379,6 @@ QApplicationPrivate::~QApplicationPrivate()
 */
 
 /*!
-    \enum QApplication::ColorSpec
-
-    \value NormalColor the default color allocation policy
-    \value CustomColor the same as NormalColor for X11; allocates colors
-    to a palette on demand under Windows
-    \value ManyColor the right choice for applications that use thousands of
-    colors
-
-    See setColorSpec() for full details.
-*/
-
-/*!
     \fn QWidget *QApplication::topLevelAt(const QPoint &point)
 
     Returns the top-level widget at the given \a point; returns 0 if
@@ -439,7 +418,6 @@ QString QApplicationPrivate::styleSheet;           // default application styles
 #endif
 QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
 
-int QApplicationPrivate::app_cspec = QApplication::NormalColor;
 QPalette *QApplicationPrivate::app_pal = 0;        // default application palette
 QPalette *QApplicationPrivate::sys_pal = 0;        // default system palette
 QPalette *QApplicationPrivate::set_pal = 0;        // default palette set by programmer
@@ -1587,80 +1565,6 @@ void QApplication::setGraphicsSystem(const QString &system)
 }
 
 /*!
-    Returns the color specification.
-
-    \sa QApplication::setColorSpec()
-*/
-
-int QApplication::colorSpec()
-{
-    return QApplicationPrivate::app_cspec;
-}
-
-/*!
-    Sets the color specification for the application to \a spec.
-
-    The color specification controls how the application allocates colors when
-    run on a display with a limited amount of colors, e.g. 8 bit / 256 color
-    displays.
-
-    The color specification must be set before you create the QApplication
-    object.
-
-    The options are:
-    \list
-        \o  QApplication::NormalColor. This is the default color allocation
-            strategy. Use this option if your application uses buttons, menus,
-            texts and pixmaps with few colors. With this option, the
-            application uses system global colors. This works fine for most
-            applications under X11, but on the Windows platform, it may cause
-            dithering of non-standard colors.
-        \o  QApplication::CustomColor. Use this option if your application
-            needs a small number of custom colors. On X11, this option is the
-            same as NormalColor. On Windows, Qt creates a Windows palette, and
-            allocates colors to it on demand.
-        \o  QApplication::ManyColor. Use this option if your application is
-            very color hungry, e.g., it requires thousands of colors. \br
-            Under X11 the effect is:
-            \list
-                \o  For 256-color displays which have at best a 256 color true
-                    color visual, the default visual is used, and colors are
-                    allocated from a color cube. The color cube is the 6x6x6
-                    (216 color) "Web palette" (the red, green, and blue
-                    components always have one of the following values: 0x00,
-                    0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors
-                    can be changed by the \e -ncols option. The user can force
-                    the application to use the true color visual with the
-                    \l{QApplication::QApplication()}{-visual} option.
-                \o  For 256-color displays which have a true color visual with
-                    more than 256 colors, use that visual. Silicon Graphics X
-                    servers this feature, for example. They provide an 8 bit
-                    visual by default but can deliver true color when asked.
-            \endlist
-            On Windows, Qt creates a Windows palette, and fills it with a color
-            cube.
-    \endlist
-
-    Be aware that the CustomColor and ManyColor choices may lead to colormap
-    flashing: The foreground application gets (most) of the available colors,
-    while the background windows will look less attractive.
-
-    Example:
-
-    \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 2
-
-    \sa colorSpec()
-*/
-
-void QApplication::setColorSpec(int spec)
-{
-    if (qApp)
-        qWarning("QApplication::setColorSpec: This function must be "
-                 "called before the QApplication object is created");
-    QApplicationPrivate::app_cspec = spec;
-}
-
-/*!
     \property QApplication::globalStrut
     \brief the minimum size that any GUI element that the user can interact
            with should have
@@ -4886,31 +4790,12 @@ void QSessionManager::requestPhase2()
 #endif // QT_NO_SESSIONMANAGER
 
 /*!
-    \typedef QApplication::ColorMode
-    \compat
-
-    Use ColorSpec instead.
-*/
-
-/*!
     \fn Qt::MacintoshVersion QApplication::macVersion()
 
     Use QSysInfo::MacintoshVersion instead.
 */
 
 /*!
-    \fn QApplication::ColorMode QApplication::colorMode()
-
-    Use colorSpec() instead, and use ColorSpec as the enum type.
-*/
-
-/*!
-    \fn void QApplication::setColorMode(ColorMode mode)
-
-    Use setColorSpec() instead, and pass a ColorSpec value instead.
-*/
-
-/*!
     \fn bool QApplication::hasGlobalMouseTracking()
 
     This feature does not exist anymore. This function always returns true
index 755f577..068a2b0 100644 (file)
@@ -126,9 +126,6 @@ public:
     static QStyle *style();
     static void setStyle(QStyle*);
     static QStyle *setStyle(const QString&);
-    enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
-    static int colorSpec();
-    static void setColorSpec(int);
     static void setGraphicsSystem(const QString &);
 
 #ifndef QT_NO_CURSOR
index 151c89a..2dc6cd3 100644 (file)
@@ -2910,7 +2910,6 @@ bool QApplicationPrivate::qt_mac_apply_settings()
       doubleClickInterval    - int
       cursorFlashTime        - int
       wheelScrollLines       - int
-      colorSpec              - QString
       defaultCodec           - QString
       globalStrut/width      - int
       globalStrut/height     - int
@@ -3003,17 +3002,6 @@ bool QApplicationPrivate::qt_mac_apply_settings()
         QApplication::setWheelScrollLines(num);
 #endif
 
-        QString colorspec = settings.value(QLatin1String("colorSpec"),
-                                            QVariant(QLatin1String("default"))).toString();
-        if (colorspec == QLatin1String("normal"))
-            QApplication::setColorSpec(QApplication::NormalColor);
-        else if (colorspec == QLatin1String("custom"))
-            QApplication::setColorSpec(QApplication::CustomColor);
-        else if (colorspec == QLatin1String("many"))
-            QApplication::setColorSpec(QApplication::ManyColor);
-        else if (colorspec != QLatin1String("default"))
-            colorspec = QLatin1String("default");
-
         int w = settings.value(QLatin1String("globalStrut/width")).toInt();
         int h = settings.value(QLatin1String("globalStrut/height")).toInt();
         QSize strut(w, h);
index baf998f..b870532 100644 (file)
@@ -881,7 +881,6 @@ bool QApplicationPrivate::x11_apply_settings()
       keyboardInputInterval  - int
       cursorFlashTime            - int
       wheelScrollLines           - int
-      colorSpec                  - QString
       defaultCodec               - QString
       globalStrut/width          - int
       globalStrut/height         - int
@@ -993,17 +992,6 @@ bool QApplicationPrivate::x11_apply_settings()
     QApplication::setWheelScrollLines(num);
 #endif
 
-    QString colorspec = settings.value(QLatin1String("colorSpec"),
-                                       QVariant(QLatin1String("default"))).toString();
-    if (colorspec == QLatin1String("normal"))
-        QApplication::setColorSpec(QApplication::NormalColor);
-    else if (colorspec == QLatin1String("custom"))
-        QApplication::setColorSpec(QApplication::CustomColor);
-    else if (colorspec == QLatin1String("many"))
-        QApplication::setColorSpec(QApplication::ManyColor);
-    else if (colorspec != QLatin1String("default"))
-        colorspec = QLatin1String("default");
-
     QString defaultcodec = settings.value(QLatin1String("defaultCodec"),
                                           QVariant(QLatin1String("none"))).toString();
     if (defaultcodec != QLatin1String("none")) {
index 79d9e6f..e12f150 100644 (file)
@@ -370,14 +370,6 @@ void QColormap::initialize()
             // look for a specific visual or type of visual
             d->visual = find_visual(display, i, X11->visual_class, X11->visual_id,
                                     &d->depth, &d->defaultVisual);
-        } else if (QApplication::colorSpec() == QApplication::ManyColor) {
-            // look for a TrueColor w/ a depth higher than 8bpp
-            d->visual = find_visual(display, i, TrueColor, -1, &d->depth, &d->defaultVisual);
-            if (d->depth <= 8) {
-                d->visual = DefaultVisual(display, i);
-                d->defaultVisual = true;
-                color_count = 216;
-            }
         } else if (!X11->custom_cmap) {
             XStandardColormap *stdcmap = 0;
             int ncmaps = 0;