| 1 | /* |
| 2 | * File: PrinterInterface.h |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: May 10, 2014 |
| 6 | * |
| 7 | * Copyright (c) 2009-2014 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Printer Interface classes |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef PRINTERINTERFACE_H |
| 28 | #define PRINTERINTERFACE_H |
| 29 | |
| 30 | #include "HerculesStudio.h" |
| 31 | #include "Stationery.h" |
| 32 | #include "DecolationRules.h" |
| 33 | |
| 34 | #include <QHostAddress> |
| 35 | #include <QPainter> |
| 36 | |
| 37 | mk_shared_ptr(Stationery) |
| 38 | mk_shared_ptr(DecolationRules) |
| 39 | class BasicPrinter : public QObject |
| 40 | { |
| 41 | Q_OBJECT |
| 42 | public: |
| 43 | BasicPrinter(); |
| 44 | virtual bool print(QByteArray data) = 0; |
| 45 | virtual void close() = 0; |
| 46 | |
| 47 | protected: |
| 48 | QString mName; |
| 49 | int mLinesPerInch; |
| 50 | int mFontSize; |
| 51 | QString mSpoolDir; |
| 52 | }; |
| 53 | |
| 54 | class GenericPagePrinter : public BasicPrinter |
| 55 | { |
| 56 | public: |
| 57 | GenericPagePrinter(StationeryPtr& stationery, float scaling); |
| 58 | virtual bool print(QByteArray line) = 0; |
| 59 | virtual void preparePage(bool eject); |
| 60 | protected: |
| 61 | virtual void setValues(bool eject) = 0; |
| 62 | virtual void setBarsColor() = 0; |
| 63 | |
| 64 | |
| 65 | QMultiMap<int, Trigger> mEndJobTrigger; |
| 66 | StationeryPtr mStationery; |
| 67 | DecolationRulesPtr mDecolation; |
| 68 | int mPixelsPerLine; |
| 69 | int mPaperR; |
| 70 | int mPaperG; |
| 71 | int mPaperB; |
| 72 | int mLinesPerPage; |
| 73 | int mMargin; |
| 74 | int mLeftMargin; |
| 75 | int mBottomMargin; |
| 76 | float mPaperHeight; |
| 77 | float mPaperWidth; |
| 78 | int mWidthInPixels; |
| 79 | int mHeightInPixels; |
| 80 | int mLogicalDpiX; |
| 81 | int mLogicalDpiY; |
| 82 | int mBarsColor[3]; |
| 83 | QPainter * mPen; |
| 84 | QPixmap mLogo; |
| 85 | int mLogoWidth; |
| 86 | int mLogoHeight; |
| 87 | float mScaling; |
| 88 | }; |
| 89 | |
| 90 | #endif // PRINTERINTERFACE_H |