Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qprinterinfo_mac.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6565
    6666static QPrinterInfoPrivate nullQPrinterInfoPrivate;
     67
     68class QPrinterInfoPrivateDeleter
     69{
     70public:
     71    static inline void cleanup(QPrinterInfoPrivate *d)
     72    {
     73        if (d != &nullQPrinterInfoPrivate)
     74            delete d;
     75    }
     76};
    6777
    6878extern QPrinter::PaperSize qSizeFTopaperSize(const QSizeF& size);
     
    107117
    108118QPrinterInfo::QPrinterInfo(const QPrinter& prn)
    109 {
    110     d_ptr = &nullQPrinterInfoPrivate;
     119    : d_ptr(&nullQPrinterInfoPrivate)
     120{
    111121    QList<QPrinterInfo> list = availablePrinters();
    112122    for (int c = 0; c < list.size(); ++c) {
     
    116126        }
    117127    }
    118 
    119     *this = QPrinterInfo();
    120128}
    121129
    122130QPrinterInfo::~QPrinterInfo()
    123131{
    124     if (d_ptr != &nullQPrinterInfoPrivate)
    125         delete d_ptr;
    126132}
    127133
    128134QPrinterInfo::QPrinterInfo()
    129 {
    130     d_ptr = &nullQPrinterInfoPrivate;
     135    : d_ptr(&nullQPrinterInfoPrivate)
     136{
    131137}
    132138
    133139QPrinterInfo::QPrinterInfo(const QString& name)
    134 {
    135     d_ptr = new QPrinterInfoPrivate(name);
     140    : d_ptr(new QPrinterInfoPrivate(name))
     141{
    136142    d_ptr->q_ptr = this;
    137143}
    138144
    139145QPrinterInfo::QPrinterInfo(const QPrinterInfo& src)
    140 {
    141     d_ptr = &nullQPrinterInfoPrivate;
     146    : d_ptr(&nullQPrinterInfoPrivate)
     147{
    142148    *this = src;
    143149}
     
    146152{
    147153    Q_ASSERT(d_ptr);
    148     if (d_ptr != &nullQPrinterInfoPrivate)
    149         delete d_ptr;
    150     d_ptr = new QPrinterInfoPrivate(*src.d_ptr);
     154    d_ptr.reset(new QPrinterInfoPrivate(*src.d_ptr));
    151155    d_ptr->q_ptr = this;
    152156    return *this;
     
    173177QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
    174178{
    175 #if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
    176                 return QList<QPrinter::PaperSize>();
    177 #else
    178         if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
    179                 return QList<QPrinter::PaperSize>();
    180 
    181     const Q_D(QPrinterInfo);
    182 
    183     PMPrinter cfPrn = PMPrinterCreateFromPrinterID(
    184             QCFString::toCFStringRef(d->m_name));
     179    const Q_D(QPrinterInfo);
     180
     181    PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->m_name));
    185182
    186183    if (!cfPrn) return QList<QPrinter::PaperSize>();
     
    212209
    213210    return paperList;
    214 #endif // MAC_OS_X_VERSION_MAX_ALLOWED
    215211}
    216212
Note: See TracChangeset for help on using the changeset viewer.