QtPrintSupport: Move printer list into plugin base class

Move the cached printer list from the Windows plugin into the base
class so the CUPS plugin can also use it in a subsequent commit.

Change-Id: Idf5fb7fc49b1820aad58f16e8854ab9120caa193
Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com>
Reviewed-by: John Layt <jlayt@kde.org>
This commit is contained in:
John Layt 2012-06-01 21:06:26 +01:00 committed by Qt by Nokia
parent f2df9cef75
commit 20c7fa62ca
4 changed files with 6 additions and 15 deletions

View File

@ -66,7 +66,7 @@ QWindowsPrinterSupport::QWindowsPrinterSupport()
QString printerName(QString::fromWCharArray(infoList[i].pPrinterName));
bool isDefault = (printerName == defaultPrinterName);
QPrinterInfo printerInfo = createPrinterInfo(printerName, QString(), QString(), QString(), isDefault, i);
mPrinterList.append(printerInfo);
m_printers.append(printerInfo);
}
}
delete [] buffer;
@ -93,9 +93,4 @@ QList<QPrinter::PaperSize> QWindowsPrinterSupport::supportedPaperSizes(const QPr
return QWin32PrintEngine::supportedPaperSizes(printerInfo);
}
QList<QPrinterInfo> QWindowsPrinterSupport::availablePrinters()
{
return mPrinterList;
}
QT_END_NAMESPACE

View File

@ -42,7 +42,6 @@
#ifndef WINDOWSPRINTERSUPPORT_H
#define WINDOWSPRINTERSUPPORT_H
#include <QtCore/QList>
#include <qpa/qplatformprintersupport.h>
QT_BEGIN_HEADER
@ -59,12 +58,6 @@ public:
virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode);
virtual QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode);
virtual QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &) const;
virtual QList<QPrinterInfo> availablePrinters();
private:
QList<QPrinterInfo> mPrinterList;
QPrinter::PrinterMode mCurrentMode;
};
QT_END_NAMESPACE

View File

@ -52,11 +52,12 @@
#include <QtPrintSupport/qprinter.h>
#include <QtCore/qlist.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
class QPrintEngine;
@ -83,6 +84,8 @@ protected:
static QPrinterInfo createPrinterInfo(const QString &name, const QString &description,
const QString &location, const QString &makeAndModel,
bool isDefault, int index);
QList<QPrinterInfo> m_printers;
};
#endif // QT_NO_PRINTER

View File

@ -84,7 +84,7 @@ QList<QPrinter::PaperSize> QPlatformPrinterSupport::supportedPaperSizes(const QP
QList<QPrinterInfo> QPlatformPrinterSupport::availablePrinters()
{
return QList<QPrinterInfo>();
return m_printers;
}
QPrinterInfo QPlatformPrinterSupport::defaultPrinter()