diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2010-12-01 04:48:55 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-12-20 15:14:09 (GMT) |
commit | f725c90032b83df62432018af362830e899e71c1 (patch) | |
tree | 904b26eb40c935bd45a9dc1d876bff895ea62304 /src/gui/painting | |
parent | 6d6c738879bb2ef5b5c1e42908bdd1ed16980f95 (diff) | |
download | Qt-f725c90032b83df62432018af362830e899e71c1.zip Qt-f725c90032b83df62432018af362830e899e71c1.tar.gz Qt-f725c90032b83df62432018af362830e899e71c1.tar.bz2 |
minor refactoring of QPrinterInfoPrivate
use member initialization lists;
remove unused Q_DECLARE_PUBLIC stuff and q_ptr member; make members public instead
Merge-request: 2516
Signed-off-by: axis
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qprinterinfo_mac.cpp | 42 | ||||
-rw-r--r-- | src/gui/painting/qprinterinfo_unix.cpp | 48 | ||||
-rw-r--r-- | src/gui/painting/qprinterinfo_win.cpp | 42 |
3 files changed, 32 insertions, 100 deletions
diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 9b199f4..6a48c91 100644 --- a/src/gui/painting/qprinterinfo_mac.cpp +++ b/src/gui/painting/qprinterinfo_mac.cpp @@ -49,18 +49,20 @@ QT_BEGIN_NAMESPACE class QPrinterInfoPrivate { -Q_DECLARE_PUBLIC(QPrinterInfo) public: - ~QPrinterInfoPrivate(); - QPrinterInfoPrivate(); - QPrinterInfoPrivate(const QString& name); - -private: - QPrinterInfo* q_ptr; + QPrinterInfoPrivate() : + m_isNull(true), m_default(false) + {} + QPrinterInfoPrivate(const QString& name) : + m_name(name), + m_isNull(false), m_default(false) + {} + ~QPrinterInfoPrivate() + {} QString m_name; - bool m_default; bool m_isNull; + bool m_default; }; static QPrinterInfoPrivate nullQPrinterInfoPrivate; @@ -139,7 +141,6 @@ QPrinterInfo::QPrinterInfo() QPrinterInfo::QPrinterInfo(const QString& name) : d_ptr(new QPrinterInfoPrivate(name)) { - d_ptr->q_ptr = this; } QPrinterInfo::QPrinterInfo(const QPrinterInfo& src) @@ -152,7 +153,6 @@ QPrinterInfo& QPrinterInfo::operator=(const QPrinterInfo& src) { Q_ASSERT(d_ptr); d_ptr.reset(new QPrinterInfoPrivate(*src.d_ptr)); - d_ptr->q_ptr = this; return *this; } @@ -210,28 +210,6 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const return paperList; } -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - -QPrinterInfoPrivate::QPrinterInfoPrivate() : - q_ptr(NULL), - m_default(false), - m_isNull(true) -{ -} - -QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name) : - q_ptr(NULL), - m_name(name), - m_default(false), - m_isNull(false) -{ -} - -QPrinterInfoPrivate::~QPrinterInfoPrivate() -{ -} - #endif // QT_NO_PRINTER QT_END_NAMESPACE diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index 0d4cc16..eb16a1b 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -124,21 +124,26 @@ static inline const char *paperSize2String(QPrinter::PaperSize size) class QPrinterInfoPrivate { -Q_DECLARE_PUBLIC(QPrinterInfo) public: - QPrinterInfoPrivate(); - QPrinterInfoPrivate(const QString& name); - ~QPrinterInfoPrivate(); + QPrinterInfoPrivate() : + m_isNull(true), m_default(false), + m_mustGetPaperSizes(true), m_cupsPrinterIndex(0) + {} + QPrinterInfoPrivate(const QString& name) : + m_name(name), + m_isNull(false), m_default(false), + m_mustGetPaperSizes(true), m_cupsPrinterIndex(0) + {} + ~QPrinterInfoPrivate() + {} -private: QString m_name; bool m_isNull; bool m_default; + mutable bool m_mustGetPaperSizes; mutable QList<QPrinter::PaperSize> m_paperSizes; int m_cupsPrinterIndex; - - QPrinterInfo* q_ptr; }; static QPrinterInfoPrivate nullQPrinterInfoPrivate; @@ -946,7 +951,6 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer) { Q_D(QPrinterInfo); - d->q_ptr = this; #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) QCUPSSupport cups; @@ -990,7 +994,6 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer) QPrinterInfo::QPrinterInfo(const QString& name) : d_ptr(new QPrinterInfoPrivate(name)) { - d_ptr->q_ptr = this; } QPrinterInfo::~QPrinterInfo() @@ -1001,7 +1004,6 @@ QPrinterInfo& QPrinterInfo::operator=(const QPrinterInfo& src) { Q_ASSERT(d_ptr); d_ptr.reset(new QPrinterInfoPrivate(*src.d_ptr)); - d_ptr->q_ptr = this; return *this; } @@ -1046,32 +1048,6 @@ QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const return d->m_paperSizes; } -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - -QPrinterInfoPrivate::QPrinterInfoPrivate() -{ - m_isNull = true; - m_default = false; - m_mustGetPaperSizes = true; - m_cupsPrinterIndex = 0; - q_ptr = 0; -} - -QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name) -{ - m_name = name; - m_isNull = false; - m_default = false; - m_mustGetPaperSizes = true; - m_cupsPrinterIndex = 0; - q_ptr = 0; -} - -QPrinterInfoPrivate::~QPrinterInfoPrivate() -{ -} - #endif // QT_NO_PRINTER QT_END_NAMESPACE diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp index caada1f..808de2c 100644 --- a/src/gui/painting/qprinterinfo_win.cpp +++ b/src/gui/painting/qprinterinfo_win.cpp @@ -53,18 +53,20 @@ extern QPrinter::PaperSize mapDevmodePaperSize(int s); class QPrinterInfoPrivate { -Q_DECLARE_PUBLIC(QPrinterInfo) public: - ~QPrinterInfoPrivate(); - QPrinterInfoPrivate(); - QPrinterInfoPrivate(const QString& name); + QPrinterInfoPrivate() : + m_isNull(true), m_default(false) + {} + QPrinterInfoPrivate(const QString& name) : + m_name(name), + m_isNull(false), m_default(false) + {} + ~QPrinterInfoPrivate() + {} -private: QString m_name; - bool m_default; bool m_isNull; - - QPrinterInfo* q_ptr; + bool m_default; }; static QPrinterInfoPrivate nullQPrinterInfoPrivate; @@ -142,7 +144,6 @@ QPrinterInfo::QPrinterInfo() QPrinterInfo::QPrinterInfo(const QString& name) : d_ptr(new QPrinterInfoPrivate(name)) { - d_ptr->q_ptr = this; } QPrinterInfo::QPrinterInfo(const QPrinterInfo& src) @@ -173,7 +174,6 @@ QPrinterInfo& QPrinterInfo::operator=(const QPrinterInfo& src) { Q_ASSERT(d_ptr); d_ptr.reset(new QPrinterInfoPrivate(*src.d_ptr)); - d_ptr->q_ptr = this; return *this; } @@ -218,28 +218,6 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const return paperList; } -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - -QPrinterInfoPrivate::QPrinterInfoPrivate() : - m_default(false), - m_isNull(true), - q_ptr(NULL) -{ -} - -QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name) : - m_name(name), - m_default(false), - m_isNull(false), - q_ptr(NULL) -{ -} - -QPrinterInfoPrivate::~QPrinterInfoPrivate() -{ -} - #endif // QT_NO_PRINTER QT_END_NAMESPACE |