summaryrefslogtreecommitdiffstats
path: root/kbarcode/printersettings.h
blob: d4ccda90c7892667ba5b935b3d6880334780965f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/***************************************************************************
                          printersettings.h  -  description
                             -------------------
    begin                : Don Jan 16 2003
    copyright            : (C) 2003 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PRINTERSETTINGS_H
#define PRINTERSETTINGS_H

#include <tqobject.h>
#include <tqstring.h>
#include <kprinter.h>

class KURL;

struct labelprinterdata {
   int articleEvent1;
   int articleEvent2;
   int articleEvent3;
   int articleEvent4;

   int groupEvent1;
   int groupEvent2;
   int groupEvent3;
   int groupEvent4;

   bool useCustomNo;

   int quality; // printer quality; enum PrinterMode
   bool border;
   int format; // index of the page format
   
   TQString comment;
   TQString separator;
   TQString quote;
};

struct PageFormatInfo
{
    KPrinter::PageSize kprinter;
    const char* shortName; // Short name
    const char* descriptiveName; // Full name, which will be translated
    double width; // in mm
    double height; // in mm
};

class KPrinter;
class KComboBox;
class PrinterSettings: public TQObject  {
    TQ_OBJECT
  
    public:
        enum { High = TQPrinter::HighResolution, Middle, VeryHigh };
        enum { TEC, ZEBRA, INTERMEC, EPCL };

        PrinterSettings();
        ~PrinterSettings();

        labelprinterdata* getData() const {
            return lpdata;
        }

        int getQuality() const;

        // Get the size of the current selected page format
        double pageWidth() const;
        double pageHeight() const;

        void insertPageFormat( KComboBox* combo );
        static PrinterSettings* getInstance();

        // don't forget to delete printer
        KPrinter* setupPrinter( const KURL & url, TQWidget* parent, bool immediately = false, const TQString & prn = TQString() );
        
    public slots:
        void loadConfig();
        void saveConfig();

    private:
        labelprinterdata* lpdata;

        static PrinterSettings* printerInstance;
};

#endif